Ignore:
Timestamp:
10/17/19 06:03:43 (5 years ago)
Author:
bdef
Message:

Adding a substeping framework in hydro and part of smb

File:
1 edited

Legend:

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

    r24213 r24240  
    3434        self.precipitations_presentday = float('NaN')
    3535        self.precipitations_lgm = float('NaN')
     36        self.steps_per_step = 1
    3637
    3738    #set defaults
     
    4849        string = "%s\n%s" % (string, fielddisplay(self, 's0p', 'should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]'))
    4950        string = "%s\n%s" % (string, fielddisplay(self, 's0t', 'should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]'))
    50         string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree / km]'))
    51         string = "%s\n%s" % (string, fielddisplay(self, 'rlapslgm', 'LGM lapse rate [degree / km]'))
     51        string = "%s\n%s" % (string, fielddisplay(self, 'rlaps', 'present day lapse rate [degree/km]'))
     52        string = "%s\n%s" % (string, fielddisplay(self, 'rlapslgm', 'LGM lapse rate [degree/km]'))
    5253        if not (self.isdelta18o and self.ismungsm):
    53             string = "%s\n%s" % (string, fielddisplay(self, 'monthlytemperatures', ['monthly surface temperatures [K], required if pdd is activated and delta18o not activated']))
    54             string = "%s\n%s" % (string, fielddisplay(self, 'precipitation', ['monthly surface precipitation [m / yr water eq], required if pdd is activated and delta18o or mungsm not activated']))
     54            string = "%s\n%s" % (string, fielddisplay(self, 'monthlytemperatures', 'monthly surface temperatures [K], required if pdd is activated and delta18o not activated'))
     55            string = "%s\n%s" % (string, fielddisplay(self, 'precipitation', 'monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o or mungsm not activated'))
    5556            if self.isdelta18o:
    5657                string = "%s\n%s" % (string, fielddisplay(self, 'delta18o', 'delta18o [per mil], required if pdd is activated and delta18o activated'))
    5758                string = "%s\n%s" % (string, fielddisplay(self, 'delta18o_surface', 'surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
    58                 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o / mungsm is activated'))
     59                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))
    5960                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_lgm', 'monthly LGM surface temperatures [K], required if delta18o or mungsm is activated'))
    60                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
    61                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
     61                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
     62                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
    6263                string = "%s\n%s" % (string, fielddisplay(self, 'Tdiff', 'time interpolation parameter for temperature, 1D(year), required if mungsm is activated'))
    6364                string = "%s\n%s" % (string, fielddisplay(self, 'sealev', 'sea level [m], 1D(year), required if mungsm is activated'))
     65
    6466            if self.ismungsm:
    65                 string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o / mungsm is activated'))
     67                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_presentday', 'monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))
    6668                string = "%s\n%s" % (string, fielddisplay(self, 'temperatures_lgm', 'monthly LGM surface temperatures [K], required if delta18o or mungsm is activated'))
    67                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
    68                 string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m / yr water eq], required if delta18o or mungsm is activated'))
     69                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_presentday', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
     70                string = "%s\n%s" % (string, fielddisplay(self, 'precipitations_lgm', 'monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
    6971                string = "%s\n%s" % (string, fielddisplay(self, 'Pfac', 'time interpolation parameter for precipitation, 1D(year), required if mungsm is activated'))
    7072                string = "%s\n%s" % (string, fielddisplay(self, 'Tdiff', 'time interpolation parameter for temperature, 1D(year), required if mungsm is activated'))
    7173                string = "%s\n%s" % (string, fielddisplay(self, 'sealev', 'sea level [m], 1D(year), required if mungsm is activated'))
     74
     75        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
    7276        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
    7377
     
    7983            self.precipitation = project3d(md, 'vector', self.precipitation, 'type', 'node')
    8084            self.monthlytemperatures = project3d(md, 'vector', self.monthlytemperatures, 'type', 'node')
     85
    8186        if self.isdelta18o:
    8287            self.temperatures_lgm = project3d(md, 'vector', self.temperatures_lgm, 'type', 'node')
    83         if self.isdelta18o:
    8488            self.temperatures_presentday = project3d(md, 'vector', self.temperatures_presentday, 'type', 'node')
    85         if self.isdelta18o:
    8689            self.precipitations_presentday = project3d(md, 'vector', self.precipitations_presentday, 'type', 'node')
    87         if self.isdelta18o:
    8890            self.precipitations_lgm = project3d(md, 'vector', self.precipitations_lgm, 'type', 'node')
     91
    8992        if self.ismungsm:
    9093            self.temperatures_lgm = project3d(md, 'vector', self.temperatures_lgm, 'type', 'node')
    91         if self.ismungsm:
    9294            self.temperatures_presentday = project3d(md, 'vector', self.temperatures_presentday, 'type', 'node')
    93         if self.ismungsm:
    9495            self.precipitations_presentday = project3d(md, 'vector', self.precipitations_presentday, 'type', 'node')
    95         if self.ismungsm:
    9696            self.precipitations_lgm = project3d(md, 'vector', self.precipitations_lgm, 'type', 'node')
     97
    9798        self.s0p = project3d(md, 'vector', self.s0p, 'type', 'node')
    9899        self.s0t = project3d(md, 'vector', self.s0t, 'type', 'node')
    99 
    100100        return self
    101101    #}}}
     
    128128    #}}}
    129129
    130     def checkconsistency(self, md, solution, analyses):  # {{{
     130    def checkconsistency(self, md, solution, analyses):    # {{{
     131
    131132        if 'MasstransportAnalysis' in analyses:
    132133            md = checkfield(md, 'fieldname', 'smb.desfac', '<=', 1, 'numel', [1])
     
    157158                md = checkfield(md, 'fieldname', 'smb.sealev', 'NaN', 1, 'Inf', 1, 'size', [2, np.nan], 'singletimeseries', 1)
    158159
     160        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
    159161        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
    160162        return md
    161163    #}}}
    162164
    163     def marshall(self, prefix, md, fid):  # {{{
     165    def marshall(self, prefix, md, fid):    # {{{
    164166        yts = md.constants.yts
    165167
    166168        WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 4, 'format', 'Integer')
     169
    167170        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isdelta18o', 'format', 'Boolean')
    168171        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ismungsm', 'format', 'Boolean')
     
    173176        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'rlaps', 'format', 'Double')
    174177        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'rlapslgm', 'format', 'Double')
     178        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
    175179
    176180        if (self.isdelta18o == 0 and self.ismungsm == 0):
     
    182186            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_presentday', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    183187            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_lgm', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    184             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o_surface', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    185             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    186             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    187             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
     188            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o_surface', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     189            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'delta18o', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     190            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     191            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
    188192        elif self.ismungsm:
    189193            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'temperatures_presentday', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     
    191195            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_presentday', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    192196            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'precipitations_lgm', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
    193             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Pfac', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    194             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    195             WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', yts)
    196 
    197     #process requested outputs
     197            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Pfac', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     198            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tdiff', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     199            WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'sealev', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 2, 'yts', md.constants.yts)
     200
     201        #process requested outputs
    198202        outputs = self.requested_outputs
    199203        indices = [i for i, x in enumerate(outputs) if x == 'default']
Note: See TracChangeset for help on using the changeset viewer.