source: issm/trunk/src/m/classes/basalforcings.m

Last change on this file was 28013, checked in by Mathieu Morlighem, 16 months ago

merged trunk-jpl and trunk for revision 28011

File size: 4.6 KB
Line 
1%BASAL FORCINGS class definition
2%
3% Usage:
4% basalforcings=basalforcings();
5
6classdef basalforcings
7 properties (SetAccess=public)
8 groundedice_melting_rate = NaN;
9 floatingice_melting_rate = NaN;
10 perturbation_melting_rate = NaN;
11 geothermalflux = NaN;
12 end
13 methods
14 function self = basalforcings(varargin) % {{{
15 switch nargin
16 case 0
17 self=setdefaultparameters(self);
18 case 1
19 self =structtoobj(basalforcings(),varargin{1});
20 otherwise
21 error('constructor not supported');
22 end
23 end % }}}
24 function disp(self) % {{{
25 disp(sprintf(' basal forcings parameters:'));
26
27 fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) [m/yr]');
28 fielddisplay(self,'floatingice_melting_rate','basal melting rate (positive if melting) [m/yr]');
29 fielddisplay(self,'perturbation_melting_rate','(optional) perturbation in basal melting rate under floating ice [m/yr]');
30 fielddisplay(self,'geothermalflux','geothermal heat flux [W/m^2]');
31
32 end % }}}
33 function self = extrude(self,md) % {{{
34 self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1);
35 self.floatingice_melting_rate=project3d(md,'vector',self.floatingice_melting_rate,'type','node','layer',1);
36 self.perturbation_melting_rate=project3d(md,'vector',self.perturbation_melting_rate,'type','node','layer',1);
37 self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','node','layer',1); %bedrock only gets geothermal flux
38 end % }}}
39 function self = initialize(self,md) % {{{
40
41 if isnan(self.groundedice_melting_rate),
42 self.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1);
43 disp(' no basalforcings.groundedice_melting_rate specified: values set as zero');
44 end
45
46 if isnan(self.floatingice_melting_rate),
47 self.floatingice_melting_rate=zeros(md.mesh.numberofvertices,1);
48 disp(' no basalforcings.floatingice_melting_rate specified: values set as zero');
49 end
50
51 end % }}}
52 function self = setdefaultparameters(self) % {{{
53
54 end % }}}
55 function md = checkconsistency(self,md,solution,analyses) % {{{
56
57 if ismember('MasstransportAnalysis',analyses) & ~(strcmp(solution,'TransientSolution') & md.transient.ismasstransport==0),
58 md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
59 md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
60 end
61 if ismember('BalancethicknessAnalysis',analyses),
62 md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
63 md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
64 end
65 if ismember('ThermalAnalysis',analyses) & ~(strcmp(solution,'TransientSolution') & md.transient.isthermal==0),
66 md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
67 md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
68 md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'timeseries',1,'>=',0);
69 end
70 end % }}}
71 function marshall(self,prefix,md,fid) % {{{
72
73 yts=md.constants.yts;
74
75 WriteData(fid,prefix,'name','md.basalforcings.model','data',1,'format','Integer');
76 WriteData(fid,prefix,'object',self,'fieldname','groundedice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts)
77 WriteData(fid,prefix,'object',self,'fieldname','floatingice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts)
78 WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
79 WriteData(fid,prefix,'object',self,'fieldname','perturbation_melting_rate','format','DoubleMat','name','md.basalforcings.perturbation_melting_rate','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts)
80 end % }}}
81 function savemodeljs(self,fid,modelname) % {{{
82
83 writejs1Darray(fid,[modelname '.basalforcings.groundedice_melting_rate'],self.groundedice_melting_rate);
84 writejs1Darray(fid,[modelname '.basalforcings.floatingice_melting_rate'],self.floatingice_melting_rate);
85 writejs1Darray(fid,[modelname '.basalforcings.perturbation_melting_rate'],self.perturbation_melting_rate);
86 writejs1Darray(fid,[modelname '.basalforcings.geothermalflux'],self.geothermalflux);
87
88 end % }}}
89 end
90end
Note: See TracBrowser for help on using the repository browser.