Changeset 26299
- Timestamp:
- 06/05/21 15:30:12 (4 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/geometry.m
r26062 r26299 33 33 end 34 34 methods 35 function self = extrude(self,md) % {{{36 self.surface=project3d(md,'vector',self.surface,'type','node');37 self.thickness=project3d(md,'vector',self.thickness,'type','node');38 self.hydrostatic_ratio=project3d(md,'vector',self.hydrostatic_ratio,'type','node');39 self.base=project3d(md,'vector',self.base,'type','node');40 self.bed=project3d(md,'vector',self.bed,'type','node');41 end % }}}42 35 function self = geometry(varargin) % {{{ 43 36 switch nargin … … 99 92 WriteData(fid,prefix,'object',self,'fieldname','hydrostatic_ratio','format','DoubleMat','mattype',1); 100 93 end % }}} 94 function self = extrude(self,md) % {{{ 95 self.surface=project3d(md,'vector',self.surface,'type','node'); 96 self.thickness=project3d(md,'vector',self.thickness,'type','node'); 97 self.hydrostatic_ratio=project3d(md,'vector',self.hydrostatic_ratio,'type','node'); 98 self.base=project3d(md,'vector',self.base,'type','node'); 99 self.bed=project3d(md,'vector',self.bed,'type','node'); 100 end % }}} 101 101 function savemodeljs(self,fid,modelname) % {{{ 102 102 -
issm/trunk-jpl/src/m/classes/geometry.py
r26059 r26299 21 21 self.hydrostatic_ratio = np.nan 22 22 23 nargs = len(args) 24 if nargs == 0: 23 if len(args) == 0: 25 24 self.setdefaultparameters() 26 25 else: … … 37 36 #}}} 38 37 39 def extrude(self, md): #{{{40 self.surface = project3d(md, 'vector', self.surface, 'type', 'node')41 self.thickness = project3d(md, 'vector', self.thickness, 'type', 'node')42 self.hydrostatic_ratio = project3d(md, 'vector', self.hydrostatic_ratio, 'type', 'node')43 self.base = project3d(md, 'vector', self.base, 'type', 'node')44 self.bed = project3d(md, 'vector', self.bed, 'type', 'node')45 return self46 #}}}47 48 38 def setdefaultparameters(self): #{{{ 49 39 return self … … 56 46 md = checkfield(md, 'fieldname', 'geometry.surface', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 57 47 md = checkfield(md, 'fieldname', 'geometry.base', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 58 md = checkfield(md, 'fieldname', 'geometry.thickness', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices], '> ', 0, 'timeseries', 1)59 if any(abs(self.thickness - self.surface + self.base) > 1 0**-9):60 md.checkmessage( "equality thickness = surface-base violated")48 md = checkfield(md, 'fieldname', 'geometry.thickness', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices], '>=', 0) 49 if any(abs(self.thickness - self.surface + self.base) > 1e-9): 50 md.checkmessage('equality thickness = surface-base violated') 61 51 if solution == 'TransientSolution' and md.transient.isgroundingline: 62 52 md = checkfield(md, 'fieldname', 'geometry.bed', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 63 if np.any(self.bed - self.base > 1 0**-12):53 if np.any(self.bed - self.base > 1e-12): 64 54 md.checkmessage('base < bed on one or more vertex') 65 55 pos = np.where(md.mask.ocean_levelset > 0) 66 if np.any(np.abs(self.bed[pos] - self.base[pos]) > 1 0**-9):56 if np.any(np.abs(self.bed[pos] - self.base[pos]) > 1e-9): 67 57 md.checkmessage('equality base = bed on grounded ice violated') 68 58 md = checkfield(md, 'fieldname', 'geometry.bed', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) … … 71 61 72 62 def marshall(self, prefix, md, fid): #{{{ 73 if (len(self.thickness) == md.mesh.numberofvertices) or (len(self.thickness) == md.mesh.numberofvertices + 1): 63 length_thickness = len(self.thickness) 64 if (length_thickness == md.mesh.numberofvertices) or (length_thickness == md.mesh.numberofvertices + 1): 74 65 WriteData(fid, prefix, 'object', self, 'fieldname', 'thickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) 75 elif (len (self.thickness) == md.mesh.numberofelements) or (len(self.thickness)== md.mesh.numberofelements + 1):66 elif (length_thickness == md.mesh.numberofelements) or (length_thickness == md.mesh.numberofelements + 1): 76 67 WriteData(fid, prefix, 'object', self, 'fieldname', 'thickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) 77 68 else: … … 83 74 WriteData(fid, prefix, 'object', self, 'fieldname', 'hydrostatic_ratio', 'format', 'DoubleMat', 'mattype', 1) 84 75 # }}} 76 77 def extrude(self, md): #{{{ 78 self.surface = project3d(md, 'vector', self.surface, 'type', 'node') 79 self.thickness = project3d(md, 'vector', self.thickness, 'type', 'node') 80 self.hydrostatic_ratio = project3d(md, 'vector', self.hydrostatic_ratio, 'type', 'node') 81 self.base = project3d(md, 'vector', self.base, 'type', 'node') 82 self.bed = project3d(md, 'vector', self.bed, 'type', 'node') 83 return self 84 #}}} -
issm/trunk-jpl/src/m/classes/materials.m
r26233 r26299 96 96 97 97 %ice latent heat of fusion L (J/kg) 98 self.latentheat=3.34*1 0^5;98 self.latentheat=3.34*1e5; 99 99 100 100 %ice thermal conductivity (W/m/K) … … 111 111 112 112 %rate of change of melting point with pressure (K/Pa) 113 self.beta=9.8*1 0^-8;113 self.beta=9.8*1e-8; 114 114 115 115 %mixed layer (ice-water interface) heat capacity (J/kg/K) … … 117 117 118 118 %thermal exchange velocity (ice-water interface) (m/s) 119 self.thermal_exchange_velocity=1.00*1 0^-4;119 self.thermal_exchange_velocity=1.00*1e-4; 120 120 121 121 %Rheology law: what is the temperature dependence of B with T … … 124 124 125 125 %Rheology fields default: 126 self.rheology_B = 1 *1e8;126 self.rheology_B = 1 * 1e8; 127 127 self.rheology_n = 3; 128 128 … … 136 136 137 137 self.viscosity=[1e21;1e40]; %mantle and lithosphere viscosity (respectively) [Pa.s] 138 self.lame_mu=[1.45*1e11;6.7*1 0^10]; % (Pa) %lithosphere and mantle shear modulus (respectively) [Pa]138 self.lame_mu=[1.45*1e11;6.7*1e10]; % (Pa) %lithosphere and mantle shear modulus (respectively) [Pa] 139 139 self.lame_lambda=self.lame_mu; % (Pa) %mantle and lithosphere lamba parameter (respectively) [Pa] 140 140 self.burgers_viscosity=[NaN;NaN]; … … 193 193 case 'litho' 194 194 disp(sprintf(' \nLitho:')); 195 fielddisplay(self,'numlayers','number of layers (default 2)');195 fielddisplay(self,'numlayers','number of layers (default: 2)'); 196 196 fielddisplay(self,'radius','array describing the radius for each interface (numlayers+1) [m]'); 197 197 fielddisplay(self,'viscosity','array describing each layer''s viscosity (numlayers) [Pa.s]'); … … 207 207 208 208 209 fielddisplay(self,'rheologymodel','array describing whether we adopt a Max Well (0), Burgers (1) or EBM (2) rheology (default0)');209 fielddisplay(self,'rheologymodel','array describing whether we adopt a Maxwell (0), Burgers (1) or EBM (2) rheology (default: 0)'); 210 210 fielddisplay(self,'density','array describing each layer''s density (numlayers) [kg/m^3]'); 211 211 fielddisplay(self,'issolid','array describing whether the layer is solid or liquid (default 1) (numlayers)'); … … 261 261 end 262 262 if md.materials.issolid(1)==0 | md.materials.lame_mu(1)==0 263 263 error('First layer must be solid (issolid(1) > 0 AND lame_mu(1) > 0). Add a weak inner core if necessary.'); 264 264 end 265 265 ind=find(md.materials.issolid==0); 266 266 if sum(ismember(diff(ind),1)>=1) %if there are at least two consecutive indices that contain issolid = 0 267 267 error(['Fluid layers detected at layers #', num2str(ind'), ', but having 2 or more adjacent fluid layers is not supported yet. Consider merging them.']) 268 268 end 269 269 … … 323 323 earth_density=0; 324 324 for i=1:self.numlayers, 325 earth_density=earth_density + (self.radius(i+1)^3-self.radius(i)^3)*self.density(i);325 earth_density=earth_density + (self.radius(i+1)^3-self.radius(i)^3)*self.density(i); 326 326 end 327 327 earth_density=earth_density/self.radius(self.numlayers+1)^3; … … 565 565 for i=1:length(strnat), 566 566 switch strnat{i}, 567 567 case 'damageice' 568 568 intnat(i)=1; 569 569 case 'estar' -
issm/trunk-jpl/src/m/classes/materials.py
r26059 r26299 16 16 def __init__(self, *args): #{{{ 17 17 self.nature = [] 18 if not len(args):18 if len(args) == 0: 19 19 self.nature = ['ice'] 20 20 else: … … 25 25 raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") 26 26 27 #start filling in the dynamic fields: 28 for i in range(len(self.nature)): 29 nat = self.nature[i] 30 if nat == 'ice': 31 setattr(self, 'rho_ice', 0) 32 setattr(self, 'rho_water', 0) 33 setattr(self, 'rho_freshwater', 0) 34 setattr(self, 'mu_water', 0) 35 setattr(self, 'heatcapacity', 0) 36 setattr(self, 'latentheat', 0) 37 setattr(self, 'thermalconductivity', 0) 38 setattr(self, 'temperateiceconductivity', 0) 39 setattr(self, 'effectiveconductivity_averaging', 0) 40 setattr(self, 'meltingpoint', 0) 41 setattr(self, 'beta', 0) 42 setattr(self, 'mixed_layer_capacity', 0) 43 setattr(self, 'thermal_exchange_velocity', 0) 44 setattr(self, 'rheology_B', 0) 45 setattr(self, 'rheology_n', 0) 46 setattr(self, 'rheology_law', 0) 47 elif nat == 'litho': 48 setattr(self, 'numlayers', 0) 49 setattr(self, 'radius', 0) 50 setattr(self, 'viscosity', 0) 51 setattr(self, 'lame_lambda', 0) 52 setattr(self, 'lame_mu', 0) 53 setattr(self, 'burgers_viscosity', 0) 54 setattr(self, 'burgers_mu', 0) 55 setattr(self, 'isburgers', 0) 56 setattr(self, 'density', 0) 57 setattr(self, 'issolid', 0) 58 elif nat == 'hydro': 59 setattr(self, 'rho_ice', 0) 60 setattr(self, 'rho_water', 0) 61 setattr(self, 'rho_freshwater', 0) 27 for i in range(len(self.nature)): 28 nat = self.nature[i] 29 if nat == 'ice': 30 self.rho_ice = 0 31 self.rho_water = 0 32 self.rho_freshwater = 0 33 self.mu_water = 0 34 self.heatcapacity = 0 35 self.latentheat = 0 36 self.thermalconductivity = 0 37 self.temperateiceconductivity = 0 38 self.effectiveconductivity_averaging = 0 39 self.meltingpoint = 0 40 self.beta = 0 41 self.mixed_layer_capacity = 0 42 self.thermal_exchange_velocity = 0 43 self.rheology_B = 0 44 self.rheology_n = 0 45 self.rheology_law = 0 46 elif nat == 'litho': 47 self.numlayers = 0 48 self.radius = 0 49 self.viscosity = 0 50 self.lame_lambda = 0 51 self.lame_mu = 0 52 self.burgers_viscosity = 0 53 self.burgers_mu = 0 54 self.ebm_alpha = 0 55 self.ebm_delta = 0 56 self.ebm_taul = 0 57 self.ebm_tauh = 0 58 self.rheologymodel = 0 59 self.density = 0 60 self.issolid = 0 61 elif nat == 'hydro': 62 self.rho_ice = 0 63 self.rho_water = 0 64 self.rho_freshwater = 0 62 65 else: 63 66 raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") 64 se tattr(self, 'earth_density', 0)65 66 # set default parameters:67 self.earth_density = 0 68 69 # Set default parameters 67 70 self.setdefaultparameters() 68 71 #}}} 69 72 73 def __repr__(self): #{{{ 74 s = ' Materials:\n' 75 for i in range(len(self.nature)): 76 nat = self.nature[i] 77 if nat == 'ice': 78 s += 'Ice:\n' 79 s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]')) 80 s += '{}\n'.format(fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]')) 81 s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]')) 82 s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]')) 83 s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]')) 84 s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', 'ice thermal conductivity [W/m/K]')) 85 s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]')) 86 s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K')) 87 s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/m^3]')) 88 s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]')) 89 s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]')) 90 s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]')) 91 s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/n)]')) 92 s += '{}\n'.format(fielddisplay(self, 'rheology_n', 'Glen\'s flow law exponent')) 93 s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\', \'LliboutryDuval\', \'NyeCO2\', or \'NyeH2O\'')) 94 elif nat == 'litho': 95 s += 'Litho:\n' 96 s += '{}\n'.format(fielddisplay(self, 'numlayers', 'number of layers (default: 2)')) 97 s += '{}\n'.format(fielddisplay(self, 'radius', 'array describing the radius for each interface (numlayers + 1) [m]')) 98 s += '{}\n'.format(fielddisplay(self, 'viscosity', 'array describing each layer\'s viscosity (numlayers) [Pa.s]')) 99 s += '{}\n'.format(fielddisplay(self, 'lame_lambda', 'array describing the lame lambda parameter (numlayers) [Pa]')) 100 s += '{}\n'.format(fielddisplay(self, 'lame_mu', 'array describing the shear modulus for each layers (numlayers) [Pa]')) 101 s += '{}\n'.format(fielddisplay(self, 'burgers_viscosity', 'array describing each layer\'s transient viscosity, only for Burgers rheologies (numlayers) [Pa.s]')) 102 s += '{}\n'.format(fielddisplay(self, 'burgers_mu', 'array describing each layer\'s transient shear modulus, only for Burgers rheologies (numlayers) [Pa]')) 103 104 s += '{}\n'.format(fielddisplay(self, 'ebm_alpha', 'array describing each layer\'s exponent parameter controlling the shape of shear modulus curve between taul and tauh, only for EBM rheology (numlayers)')) 105 s += '{}\n'.format(fielddisplay(self, 'ebm_delta', 'array describing each layer\'s amplitude of the transient relaxation (ratio between elastic rigity to pre-maxwell relaxation rigity), only for EBM rheology (numlayers)')) 106 s += '{}\n'.format(fielddisplay(self, 'ebm_taul', 'array describing each layer\'s starting period for transient relaxation, only for EBM rheology (numlayers) [s]')) 107 s += '{}\n'.format(fielddisplay(self, 'ebm_tauh', 'array describing each layer''s array describing each layer\'s end period for transient relaxation, only for Burgers rheology (numlayers) [s]')) 108 109 s += '{}\n'.format(fielddisplay(self, 'rheologymodel', 'array describing whether we adopt a Maxwell (0), Burgers (1) or EBM (2) rheology (default: 0)')) 110 s += '{}\n'.format(fielddisplay(self, 'density', 'array describing each layer\'s density (numlayers) [kg/m^3]')) 111 s += '{}\n'.format(fielddisplay(self, 'issolid', 'array describing whether the layer is solid or liquid (default 1) (numlayers)')) 112 elif nat == 'hydro': 113 s += 'Hydro:\n' 114 s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]')) 115 s += '{}\n'.format(fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]')) 116 s += '{}\n'.format(fielddisplay(self, 'earth_density', 'mantle density [kg/m^3]')) 117 s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]')) 118 119 else: 120 raise RuntimeError('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')') 121 return s 122 #}}} 123 70 124 def setdefaultparameters(self): #{{{ 71 125 for i in range(len(self.nature)): 72 126 nat = self.nature[i] 73 127 if nat == 'ice': 74 # ice density (kg/m^3)128 # Ice density (kg/m^3) 75 129 self.rho_ice = 917. 76 130 77 # ocean water density (kg/m^3)131 # Ocean water density (kg/m^3) 78 132 self.rho_water = 1023. 79 133 80 # fresh water density (kg/m^3)134 # Fresh water density (kg/m^3) 81 135 self.rho_freshwater = 1000. 82 136 83 # water viscosity (N.s/m^2)137 # Water viscosity (N.s/m^2) 84 138 self.mu_water = 0.001787 85 139 86 # ice heat capacity cp (J/kg/K)140 # Ice heat capacity cp (J/kg/K) 87 141 self.heatcapacity = 2093. 88 142 89 # ice latent heat of fusion L (J /kg)90 self.latentheat = 3.34 e591 92 # ice thermal conductivity (W/m/K)143 # Ice latent heat of fusion L (J/kg) 144 self.latentheat = 3.34 * 1e5 145 146 # Ice thermal conductivity (W/m/K) 93 147 self.thermalconductivity = 2.4 94 148 95 # wet ice thermal conductivity (W/m/K)149 # Wet ice thermal conductivity (W/m/K) 96 150 self.temperateiceconductivity = 0.24 97 151 98 # computation of effective conductivity152 # Computation of effective conductivity 99 153 self.effectiveconductivity_averaging = 1 100 154 101 # the melting point of ice at 1 atmosphere of pressure in K155 # The melting point of ice at 1 atmosphere of pressure in K 102 156 self.meltingpoint = 273.15 103 157 104 # rate of change of melting point with pressure (K/Pa)105 self.beta = 9.8 e-8106 107 # mixed layer (ice-water interface) heat capacity (J/kg/K)158 # Rate of change of melting point with pressure (K/Pa) 159 self.beta = 9.8 * 1e-8 160 161 # Mixed layer (ice-water interface) heat capacity (J/kg/K) 108 162 self.mixed_layer_capacity = 3974. 109 163 110 # thermal exchange velocity (ice-water interface) (m/s)111 self.thermal_exchange_velocity = 1.00 e-4112 113 # Rheology law: what is the temperature dependence of B with T114 # available: none, paterson and arrhenius164 # Thermal exchange velocity (ice-water interface) (m/s) 165 self.thermal_exchange_velocity = 1.00 * 1e-4 166 167 # Rheology law: what is the temperature dependence of B with T 168 # available: none, paterson and arrhenius 115 169 self.rheology_law = 'Paterson' 116 170 117 # Rheology fields default118 self.rheology_B = 1 e8171 # Rheology fields default 172 self.rheology_B = 1 * 1e8 119 173 self.rheology_n = 3 120 174 elif nat == 'litho': 121 #we default to a configuration that enables running GIA solutions using giacaron and/or giaivins. 175 # We default to a configuration that enables running GIA 176 # solutions using giacaron and/or giaivins 122 177 self.numlayers = 2 123 178 124 #center of the earth (approximation, must not be 0), then the lab (lithosphere / asthenosphere boundary) then the surface 125 #(with 1d3 to avoid numerical singularities) 126 self.radius = [1e3, 6278e3, 6378e3] 127 128 self.viscosity = [1e21, 1e40] #mantle and lithosphere viscosity (respectively) [Pa.s] 129 self.lame_mu = [1.45e11, 6.7e10] # (Pa) #lithosphere and mantle shear modulus (respectively) [Pa] 130 self.lame_lambda = self.lame_mu # (Pa) #mantle and lithosphere lamba parameter (respectively) [Pa] 179 # Center of the earth (approximation, must not be 0), then the 180 # lab (lithosphere/asthenosphere boundary) then the surface 181 # (with 1d3 to avoid numerical singularities) 182 self.radius = [1e3, 6278 * 1e3, 6378 * 1e3] 183 184 self.viscosity = [1e21, 1e40] # Mantle and lithosphere viscosity (respectively) [Pa.s] 185 self.lame_mu = [1.45 * 1e11, 6.7 * 1e10] # (Pa) # Lithosphere and mantle shear modulus (respectively) [Pa] 186 self.lame_lambda = self.lame_mu # (Pa) # Mantle and lithosphere lamba parameter (respectively) [Pa] 131 187 self.burgers_viscosity = [np.nan, np.nan] 132 188 self.burgers_mu = [np.nan, np.nan] 133 self.isburgers = [0, 0] 134 self.density = [5.51e3, 5.50e3] # (Pa) #mantle and lithosphere density [kg/m^3] 135 self.issolid = [1, 1] # is layer solid or liquid. 136 elif nat == 'hydro': 137 #ice density (kg/m^3) 189 190 self.ebm_alpha = [np.nan, np.nan] 191 self.ebm_delta = [np.nan, np.nan] 192 self.ebm_taul = [np.nan, np.nan] 193 self.ebm_tauh = [np.nan, np.nan] 194 self.rheologymodel = [0, 0] 195 self.density = [5.51e3, 5.50e3] # (Pa) # Mantle and lithosphere density [kg/m^3] 196 self.issolid = [1, 1] # Is layer solid or liquid? 197 elif nat == 'hydro': 198 # Ice density (kg/m^3) 138 199 self.rho_ice = 917. 139 200 140 # ocean water density (kg/m^3)201 # Ocean water density (kg/m^3) 141 202 self.rho_water = 1023. 142 203 143 # fresh water density (kg/m^3)204 # Fresh water density (kg/m^3) 144 205 self.rho_freshwater = 1000. 145 206 else: 146 207 raise RuntimeError("materials setdefaultparameters error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") 147 208 148 # average density of the Earth (kg/m^3)209 # Average density of the Earth (kg/m^3) 149 210 self.earth_density = 5512 150 #}}}151 152 def __repr__(self): #{{{153 string = " Materials:"154 for i in range(len(self.nature)):155 nat = self.nature[i]156 if nat == 'ice':157 string = "%s\n%s" % (string, 'Ice:')158 string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg/m^3]"))159 string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "ocean water density [kg/m^3]"))160 string = "%s\n%s" % (string, fielddisplay(self, "rho_freshwater", "fresh water density [kg/m^3]"))161 string = "%s\n%s" % (string, fielddisplay(self, "mu_water", "water viscosity [N s/m^2]"))162 string = "%s\n%s" % (string, fielddisplay(self, "heatcapacity", "heat capacity [J/kg/K]"))163 string = "%s\n%s" % (string, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W/m/K]"))164 string = "%s\n%s" % (string, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W/m/K]"))165 string = "%s\n%s" % (string, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K"))166 string = "%s\n%s" % (string, fielddisplay(self, "latentheat", "latent heat of fusion [J/m^3]"))167 string = "%s\n%s" % (string, fielddisplay(self, "beta", "rate of change of melting point with pressure [K/Pa]"))168 string = "%s\n%s" % (string, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W/kg/K]"))169 string = "%s\n%s" % (string, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m/s]"))170 string = "%s\n%s" % (string, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1/n)]"))171 string = "%s\n%s" % (string, fielddisplay(self, "rheology_n", "Glen's flow law exponent"))172 string = "%s\n%s" % (string, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', or 'NyeH2O'"))173 elif nat == 'litho':174 string = "%s\n%s" % (string, 'Litho:')175 string = "%s\n%s" % (string, fielddisplay(self, 'numlayers', 'number of layers (default 2)'))176 string = "%s\n%s" % (string, fielddisplay(self, 'radius', 'array describing the radius for each interface (numlayers + 1) [m]'))177 string = "%s\n%s" % (string, fielddisplay(self, 'viscosity', 'array describing each layer''s viscosity (numlayers) [Pa.s]'))178 string = "%s\n%s" % (string, fielddisplay(self, 'lame_lambda', 'array describing the lame lambda parameter (numlayers) [Pa]'))179 string = "%s\n%s" % (string, fielddisplay(self, 'lame_mu', 'array describing the shear modulus for each layers (numlayers) [Pa]'))180 string = "%s\n%s" % (string, fielddisplay(self, 'burgers_viscosity', 'array describing each layer''s transient viscosity, only for Burgers rheologies (numlayers) [Pa.s]'))181 string = "%s\n%s" % (string, fielddisplay(self, 'burgers_mu', 'array describing each layer''s transient shear modulus, only for Burgers rheologies (numlayers) [Pa]'))182 string = "%s\n%s" % (string, fielddisplay(self, 'isburgers', 'array describing whether we adopt a MaxWell (0) or Burgers (1) rheology (default 0)'))183 string = "%s\n%s" % (string, fielddisplay(self, 'density', 'array describing each layer''s density (numlayers) [kg/m^3]'))184 string = "%s\n%s" % (string, fielddisplay(self, 'issolid', 'array describing whether the layer is solid or liquid (default 1) (numlayers)'))185 elif nat == 'hydro':186 string = "%s\n%s" % (string, 'Hydro:')187 string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg/m^3]"))188 string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "ocean water density [kg/m^3]"))189 string = "%s\n%s" % (string, fielddisplay(self, "earth_density", "mantle density [kg/m^3]"))190 string = "%s\n%s" % (string, fielddisplay(self, "rho_freshwater", "fresh water density [kg/m^3]"))191 192 else:193 raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")194 195 return string196 211 #}}} 197 212 … … 218 233 md = checkfield(md, 'fieldname', 'materials.density', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>', 0) 219 234 md = checkfield(md, 'fieldname', 'materials.viscosity', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0) 220 md = checkfield(md, 'fieldname', 'materials. isburgers', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0, '<=', 1)235 md = checkfield(md, 'fieldname', 'materials.rheologymodel', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0, '<=', 2) 221 236 md = checkfield(md, 'fieldname', 'materials.burgers_viscosity', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0) 222 237 md = checkfield(md, 'fieldname', 'materials.burgers_mu', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0) 238 md = checkfield(md, 'fieldname', 'materials.ebm_alpha', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0) 239 md = checkfield(md, 'fieldname', 'materials.ebm_delta', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0) 240 md = checkfield(md, 'fieldname', 'materials.ebm_taul', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0) 241 md = checkfield(md, 'fieldname', 'materials.ebm_tauh', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0) 223 242 224 243 for i in range(md.materials.numlayers): 225 if md.materials.isburgers[i] and (np.isnan(md.materials.burgers_viscosity[i] or np.isnan(md.materials.burgers_mu[i]))): 226 raise RuntimeError("materials checkconsistency error message: Litho burgers_viscosity or burgers_mu has NaN values, inconsistent with isburgers choice") 227 228 if md.materials.issolid[0] == 0 or md.materials.lame_mu[0] == 0: 229 raise RuntimeError('First layer must be solid (issolid(1) > 0 AND lame_mu(1) > 0). Add a weak inner core if necessary.') 230 231 for i in range(md.materials.numlayers - 1): 232 if (not md.materials.issolid[i]) and (not md.materials.issolid[i + 1]): #if there are at least two consecutive indices that contain issolid = 0 233 raise RuntimeError("%s%i%s" % ('2 or more adjacent fluid layers detected starting at layer ', i, '. This is not supported yet. Consider merging them.')) 244 if md.materials.rheologymodel[i] == 1 and (np.isnan(md.materials.burgers_viscosity[i] or np.isnan(md.materials.burgers_mu[i]))): 245 raise RuntimeError('materials checkconsistency error message: Litho burgers_viscosity or burgers_mu has NaN values, inconsistent with rheologymodel choice') 246 247 if md.materials.rheologymodel[i] == 2 and (np.isnan(md.materials.ebm_alpha[i]) or np.isnan(md.materials.ebm_delta[i]) or np.isnan(md.materials.ebm_taul[i]) or np.isnan(md.materials.ebm_tauh[i])): 248 raise RuntimeError('materials checkconsistency error message: Litho ebm_alpha, ebm_delta, ebm_taul or ebm_tauh has NaN values, inconsistent with rheologymodel choice') 249 if md.materials.issolid[0] == 0 or md.materials.lame_mu[0] == 0: 250 raise RuntimeError('First layer must be solid (issolid[0] > 0 AND lame_mu[0] > 0). Add a weak inner core if necessary.') 251 ind = np.where(md.materials.issolid == 0)[0] 252 if np.sum(np.in1d(np.diff(ind),1) >= 1): # If there are at least two consecutive indices that contain issolid = 0 253 raise RuntimeError('Fluid layers detected at layers #{} but having 2 or more adjacent fluid layers is not supported yet. Consider merging them.'.format(i)) 254 234 255 elif nat == 'hydro': 235 256 md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0) … … 238 259 md = checkfield(md, 'fieldname', 'materials.rho_freshwater', '>', 0) 239 260 else: 240 raise RuntimeError( "materials checkconsistency error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")261 raise RuntimeError('materials checkconsistency error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')') 241 262 242 263 return md … … 250 271 nat = self.nature[i] 251 272 if nat == 'ice': 252 WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 3, 'format', 'Integer')253 273 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double') 254 274 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_water', 'format', 'Double') … … 275 295 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'density', 'format', 'DoubleMat', 'mattype', 3) 276 296 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'viscosity', 'format', 'DoubleMat', 'mattype', 3) 277 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', ' isburgers', 'format', 'DoubleMat', 'mattype', 3)297 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheologymodel', 'format', 'DoubleMat', 'mattype', 3) 278 298 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'burgers_viscosity', 'format', 'DoubleMat', 'mattype', 3) 279 299 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'burgers_mu', 'format', 'DoubleMat', 'mattype', 3) 300 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'ebm_alpha', 'format', 'DoubleMat', 'mattype', 3) 301 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'ebm_delta', 'format', 'DoubleMat', 'mattype', 3) 302 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'ebm_taul', 'format', 'DoubleMat', 'mattype', 3) 303 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'ebm_tauh', 'format', 'DoubleMat', 'mattype', 3) 280 304 # Compute earth density compatible with our layer density distribution 281 305 earth_density = 0 282 for i in range( len(self.numlayers)):283 earth_density = earth_density + ( self.radius[i + 1] ** 3 - self.radius[i] ** 3) * self.density[i]284 earth_density = earth_density / self.radius[self.numlayers + 1] ** 3306 for i in range(self.numlayers): 307 earth_density = earth_density + (pow(self.radius[i + 1], 3) - pow(self.radius[i], 3)) * self.density[i] 308 earth_density = earth_density / pow(self.radius[self.numlayers], 3) 285 309 self.earth_density = earth_density 286 310 elif nat == 'hydro': … … 289 313 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_freshwater', 'format', 'Double') 290 314 else: 291 raise RuntimeError( "materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")315 raise RuntimeError('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')') 292 316 WriteData(fid, prefix, 'data', self.earth_density, 'name', 'md.materials.earth_density', 'format', 'Double') 293 317 #}}} … … 322 346 intnat[i] = 7 323 347 else: 324 raise RuntimeError( "materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")348 raise RuntimeError('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')') 325 349 326 350 return intnat -
issm/trunk-jpl/src/m/classes/solidearth.m
r26099 r26299 83 83 end 84 84 85 86 85 end % }}} 87 86 function list=defaultoutputs(self,md) % {{{ … … 107 106 end % }}} 108 107 function marshall(self,prefix,md,fid) % {{{ 109 108 110 109 WriteData(fid,prefix,'object',self,'fieldname','planetradius','format','Double'); 111 110 WriteData(fid,prefix,'object',self,'fieldname','transitions','format','MatArray'); 112 111 113 112 if ~isempty(self.partitionice), 114 113 npartice=max(self.partitionice)+2; … … 127 126 end 128 127 129 130 131 128 WriteData(fid,prefix,'object',self,'fieldname','partitionice','mattype',1,'format','DoubleMat'); 132 129 WriteData(fid,prefix,'data',npartice,'format','Integer','name','md.solidearth.npartice'); … … 135 132 WriteData(fid,prefix,'object',self,'fieldname','partitionocean','mattype',1,'format','DoubleMat'); 136 133 WriteData(fid,prefix,'data',npartocean,'format','Integer','name','md.solidearth.npartocean'); 137 134 138 135 self.settings.marshall(prefix,md,fid); 139 136 self.lovenumbers.marshall(prefix,md,fid); … … 145 142 WriteData(fid,prefix,'data',0,'format','Integer','name','md.solidearth.isexternal'); 146 143 end 147 144 148 145 %process requested outputs 149 146 outputs = self.requested_outputs; 150 pos 147 pos = find(ismember(outputs,'default')); 151 148 if ~isempty(pos), 152 149 outputs(pos) = []; %remove 'default' from outputs … … 155 152 WriteData(fid,prefix,'data',outputs,'name','md.solidearth.requested_outputs','format','StringArray'); 156 153 154 end % }}} 155 function self = extrude(self,md) % {{{ 157 156 end % }}} 158 157 function savemodeljs(self,fid,modelname) % {{{ … … 168 167 writejscellarray(fid,[modelname '.solidearth.partition'],self.partition); 169 168 end % }}} 170 function self = extrude(self,md) % {{{171 end % }}}172 169 end 173 170 end -
issm/trunk-jpl/src/m/classes/solidearth.py
r25969 r26299 19 19 """ 20 20 21 def __init__(self, *args): #{{{ 22 self.initialsealevel = np.nan 21 def __init__(self, *args): #{{{ 23 22 self.settings = solidearthsettings() 24 23 self.external = [] 25 self.surfaceload = surfaceload()26 24 self.lovenumbers = lovenumbers() 27 25 self.rotational = rotational() … … 31 29 self.partitionice = [] 32 30 self.partitionhydro = [] 31 self.partitionocean = [] 33 32 34 33 nargs = len(args) 35 36 34 if nargs == 0: 37 35 self.setdefaultparameters('earth') … … 41 39 raise Exception('solidearth constructor error message: zero or one argument only!') 42 40 #}}} 43 def __repr__(self): #{{{41 def __repr__(self): #{{{ 44 42 s = ' solidearthinputs, forcings and settings:\n' 45 s += '{}\n'.format(fielddisplay(self, 'initialsealevel', 'sea level at the start of computation [m]'))46 43 s += '{}\n'.format(fielddisplay(self, 'planetradius', 'planet radius [m]')) 47 44 s += '{}\n'.format(fielddisplay(self, 'transitions', 'indices into parts of the mesh that will be icecaps')) … … 49 46 s += '{}\n'.format(fielddisplay(self, 'partitionice', 'ice partition vector for barystatic contribution')) 50 47 s += '{}\n'.format(fielddisplay(self, 'partitionhydro', 'hydro partition vector for barystatic contribution')) 48 s += '{}\n'.format(fielddisplay(self, 'partitionocean', 'ocean partition vector for barystatic contribution')) 51 49 if not self.external: 52 50 s += '{}\n'.format(fielddisplay(self, 'external', 'external solution, of the type solidearthsolution')) 53 51 print(self.settings) 54 print(self.surfaceload)55 52 print(self.lovenumbers) 56 53 print(self.rotational) … … 59 56 return s 60 57 #}}} 61 def setdefaultparameters(self, planet): #{{{62 # Default output58 def setdefaultparameters(self, planet): #{{{ 59 # Output default 63 60 self.requested_outputs = ['default'] 64 61 … … 69 66 self.partitionice = [] 70 67 self.partitionhydro = [] 68 self.partitionocean = [] 71 69 72 # No external solutions by defa lt70 # No external solutions by default 73 71 self.external = [] 74 72 … … 76 74 self.planetradius = planetradius(planet) 77 75 #}}} 78 def checkconsistency(self, md, solution, analyses): #{{{76 def checkconsistency(self, md, solution, analyses): #{{{ 79 77 if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc): 80 78 return md 81 md = checkfield(md, 'fieldname', 'solidearth.initialsealevel', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 79 82 80 md = checkfield(md, 'fieldname', 'solidearth.requested_outputs', 'stringrow', 1) 83 81 84 82 self.settings.checkconsistency(md, solution, analyses) 85 self.surfaceload.checkconsistency(md, solution, analyses)86 83 self.lovenumbers.checkconsistency(md, solution, analyses) 87 84 self.rotational.checkconsistency(md, solution, analyses) 88 85 if self.external: 89 if not isinstance(self.external, 'solidearthsolution'):86 if not isinstance(self.external, 'solidearthsolution'): 90 87 raise Exception('solidearth consistency check: external field should be a solidearthsolution') 91 88 end 92 self.external.checkconsistency(md, solution,analyses)89 self.external.checkconsistency(md, solution, analyses) 93 90 return md 94 91 #}}} 95 def defaultoutputs(self, md): 92 def defaultoutputs(self, md): #{{{ 96 93 return ['Sealevel'] 97 94 #}}} 98 def marshall(self, prefix, md, fid): #{{{ 99 WriteData(fid, prefix, 'object', self, 'fieldname', 'initialsealevel', 'mattype', 1, 'format', 'DoubleMat', 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) 95 def marshall(self, prefix, md, fid): #{{{ 100 96 WriteData(fid, prefix, 'object', self, 'fieldname', 'planetradius', 'format', 'Double') 101 97 WriteData(fid, prefix, 'object', self, 'fieldname', 'transitions', 'format', 'MatArray') … … 111 107 nparthydro = 0 112 108 109 if len(self.partitionocean): 110 npartocean = np.max(self.partitionocean) + 2 111 else: 112 npartocean = 0 113 113 114 WriteData(fid, prefix, 'object', self, 'fieldname', 'partitionice', 'mattype', 1, 'format', 'DoubleMat'); 114 115 WriteData(fid, prefix, 'data', npartice, 'format', 'Integer', 'name', 'md.solidearth.npartice'); 115 116 WriteData(fid, prefix, 'object', self, 'fieldname', 'partitionhydro', 'mattype', 1, 'format', 'DoubleMat'); 116 117 WriteData(fid, prefix, 'data', nparthydro,'format', 'Integer', 'name','md.solidearth.nparthydro'); 118 WriteData(fid, prefix, 'object', self, 'fieldname', 'partitionocean', 'mattype', 1, 'format', 'DoubleMat'); 119 WriteData(fid, prefix, 'data', npartocean,'format', 'Integer', 'name','md.solidearth.npartocean'); 117 120 118 121 self.settings.marshall(prefix, md, fid) 119 self.surfaceload.marshall(prefix, md, fid)120 122 self.lovenumbers.marshall(prefix, md, fid) 121 123 self.rotational.marshall(prefix, md, fid) 122 124 if self.external: 125 WriteData(fid, prefix, 'data', 1, 'format', 'Integer', 'name', 'md.solidearth.isexternal') 123 126 self.external.marshall(prefix, md, fid) 127 else: 128 WriteData(fid, prefix, 'data', 0, 'format', 'Integer', 'name', 'md.solidearth.isexternal') 124 129 125 130 #process requested outputs … … 127 132 pos = np.where(np.asarray(outputs) == 'default')[0] 128 133 if len(pos): 129 outputs = np.delete(outputs, pos) # remove 'default' from outputs130 outputs = np.append(outputs, self.defaultoutputs(md)) #add defaults134 outputs = np.delete(outputs, pos) # remove 'default' from outputs 135 outputs = np.append(outputs, self.defaultoutputs(md)) # add defaults 131 136 WriteData(fid, prefix, 'data', outputs, 'name', 'md.solidearth.requested_outputs', 'format', 'StringArray') 132 137 #}}} 133 138 def extrude(self, md): #{{{ 134 self.initialsealevel = project3d(md, 'vector', self.initialsealevel, 'type', 'node')135 139 return self 136 140 #}}} -
issm/trunk-jpl/src/m/classes/solidearthsettings.m
r26296 r26299 5 5 6 6 classdef solidearthsettings 7 properties (SetAccess=public) 7 properties (SetAccess=public) 8 8 reltol = 0; 9 9 abstol = 0; … … 13 13 viscous = 1; 14 14 rotation = 1; 15 grdocean 15 grdocean = 1; 16 16 ocean_area_scaling = 0; 17 17 runfrequency = 1; %how many time steps we skip before we run grd_core … … 20 20 compute_bp_grd = 0; %will GRD patterns for bottom pressures be computed? 21 21 degacc = 0; %degree increment for resolution of Green tables. 22 timeacc = 0; %time step accura ry required to compute Green tables22 timeacc = 0; %time step accuracy required to compute Green tables 23 23 horiz = 0; %compute horizontal deformation 24 grdmodel = 0; %grd model (0 by default, 1 for (visco )-elastic, 2 for Ivins)24 grdmodel = 0; %grd model (0 by default, 1 for (visco-)elastic, 2 for Ivins) 25 25 cross_section_shape = 0; %cross section only used when grd model is Ivins 26 26 end … … 81 81 %how many time steps we skip before we run solidearthsettings solver during transient 82 82 self.runfrequency=1; 83 84 %horizontal displacement? (notby default)83 84 %horizontal displacement? (not on by default) 85 85 self.horiz=0; 86 87 %cross section for Ivins model 86 87 %cross section for Ivins model 88 88 self.cross_section_shape=1; %square as default (see iedge in GiaDeflectionCorex) 89 89 … … 106 106 md = checkfield(md,'fieldname','solidearth.settings.grdmodel','>=',0,'<=',2); 107 107 md = checkfield(md,'fieldname','solidearth.settings.cross_section_shape','numel',[1],'values',[1,2]); 108 108 109 if self.elastic==1 & self.selfattraction==0, 109 110 error('solidearthsettings checkconsistency error message: need selfattraction on if elastic flag is set'); … … 137 138 disp(sprintf(' solidearth settings:')); 138 139 139 fielddisplay(self,'reltol','sea level change relative convergence criterion ,(default, NaN: not applied)');140 fielddisplay(self,'abstol','sea level change absolute convergence criterion , NaN: not applied');140 fielddisplay(self,'reltol','sea level change relative convergence criterion (default, NaN: not applied)'); 141 fielddisplay(self,'abstol','sea level change absolute convergence criterion(default, NaN: not applied)'); 141 142 fielddisplay(self,'maxiter','maximum number of nonlinear iterations'); 142 fielddisplay(self,'grdocean','does this planet have an ocean, if set to 1: global water mass is conserved in GRD module [default: 1]');143 fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area [default: No correction]');144 fielddisplay(self,'sealevelloading','enables surface loading from sea-level change (default 1)');145 fielddisplay(self,'isgrd','compute GRD patterns (default 1)');146 fielddisplay(self,'compute_bp_grd','compute GRD patterns for bottom pressure loads (default 1)');143 fielddisplay(self,'grdocean','does this planet have an ocean, if set to 1: global water mass is conserved in GRD module (default: 1)'); 144 fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area (default: No correction)'); 145 fielddisplay(self,'sealevelloading','enables surface loading from sea-level change (default: 1)'); 146 fielddisplay(self,'isgrd','compute GRD patterns (default: 1)'); 147 fielddisplay(self,'compute_bp_grd','compute GRD patterns for bottom pressure loads (default: 1)'); 147 148 fielddisplay(self,'runfrequency','how many time steps we skip before we run solidearthsettings solver during transient (default: 1)'); 148 149 fielddisplay(self,'selfattraction','enables surface mass load to perturb the gravity field'); … … 150 151 fielddisplay(self,'viscous','enables viscous deformation from surface loading'); 151 152 fielddisplay(self,'rotation','enables polar motion to feedback on the GRD fields'); 152 fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions');153 fielddisplay(self,'timeacc','time accuracy (default 1 yr) for numerical discretization of the Green''s functions');153 fielddisplay(self,'degacc','accuracy (default: .01 deg) for numerical discretization of the Green''s functions'); 154 fielddisplay(self,'timeacc','time accuracy (default: 1 yr) for numerical discretization of the Green''s functions'); 154 155 fielddisplay(self,'grdmodel','type of deformation model, 0 for no GRD, 1 for spherical GRD model (SESAW model), 2 for half-space planar GRD (visco-elastic model from Ivins)'); 155 156 fielddisplay(self,'cross_section_shape','1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore'); … … 175 176 WriteData(fid,prefix,'object',self,'fieldname','cross_section_shape','name','md.solidearth.settings.cross_section_shape','format','Integer'); 176 177 end % }}} 178 function self = extrude(self,md) % {{{ 179 end % }}} 177 180 function savemodeljs(self,fid,modelname) % {{{ 178 181 … … 191 194 writejsdouble(fid,[modelname '.solidearth.settings.cross_section_shape'],self.cross_section_shape); 192 195 end % }}} 193 function self = extrude(self,md) % {{{194 end % }}}195 196 end 196 197 end -
issm/trunk-jpl/src/m/classes/solidearthsettings.py
r26178 r26299 13 13 """ 14 14 15 def __init__(self, *args): 15 def __init__(self, *args): #{{{ 16 16 self.reltol = 0 17 17 self.abstol = 0 18 18 self.maxiter = 0 19 self.rigid = 0 20 self.elastic = 0 21 self.rotation = 0 19 self.selfattraction = 1 20 self.elastic = 1 21 self.viscous = 1 22 self.rotation = 1 23 self.grdocean = 1 22 24 self.ocean_area_scaling = 0 23 25 self.runfrequency = 1 # How many time steps we skip before we run grd_core 24 self. computesealevelchange = 1 # Will grd_core compute sea level?25 self.isgrd = 1# Will GRD patterns be computed?26 self.compute_bp_grd = 1# Will GRD patterns for bottom pressures be computed?26 self.sealevelloading = 1 # Will sea-level loads be computed? 27 self.isgrd = 0 # Will GRD patterns be computed? 28 self.compute_bp_grd = 0 # Will GRD patterns for bottom pressures be computed? 27 29 self.degacc = 0 # Degree increment for resolution of Green tables 28 self. horiz = 0 # Compute horizontal displacement?29 self. glfraction = 1 # Barystatic contribution: full or fractional (default: fractional)30 self.grdmodel = 0 # GRD model (0 by default, 1 for elastic, 2 for Ivins)30 self.timeacc = 0 # Time step accuracy required to compute Green tables 31 self.horiz = 0 # Compute horizontal deformation? 32 self.grdmodel = 0 # GRD model (0 by default, 1 for (visco-)elastic, 2 for Ivins) 31 33 self.cross_section_shape = 0 # Cross section only used when GRD model is Ivins 32 34 33 nargin = len(args) 34 35 if nargin == 0: 35 if len(args) == 0: 36 36 self.setdefaultparameters() 37 37 else: … … 39 39 #}}} 40 40 41 def __repr__(self): #{{{41 def __repr__(self): #{{{ 42 42 s = ' solidearth settings:\n' 43 s += '{}\n'.format(fielddisplay(self, 'reltol', 'sea level rise relative convergence criterion,(default, NaN: not applied)'))44 s += '{}\n'.format(fielddisplay(self, 'abstol', 'sea level rise absolute convergence criterion, NaN: not applied'))43 s += '{}\n'.format(fielddisplay(self, 'reltol', 'sea level change relative convergence criterion (default, NaN: not applied)')) 44 s += '{}\n'.format(fielddisplay(self, 'abstol', 'sea level change absolute convergence criterion (default, NaN: not applied)')) 45 45 s += '{}\n'.format(fielddisplay(self, 'maxiter', 'maximum number of nonlinear iterations')) 46 s += '{}\n'.format(fielddisplay(self, 'ocean_area_scaling', 'correction for model representation of ocean area [default: No correction]')) 47 s += '{}\n'.format(fielddisplay(self, 'computesealevelchange', 'compute sealevel change from GRD in addition to steric?) default 0')) 46 s += '{}\n'.format(fielddisplay(self, 'grdocean', 'does this planet have an ocean, if set to 1: global water mass is conserved in GRD module (default: 1)')) 47 s += '{}\n'.format(fielddisplay(self, 'ocean_area_scaling', 'correction for model representation of ocean area (default: No correction)')) 48 s += '{}\n'.format(fielddisplay(self, 'sealevelloading', 'enables surface loading from sea-level change (default: 1)')) 48 49 s += '{}\n'.format(fielddisplay(self, 'isgrd', 'compute GRD patterns (default: 1')) 49 50 s += '{}\n'.format(fielddisplay(self, 'compute_bp_grd', 'compute GRD patterns for bottom pressure loads (default 1)')) 50 51 s += '{}\n'.format(fielddisplay(self, 'runfrequency', 'how many time steps we skip before we run solidearthsettings solver during transient (default: 1)')) 51 s += '{}\n'.format(fielddisplay(self, 'rigid', 'rigid earth graviational potential perturbation')) 52 s += '{}\n'.format(fielddisplay(self, 'elastic', 'elastic earth graviational potential perturbation')) 53 s += '{}\n'.format(fielddisplay(self, 'degacc', 'accuracy (default .01 deg) for numerical discretization of the Green\'s functions')) 54 s += '{}\n'.format(fielddisplay(self, 'glfraction', 'contribute fractionally (default, 1) to barystatic sea level')) 55 s += '{}\n'.format(fielddisplay(self, 'grdmodel', 'type of deformation model, 1 for elastic, 2 for visco-elastic from Ivins')) 52 s += '{}\n'.format(fielddisplay(self, 'selfattraction', 'enables surface mass load to perturb the gravity field')) 53 s += '{}\n'.format(fielddisplay(self, 'elastic', 'enables elastic deformation from surface loading')) 54 s += '{}\n'.format(fielddisplay(self, 'viscous', 'enables viscous deformation from surface loading')) 55 s += '{}\n'.format(fielddisplay(self, 'rotation', 'enables polar motion to feedback on the GRD fields')) 56 s += '{}\n'.format(fielddisplay(self, 'degacc', 'accuracy (default: .01 deg) for numerical discretization of the Green\'s functions')) 57 s += '{}\n'.format(fielddisplay(self, 'timeacc', 'time accuracy (default: 1 year) for numerical discretization of the Green\'s functions')) 58 s += '{}\n'.format(fielddisplay(self, 'grdmodel', 'type of deformation model, 0 for no GRD, 1 for spherical GRD model (SESAW model), 2 for half-space planar GRD (visco-elastic model from Ivins)')) 56 59 s += '{}\n'.format(fielddisplay(self, 'cross_section_shape', '1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore')) 57 60 return s 58 61 #}}} 59 62 60 def setdefaultparameters(self): #{{{63 def setdefaultparameters(self): #{{{ 61 64 # Convergence criterion: absolute, relative, and residual 62 65 self.reltol = 0.01 # 1 percent … … 67 70 68 71 # Computational flags 69 self. rigid= 172 self.selfattraction = 1 70 73 self.elastic = 1 74 self.viscous = 1 71 75 self.rotation = 1 76 self.grdocean = 1 72 77 self.ocean_area_scaling = 0 73 self.compute_bp_grd = 178 self.compute_bp_grd = 0 74 79 self.isgrd = 0 75 self. computesealevelchange= 180 self.sealevelloading = 1 76 81 77 82 # Numerical discretization accuracy 78 83 self.degacc = .01 84 self.timeacc = 1 79 85 80 86 # How many time steps we skip before we run solidearthsettings solver during transient 81 87 self.runfrequency = 1 82 83 # Fractional contribution84 self.glfraction = 185 88 86 89 # Horizontal displacement? (not on by default) … … 88 91 89 92 # Cross section for Ivins model 90 self.cross_section_shape = 1 # Square as default (see ied de in GiaDeflectionCorex)93 self.cross_section_shape = 1 # Square as default (see iedge in GiaDeflectionCorex) 91 94 92 95 # No GRD model by default … … 94 97 #}}} 95 98 96 def checkconsistency(self, md, solution, analyses): #{{{99 def checkconsistency(self, md, solution, analyses): #{{{ 97 100 if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc): 98 101 return md 102 99 103 md = checkfield(md, 'fieldname', 'solidearth.settings.reltol', 'size', [1]) 100 104 md = checkfield(md, 'fieldname', 'solidearth.settings.abstol', 'size', [1]) … … 102 106 md = checkfield(md, 'fieldname', 'solidearth.settings.runfrequency', 'size', [1], '>=', 1) 103 107 md = checkfield(md, 'fieldname', 'solidearth.settings.degacc', 'size', [1], '>=', 1e-10) 108 md = checkfield(md, 'fieldname', 'solidearth.settings.timeacc', 'size', [1], '>', 0) 104 109 md = checkfield(md, 'fieldname', 'solidearth.settings.horiz', 'NaN', 1, 'Inf', 1, 'values', [0, 1]) 105 md = checkfield(md, 'fieldname', 'solidearth.settings.glfraction', 'values', [0, 1]) 106 md = checkfield(md, 'fieldname', 'solidearth.settings.grdmodel', 'values', [1, 2]) 110 md = checkfield(md, 'fieldname', 'solidearth.settings.grdmodel', '>=', 0, '<=', 2) 107 111 md = checkfield(md, 'fieldname', 'solidearth.settings.cross_section_shape', 'numel', [1], 'values', [1, 2]) 108 112 109 # Checks on computational flags 110 if self.elastic and not self.rigid: 111 raise Exception('solidearthsettings checkconsistency error message: need rigid on if elastic flag is set') 113 if self.elastic and not self.selfattraction: 114 raise Exception('solidearthsettings checkconsistency error message: need selfattraction on if elastic flag is set') 115 if self.viscous and not self.elastic: 116 raise Exception('solidearthsettings checkconsistency error message: need elastic on if viscous flag is set') 112 117 113 118 # A GRD computation has been requested, make some checks on the nature of the meshes provided … … 119 124 if self.grdmodel == 1: 120 125 raise RuntimeException('model requires a 3D surface mesh to run GRD computations (change mesh from mesh2d to mesh3dsurface)') 126 if self.sealevelloading and not self.grdocean: 127 raise RuntimeException('solidearthsettings checkconsistency error message: need grdocean on if sealevelloading flag is set') 121 128 122 129 if self.compute_bp_grd and not md.solidearth.settings.isgrd: … … 126 133 #}}} 127 134 128 def marshall(self, prefix, md, fid): 135 def marshall(self, prefix, md, fid): #{{{ 129 136 WriteData(fid, prefix, 'object', self, 'fieldname', 'reltol', 'name', 'md.solidearth.settings.reltol', 'format', 'Double') 130 137 WriteData(fid, prefix, 'object', self, 'fieldname', 'abstol', 'name', 'md.solidearth.settings.abstol', 'format', 'Double') 131 138 WriteData(fid, prefix, 'object', self, 'fieldname', 'maxiter', 'name', 'md.solidearth.settings.maxiter', 'format', 'Integer') 132 WriteData(fid, prefix, 'object', self, 'fieldname', ' rigid', 'name', 'md.solidearth.settings.rigid', 'format', 'Boolean')139 WriteData(fid, prefix, 'object', self, 'fieldname', 'selfattraction', 'name', 'md.solidearth.settings.selfattraction', 'format', 'Boolean') 133 140 WriteData(fid, prefix, 'object', self, 'fieldname', 'elastic', 'name', 'md.solidearth.settings.elastic', 'format', 'Boolean') 141 WriteData(fid, prefix, 'object', self, 'fieldname', 'viscous', 'name', 'md.solidearth.settings.viscous', 'format', 'Boolean') 134 142 WriteData(fid, prefix, 'object', self, 'fieldname', 'rotation', 'name', 'md.solidearth.settings.rotation', 'format', 'Boolean') 135 WriteData(fid, prefix, 'object', self, 'fieldname', 'ocean_area_scaling', 'name', 'md.solidearth.settings.ocean_area_scaling', 'format', 'Boolean') 143 WriteData(fid, prefix, 'object', self, 'fieldname', 'grdocean', 'name', 'md.solidearth.settings.grdocean', 'format', 'Boolean') 144 WriteData(fid, prefix, 'object', self, 'fieldname', 'ocean_area_scaling', 'name', 'md.solidearth.settings.ocean_area_scaling', 'format', 'Integer') 136 145 WriteData(fid, prefix, 'object', self, 'fieldname', 'runfrequency', 'name', 'md.solidearth.settings.runfrequency', 'format', 'Integer') 137 146 WriteData(fid, prefix, 'object', self, 'fieldname', 'degacc', 'name', 'md.solidearth.settings.degacc', 'format', 'Double') 147 WriteData(fid, prefix, 'object', self, 'fieldname', 'timeacc', 'name', 'md.solidearth.settings.timeacc', 'format', 'Double', 'scale', md.constants.yts) 138 148 WriteData(fid, prefix, 'object', self, 'fieldname', 'horiz', 'name', 'md.solidearth.settings.horiz', 'format', 'Integer') 139 WriteData(fid, prefix, 'object', self, 'fieldname', ' computesealevelchange', 'name', 'md.solidearth.settings.computesealevelchange', 'format', 'Integer')149 WriteData(fid, prefix, 'object', self, 'fieldname', 'sealevelloading', 'name', 'md.solidearth.settings.sealevelloading', 'format', 'Integer') 140 150 WriteData(fid, prefix, 'object', self, 'fieldname','isgrd', 'name', 'md.solidearth.settings.isgrd', 'format', 'Integer') 141 151 WriteData(fid, prefix, 'object', self, 'fieldname', 'compute_bp_grd', 'name', 'md.solidearth.settings.compute_bp_grd', 'format', 'Integer') 142 WriteData(fid, prefix, 'object', self, 'fieldname','glfraction', 'name', 'md.solidearth.settings.glfraction', 'format', 'Integer')143 152 WriteData(fid, prefix, 'object', self, 'fieldname', 'grdmodel', 'name', 'md.solidearth.settings.grdmodel', 'format', 'Integer') 144 153 WriteData(fid, prefix, 'object', self, 'fieldname', 'cross_section_shape', 'name', 'md.solidearth.settings.cross_section_shape', 'format', 'Integer') 145 154 #}}} 146 155 147 def extrude(self, md): 156 def extrude(self, md): #{{{ 148 157 return self 149 158 #}}} -
issm/trunk-jpl/test/NightlyRun/test2001.m
r26296 r26299 1 1 %Test Name: SquareSheetConstrainedGia2d 2 %GIA test, inspired ontest101. Running default GIA Ivins class.2 %GIA test, based off of test101. Running default GIA Ivins class. 3 3 md=triangle(model(),'../Exp/Square.exp',100000.); 4 4 md=setmask(md,'',''); -
issm/trunk-jpl/test/NightlyRun/test2001.py
r26059 r26299 1 1 #Test Name: SquareSheetConstrainedGia2d 2 #GIA test, based off of test101. Running default GIA Ivins class. 2 3 from socket import gethostname 3 4 … … 19 20 # GIA Ivins, 2 layer model 20 21 md.solidearth.settings.grdmodel = 2 22 md.solidearth.settings.isgrd = 1 21 23 22 24 md.materials = materials('litho','ice') … … 28 30 md.initialization.sealevel = np.zeros(md.mesh.numberofvertices) 29 31 md.solidearth.settings.cross_section_shape = 1 # for square-edged x-section 30 md.solidearth.settings.computesealevelchange = 0 # do not compute sea level, only deformation 31 md.solidearth.requested_outputs = ['Sealevel', 'SealevelUGrd'] 32 md.solidearth.settings.grdocean = 0 # do not compute sea level, only deformation 33 md.solidearth.settings.sealevelloading = 0 # do not compute sea level, only deformation 34 md.solidearth.requested_outputs = ['Sealevel', 'BedGRD'] 32 35 33 36 # Loading history … … 36 39 # To get rid of default final_time, make sure final_time > start_time 37 40 md.timestepping.final_time = 2400000 # 2,400 kyr 38 md.masstransport.spcthickness np.array([41 md.masstransport.spcthickness = np.array([ 39 42 np.append(md.geometry.thickness, 0), 40 43 np.append(md.geometry.thickness, 2400000) … … 50 53 md.transient.isstressbalance = 0 51 54 md.transient.isthermal = 0 52 md.transient.ismasstransport = 053 md.transient.isslc = 055 md.transient.ismasstransport = 1 56 md.transient.isslc = 1 54 57 55 58 #Solve for GIA deflection 56 md.cluster = generic('name', gethostname(), 'np', 1)57 59 md.cluster = generic('name', gethostname(), 'np', 3) 58 60 md.verbose = verbose('11111111111') … … 63 65 field_names = ['UGrd'] 64 66 field_tolerances = [1e-13] 65 field_values = [md.results.TransientSolution[ 0].SealevelUGrd]67 field_values = [md.results.TransientSolution[1].BedGRD]
Note:
See TracChangeset
for help on using the changeset viewer.