[25118] | 1 | %SOLIDEARTHSETTINGS class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % solidearthsettings=solidearthsettings();
|
---|
| 5 |
|
---|
| 6 | classdef solidearthsettings
|
---|
| 7 | properties (SetAccess=public)
|
---|
| 8 | reltol = 0;
|
---|
| 9 | abstol = 0;
|
---|
| 10 | maxiter = 0;
|
---|
[26296] | 11 | selfattraction = 1;
|
---|
| 12 | elastic = 1;
|
---|
| 13 | viscous = 1;
|
---|
| 14 | rotation = 1;
|
---|
| 15 | grdocean = 1;
|
---|
[25118] | 16 | ocean_area_scaling = 0;
|
---|
| 17 | runfrequency = 1; %how many time steps we skip before we run grd_core
|
---|
[26296] | 18 | sealevelloading = 1; %will sea-level loads be computed?
|
---|
[26229] | 19 | isgrd = 0; %will GRD patterns be computed?
|
---|
| 20 | compute_bp_grd = 0; %will GRD patterns for bottom pressures be computed?
|
---|
[26272] | 21 | degacc = 0; %degree increment for resolution of Green tables.
|
---|
| 22 | timeacc = 0; %time step accurary required to compute Green tables
|
---|
[25118] | 23 | horiz = 0; %compute horizontal deformation
|
---|
[26296] | 24 | grdmodel = 0; %grd model (0 by default, 1 for (visco)-elastic, 2 for Ivins)
|
---|
[26047] | 25 | cross_section_shape = 0; %cross section only used when grd model is Ivins
|
---|
[25118] | 26 | end
|
---|
[26296] | 27 | methods (Static)
|
---|
| 28 | function self = loadobj(self) % {{{
|
---|
| 29 | % This function is directly called by matlab when a model object is
|
---|
| 30 | % loaded. If the input is a struct it is an old version of this class and
|
---|
| 31 | % old fields must be recovered (make sure they are in the deprecated
|
---|
| 32 | % model properties)
|
---|
| 33 |
|
---|
| 34 | if isstruct(self)
|
---|
| 35 | % 2021, Jun 4
|
---|
| 36 | if isfield(self,'rigid')
|
---|
| 37 | self.selfattraction = self.rigid;
|
---|
| 38 | end
|
---|
| 39 | if isfield(self,'computesealevelchange')
|
---|
| 40 | self.sealevelloading = self.computesealevelchange;
|
---|
| 41 | end
|
---|
| 42 | self = structtoobj(solidearthsettings(),self);
|
---|
| 43 |
|
---|
| 44 | end
|
---|
| 45 | end% }}}
|
---|
| 46 | end
|
---|
[25118] | 47 | methods
|
---|
[26296] | 48 |
|
---|
[25118] | 49 | function self = solidearthsettings(varargin) % {{{
|
---|
| 50 | switch nargin
|
---|
| 51 | case 0
|
---|
| 52 | self=setdefaultparameters(self);
|
---|
| 53 | otherwise
|
---|
| 54 | error('constructor not supported');
|
---|
| 55 | end
|
---|
| 56 | end % }}}
|
---|
| 57 | function self = setdefaultparameters(self) % {{{
|
---|
| 58 |
|
---|
| 59 | %Convergence criterion: absolute, relative and residual
|
---|
[26060] | 60 | self.reltol=0.01; % 1 percent
|
---|
| 61 | self.abstol=NaN; % default
|
---|
[25118] | 62 |
|
---|
| 63 | %maximum of non-linear iterations.
|
---|
| 64 | self.maxiter=5;
|
---|
| 65 |
|
---|
| 66 | %computational flags:
|
---|
[26296] | 67 | self.selfattraction=1;
|
---|
[25118] | 68 | self.elastic=1;
|
---|
[26272] | 69 | self.viscous=1;
|
---|
[25118] | 70 | self.rotation=1;
|
---|
[26296] | 71 | self.grdocean=1;
|
---|
[25118] | 72 | self.ocean_area_scaling=0;
|
---|
[26229] | 73 | self.compute_bp_grd=0;
|
---|
[26047] | 74 | self.isgrd=0;
|
---|
[26296] | 75 | self.sealevelloading=1;
|
---|
[25118] | 76 |
|
---|
| 77 | %numerical discretization accuracy
|
---|
| 78 | self.degacc=.01;
|
---|
[26272] | 79 | self.timeacc=1;
|
---|
[25118] | 80 |
|
---|
[25125] | 81 | %how many time steps we skip before we run solidearthsettings solver during transient
|
---|
[25118] | 82 | self.runfrequency=1;
|
---|
[25758] | 83 |
|
---|
[25118] | 84 | %horizontal displacement? (not by default)
|
---|
| 85 | self.horiz=0;
|
---|
[26047] | 86 |
|
---|
| 87 | %cross section for Ivins model
|
---|
| 88 | self.cross_section_shape=1; %square as default (see iedge in GiaDeflectionCorex)
|
---|
| 89 |
|
---|
| 90 | %no grd model by default:
|
---|
| 91 | self.grdmodel=0;
|
---|
| 92 |
|
---|
[25118] | 93 | end % }}}
|
---|
| 94 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
| 95 |
|
---|
[25956] | 96 | if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc==0),
|
---|
[25118] | 97 | return;
|
---|
| 98 | end
|
---|
| 99 | md = checkfield(md,'fieldname','solidearth.settings.reltol','size',[1 1]);
|
---|
| 100 | md = checkfield(md,'fieldname','solidearth.settings.abstol','size',[1 1]);
|
---|
| 101 | md = checkfield(md,'fieldname','solidearth.settings.maxiter','size',[1 1],'>=',1);
|
---|
| 102 | md = checkfield(md,'fieldname','solidearth.settings.runfrequency','size',[1 1],'>=',1);
|
---|
| 103 | md = checkfield(md,'fieldname','solidearth.settings.degacc','size',[1 1],'>=',1e-10);
|
---|
[26272] | 104 | md = checkfield(md,'fieldname','solidearth.settings.timeacc','size',[1 1],'>',0);
|
---|
[25118] | 105 | md = checkfield(md,'fieldname','solidearth.settings.horiz','NaN',1,'Inf',1,'values',[0 1]);
|
---|
[26229] | 106 | md = checkfield(md,'fieldname','solidearth.settings.grdmodel','>=',0,'<=',2);
|
---|
[26047] | 107 | md = checkfield(md,'fieldname','solidearth.settings.cross_section_shape','numel',[1],'values',[1,2]);
|
---|
[26296] | 108 | if self.elastic==1 & self.selfattraction==0,
|
---|
| 109 | error('solidearthsettings checkconsistency error message: need selfattraction on if elastic flag is set');
|
---|
[25767] | 110 | end
|
---|
[26272] | 111 | if self.viscous==1 & self.elastic==0,
|
---|
| 112 | error('solidearthsettings checkconsistency error message: need elastic on if viscous flag is set');
|
---|
| 113 | end
|
---|
[25767] | 114 |
|
---|
[26060] | 115 | %a GRD computation has been requested, make some checks on the nature of the meshes provided.
|
---|
[25763] | 116 | if self.isgrd,
|
---|
[26047] | 117 | if strcmpi(class(md.mesh),'mesh3dsurface'),
|
---|
| 118 | if self.grdmodel==2,
|
---|
| 119 | error('model requires a 2D mesh to run gia Ivins computations (change mesh from mesh3dsurface to mesh2d)');
|
---|
| 120 | end
|
---|
[25118] | 121 | else
|
---|
[26047] | 122 | if self.grdmodel==1,
|
---|
[26060] | 123 | error('model requires a 3D surface mesh to run GRD computations (change mesh from mesh2d to mesh3dsurface)');
|
---|
[25118] | 124 | end
|
---|
| 125 | end
|
---|
[26296] | 126 | if self.sealevelloading==1 & self.grdocean==0
|
---|
| 127 | error('solidearthsettings checkconsistency error message: need grdocean on if sealevelloading flag is set');
|
---|
| 128 | end
|
---|
[25118] | 129 | end
|
---|
| 130 |
|
---|
[26047] | 131 | if self.compute_bp_grd==1 & md.solidearth.settings.isgrd==0,
|
---|
| 132 | error('solidearthsettings checkconsistency error message; if bottom pressure grd patterns are requested, solidearth settings class should have isgrd flag on');
|
---|
| 133 | end
|
---|
| 134 |
|
---|
[25118] | 135 | end % }}}
|
---|
| 136 | function disp(self) % {{{
|
---|
| 137 | disp(sprintf(' solidearth settings:'));
|
---|
| 138 |
|
---|
[25956] | 139 | fielddisplay(self,'reltol','sea level change relative convergence criterion, (default, NaN: not applied)');
|
---|
| 140 | fielddisplay(self,'abstol','sea level change absolute convergence criterion, NaN: not applied');
|
---|
[25118] | 141 | fielddisplay(self,'maxiter','maximum number of nonlinear iterations');
|
---|
[26296] | 142 | fielddisplay(self,'grdocean','does this planet have an ocean, if set to 1: global water mass is conserved in GRD module [default: 1]');
|
---|
[25118] | 143 | fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area [default: No correction]');
|
---|
[26296] | 144 | fielddisplay(self,'sealevelloading','enables surface loading from sea-level change (default 1)');
|
---|
[25763] | 145 | fielddisplay(self,'isgrd','compute GRD patterns (default 1)');
|
---|
[26047] | 146 | fielddisplay(self,'compute_bp_grd','compute GRD patterns for bottom pressure loads (default 1)');
|
---|
[25125] | 147 | fielddisplay(self,'runfrequency','how many time steps we skip before we run solidearthsettings solver during transient (default: 1)');
|
---|
[26296] | 148 | fielddisplay(self,'selfattraction','enables surface mass load to perturb the gravity field');
|
---|
| 149 | fielddisplay(self,'elastic','enables elastic deformation from surface loading');
|
---|
| 150 | fielddisplay(self,'viscous','enables viscous deformation from surface loading');
|
---|
| 151 | fielddisplay(self,'rotation','enables polar motion to feedback on the GRD fields');
|
---|
[25118] | 152 | fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions');
|
---|
[26272] | 153 | fielddisplay(self,'timeacc','time accuracy (default 1 yr) for numerical discretization of the Green''s functions');
|
---|
[26296] | 154 | fielddisplay(self,'grdmodel','type of deformation model, 0 for no GRD, 1 for spherical GRD model (SESAW model), 2 for half-space planar GRD (visco-elastic model from Ivins)');
|
---|
[26060] | 155 | fielddisplay(self,'cross_section_shape','1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore');
|
---|
[25118] | 156 | end % }}}
|
---|
| 157 | function marshall(self,prefix,md,fid) % {{{
|
---|
| 158 | WriteData(fid,prefix,'object',self,'fieldname','reltol','name','md.solidearth.settings.reltol','format','Double');
|
---|
| 159 | WriteData(fid,prefix,'object',self,'fieldname','abstol','name','md.solidearth.settings.abstol','format','Double');
|
---|
| 160 | WriteData(fid,prefix,'object',self,'fieldname','maxiter','name','md.solidearth.settings.maxiter','format','Integer');
|
---|
[26296] | 161 | WriteData(fid,prefix,'object',self,'fieldname','selfattraction','name','md.solidearth.settings.selfattraction','format','Boolean');
|
---|
[25118] | 162 | WriteData(fid,prefix,'object',self,'fieldname','elastic','name','md.solidearth.settings.elastic','format','Boolean');
|
---|
[26272] | 163 | WriteData(fid,prefix,'object',self,'fieldname','viscous','name','md.solidearth.settings.viscous','format','Boolean');
|
---|
[25118] | 164 | WriteData(fid,prefix,'object',self,'fieldname','rotation','name','md.solidearth.settings.rotation','format','Boolean');
|
---|
[26296] | 165 | WriteData(fid,prefix,'object',self,'fieldname','grdocean','name','md.solidearth.settings.grdocean','format','Boolean');
|
---|
[25118] | 166 | WriteData(fid,prefix,'object',self,'fieldname','ocean_area_scaling','name','md.solidearth.settings.ocean_area_scaling','format','Boolean');
|
---|
| 167 | WriteData(fid,prefix,'object',self,'fieldname','runfrequency','name','md.solidearth.settings.runfrequency','format','Integer');
|
---|
| 168 | WriteData(fid,prefix,'object',self,'fieldname','degacc','name','md.solidearth.settings.degacc','format','Double');
|
---|
[26272] | 169 | WriteData(fid,prefix,'object',self,'fieldname','timeacc','name','md.solidearth.settings.timeacc','format','Double','scale',md.constants.yts);
|
---|
[25118] | 170 | WriteData(fid,prefix,'object',self,'fieldname','horiz','name','md.solidearth.settings.horiz','format','Integer');
|
---|
[26296] | 171 | WriteData(fid,prefix,'object',self,'fieldname','sealevelloading','name','md.solidearth.settings.sealevelloading','format','Integer');
|
---|
[25763] | 172 | WriteData(fid,prefix,'object',self,'fieldname','isgrd','name','md.solidearth.settings.isgrd','format','Integer');
|
---|
[26047] | 173 | WriteData(fid,prefix,'object',self,'fieldname','compute_bp_grd','name','md.solidearth.settings.compute_bp_grd','format','Integer');
|
---|
| 174 | WriteData(fid,prefix,'object',self,'fieldname','grdmodel','name','md.solidearth.settings.grdmodel','format','Integer');
|
---|
| 175 | WriteData(fid,prefix,'object',self,'fieldname','cross_section_shape','name','md.solidearth.settings.cross_section_shape','format','Integer');
|
---|
[25118] | 176 | end % }}}
|
---|
| 177 | function savemodeljs(self,fid,modelname) % {{{
|
---|
| 178 |
|
---|
[25956] | 179 | writejsdouble(fid,[modelname '.solidearth.settings.maxiter'],self.maxiter);
|
---|
| 180 | writejsdouble(fid,[modelname '.solidearth.settings.reltol'],self.reltol);
|
---|
| 181 | writejsdouble(fid,[modelname '.solidearth.settings.abstol'],self.abstol);
|
---|
[26296] | 182 | writejsdouble(fid,[modelname '.solidearth.settings.selfattraction'],self.selfattraction);
|
---|
[25956] | 183 | writejsdouble(fid,[modelname '.solidearth.settings.elastic'],self.elastic);
|
---|
[26272] | 184 | writejsdouble(fid,[modelname '.solidearth.settings.viscous'],self.viscous);
|
---|
[25956] | 185 | writejsdouble(fid,[modelname '.solidearth.settings.rotation'],self.rotation);
|
---|
[26296] | 186 | writejsdouble(fid,[modelname '.solidearth.settings.grdocean'],self.rotation);
|
---|
[25956] | 187 | writejsdouble(fid,[modelname '.solidearth.settings.ocean_area_scaling'],self.ocean_area_scaling);
|
---|
| 188 | writejsdouble(fid,[modelname '.solidearth.settings.run_frequency'],self.run_frequency);
|
---|
| 189 | writejsdouble(fid,[modelname '.solidearth.settings.degacc'],self.degacc);
|
---|
[26272] | 190 | writejsdouble(fid,[modelname '.solidearth.settings.timeacc'],self.timeacc);
|
---|
[26047] | 191 | writejsdouble(fid,[modelname '.solidearth.settings.cross_section_shape'],self.cross_section_shape);
|
---|
[25118] | 192 | end % }}}
|
---|
| 193 | function self = extrude(self,md) % {{{
|
---|
| 194 | end % }}}
|
---|
| 195 | end
|
---|
| 196 | end
|
---|