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