Changeset 26013
- Timestamp:
- 02/21/21 15:55:44 (4 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/initialization.py
r25688 r26013 29 29 self.hydraulic_potential = np.nan 30 30 self.channelarea = np.nan 31 self.sample = np.nan 31 32 32 33 #set defaults … … 50 51 s += '{}\n'.format(fielddisplay(self, 'hydraulic_potential', 'Hydraulic potential (for GlaDS) [Pa]')) 51 52 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')) 52 54 return s 53 55 #}}} … … 124 126 md = checkfield(md, 'fieldname', 'initialization.hydraulic_potential', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 125 127 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]) 126 131 return md 127 132 # }}} … … 141 146 WriteData(fid, prefix, 'object', self, 'fieldname', 'channelarea', 'format', 'DoubleMat', 'mattype', 1) 142 147 WriteData(fid, prefix, 'object', self, 'fieldname', 'hydraulic_potential', 'format', 'DoubleMat', 'mattype', 1) 148 WriteData(fid,prefix,'object',self,'fieldname','sample','format','DoubleMat','mattype',1) 143 149 if md.thermal.isenthalpy: 144 150 if (np.size(self.enthalpy) <= 1): -
issm/trunk-jpl/src/m/classes/model.py
r25988 r26013 76 76 from contourenvelope import contourenvelope 77 77 from DepthAverage import DepthAverage 78 from sampling import sampling 78 79 #}}} 79 80 … … 116 117 self.love = None 117 118 self.esa = None 119 self.sampling = None 118 120 self.autodiff = None 119 121 self.inversion = None … … 173 175 'love', 174 176 'esa', 177 'sampling', 175 178 'autodiff', 176 179 'inversion', … … 224 227 s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("gia", "[%s %s]" % ("1x1", obj.gia.__class__.__name__), "parameters for gia solution")) 225 228 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")) 226 230 s = "%s\n%s" % (s, '%19s: %-22s -- %s' % ("love", "[%s %s]" % ("1x1", obj.love.__class__.__name__), "parameters for love solution")) 227 231 s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("autodiff", "[%s %s]" % ("1x1", obj.autodiff.__class__.__name__), "automatic differentiation parameters")) … … 271 275 self.love = fourierlove() 272 276 self.esa = esa() 277 self.sampling = sampling() 273 278 self.autodiff = autodiff() 274 279 self.inversion = inversion() -
issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.py
r25485 r26013 79 79 elif 'DamageEvolutionSolution': 80 80 analyses = ['DamageEvolutionAnalysis'] 81 elseif strcmp(solutiontype,'SamplingSolution') 82 analyses=['SamplingAnalysis'] 81 83 else: 82 84 raise TypeError('solution type: {} not supported yet!'.format(solutiontype)) -
issm/trunk-jpl/src/m/sampling.py
r26012 r26013 55 55 self.phi = 0 56 56 # Exponent in fraction SPDE (default=2, biLaplacian covariance operator) 57 self.alpha =2;57 self.alpha = 2 58 58 # Seed for pseudorandom number generator (default -1 for random seed) 59 self.alpha =-1;59 self.alpha = -1 60 60 # Default output 61 61 self.requested_outputs = ['default'] … … 68 68 return md 69 69 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) 78 78 79 79 return md … … 81 81 82 82 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') 90 90 91 91 # Process requested outputs … … 98 98 99 99 # Process requested outputs 100 outputs = self.requested_outputs ;100 outputs = self.requested_outputs 101 101 indices = [i for i, x in enumerate(outputs) if x == 'default'] 102 102 if len(indices) > 0: 103 103 outputscopy = outputs[0:max(0, indices[0] - 1)] + self.defaultoutputs(md) + outputs[indices[0] + 1:] 104 104 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') 106 106 # }}} -
issm/trunk-jpl/src/m/solve/solve.py
r25955 r26013 35 35 - 'Sealevelchange' or 'slc' 36 36 - 'Love' or 'lv' 37 - 'Sampling' or 'smp' 37 38 38 39 Extra options: … … 80 81 elif solutionstring.lower() == 'slc' or solutionstring.lower() == 'sealevelchange': 81 82 solutionstring = 'SealevelchangeSolution' 83 elif solutionstring.lower() == 'smp' or solutionstring.lower() == 'sampling': 84 solutionstring = 'SamplingSolution' 82 85 else: 83 86 raise ValueError("solutionstring '%s' not supported!" % solutionstring)
Note:
See TracChangeset
for help on using the changeset viewer.