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

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

CHG: md.esa.hemisphere introduced

File size: 4.3 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.hemisphere','NaN',1,'Inf',1);
47 md = checkfield(md,'fieldname','esa.degacc','size',[1 1],'>=',1e-10);
48 md = checkfield(md,'fieldname','esa.requested_outputs','stringrow',1);
49
50 %check that love numbers are provided at the same level of accuracy:
51 if (size(self.love_h,1)~=size(self.love_l,1)),
52 error('esa error message: love numbers should be provided at the same level of accuracy');
53 end
54
55 %cross check that whereever we have an ice load, the mask is <0 on each vertex:
56 pos=find(self.deltathickness);
57 maskpos=md.mask.ice_levelset(md.mesh.elements(pos,:));
58 [els,vertices]=find(maskpos>0);
59 if length(els),
60 error('esa checkconsistency fail: there are elements with ice loads where some vertices are not on the ice!');
61 end
62
63 end % }}}
64 function list=defaultoutputs(self,md) % {{{
65 list = {'EsaUmotion'};
66 end % }}}
67 function disp(self) % {{{
68 disp(sprintf(' esa parameters:'));
69
70 fielddisplay(self,'deltathickness','thickness change: ice height equivalent [m]');
71 fielddisplay(self,'love_h','load Love number for radial displacement');
72 fielddisplay(self,'love_l','load Love number for horizontal displacements');
73 fielddisplay(self,'hemisphere','North-south, East-west components of 2-D horiz displacement vector: -1 south, 1 north');
74 fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions');
75 fielddisplay(self,'transitions','indices into parts of the mesh that will be icecaps');
76 fielddisplay(self,'requested_outputs','additional outputs requested (e.g., EsaUmotion, EsaStrainratexx, EsaRotationrate)');
77
78 end % }}}
79 function marshall(self,prefix,md,fid) % {{{
80 WriteData(fid,prefix,'object',self,'fieldname','deltathickness','format','DoubleMat','mattype',2);
81 WriteData(fid,prefix,'object',self,'fieldname','love_h','format','DoubleMat','mattype',1);
82 WriteData(fid,prefix,'object',self,'fieldname','love_l','format','DoubleMat','mattype',1);
83 WriteData(fid,prefix,'object',self,'fieldname','hemisphere','format','Integer');
84 WriteData(fid,prefix,'object',self,'fieldname','degacc','format','Double');
85 WriteData(fid,prefix,'object',self,'fieldname','transitions','format','MatArray');
86
87 %process requested outputs
88 outputs = self.requested_outputs;
89 pos = find(ismember(outputs,'default'));
90 if ~isempty(pos),
91 outputs(pos) = []; %remove 'default' from outputs
92 outputs = [outputs defaultoutputs(self,md)]; %add defaults
93 end
94 WriteData(fid,prefix,'data',outputs,'name','md.esa.requested_outputs','format','StringArray');
95
96 end % }}}
97 function savemodeljs(self,fid,modelname) % {{{
98
99 writejs1Darray(fid,[modelname '.esa.deltathickness'],self.deltathickness);
100 writejs1Darray(fid,[modelname '.esa.love_h'],self.love_h);
101 writejs1Darray(fid,[modelname '.esa.love_l'],self.love_l);
102 writejsdouble(fid,[modelname '.esa.hemisphere'],self.hemisphere);
103 writejsdouble(fid,[modelname '.esa.degacc'],self.degacc);
104 writejscellstring(fid,[modelname '.esa.requested_outputs'],self.requested_outputs);
105 writejscellarray(fid,[modelname '.esa.transitions'],self.transitions);
106 end % }}}
107 end
108end
Note: See TracBrowser for help on using the repository browser.