Skip to content
Snippets Groups Projects
Commit b703b440 authored by Ivar Stefansson's avatar Ivar Stefansson
Browse files

Delete LineNormFucntion.m

parent 55328782
No related branches found
No related tags found
No related merge requests found
function [Erel,E2,dP2] = LineNormFucntion(Xp,p,t,x,FRAC)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
boundary_line = false;
% 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 Xp(1)==Xp(2)
endpoints = [Xp(1),min(Xp(:,2)); ...
Xp(1),max(Xp(:,2))];
a=endpoints(1);
b=0;
isvertical = true;
segment = endpoints(3:4);
fracture_length = endpoints(4)-endpoints(3);
else
[x1,i_min] = min(Xp(:,1));
[x2,i_max] = max(Xp(:,1));
endpoints = [x1,Xp(i_min,2);x2,Xp(i_max,2)];
a = (endpoints(2,2) - endpoints(1,2)) / (endpoints(2,1)-endpoints(1,1));
b = endpoints(1,2) - a*endpoints(1,1);
isvertical = false;
segment = endpoints(1:2);
fracture_length = hypot(abs(endpoints(1)-endpoints(2)), abs(endpoints(3)-endpoints(4)));
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 = size(Xp,1);
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)/(dP2));
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment