source: issm/trunk-jpl/src/m/classes/solidearthsettings.m@ 26222

Last change on this file since 26222 was 26222, checked in by Eric.Larour, 4 years ago

CHG: Mathieu, here it is, just one year too late :) or one year early depending on how you see it.

Dakota: pre core capability, for things called only once prior to sampling, which could
not be called in the ModelProcessorx.

SealevelGeometry now used to optimize structures passed betweens sea level cores.

SealevelMasks: gone.

Mask logic now moved to the geometry core in the sea level solution. We now compute
barycentres of loads, for elements that can be interesected by up to two levelsets.
Allows for loading differentailly for hydro, ice, bp and ocean loads. Essentially
a sub-element parameterization of sea level solver.

File size: 8.0 KB
Line 
1%SOLIDEARTHSETTINGS class definition
2%
3% Usage:
4% solidearthsettings=solidearthsettings();
5
6classdef 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
16 computesealevelchange = 1; %will sea-level be coputed?
17 isgrd = 1; %will GRD patterns be computed?
18 compute_bp_grd = 1; %will GRD patterns for bottom pressures be computed?
19 degacc = 0; %degree increment for resolution of Green tables
20 horiz = 0; %compute horizontal deformation
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
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
36 self.reltol=0.01; % 1 percent
37 self.abstol=NaN; % default
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;
47 self.compute_bp_grd=1;
48 self.isgrd=0;
49 self.computesealevelchange=1;
50
51 %numerical discretization accuracy
52 self.degacc=.01;
53
54 %how many time steps we skip before we run solidearthsettings solver during transient
55 self.runfrequency=1;
56
57 %horizontal displacement? (not by default)
58 self.horiz=0;
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
66 end % }}}
67 function md = checkconsistency(self,md,solution,analyses) % {{{
68
69 if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc==0),
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]);
78 md = checkfield(md,'fieldname','solidearth.settings.grdmodel','values',[1 2]);
79 md = checkfield(md,'fieldname','solidearth.settings.cross_section_shape','numel',[1],'values',[1,2]);
80
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
86 %a GRD computation has been requested, make some checks on the nature of the meshes provided.
87 if self.isgrd,
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
92 else
93 if self.grdmodel==1,
94 error('model requires a 3D surface mesh to run GRD computations (change mesh from mesh2d to mesh3dsurface)');
95 end
96 end
97 end
98
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
104 end % }}}
105 function disp(self) % {{{
106 disp(sprintf(' solidearth settings:'));
107
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');
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]');
112 fielddisplay(self,'computesealevelchange','compute sealevel change (default 1)');
113 fielddisplay(self,'isgrd','compute GRD patterns (default 1)');
114 fielddisplay(self,'compute_bp_grd','compute GRD patterns for bottom pressure loads (default 1)');
115 fielddisplay(self,'runfrequency','how many time steps we skip before we run solidearthsettings solver during transient (default: 1)');
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');
120 fielddisplay(self,'grdmodel','type of deformation model, 1 for elastic, 2 for visco-elastic from Ivins');
121 fielddisplay(self,'cross_section_shape','1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore');
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');
135 WriteData(fid,prefix,'object',self,'fieldname','isgrd','name','md.solidearth.settings.isgrd','format','Integer');
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');
139 end % }}}
140 function savemodeljs(self,fid,modelname) % {{{
141
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);
151 writejsdouble(fid,[modelname '.solidearth.settings.cross_section_shape'],self.cross_section_shape);
152 end % }}}
153 function self = extrude(self,md) % {{{
154 end % }}}
155 end
156end
Note: See TracBrowser for help on using the repository browser.