Changeset 27175


Ignore:
Timestamp:
08/02/22 02:45:55 (3 years ago)
Author:
bdef
Message:

BUG:some hydro related fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/initialization.py

    r26358 r27175  
    1414    """
    1515
    16     def __init__(self): #{{{
     16    def __init__(self):  #{{{
    1717        self.vx = np.nan
    1818        self.vy = np.nan
     
    3737        self.setdefaultparameters()
    3838    #}}}
    39     def __repr__(self): #{{{
     39
     40    def __repr__(self):  #{{{
    4041        s = '   initial field values:\n'
    4142        s += '{}\n'.format(fielddisplay(self, 'vx', 'x component of velocity [m/yr]'))
     
    5354        s += '{}\n'.format(fielddisplay(self, 'hydraulic_potential', 'Hydraulic potential (for GlaDS) [Pa]'))
    5455        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'))
    5657        return s
    5758    #}}}
    58     def setdefaultparameters(self): #{{{
     59
     60    def setdefaultparameters(self):  #{{{
    5961        return
    6062    #}}}
    61     def checkconsistency(self, md, solution, analyses): #{{{
     63
     64    def checkconsistency(self, md, solution, analyses):  #{{{
    6265        if 'StressbalanceAnalysis' in analyses and not solution == 'TransientSolution' and not md.transient.isstressbalance:
    6366            if not np.any(np.logical_or(np.isnan(md.initialization.vx), np.isnan(md.initialization.vy))):
     
    9396                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')
    9497        if 'HydrologyShreveAnalysis' in analyses:
    95             if hasattr(md.hydrology, 'hydrologyshreve'):
     98            if type(md.hydrology).__name__ == 'hydrologyshreve':
    9699                if (solution == 'TransientSolution' and md.transient.ishydrology) or solution == 'HydrologySolution':
    97100                    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])
    98105        if 'HydrologyTwsAnalysis' in analyses:
    99             if hasattr(md.hydrology, 'hydrologytws'):
     106            if type(md.hydrology).__name__ == 'hydrologytws':
    100107                md = checkfield(md, 'fieldname', 'initialization.watercolumn', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
    101108        if 'SealevelchangeAnalysis' in analyses:
     
    103110                md = checkfield(md, 'fieldname', 'initialization.sealevel', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
    104111        if 'HydrologyGlaDSAnalysis' in analyses:
    105             if hasattr(md.hydrology, 'hydrologyglads'):
     112            if type(md.hydrology).__name__ == 'hydrologyglads':
    106113                md = checkfield(md, 'fieldname', 'initialization.watercolumn', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
    107114                md = checkfield(md, 'fieldname', 'initialization.hydraulic_potential', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
     
    112119        return md
    113120    #}}}
     121
    114122    def marshall(self, prefix, md, fid): #{{{
    115123        yts = md.constants.yts
     
    119127        WriteData(fid, prefix, 'object', self, 'fieldname', 'vz', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts)
    120128        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)
    122130        WriteData(fid, prefix, 'object', self, 'fieldname', 'bottompressure', 'format', 'DoubleMat', 'mattype', 1)
    123131        WriteData(fid, prefix, 'object', self, 'fieldname', 'str', 'format', 'DoubleMat', 'mattype', 1)
     
    143151            WriteData(fid, prefix, 'data', self.enthalpy, 'format', 'DoubleMat', 'mattype', 1, 'name', 'md.initialization.enthalpy')
    144152    #}}}
     153
    145154    def extrude(self, md): #{{{
    146155        self.vx = project3d(md, 'vector', self.vx, 'type', 'node')
Note: See TracChangeset for help on using the changeset viewer.