source: issm/oecreview/Archive/25834-26739/ISSM-26012-26013.diff

Last change on this file was 26740, checked in by Mathieu Morlighem, 3 years ago

CHG: added 25834-26739

File size: 10.3 KB
  • ../trunk-jpl/src/m/classes/initialization.py

     
    2828        self.epl_thickness = np.nan
    2929        self.hydraulic_potential = np.nan
    3030        self.channelarea = np.nan
     31        self.sample = np.nan
    3132
    3233        #set defaults
    3334        self.setdefaultparameters()
     
    4950        s += '{}\n'.format(fielddisplay(self, 'epl_thickness', 'thickness of the epl [m]'))
    5051        s += '{}\n'.format(fielddisplay(self, 'hydraulic_potential', 'Hydraulic potential (for GlaDS) [Pa]'))
    5152        s += '{}\n'.format(fielddisplay(self, 'channelarea', 'subglaciale water channel area (for GlaDS) [m2]'))
     53        s += '{}\n'.format(fielddisplay(self,'sample','Realization of a Gaussian random field'))
    5254        return s
    5355    #}}}
    5456
     
    123125                md = checkfield(md, 'fieldname', 'initialization.watercolumn', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
    124126                md = checkfield(md, 'fieldname', 'initialization.hydraulic_potential', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
    125127                md = checkfield(md, 'fieldname', 'initialization.channelarea', 'NaN', 1, 'Inf', 1, '>=', 0, 'size', [md.mesh.numberofelements])
     128        if 'SamplingAnalysis' in analyses and not solution == 'TransientSolution' and not md.transient.issampling:
     129            if np.any(np.isnan(md.initialization.sample)):
     130                md = checkfield(md,'fieldname','initialization.sample','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1])
    126131        return md
    127132    # }}}
    128133
     
    140145        WriteData(fid, prefix, 'object', self, 'fieldname', 'watercolumn', 'format', 'DoubleMat', 'mattype', 1)
    141146        WriteData(fid, prefix, 'object', self, 'fieldname', 'channelarea', 'format', 'DoubleMat', 'mattype', 1)
    142147        WriteData(fid, prefix, 'object', self, 'fieldname', 'hydraulic_potential', 'format', 'DoubleMat', 'mattype', 1)
     148        WriteData(fid,prefix,'object',self,'fieldname','sample','format','DoubleMat','mattype',1)
    143149        if md.thermal.isenthalpy:
    144150            if (np.size(self.enthalpy) <= 1):
    145151                tpmp = md.materials.meltingpoint - md.materials.beta * md.initialization.pressure
  • ../trunk-jpl/src/m/classes/model.py

     
    7575from ElementConnectivity import ElementConnectivity
    7676from contourenvelope import contourenvelope
    7777from DepthAverage import DepthAverage
     78from sampling import sampling
    7879#}}}
    7980
    8081
     
    115116        self.gia = None
    116117        self.love = None
    117118        self.esa = None
     119        self.sampling = None
    118120        self.autodiff = None
    119121        self.inversion = None
    120122        self.qmu = None
     
    172174                'gia',
    173175                'love',
    174176                'esa',
     177                'sampling',
    175178                'autodiff',
    176179                'inversion',
    177180                'qmu',
     
    223226        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("frontalforcings", "[%s %s]" % ("1x1", obj.frontalforcings.__class__.__name__), "parameters for frontalforcings"))
    224227        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("gia", "[%s %s]" % ("1x1", obj.gia.__class__.__name__), "parameters for gia solution"))
    225228        s = "%s\n%s" % (s, '%19s: %-22s -- %s' % ("esa", "[%s %s]" % ("1x1", obj.esa.__class__.__name__), "parameters for elastic adjustment solution"))
     229        s = "%s\n%s" % (s, '%19s: %-22s -- %s' % ("sampling", "[%s %s]" % ("1x1", obj.sampling.__class__.__name__), "parameters for stochastic sampler"))
    226230        s = "%s\n%s" % (s, '%19s: %-22s -- %s' % ("love", "[%s %s]" % ("1x1", obj.love.__class__.__name__), "parameters for love solution"))
    227231        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("autodiff", "[%s %s]" % ("1x1", obj.autodiff.__class__.__name__), "automatic differentiation parameters"))
    228232        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("inversion", "[%s %s]" % ("1x1", obj.inversion.__class__.__name__), "parameters for inverse methods"))
     
    270274        self.gia = giamme()
    271275        self.love = fourierlove()
    272276        self.esa = esa()
     277        self.sampling = sampling()
    273278        self.autodiff = autodiff()
    274279        self.inversion = inversion()
    275280        self.qmu = qmu()
  • ../trunk-jpl/src/m/consistency/ismodelselfconsistent.py

     
    7878        analyses = ['L2ProjectionBaseAnalysis', 'HydrologyShreveAnalysis', 'HydrologyDCInefficientAnalysis', 'HydrologyDCEfficientAnalysis']
    7979    elif 'DamageEvolutionSolution':
    8080        analyses = ['DamageEvolutionAnalysis']
     81    elseif strcmp(solutiontype,'SamplingSolution')
     82                analyses=['SamplingAnalysis'] 
    8183    else:
    8284        raise TypeError('solution type: {} not supported yet!'.format(solutiontype))
    8385
  • ../trunk-jpl/src/m/sampling.py

     
    5454        # Temporal correlation factor
    5555        self.phi = 0
    5656        # Exponent in fraction SPDE (default=2, biLaplacian covariance operator)
    57         self.alpha=2;
     57        self.alpha = 2
    5858        # Seed for pseudorandom number generator (default -1 for random seed)
    59         self.alpha=-1;
     59        self.alpha = -1
    6060        # Default output
    6161        self.requested_outputs = ['default']
    6262        return self
     
    6767        if (SamplingAnalysis' not in analyses):
    6868            return md
    6969
    70         md = checkfield(md,'fieldname','sampling.kappa','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0);
    71         md = checkfield(md,'fieldname','sampling.tau','NaN',1,'Inf',1,'numel',1,'>',0);
    72         md = checkfield(md,'fieldname','sampling.beta','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0);
    73         md = checkfield(md,'fieldname','sampling.phi','NaN',1,'Inf',1,'numel',1,'>=',0);
    74         md = checkfield(md,'fieldname','sampling.alpha','NaN',1,'Inf',1,'numel',1,'>',0);
    75         md = checkfield(md,'fieldname','sampling.robin','numel',1,'values',[0 1]);
    76         md = checkfield(md,'fieldname','sampling.seed','NaN',1,'Inf',1,'numel',1);
    77         md = checkfield(md,'fieldname','sampling.requested_outputs','stringrow',1);
     70        md = checkfield(md,'fieldname','sampling.kappa','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0)
     71        md = checkfield(md,'fieldname','sampling.tau','NaN',1,'Inf',1,'numel',1,'>',0)
     72        md = checkfield(md,'fieldname','sampling.beta','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0)
     73        md = checkfield(md,'fieldname','sampling.phi','NaN',1,'Inf',1,'numel',1,'>=',0)
     74        md = checkfield(md,'fieldname','sampling.alpha','NaN',1,'Inf',1,'numel',1,'>',0)
     75        md = checkfield(md,'fieldname','sampling.robin','numel',1,'values',[0 1])
     76        md = checkfield(md,'fieldname','sampling.seed','NaN',1,'Inf',1,'numel',1)
     77        md = checkfield(md,'fieldname','sampling.requested_outputs','stringrow',1)
    7878
    7979        return md
    8080    # }}}
    8181
    8282    def marshall(self, prefix, md, fid):  # {{{
    83         WriteData(fid,prefix,'object',self,'fieldname','kappa','format','DoubleMat','mattype',1);
    84         WriteData(fid,prefix,'object',self,'fieldname','tau','format','Double');
    85         WriteData(fid,prefix,'object',self,'fieldname','beta','format','DoubleMat','mattype',1);
    86         WriteData(fid,prefix,'object',self,'fieldname','phi','format','Double');
    87         WriteData(fid,prefix,'object',self,'fieldname','alpha','format','Integer');
    88         WriteData(fid,prefix,'object',self,'fieldname','robin','format','Boolean');
    89         WriteData(fid,prefix,'object',self,'fieldname','seed','format','Integer');
     83        WriteData(fid,prefix,'object',self,'fieldname','kappa','format','DoubleMat','mattype',1)
     84        WriteData(fid,prefix,'object',self,'fieldname','tau','format','Double')
     85        WriteData(fid,prefix,'object',self,'fieldname','beta','format','DoubleMat','mattype',1)
     86        WriteData(fid,prefix,'object',self,'fieldname','phi','format','Double')
     87        WriteData(fid,prefix,'object',self,'fieldname','alpha','format','Integer')
     88        WriteData(fid,prefix,'object',self,'fieldname','robin','format','Boolean')
     89        WriteData(fid,prefix,'object',self,'fieldname','seed','format','Integer')
    9090
    9191        # Process requested outputs
    9292        outputs = self.requested_outputs
     
    9797        WriteData(fid, prefix, 'data', outputs, 'name', 'md.masstransport.requested_outputs', 'format', 'StringArray')
    9898
    9999        # Process requested outputs
    100                 outputs = self.requested_outputs;
     100                outputs = self.requested_outputs
    101101                indices = [i for i, x in enumerate(outputs) if x == 'default']
    102102                   if len(indices) > 0:
    103103            outputscopy = outputs[0:max(0, indices[0] - 1)] + self.defaultoutputs(md) + outputs[indices[0] + 1:]
    104104            outputs = outputscopy
    105                 WriteData(fid,prefix,'data',outputs,'name','md.sampling.requested_outputs','format','StringArray');
     105                WriteData(fid,prefix,'data',outputs,'name','md.sampling.requested_outputs','format','StringArray')
    106106    # }}}
     107 No newline at end of file
  • ../trunk-jpl/src/m/solve/solve.py

     
    3434    - 'Esa'                or 'esa'
    3535    - 'Sealevelchange'     or 'slc'
    3636    - 'Love'               or 'lv'
     37    - 'Sampling'           or 'smp'
    3738
    3839    Extra options:
    3940    - loadonly         : does not solve. only load results
     
    7980        solutionstring = 'EsaSolution'
    8081    elif solutionstring.lower() == 'slc' or solutionstring.lower() == 'sealevelchange':
    8182        solutionstring = 'SealevelchangeSolution'
     83    elif solutionstring.lower() == 'smp' or solutionstring.lower() == 'sampling':
     84        solutionstring = 'SamplingSolution'
    8285    else:
    8386        raise ValueError("solutionstring '%s' not supported!" % solutionstring)
    8487    options = pairoptions('solutionstring', solutionstring, *args)
Note: See TracBrowser for help on using the repository browser.