Ignore:
Timestamp:
11/16/20 19:47:06 (4 years ago)
Author:
jdquinn
Message:

CHG: MATLAB -> Python

File:
1 edited

Legend:

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

    r25758 r25764  
    2020
    2121    def __init__(self, *args):  #{{{
    22         self.sealevel           = np.nan
     22        self.initialsealevel    = np.nan
    2323        self.settings           = solidearthsettings()
     24        self.external           = []
    2425        self.surfaceload        = surfaceload()
    2526        self.lovenumbers        = lovenumbers()
     
    4142    def __repr__(self):  # {{{
    4243        s = '   solidearthinputs, forcings and settings:\n'
    43         s += '{}\n'.format(fielddisplay(self, 'sealevel', 'current sea level (prior to computation) [m]'))
     44        s += '{}\n'.format(fielddisplay(self, 'initialsealevel', 'sea level at the start of computation [m]'))
    4445        s += '{}\n'.format(fielddisplay(self, 'planetradius', 'planet radius [m]'))
    4546        s += '{}\n'.format(fielddisplay(self, 'transitions', 'indices into parts of the mesh that will be icecaps'))
    4647        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    47         s += '{}\n'.format(self.settings)
    48         s += '{}\n'.format(self.surfaceload)
    49         s += '{}\n'.format(self.lovenumbers)
    50         s += '{}\n'.format(self.rotational)
     48        s += '{}\n'.format(fielddisplay(self, 'partitionice', 'ice partition vector for barystatic contribution'))
     49        s += '{}\n'.format(fielddisplay(self, 'partitionhydro', 'hydro partition vector for barystatic contribution'))
     50        if not self.external:
     51            s += '{}\n'.format(fielddisplay(self, 'external', 'external solution, of the type solidearthsolution'))
     52        print(self.settings)
     53        print(self.surfaceload)
     54        print(self.lovenumbers)
     55        print(self.rotational)
     56        if self.external:
     57            print(self.external)
    5158        return s
    5259    #}}}
     
    6370        self.partitionhydro = []
    6471
     72        # No external solutions by defalt
     73        self.external = []
     74
    6575        # Earth radius
    6676        self.planetradius = planetradius('earth')
     
    7080        if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslr):
    7181            return md
    72         md = checkfield(md, 'fieldname', 'solidearth.sealevel', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
     82        md = checkfield(md, 'fieldname', 'solidearth.initialsealevel', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
    7383        md = checkfield(md, 'fieldname', 'solidearth.requested_outputs', 'stringrow', 1)
    7484
     
    7787        self.lovenumbers.checkconsistency(md, solution, analyses)
    7888        self.rotational.checkconsistency(md, solution, analyses)
     89        if self.external:
     90            if not isinstance(self.external,'solidearthsolution'):
     91                raise Exception('solidearth consistency check: external field should be a solidearthsolution')
     92            end
     93            self.external.checkconsistency(md,solution,analyses)
    7994        return md
    8095    #}}}
     
    85100
    86101    def marshall(self, prefix, md, fid):  #{{{
    87         WriteData(fid, prefix, 'object', self, 'fieldname', 'sealevel', 'mattype', 1, 'format', 'DoubleMat', 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
     102        WriteData(fid, prefix, 'object', self, 'fieldname', 'initialsealevel', 'mattype', 1, 'format', 'DoubleMat', 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
    88103        WriteData(fid, prefix, 'object', self, 'fieldname', 'planetradius', 'format', 'Double')
    89104        WriteData(fid, prefix, 'object', self, 'fieldname', 'transitions', 'format', 'MatArray')
     
    108123        self.lovenumbers.marshall(prefix, md, fid)
    109124        self.rotational.marshall(prefix, md, fid)
     125        if self.external:
     126            self.external.marshall(prefix, md, fid)
    110127
    111128        #process requested outputs
     
    119136
    120137    def extrude(self, md): #{{{
    121         self.sealevel = project3d(md, 'vector', self.sealevel, 'type', 'node')
     138        self.initialsealevel = project3d(md, 'vector', self.initialsealevel, 'type', 'node')
    122139        return self
    123140    #}}}
Note: See TracChangeset for help on using the changeset viewer.