source: issm/trunk-jpl/src/m/classes/esa.m@ 22349

Last change on this file since 22349 was 22349, checked in by adhikari, 7 years ago

CHG: ESA2D can now compute north east components of 2D crustal disp vector

File size: 4.2 KB
Line 
1%ESA class definition
2%
3% Usage:
4% esa=esa();
5
6classdef esa
7 properties (SetAccess=public)
8 deltathickness = NaN;
9 love_h = 0; %provided by PREM model
10 love_l = 0; %ideam
11 degacc = 0;
12 hemisphere = 0;
13 requested_outputs = {};
14 transitions = {};
15 end
16 methods
17 function self = esa(varargin) % {{{
18 switch nargin
19 case 0
20 self=setdefaultparameters(self);
21 otherwise
22 error('constructor not supported');
23 end
24 end % }}}
25 function self = setdefaultparameters(self) % {{{
26
27 %numerical discretization accuracy
28 self.degacc=.01;
29
30 %computational flags:
31 self.hemisphere=0;
32
33 %output default:
34 self.requested_outputs={'default'};
35
36 %transitions should be a cell array of vectors:
37 self.transitions={};
38
39 end % }}}
40 function md = checkconsistency(self,md,solution,analyses) % {{{
41
42 if ~ismember('EsaAnalysis',analyses), return; end
43 md = checkfield(md,'fieldname','esa.deltathickness','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
44 md = checkfield(md,'fieldname','esa.love_h','NaN',1,'Inf',1);
45 md = checkfield(md,'fieldname','esa.love_l','NaN',1,'Inf',1);
46 md = checkfield(md,'fieldname','esa.degacc','size',[1 1],'>=',1e-10);
47 md = checkfield(md,'fieldname','esa.requested_outputs','stringrow',1);
48
49 %check that love numbers are provided at the same level of accuracy:
50 if (size(self.love_h,1)~=size(self.love_l,1)),
51 error('esa error message: love numbers should be provided at the same level of accuracy');
52 end
53
54 %cross check that whereever we have an ice load, the mask is <0 on each vertex:
55 pos=find(self.deltathickness);
56 maskpos=md.mask.ice_levelset(md.mesh.elements(pos,:));
57 [els,vertices]=find(maskpos>0);
58 if length(els),
59 error('esa checkconsistency fail: there are elements with ice loads where some vertices are not on the ice!');
60 end
61
62 end % }}}
63 function list=defaultoutputs(self,md) % {{{
64 list = {'EsaUmotion'};
65 end % }}}
66 function disp(self) % {{{
67 disp(sprintf(' esa parameters:'));
68
69 fielddisplay(self,'deltathickness','thickness change: ice height equivalent [m]');
70 fielddisplay(self,'love_h','load Love number for radial displacement');
71 fielddisplay(self,'love_l','load Love number for horizontal displacements');
72 fielddisplay(self,'hemisphere','North-south, East-west components of 2-D horiz displacement vector: -1 south, 1 north');
73 fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions');
74 fielddisplay(self,'transitions','indices into parts of the mesh that will be icecaps');
75 fielddisplay(self,'requested_outputs','additional outputs requested (e.g., EsaUmotion, EsaStrainratexx, EsaRotationrate)');
76
77 end % }}}
78 function marshall(self,prefix,md,fid) % {{{
79 WriteData(fid,prefix,'object',self,'fieldname','deltathickness','format','DoubleMat','mattype',2);
80 WriteData(fid,prefix,'object',self,'fieldname','love_h','format','DoubleMat','mattype',1);
81 WriteData(fid,prefix,'object',self,'fieldname','love_l','format','DoubleMat','mattype',1);
82 WriteData(fid,prefix,'object',self,'fieldname','hemisphere','format','Integer');
83 WriteData(fid,prefix,'object',self,'fieldname','degacc','format','Double');
84 WriteData(fid,prefix,'object',self,'fieldname','transitions','format','MatArray');
85
86 %process requested outputs
87 outputs = self.requested_outputs;
88 pos = find(ismember(outputs,'default'));
89 if ~isempty(pos),
90 outputs(pos) = []; %remove 'default' from outputs
91 outputs = [outputs defaultoutputs(self,md)]; %add defaults
92 end
93 WriteData(fid,prefix,'data',outputs,'name','md.esa.requested_outputs','format','StringArray');
94
95 end % }}}
96 function savemodeljs(self,fid,modelname) % {{{
97
98 writejs1Darray(fid,[modelname '.esa.deltathickness'],self.deltathickness);
99 writejs1Darray(fid,[modelname '.esa.love_h'],self.love_h);
100 writejs1Darray(fid,[modelname '.esa.love_l'],self.love_l);
101 writejsdouble(fid,[modelname '.esa.hemisphere'],self.hemisphere);
102 writejsdouble(fid,[modelname '.esa.degacc'],self.degacc);
103 writejscellstring(fid,[modelname '.esa.requested_outputs'],self.requested_outputs);
104 writejscellarray(fid,[modelname '.esa.transitions'],self.transitions);
105 end % }}}
106 end
107end
Note: See TracBrowser for help on using the repository browser.