Changeset 16065
- Timestamp:
- 09/04/13 12:10:42 (12 years ago)
- Location:
- issm/trunk-jpl/src/m/mech
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/mech/analyticaldamage.m
r16056 r16065 20 20 % 'damage' which is truncated in the range [0,1-1e-9] 21 21 % 22 % 'mask' is a mask defining areas where damage was calculated as negative prior23 % to truncation, indicating that the ice is too warm or a back stress has not24 % been accounted for.25 %26 22 % 'B' is the rigidity, which is equal to md.materials.rheology_B in areas outside 27 23 % those defined by 'mask.' Within areas defined by 'mask,' where negative damage … … 32 28 % 33 29 % Usage: 34 % [damage, mask,B,backstress]=analyticaldamage(md,options)30 % [damage,B,backstress]=analyticaldamage(md,options) 35 31 % 36 32 % Example: 37 % [damage, mask,B,backstress]=analyticaldamage(md,'eq','Weertman2D','smoothing',2,'backstress',10e3);33 % [damage,B,backstress]=analyticaldamage(md,'eq','Weertman2D','smoothing',2,'backstress',10e3); 38 34 39 35 % check inputs … … 114 110 a(pos)=-2+1e-3; 115 111 116 %plotmodel(md,'data',a,'caxis',[-2,1])117 %plotmodel(md,'data',ex,'caxis',[-0.5e-9,0.5e-9])118 119 112 % spreading stress 120 113 rhoi=md.materials.rho_ice; … … 140 133 end 141 134 142 %D2=1-((theta./ex).^(1./n)).*(T-sigmab)./B;143 %length(find(D2<0))144 %length(find(ex<0))145 %length(find(D2>1))146 %length(find(theta<0))147 %pos=find(ex<0);148 %mask2=ismember(1:md.mesh.numberofvertices,pos);149 135 D=1-(1+a+a.^2+b.^2).^((n-1)./(2*n))./abs(ex).^(1./n).*(T-sigmab)./B./(2+a)./sign(ex); 150 151 %pos=find(D2>1);152 %mask1=ismember(1:md.mesh.numberofvertices,pos);153 %pos=find(a<-2);154 %mask2=ismember(1:md.mesh.numberofvertices,pos);155 %pos=find(ex<-0);156 %mask3=ismember(1:md.mesh.numberofvertices,pos);157 %pos=find(((2+a).*sign(ex))<0);158 %mask4=ismember(1:md.mesh.numberofvertices,pos);159 %plotmodel(md,'nlines',2,'ncols',2,'data',D2,'data',a,'data',ex,'data',(2+a).*sign(ex),...160 % 'mask#1',mask1,'mask#2',mask2,'mask#3',mask3,'mask#4',mask4,...161 % 'expdisp#all','./Exp/LarsenC_DomainOutline_Bedmap2extent.exp',...162 % 'caxis#1',[0 1],'caxis#2',[-2,1],'caxis#3',[0 4e-9],'caxis#4',[0 1]);163 136 164 137 backstress=zeros(md.mesh.numberofvertices,1); 165 138 166 % new corrections167 139 % D>1 where (2+a).*sign(ex)<0, compressive regions where high backstress needed 168 140 pos=find(D>1); 169 141 D(pos)=0; 142 170 143 % backstress to bring damage to zero 171 144 backstress(pos)=T(pos)-(1-D(pos)).*B(pos).*sign(ex(pos)).*(2+a(pos)).*abs(ex(pos)).^(1./n(pos))./(1+a(pos)+a(pos).^2).^((n(pos)-1)/2./n(pos)); 172 %backstress(pos)=T(pos)-(1-D(pos)).*B(pos).*(ex(pos)./theta(pos)).^(1./n(pos));173 145 174 146 pos=find(D<0); 175 147 mask=ismember(1:md.mesh.numberofvertices,pos); 176 %plotmodel(md,'data',D,'caxis',[0,1],'mask',mask)177 148 D(pos)=0; 149 178 150 % backstress to bring negative damage to zero 179 151 backstress(pos)=T(pos)-(1-D(pos)).*B(pos).*sign(ex(pos)).*(2+a(pos)).*abs(ex(pos)).^(1./n(pos))./(1+a(pos)+a(pos).^2).^((n(pos)-1)/2./n(pos)); 180 152 181 153 pos=find(backstress<0); 182 %length(pos)183 154 backstress(pos)=0; 184 185 %plotmodel(md,'data',backstress,'caxis',[0 2e5],'edgecolor','k')186 155 187 156 % increased rigidity to bring negative damage to zero 188 157 B(pos)=sign(ex(pos))./(2+a(pos)).*(1+a(pos)+a(pos).^2).^((n(pos)-1)/2./n(pos)).*T(pos)./abs(ex(pos)).^(1./n(pos)); 189 %B(pos)=T(pos)./(1-D(pos)).*(theta(pos)./ex(pos)).^(1./n(pos)); % same calculated both ways190 158 191 % enforce maximum B corresponding to -50 deg C ice192 %Bmax=paterson(273.15-50);193 %posB=find(B>Bmax);194 %B(posB)=Bmax;195 196 %plotmodel(md,'nlines',2,'ncols',1,'data',D,'data',D2,'caxis#all',[0,1])197 %plotmodel(md,'data',paterson(md.initialization.temperature)-B,'caxis',[-1e8 1e8])198 %plotmodel(md,'data',B,'caxis',[0.8e8 5e8])199 %plotmodel(md,'data',D2,'caxis',[0,1])200 %plotmodel(md,'data',(1-D2).*B,'caxis',[0.1e8 2e8])201 202 %plotmodel(md,'data',backstress2./T,'caxis',[1 2],'data',D2)203 %max(D2)204 %min(D2)205 206 %pos=find(D>1);207 %D(pos)=1-1e-9;208 %209 %pos=find(isnan(D));210 %D(pos)=0;211 %212 %% additional calculations here where negative damage is inferred213 %pos=find(D<0);214 %D(pos)=0;215 %216 %% magnitude of back stress to bring negative damage to zero217 %backstress=zeros(md.mesh.numberofvertices,1);218 %backstress(pos)=T(pos)-(1-D(pos)).*B(pos).*(ex(pos)./theta(pos)).^(1./n(pos));219 %220 %mask=ismember(1:md.mesh.numberofvertices,pos);221 %222 %%% enforce max back stress equal to spreading stress223 %%posS=find(backstress>T);224 %%backstress(posS)=T(posS);225 %226 %% decreased thickness in areas of negative damage227 %dH=zeros(md.mesh.numberofvertices,1);228 %dH(pos)=1/C*((1-D(pos)).*B(pos).*(ex(pos)./theta(pos)).^(1./n(pos))-T(pos));229 %230 %% higher rigidity to eliminate areas of negative damage231 %B(pos)=T(pos)./(1-D(pos)).*(theta(pos)./ex(pos)).^(1./n(pos));232 %233 %234 %temp=[0:-0.1:-50]+273.15;235 %rig=paterson(temp);236 %newtemp=md.initialization.temperature;237 %238 %for i=1:length(pos)239 % [mindiff,index]=min(abs(rig-B(pos(i))));240 % newtemp(pos(i))=temp(index);241 %end242 %243 %dT=newtemp-md.initialization.temperature;244 245 %any(D<0)246 %any(D>1)247 %any(backstress<0)248 159 damage=D; -
issm/trunk-jpl/src/m/mech/analyticaldamage.py
r16056 r16065 26 26 'damage' which is truncated in the range [0,1-1e-9] 27 27 28 'mask' is a mask defining areas where damage was calculated as negative prior29 to truncation, indicating that the ice is too warm or a back stress has not30 been accounted for.31 32 28 'B' is the rigidity, which is equal to md.materials.rheology_B in areas outside 33 29 those defined by 'mask.' Within areas defined by 'mask,' where negative damage … … 38 34 39 35 Usage: 40 [damage, mask,B,backstress]=analyticaldamage(md,options)36 [damage,B,backstress]=analyticaldamage(md,options) 41 37 42 38 Example: 43 [damage, mask,B,backstress]=analyticaldamage(md,'eq','Weertman2D','smoothing',2,'backstress',10e3)39 [damage,B,backstress]=analyticaldamage(md,'eq','Weertman2D','smoothing',2,'backstress',10e3) 44 40 ''' 45 41 … … 102 98 a=ey/ex 103 99 b=exy/ex 104 pos=npy.nonzero(npy.logical_ or(ex<0,ey<0))100 pos=npy.nonzero(npy.logical_and(ex<0,ey<0)) 105 101 #length(pos) 106 102 a[pos]=-a[pos] … … 110 106 pos=npy.nonzero(abs((abs(a)-2))<1e-3) 111 107 a[pos]=-2+1e-3 112 113 #plotmodel(md,'data',a,'caxis',[-2,1])114 #plotmodel(md,'data',ex,'caxis',[-0.5e-9,0.5e-9])115 108 116 109 # spreading stress … … 135 128 raise StandardError('argument passed to "eq" not valid. Type "help analyticaldamage" for usage') 136 129 137 #D2=1-((theta./ex).^(1./n)).*(T-sigmab)./B;138 #length(find(D2<0))139 #length(find(ex<0))140 #length(find(D2>1))141 #length(find(theta<0))142 #pos=find(ex<0);143 #mask2=ismember(1:md.mesh.numberofvertices,pos);144 130 D=1-(1+a+a**2+b**2)**((n-1)/(2*n))/abs(ex)**(1./n)*(T-sigmab)/B/(2+a)/npy.sign(ex) 145 146 #pos=find(D2>1);147 #mask1=ismember(1:md.mesh.numberofvertices,pos);148 #pos=find(a<-2);149 #mask2=ismember(1:md.mesh.numberofvertices,pos);150 #pos=find(ex<-0);151 #mask3=ismember(1:md.mesh.numberofvertices,pos);152 #pos=find(((2+a).*sign(ex))<0);153 #mask4=ismember(1:md.mesh.numberofvertices,pos);154 #plotmodel(md,'nlines',2,'ncols',2,'data',D2,'data',a,'data',ex,'data',(2+a).*sign(ex),...155 # 'mask#1',mask1,'mask#2',mask2,'mask#3',mask3,'mask#4',mask4,...156 # 'expdisp#all','./Exp/LarsenC_DomainOutline_Bedmap2extent.exp',...157 # 'caxis#1',[0 1],'caxis#2',[-2,1],'caxis#3',[0 4e-9],'caxis#4',[0 1]);158 131 159 132 backstress=npy.zeros(md.mesh.numberofvertices,) 160 133 161 # new corrections162 134 # D>1 where (2+a).*sign(ex)<0, compressive regions where high backstress needed 163 135 pos=npy.nonzero(D>1) 164 136 D[pos]=0 137 165 138 # backstress to bring damage to zero 166 139 backstress[pos]=T[pos]-(1-D[pos])*B[pos]*npy.sign(ex[pos])*(2+a[pos])*abs(ex[pos])**(1./n[pos])/(1+a[pos]+a[pos]**2)**((n[pos]-1)/2./n[pos]) 167 #backstress[pos]=T[pos]-(1-D[pos]).*B[pos].*(ex[pos]./theta[pos]).^(1./n[pos]);168 140 169 141 pos=npy.nonzero(D<0) 170 #mask=ismember(1:md.mesh.numberofvertices,pos)171 #plotmodel(md,'data',D,'caxis',[0,1],'mask',mask)172 142 D[pos]=0 143 173 144 # backstress to bring negative damage to zero 174 145 backstress[pos]=T[pos]-(1-D[pos])*B[pos]*npy.sign(ex[pos])*(2+a[pos])*abs(ex[pos])**(1./n[pos])/(1+a[pos]+a[pos]**2)**((n[pos]-1)/2./n[pos]) 175 146 176 147 pos=npy.nonzero(backstress<0) 177 #length[pos]178 148 backstress[pos]=0 179 180 #plotmodel(md,'data',backstress,'caxis',[0 2e5],'edgecolor','k')181 149 182 150 # increased rigidity to bring negative damage to zero 183 151 B[pos]=npy.sign(ex[pos])/(2+a[pos])*(1+a[pos]+a[pos]**2)**((n[pos]-1)/2./n[pos])*T[pos]/abs(ex[pos])**(1./n[pos]); 184 #B[pos]=T[pos]./(1-D[pos]).*(theta[pos]./ex[pos]).^(1./n[pos]); # same calculated both ways185 152 186 # enforce maximum B corresponding to -50 deg C ice187 #Bmax=paterson(273.15-50);188 #posB=find(B>Bmax);189 #B(posB)=Bmax;190 191 #plotmodel(md,'nlines',2,'ncols',1,'data',D,'data',D2,'caxis#all',[0,1])192 #plotmodel(md,'data',paterson(md.initialization.temperature)-B,'caxis',[-1e8 1e8])193 #plotmodel(md,'data',B,'caxis',[0.8e8 5e8])194 #plotmodel(md,'data',D2,'caxis',[0,1])195 #plotmodel(md,'data',(1-D2).*B,'caxis',[0.1e8 2e8])196 197 #plotmodel(md,'data',backstress2./T,'caxis',[1 2],'data',D2)198 #max(D2)199 #min(D2)200 201 #pos=find(D>1);202 #D[pos]=1-1e-9;203 #204 #pos=find(isnan(D));205 #D[pos]=0;206 #207 ## additional calculations here where negative damage is inferred208 #pos=find(D<0);209 #D[pos]=0;210 #211 ## magnitude of back stress to bring negative damage to zero212 #backstress=zeros(md.mesh.numberofvertices,1);213 #backstress[pos]=T[pos]-(1-D[pos]).*B[pos].*(ex[pos]./theta[pos]).^(1./n[pos]);214 #215 #mask=ismember(1:md.mesh.numberofvertices,pos);216 #217 ## enforce max back stress equal to spreading stress218 ##posS=find(backstress>T);219 ##backstress(posS)=T(posS);220 #221 ## decreased thickness in areas of negative damage222 #dH=zeros(md.mesh.numberofvertices,1);223 #dH[pos]=1/C*((1-D[pos]).*B[pos].*(ex[pos]./theta[pos]).^(1./n[pos])-T[pos]);224 #225 ## higher rigidity to eliminate areas of negative damage226 #B[pos]=T[pos]./(1-D[pos]).*(theta[pos]./ex[pos]).^(1./n[pos]);227 #228 #229 #temp=[0:-0.1:-50]+273.15;230 #rig=paterson(temp);231 #newtemp=md.initialization.temperature;232 #233 #for i=1:length(pos)234 # [mindiff,index]=min(abs(rig-B(pos(i))));235 # newtemp(pos(i))=temp(index);236 #end237 #238 #dT=newtemp-md.initialization.temperature;239 240 #any(D<0)241 #any(D>1)242 #any(backstress<0)243 153 damage=D 244 154
Note:
See TracChangeset
for help on using the changeset viewer.