[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;
|
---|
| 11 | rigid = 0;
|
---|
| 12 | elastic = 0;
|
---|
| 13 | rotation = 0;
|
---|
| 14 | ocean_area_scaling = 0;
|
---|
| 15 | runfrequency = 1; %how many time steps we skip before we run grd_core
|
---|
[25763] | 16 | computesealevelchange = 1; %will sea-level be coputed?
|
---|
| 17 | isgrd = 1; %will GRD patterns be computed?
|
---|
[26060] | 18 | compute_bp_grd = 1; %will GRD patterns for bottom pressures be computed?
|
---|
[25118] | 19 | degacc = 0; %degree increment for resolution of Green tables
|
---|
| 20 | horiz = 0; %compute horizontal deformation
|
---|
[25758] | 21 | glfraction = 1; %barystatic contribution full or fractional (default fractional)
|
---|
[26047] | 22 | grdmodel = 0; %grd model (0 by default, 1 for elastic, 2 for Ivins)
|
---|
| 23 | cross_section_shape = 0; %cross section only used when grd model is Ivins
|
---|
[26126] | 24 | optim = 0; %new optimized version of the GRD code.
|
---|
[25118] | 25 | end
|
---|
| 26 | methods
|
---|
| 27 | function self = solidearthsettings(varargin) % {{{
|
---|
| 28 | switch nargin
|
---|
| 29 | case 0
|
---|
| 30 | self=setdefaultparameters(self);
|
---|
| 31 | otherwise
|
---|
| 32 | error('constructor not supported');
|
---|
| 33 | end
|
---|
| 34 | end % }}}
|
---|
| 35 | function self = setdefaultparameters(self) % {{{
|
---|
| 36 |
|
---|
| 37 | %Convergence criterion: absolute, relative and residual
|
---|
[26060] | 38 | self.reltol=0.01; % 1 percent
|
---|
| 39 | self.abstol=NaN; % default
|
---|
[25118] | 40 |
|
---|
| 41 | %maximum of non-linear iterations.
|
---|
| 42 | self.maxiter=5;
|
---|
| 43 |
|
---|
| 44 | %computational flags:
|
---|
| 45 | self.rigid=1;
|
---|
| 46 | self.elastic=1;
|
---|
| 47 | self.rotation=1;
|
---|
| 48 | self.ocean_area_scaling=0;
|
---|
[26047] | 49 | self.compute_bp_grd=1;
|
---|
| 50 | self.isgrd=0;
|
---|
[25763] | 51 | self.computesealevelchange=1;
|
---|
[25118] | 52 |
|
---|
| 53 | %numerical discretization accuracy
|
---|
| 54 | self.degacc=.01;
|
---|
| 55 |
|
---|
[25125] | 56 | %how many time steps we skip before we run solidearthsettings solver during transient
|
---|
[25118] | 57 | self.runfrequency=1;
|
---|
[25758] | 58 |
|
---|
| 59 | %fractional contribution:
|
---|
| 60 | self.glfraction=1;
|
---|
[25118] | 61 |
|
---|
| 62 | %horizontal displacement? (not by default)
|
---|
| 63 | self.horiz=0;
|
---|
[26047] | 64 |
|
---|
| 65 | %cross section for Ivins model
|
---|
| 66 | self.cross_section_shape=1; %square as default (see iedge in GiaDeflectionCorex)
|
---|
| 67 |
|
---|
[26126] | 68 | %optim?
|
---|
| 69 | self.optim=0;
|
---|
| 70 |
|
---|
[26047] | 71 | %no grd model by default:
|
---|
| 72 | self.grdmodel=0;
|
---|
| 73 |
|
---|
[25118] | 74 | end % }}}
|
---|
| 75 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
| 76 |
|
---|
[25956] | 77 | if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc==0),
|
---|
[25118] | 78 | return;
|
---|
| 79 | end
|
---|
| 80 | md = checkfield(md,'fieldname','solidearth.settings.reltol','size',[1 1]);
|
---|
| 81 | md = checkfield(md,'fieldname','solidearth.settings.abstol','size',[1 1]);
|
---|
| 82 | md = checkfield(md,'fieldname','solidearth.settings.maxiter','size',[1 1],'>=',1);
|
---|
| 83 | md = checkfield(md,'fieldname','solidearth.settings.runfrequency','size',[1 1],'>=',1);
|
---|
| 84 | md = checkfield(md,'fieldname','solidearth.settings.degacc','size',[1 1],'>=',1e-10);
|
---|
| 85 | md = checkfield(md,'fieldname','solidearth.settings.horiz','NaN',1,'Inf',1,'values',[0 1]);
|
---|
[25758] | 86 | md = checkfield(md,'fieldname','solidearth.settings.glfraction','values',[0 1]);
|
---|
[26047] | 87 | md = checkfield(md,'fieldname','solidearth.settings.grdmodel','values',[1 2]);
|
---|
| 88 | md = checkfield(md,'fieldname','solidearth.settings.cross_section_shape','numel',[1],'values',[1,2]);
|
---|
[26126] | 89 | md = checkfield(md,'fieldname','solidearth.settings.optim','values',[0,1]);
|
---|
[25118] | 90 |
|
---|
[25767] | 91 | %checks on computational flags
|
---|
| 92 | if self.elastic==1 & self.rigid==0,
|
---|
| 93 | error('solidearthsettings checkconsistency error message: need rigid on if elastic flag is set');
|
---|
| 94 | end
|
---|
| 95 |
|
---|
[26060] | 96 | %a GRD computation has been requested, make some checks on the nature of the meshes provided.
|
---|
[25763] | 97 | if self.isgrd,
|
---|
[26047] | 98 | if strcmpi(class(md.mesh),'mesh3dsurface'),
|
---|
| 99 | if self.grdmodel==2,
|
---|
| 100 | error('model requires a 2D mesh to run gia Ivins computations (change mesh from mesh3dsurface to mesh2d)');
|
---|
| 101 | end
|
---|
[25118] | 102 | else
|
---|
[26047] | 103 | if self.grdmodel==1,
|
---|
[26060] | 104 | error('model requires a 3D surface mesh to run GRD computations (change mesh from mesh2d to mesh3dsurface)');
|
---|
[25118] | 105 | end
|
---|
| 106 | end
|
---|
| 107 | end
|
---|
| 108 |
|
---|
[26047] | 109 | if self.compute_bp_grd==1 & md.solidearth.settings.isgrd==0,
|
---|
| 110 | error('solidearthsettings checkconsistency error message; if bottom pressure grd patterns are requested, solidearth settings class should have isgrd flag on');
|
---|
| 111 | end
|
---|
| 112 |
|
---|
| 113 |
|
---|
[25118] | 114 | end % }}}
|
---|
| 115 | function disp(self) % {{{
|
---|
| 116 | disp(sprintf(' solidearth settings:'));
|
---|
| 117 |
|
---|
[25956] | 118 | fielddisplay(self,'reltol','sea level change relative convergence criterion, (default, NaN: not applied)');
|
---|
| 119 | fielddisplay(self,'abstol','sea level change absolute convergence criterion, NaN: not applied');
|
---|
[25118] | 120 | fielddisplay(self,'maxiter','maximum number of nonlinear iterations');
|
---|
| 121 | fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area [default: No correction]');
|
---|
[25763] | 122 | fielddisplay(self,'computesealevelchange','compute sealevel change (default 1)');
|
---|
| 123 | fielddisplay(self,'isgrd','compute GRD patterns (default 1)');
|
---|
[26047] | 124 | fielddisplay(self,'compute_bp_grd','compute GRD patterns for bottom pressure loads (default 1)');
|
---|
[25125] | 125 | fielddisplay(self,'runfrequency','how many time steps we skip before we run solidearthsettings solver during transient (default: 1)');
|
---|
[25118] | 126 | fielddisplay(self,'rigid','rigid earth graviational potential perturbation');
|
---|
| 127 | fielddisplay(self,'elastic','elastic earth graviational potential perturbation');
|
---|
| 128 | fielddisplay(self,'rotation','earth rotational potential perturbation');
|
---|
| 129 | fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions');
|
---|
[25758] | 130 | fielddisplay(self,'glfraction','contribute fractionally (default, 1) to barystatic sea level');
|
---|
[26047] | 131 | fielddisplay(self,'grdmodel','type of deformation model, 1 for elastic, 2 for visco-elastic from Ivins');
|
---|
[26060] | 132 | fielddisplay(self,'cross_section_shape','1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore');
|
---|
[26126] | 133 | fielddisplay(self,'optim','use optimized version of the GRD code? (default 0)');
|
---|
[25118] | 134 | end % }}}
|
---|
| 135 | function marshall(self,prefix,md,fid) % {{{
|
---|
| 136 | WriteData(fid,prefix,'object',self,'fieldname','reltol','name','md.solidearth.settings.reltol','format','Double');
|
---|
| 137 | WriteData(fid,prefix,'object',self,'fieldname','abstol','name','md.solidearth.settings.abstol','format','Double');
|
---|
| 138 | WriteData(fid,prefix,'object',self,'fieldname','maxiter','name','md.solidearth.settings.maxiter','format','Integer');
|
---|
| 139 | WriteData(fid,prefix,'object',self,'fieldname','rigid','name','md.solidearth.settings.rigid','format','Boolean');
|
---|
| 140 | WriteData(fid,prefix,'object',self,'fieldname','elastic','name','md.solidearth.settings.elastic','format','Boolean');
|
---|
| 141 | WriteData(fid,prefix,'object',self,'fieldname','rotation','name','md.solidearth.settings.rotation','format','Boolean');
|
---|
| 142 | WriteData(fid,prefix,'object',self,'fieldname','ocean_area_scaling','name','md.solidearth.settings.ocean_area_scaling','format','Boolean');
|
---|
| 143 | WriteData(fid,prefix,'object',self,'fieldname','runfrequency','name','md.solidearth.settings.runfrequency','format','Integer');
|
---|
| 144 | WriteData(fid,prefix,'object',self,'fieldname','degacc','name','md.solidearth.settings.degacc','format','Double');
|
---|
| 145 | WriteData(fid,prefix,'object',self,'fieldname','horiz','name','md.solidearth.settings.horiz','format','Integer');
|
---|
| 146 | WriteData(fid,prefix,'object',self,'fieldname','computesealevelchange','name','md.solidearth.settings.computesealevelchange','format','Integer');
|
---|
[25763] | 147 | WriteData(fid,prefix,'object',self,'fieldname','isgrd','name','md.solidearth.settings.isgrd','format','Integer');
|
---|
[26047] | 148 | WriteData(fid,prefix,'object',self,'fieldname','compute_bp_grd','name','md.solidearth.settings.compute_bp_grd','format','Integer');
|
---|
[25758] | 149 | WriteData(fid,prefix,'object',self,'fieldname','glfraction','name','md.solidearth.settings.glfraction','format','Integer');
|
---|
[26047] | 150 | WriteData(fid,prefix,'object',self,'fieldname','grdmodel','name','md.solidearth.settings.grdmodel','format','Integer');
|
---|
| 151 | WriteData(fid,prefix,'object',self,'fieldname','cross_section_shape','name','md.solidearth.settings.cross_section_shape','format','Integer');
|
---|
[26126] | 152 | WriteData(fid,prefix,'object',self,'fieldname','optim','name','md.solidearth.settings.optim','format','Integer');
|
---|
[25118] | 153 | end % }}}
|
---|
| 154 | function savemodeljs(self,fid,modelname) % {{{
|
---|
| 155 |
|
---|
[25956] | 156 | writejsdouble(fid,[modelname '.solidearth.settings.maxiter'],self.maxiter);
|
---|
| 157 | writejsdouble(fid,[modelname '.solidearth.settings.reltol'],self.reltol);
|
---|
| 158 | writejsdouble(fid,[modelname '.solidearth.settings.abstol'],self.abstol);
|
---|
| 159 | writejsdouble(fid,[modelname '.solidearth.settings.rigid'],self.rigid);
|
---|
| 160 | writejsdouble(fid,[modelname '.solidearth.settings.elastic'],self.elastic);
|
---|
| 161 | writejsdouble(fid,[modelname '.solidearth.settings.rotation'],self.rotation);
|
---|
| 162 | writejsdouble(fid,[modelname '.solidearth.settings.ocean_area_scaling'],self.ocean_area_scaling);
|
---|
| 163 | writejsdouble(fid,[modelname '.solidearth.settings.run_frequency'],self.run_frequency);
|
---|
| 164 | writejsdouble(fid,[modelname '.solidearth.settings.degacc'],self.degacc);
|
---|
| 165 | writejsdouble(fid,[modelname '.solidearth.settings.glfraction'],self.glfraction);
|
---|
[26047] | 166 | writejsdouble(fid,[modelname '.solidearth.settings.cross_section_shape'],self.cross_section_shape);
|
---|
[26126] | 167 | writejsdouble(fid,[modelname '.solidearth.settings.optim'],self.optim);
|
---|
[25118] | 168 | end % }}}
|
---|
| 169 | function self = extrude(self,md) % {{{
|
---|
| 170 | end % }}}
|
---|
| 171 | end
|
---|
| 172 | end
|
---|