diff --git a/scripts/LineNorm.m b/scripts/LineNorm.m deleted file mode 100644 index 414aa91a8932aae42acee9e876a1359fb70a3f37..0000000000000000000000000000000000000000 --- a/scripts/LineNorm.m +++ /dev/null @@ -1,127 +0,0 @@ -coarsefile = '../new_case_4/results/bernd_dfm_lefttoright.mat'; -load(coarsefile); -%load 'coarse file.mat' -X = Points; - -FRAC = true; -if FRAC -% i = 2; %fracture identity - Xp = fracxandp{i}; % The fracture information has here the format - endpoints=[Xp(1, 1:2); Xp(end, 1:2)]; - - % [x1(c) y1(c) p(c); x2(c) y2(c) p(c)] for cell c in position - % Xp(2*c-1:2*c, :), the coordinates being the vertices of the fracture. -end - -%load geiger_permeable_reference.mat -load anna_reference_lefttoright.mat - - -% Both the "coarse" and "fine" input files are assumed to have a triangulation -% CELL t with one (number of vertices of the cell) x 1 pointer to the points -% x of each grid cell and vector p for pressure in each cell (length(p) == -% length(t)). In case a fracture is being evaluated, the only coarse -% simulation information needed is fracxandp, a cell containing the -% pressure and coordinate information for each fracture. -% Capital Letters Indicate The Coarse Grid. - -boundary_line = false; - -%segment = [endpoints(1),endpoints(2,1)]; -segment = [1, 1]; -% assign two identical values for the whole cross-section of -% the domain. Assign x values for the endpoints of the desired segment -% unless the line is vertical, in which case the two y values should be -% provided. -% NOTE the segments are assumed to be chosen so that the cells end at the -% endpoints (fracture endpoints, in our case). If not, only the part of the -% line that is covered by coarse and fine cells lying in the interior of -% the segment is evaluated. -if endpoints(1)==endpoints(2) - a=endpoints(1); - b=0; - isvertical = true; - if segment(1) == segment(2) - fracture_length = abs(endpoints(3)-endpoints(4)); - else - fracture_length = abs(segment(1)-segment(2)); - end -else - a = (endpoints(2,2) - endpoints(1,2)) / (endpoints(2,1)-endpoints(1,1)); - b = endpoints(1,2) - a*endpoints(1,1); - isvertical = false; - if segment(1) == segment(2) - fracture_length = hypot(abs(endpoints(1)-endpoints(2)), ... - abs(endpoints(3)-endpoints(4))); - else - fracture_length = hypot(abs(segment(1)-segment(2)), ... - abs(endpoints(3)-endpoints(4))); - end -end - - -[nw, vertices_on] = check_points(x,a,b,isvertical); -if ~FRAC - [Nw, Vertices_on] = check_points(X,a,b,isvertical); -end -%must unfortunately allow for cells with different number of vertices both -%for fine grid (Bernd uses both for the hydrocoin case, at least) and coarse. -% Therefore, cell_points_on is a CELL with nvertices(c) pointer extracted -%from t. c_p_nw_on is the corresponding logical nw cell. - -[cell_points_on, p_on, c_p_nw_on, cell_vertices_on, vertices_p] = ... - extract_on_line(t,x,nw,vertices_on,p); -if ~FRAC - [Cell_points_on, P_on, C_p_nw_on, Cell_vertices_on, Vertices_p] = ... - extract_on_line(T,X,Nw,Vertices_on,P); -else - Cell_vertices_on = []; - Vertices_p = []; -end - - -if ~boundary_line && ~isempty(cell_vertices_on) - - [cell_vertices_on, vertices_p] = combine_faces(cell_vertices_on, vertices_p,isvertical); -end -if ~boundary_line && ~isempty(Cell_vertices_on) - - [Cell_vertices_on, Vertices_p] = combine_faces(Cell_vertices_on, Vertices_p,isvertical); -end - - -% find the points where the line intersects each of the fine and coarse -% cells, respectively. Format intersectionpoints(c) = [x1,y1,x2,y2] for the -% two points for cell c. - - -[intersectionpoints] = intersections_of_cells(endpoints, isvertical, ... - cell_points_on, c_p_nw_on); - -if FRAC - n = length(Xp); - ind_two = linspace(2,n,n/2); - ind_one = ind_two-1; - Intersectionpoints = [Xp(ind_one,1:2), Xp(ind_two,1:2)]; - P_on = Xp(ind_two,3); -else - [Intersectionpoints] = intersections_of_cells(endpoints, isvertical, ... - Cell_points_on, C_p_nw_on); -end - -% Add the values for the faces coinciding with the line: -if ~isempty(cell_vertices_on) - intersectionpoints = [intersectionpoints;cell_vertices_on]; - p_on = [p_on;vertices_p]; -end -if ~isempty(Cell_vertices_on) - Intersectionpoints = [Intersectionpoints;Cell_vertices_on]; - P_on = [P_on;Vertices_p]; -end - - -% Loop through large cells, find smalls cells (partly) inside and evaluate -% norms -[E2] = evaluate_norm(Intersectionpoints, intersectionpoints, P_on, p_on, isvertical,segment); -dP2 = (max(p)-min(p))^2*fracture_length; -Erel = sqrt(E2)/sqrt(dP2)