Changeset 27175
- Timestamp:
- 08/02/22 02:45:55 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/initialization.py
r26358 r27175 14 14 """ 15 15 16 def __init__(self): #{{{16 def __init__(self): #{{{ 17 17 self.vx = np.nan 18 18 self.vy = np.nan … … 37 37 self.setdefaultparameters() 38 38 #}}} 39 def __repr__(self): #{{{ 39 40 def __repr__(self): #{{{ 40 41 s = ' initial field values:\n' 41 42 s += '{}\n'.format(fielddisplay(self, 'vx', 'x component of velocity [m/yr]')) … … 53 54 s += '{}\n'.format(fielddisplay(self, 'hydraulic_potential', 'Hydraulic potential (for GlaDS) [Pa]')) 54 55 s += '{}\n'.format(fielddisplay(self, 'channelarea', 'subglaciale water channel area (for GlaDS) [m2]')) 55 s += '{}\n'.format(fielddisplay(self, 'sample', 'Realization of a Gaussian random field'))56 s += '{}\n'.format(fielddisplay(self, 'sample', 'Realization of a Gaussian random field')) 56 57 return s 57 58 #}}} 58 def setdefaultparameters(self): #{{{ 59 60 def setdefaultparameters(self): #{{{ 59 61 return 60 62 #}}} 61 def checkconsistency(self, md, solution, analyses): #{{{ 63 64 def checkconsistency(self, md, solution, analyses): #{{{ 62 65 if 'StressbalanceAnalysis' in analyses and not solution == 'TransientSolution' and not md.transient.isstressbalance: 63 66 if not np.any(np.logical_or(np.isnan(md.initialization.vx), np.isnan(md.initialization.vy))): … … 93 96 md = checkfield(md, 'fieldname', 'delta Tpmp', 'field', np.absolute(md.initialization.temperature[pos] - (md.materials.meltingpoint - md.materials.beta * md.initialization.pressure[pos])), '<', 1e-11, 'message', 'set temperature to pressure melting point at locations with waterfraction > 0') 94 97 if 'HydrologyShreveAnalysis' in analyses: 95 if hasattr(md.hydrology, 'hydrologyshreve'):98 if type(md.hydrology).__name__ == 'hydrologyshreve': 96 99 if (solution == 'TransientSolution' and md.transient.ishydrology) or solution == 'HydrologySolution': 97 100 md = checkfield(md, 'fieldname', 'initialization.watercolumn', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 101 if 'HydrologyDCAnalysis' in analyses: 102 if type(md.hydrology).__name__ == 'hydrologydc': 103 if (solution == 'TransientSolution' and md.transient.ishydrology) or solution == 'HydrologySolution': 104 md = checkfield(md, 'fieldname', 'initialization.sediment_head', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 98 105 if 'HydrologyTwsAnalysis' in analyses: 99 if hasattr(md.hydrology, 'hydrologytws'):106 if type(md.hydrology).__name__ == 'hydrologytws': 100 107 md = checkfield(md, 'fieldname', 'initialization.watercolumn', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 101 108 if 'SealevelchangeAnalysis' in analyses: … … 103 110 md = checkfield(md, 'fieldname', 'initialization.sealevel', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 104 111 if 'HydrologyGlaDSAnalysis' in analyses: 105 if hasattr(md.hydrology, 'hydrologyglads'):112 if type(md.hydrology).__name__ == 'hydrologyglads': 106 113 md = checkfield(md, 'fieldname', 'initialization.watercolumn', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 107 114 md = checkfield(md, 'fieldname', 'initialization.hydraulic_potential', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) … … 112 119 return md 113 120 #}}} 121 114 122 def marshall(self, prefix, md, fid): #{{{ 115 123 yts = md.constants.yts … … 119 127 WriteData(fid, prefix, 'object', self, 'fieldname', 'vz', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts) 120 128 WriteData(fid, prefix, 'object', self, 'fieldname', 'pressure', 'format', 'DoubleMat', 'mattype', 1) 121 WriteData(fid, prefix, 'object', self, 'fieldname', 'sealevel', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)129 WriteData(fid, prefix, 'object', self, 'fieldname', 'sealevel', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 122 130 WriteData(fid, prefix, 'object', self, 'fieldname', 'bottompressure', 'format', 'DoubleMat', 'mattype', 1) 123 131 WriteData(fid, prefix, 'object', self, 'fieldname', 'str', 'format', 'DoubleMat', 'mattype', 1) … … 143 151 WriteData(fid, prefix, 'data', self.enthalpy, 'format', 'DoubleMat', 'mattype', 1, 'name', 'md.initialization.enthalpy') 144 152 #}}} 153 145 154 def extrude(self, md): #{{{ 146 155 self.vx = project3d(md, 'vector', self.vx, 'type', 'node')
Note:
See TracChangeset
for help on using the changeset viewer.