Changeset 16198 for issm/trunk-jpl/src/m/classes/damage.py
- Timestamp:
- 09/20/13 07:39:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/damage.py
r16179 r16198 16 16 17 17 #damage: 18 isdamage = float('NaN') 19 self.D = float('NaN') 20 self.law = '' 18 self.D = float('NaN') 19 self.law = '' 20 self.spcdamage = float('NaN') 21 self.max_damage = float('NaN') 21 22 22 #parameters for law 'initial': 23 self.stress_threshold = float('NaN') 24 self.c1 = float('NaN') 25 self.c2 = float('NaN') 26 self.c3 = float('NaN') 27 self.c4 = float('NaN') 23 #numerical 24 stabilization = float('NaN') 25 penalty_threshold = float('NaN') 26 maxiter = float('NaN') 27 penalty_lock = float('NaN') 28 penalty_factor = float('NaN') 29 30 #general parameters for evolution law: 31 self.stress_threshold = float('NaN') 32 self.c1 = float('NaN') 33 self.c2 = float('NaN') 34 self.c3 = float('NaN') 35 self.c4 = float('NaN') 36 self.healing = float('NaN') 28 37 29 38 if not len(args): … … 38 47 s+="%s\n" % fielddisplay(self,"D","damage tensor (scalar for now)") 39 48 s+="%s\n" % fielddisplay(self,"law","damage law (string) from ['undamaged','pralong']") 49 s+="%s\n" % fielddisplay(self,"spcdamage","damage constraints (NaN means no constraint)") 50 s+="%s\n" % fielddisplay(self,"max_damage","maximum possible damage (0<=max_damage<1)") 51 52 s+="%s\n" % fielddisplay(self,"stabilization","0: no, 1: artificial_diffusivity, 2: SUPG") 53 s+="%s\n" % fielddisplay(self,"maxiter","maximum number of non linear iterations") 54 s+="%s\n" % fielddisplay(self,"penalty_lock","stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)") 55 s+="%s\n" % fielddisplay(self,"penalty_lock","threshold to declare convergence of damage evolution solution (default is 0)") 56 s+="%s\n" % fielddisplay(self,"penalty_lock","scaling exponent (default is 3)") 40 57 41 58 if (self.law=='pralong'): … … 51 68 52 69 #damage parameters: 53 self.isdamage=054 70 self.D=0 55 71 self.law='undamaged' 72 73 self.max_damage=1-1e-5 #if damage reaches 1, solve becomes singular, as viscosity becomes nil 74 75 #Type of stabilization used 76 self.stabilization=2 77 78 #Maximum number of iterations 79 self.maxiter=100 80 81 #factor used to compute the values of the penalties: kappa=max(stiffness matrix)*10^penalty_factor 82 self.penalty_factor=3 83 84 #stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) 85 self.penalty_lock=0 86 87 #threshold to declare convergence of thermal solution (default is 0) 88 self.penalty_threshold=0 89 90 #damage evolution parameters 56 91 self.stress_threshold=0 57 92 self.c1=0 … … 59 94 self.c3=0 60 95 self.c4=0 96 self.healing=0 61 97 62 98 # }}} 63 99 def checkconsistency(self,md,solution,analyses): # {{{ 64 100 65 md = checkfield(md,'damage.D','>=',0,'size',[md.mesh.numberofvertices]) 66 if self.isdamage: 67 md = checkfield(md,'damage.law','values',['undamaged','pralong']) 101 md = checkfield(md,'damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices]) 102 md = checkfield(md,'damage.max_damage','<',1,'>=',0) 103 md = checkfield(md,'damage.law','values',['undamaged','pralong']) 104 md = checkfield(md,'damage.spcdamage','forcing',1) 105 106 md = checkfield(md,'damage.stabilization','numel',[1],'values',[0,1,2]); 107 md = checkfield(md,'damage.maxiter','>=0',0); 108 md = checkfield(md,'damage.penalty_factor','>=0',0); 109 md = checkfield(md,'damage.penalty_lock','>=0',0); 110 md = checkfield(md,'damage.penalty_threshold','>=0',0); 111 68 112 if self.law == 'pralong': 113 md = checkfield(md,'damage.healing','>=',0); 69 114 md = checkfield(md,'damage.c1','>=',0) 70 115 md = checkfield(md,'damage.c2','>=',0) … … 72 117 md = checkfield(md,'damage.c4','>=',0) 73 118 md = checkfield(md,'damage.stress_threshold','>=',0) 119 elif strcmpi(self.law,'undamaged'): 120 if (solution==DamageEvolutionSolutionEnum): 121 raise RuntimeError('Invalid evolution law (md.damage.law) for a damage solution'); 74 122 75 123 return md … … 77 125 def marshall(self,md,fid): # {{{ 78 126 79 WriteData(fid,'object',self,'fieldname','isdamage','format','DoubleMat','mattype',1)80 127 WriteData(fid,'object',self,'fieldname','D','format','DoubleMat','mattype',1) 81 if self.isdamage: 82 WriteData(fid,'object',self,'fieldname','law','format','String') 128 WriteData(fid,'object',self,'fieldname','law','format','String') 129 WriteData(fid,'object',self,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1); 130 WriteData(fid,'object',self,'fieldname','max_damage','format','Double'); 131 132 WriteData(fid,'object',self,'fieldname','stabilization','format','Integer'); 133 WriteData(fid,'object',self,'fieldname','penalty_threshold','format','Integer'); 134 WriteData(fid,'object',self,'fieldname','maxiter','format','Integer'); 135 WriteData(fid,'object',self,'fieldname','penalty_lock','format','Integer'); 136 WriteData(fid,'object',self,'fieldname','penalty_factor','format','Double'); 137 83 138 if self.law=='pralong': 84 139 WriteData(fid,'object',self,'fieldname','c1','format','Double')
Note:
See TracChangeset
for help on using the changeset viewer.