Changeset 2737
- Timestamp:
- 01/04/10 14:26:01 (15 years ago)
- Location:
- issm/trunk/src/m/classes/public/mesh
- Files:
-
- 7 added
- 2 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/mesh/meshyams.m
r2688 r2737 54 54 else 55 55 md=mesh(md,domainoutline,riftoutline,resolution); 56 md=meshprocessrifts(md); 56 57 end 57 58 disp(['Initial mesh, number of elements: ' num2str(md.numberofelements)]); … … 90 91 md=YamsCall(md,field,hmin,hmax,gradation(i),epsilon); 91 92 93 %if we have rifts, we just messed them up, we need to recreate the segments that constitute those 94 %rifts, because the segments are used in YamsCall to freeze the rifts elements during refinement. 95 if md.numrifts, 96 md.nodeconnectivity=NodeConnectivity(md.elements,md.numberofgrids); 97 md.elementconnectivity=ElementConnectivity(md.elements,md.nodeconnectivity); 98 md.segments=findsegments(md); 99 md=meshyamsrecreateriftsegments(md); 100 end 101 92 102 end 93 103 … … 123 133 end 124 134 md.vel_obs=sqrt(md.vx_obs.^2+md.vy_obs.^2); 135 136 %deal with rifts 137 if md.numrifts, 138 %first, recreate rift segments 139 md=meshyamsrecreateriftsegments(md); 140 141 %using the segments, recreate the penaltypairs 142 for j=1:md.numrifts, 143 rift=md.rifts(j); 144 145 %build normals and lengths of segments: 146 lengths=sqrt((md.x(rift.segments(:,1))-md.x(rift.segments(:,2))).^2 + (md.y(rift.segments(:,1))-md.y(rift.segments(:,2))).^2 ); 147 normalsx=cos(atan2((md.x(rift.segments(:,1))-md.x(rift.segments(:,2))) , (md.y(rift.segments(:,2))-md.y(rift.segments(:,1))))); 148 normalsy=sin(atan2((md.x(rift.segments(:,1))-md.x(rift.segments(:,2))) , (md.y(rift.segments(:,2))-md.y(rift.segments(:,1))))); 149 150 %ok, build penaltypairs: 151 numpenaltypairs=length(rift.segments)/2-1; 152 rift.penaltypairs=zeros(numpenaltypairs,7); 153 154 for i=1:numpenaltypairs, 155 rift.penaltypairs(i,1)=rift.segments(i,2); 156 rift.penaltypairs(i,2)=rift.segments(end-i,2); 157 rift.penaltypairs(i,3)=rift.segments(i,3); 158 rift.penaltypairs(i,4)=rift.segments(end-i,3); 159 rift.penaltypairs(i,5)=normalsx(i)+normalsx(i+1); 160 rift.penaltypairs(i,6)=normalsy(i)+normalsy(i+1); 161 rift.penaltypairs(i,7)=(lengths(i)+lengths(i+1))/2; 162 end 163 %renormalize norms: 164 norms=sqrt(rift.penaltypairs(:,5).^2+rift.penaltypairs(:,6).^2); 165 rift.penaltypairs(:,5)=rift.penaltypairs(:,5)./norms; 166 rift.penaltypairs(:,6)=rift.penaltypairs(:,6)./norms; 167 168 md.rifts(j)=rift; 169 end 170 171 end 172 173 174 175 176
Note:
See TracChangeset
for help on using the changeset viewer.