Changeset 16065


Ignore:
Timestamp:
09/04/13 12:10:42 (12 years ago)
Author:
cborstad
Message:

CHG: cleanup of damage function

Location:
issm/trunk-jpl/src/m/mech
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/mech/analyticaldamage.m

    r16056 r16065  
    2020%               'damage' which is truncated in the range [0,1-1e-9]
    2121%
    22 %               'mask' is a mask defining areas where damage was calculated as negative prior
    23 %               to truncation, indicating that the ice is too warm or a back stress has not
    24 %               been accounted for.
    25 %
    2622%          'B' is the rigidity, which is equal to md.materials.rheology_B in areas outside
    2723%               those defined by 'mask.'  Within areas defined by 'mask,' where negative damage
     
    3228%
    3329%   Usage:
    34 %      [damage,mask,B,backstress]=analyticaldamage(md,options)
     30%      [damage,B,backstress]=analyticaldamage(md,options)
    3531%
    3632%   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);
    3834
    3935% check inputs
     
    114110a(pos)=-2+1e-3;
    115111
    116 %plotmodel(md,'data',a,'caxis',[-2,1])
    117 %plotmodel(md,'data',ex,'caxis',[-0.5e-9,0.5e-9])
    118 
    119112% spreading stress
    120113rhoi=md.materials.rho_ice;
     
    140133end
    141134
    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);
    149135D=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]);
    163136
    164137backstress=zeros(md.mesh.numberofvertices,1);
    165138
    166 % new corrections
    167139% D>1 where (2+a).*sign(ex)<0, compressive regions where high backstress needed
    168140pos=find(D>1);
    169141D(pos)=0;
     142
    170143% backstress to bring damage to zero
    171144backstress(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));
    173145
    174146pos=find(D<0);
    175147mask=ismember(1:md.mesh.numberofvertices,pos);
    176 %plotmodel(md,'data',D,'caxis',[0,1],'mask',mask)
    177148D(pos)=0;
     149
    178150% backstress to bring negative damage to zero
    179151backstress(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));
    180152
    181153pos=find(backstress<0);
    182 %length(pos)
    183154backstress(pos)=0;
    184 
    185 %plotmodel(md,'data',backstress,'caxis',[0 2e5],'edgecolor','k')
    186155
    187156% increased rigidity to bring negative damage to zero
    188157B(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 ways
    190158
    191 % enforce maximum B corresponding to -50 deg C ice
    192 %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 inferred
    213 %pos=find(D<0);
    214 %D(pos)=0;
    215 %
    216 %% magnitude of back stress to bring negative damage to zero
    217 %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 stress
    223 %%posS=find(backstress>T);
    224 %%backstress(posS)=T(posS);
    225 %
    226 %% decreased thickness in areas of negative damage
    227 %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 damage
    231 %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 %end
    242 %
    243 %dT=newtemp-md.initialization.temperature;
    244 
    245 %any(D<0)
    246 %any(D>1)
    247 %any(backstress<0)
    248159damage=D;
  • issm/trunk-jpl/src/m/mech/analyticaldamage.py

    r16056 r16065  
    2626                        'damage' which is truncated in the range [0,1-1e-9]
    2727       
    28                         'mask' is a mask defining areas where damage was calculated as negative prior
    29                         to truncation, indicating that the ice is too warm or a back stress has not
    30                         been accounted for.
    31        
    3228                   'B' is the rigidity, which is equal to md.materials.rheology_B in areas outside
    3329                        those defined by 'mask.'  Within areas defined by 'mask,' where negative damage
     
    3834       
    3935           Usage:
    40               [damage,mask,B,backstress]=analyticaldamage(md,options)
     36              [damage,B,backstress]=analyticaldamage(md,options)
    4137       
    4238           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)
    4440        '''
    4541
     
    10298        a=ey/ex
    10399        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))
    105101        #length(pos)
    106102        a[pos]=-a[pos]
     
    110106        pos=npy.nonzero(abs((abs(a)-2))<1e-3)
    111107        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])
    115108       
    116109        # spreading stress
     
    135128                raise StandardError('argument passed to "eq" not valid.  Type "help analyticaldamage" for usage')
    136129       
    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);
    144130        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]);
    158131       
    159132        backstress=npy.zeros(md.mesh.numberofvertices,)
    160133       
    161         # new corrections
    162134        # D>1 where (2+a).*sign(ex)<0, compressive regions where high backstress needed
    163135        pos=npy.nonzero(D>1)
    164136        D[pos]=0
     137       
    165138        # backstress to bring damage to zero
    166139        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]);
    168140       
    169141        pos=npy.nonzero(D<0)
    170         #mask=ismember(1:md.mesh.numberofvertices,pos)
    171         #plotmodel(md,'data',D,'caxis',[0,1],'mask',mask)
    172142        D[pos]=0
     143
    173144        # backstress to bring negative damage to zero
    174145        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])
    175146       
    176147        pos=npy.nonzero(backstress<0)
    177         #length[pos]
    178148        backstress[pos]=0
    179        
    180         #plotmodel(md,'data',backstress,'caxis',[0 2e5],'edgecolor','k')
    181149       
    182150        # increased rigidity to bring negative damage to zero
    183151        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 ways
    185152       
    186         # enforce maximum B corresponding to -50 deg C ice
    187         #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 inferred
    208         #pos=find(D<0);
    209         #D[pos]=0;
    210         #
    211         ## magnitude of back stress to bring negative damage to zero
    212         #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 stress
    218         ##posS=find(backstress>T);
    219         ##backstress(posS)=T(posS);
    220         #
    221         ## decreased thickness in areas of negative damage
    222         #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 damage
    226         #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         #end
    237         #
    238         #dT=newtemp-md.initialization.temperature;
    239        
    240         #any(D<0)
    241         #any(D>1)
    242         #any(backstress<0)
    243153        damage=D
    244154       
Note: See TracChangeset for help on using the changeset viewer.