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