1 | %ISMIP6 BASAL FORCINGS class definition
|
---|
2 | %
|
---|
3 | % Usage:
|
---|
4 | % basalforcingsismip6=basalforcingsismip6();
|
---|
5 |
|
---|
6 | classdef basalforcingsismip6
|
---|
7 | properties (SetAccess=public)
|
---|
8 | num_basins = 0;
|
---|
9 | basin_id = NaN;
|
---|
10 | gamma_0 = 0.;
|
---|
11 | tf = NaN;
|
---|
12 | tf_depths = NaN;
|
---|
13 | delta_t = NaN;
|
---|
14 | islocal = 0;
|
---|
15 | geothermalflux = NaN;
|
---|
16 | groundedice_melting_rate = NaN;
|
---|
17 | melt_anomaly = NaN;
|
---|
18 | end
|
---|
19 | methods
|
---|
20 | function self = extrude(self,md) % {{{
|
---|
21 | self.basin_id=project3d(md,'vector',self.basin_id,'type','element','layer',1);
|
---|
22 | %self.tf=project3d(md,'vector',self.tf,'type','element','layer',1);
|
---|
23 | %self.delta_t=project3d(md,'vector',self.delta_t,'type','element','layer',1);
|
---|
24 | self.tf=project3d(md,'vector',self.tf,'type','node');
|
---|
25 | self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','element','layer',1); %bedrock only gets geothermal flux
|
---|
26 | self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1);
|
---|
27 | self.melt_anomaly=project3d(md,'vector',self.melt_anomaly,'type','element','layer',1); %bedrock only gets geothermal flux
|
---|
28 | end % }}}
|
---|
29 | function self = basalforcingsismip6(varargin) % {{{
|
---|
30 | switch nargin
|
---|
31 | case 0
|
---|
32 | self=setdefaultparameters(self);
|
---|
33 | case 1
|
---|
34 | self=setdefaultparameters(self);
|
---|
35 | self=structtoobj(self,varargin{1});
|
---|
36 | otherwise
|
---|
37 | error('constructor not supported');
|
---|
38 | end
|
---|
39 | end % }}}
|
---|
40 | function self = initialize(self,md) % {{{
|
---|
41 | if self.gamma_0 == 0,
|
---|
42 | self.gamma_0 = 14477;
|
---|
43 | disp(' no basalforcings.gamma_0 specified: value set to 14477 m/yr');
|
---|
44 | end
|
---|
45 | if isnan(self.groundedice_melting_rate),
|
---|
46 | self.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1);
|
---|
47 | disp(' no basalforcings.groundedice_melting_rate specified: values set as zero');
|
---|
48 | end
|
---|
49 |
|
---|
50 | end % }}}
|
---|
51 | function self = setdefaultparameters(self) % {{{
|
---|
52 | self.gamma_0 = 14477; %m/yr
|
---|
53 | self.islocal = false;
|
---|
54 | end % }}}
|
---|
55 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
56 |
|
---|
57 | md = checkfield(md,'fieldname','basalforcings.num_basins','numel',1,'NaN',1,'Inf',1,'>',0);
|
---|
58 | md = checkfield(md,'fieldname','basalforcings.basin_id','Inf',1,'>=',0,'<=',md.basalforcings.num_basins,'size',[md.mesh.numberofelements 1]);
|
---|
59 | md = checkfield(md,'fieldname','basalforcings.gamma_0','numel',1,'NaN',1,'Inf',1,'>',0);
|
---|
60 | md = checkfield(md,'fieldname','basalforcings.tf_depths','NaN',1,'Inf',1);
|
---|
61 | md = checkfield(md,'fieldname','basalforcings.delta_t','NaN',1,'Inf',1,'numel',md.basalforcings.num_basins,'size',[1,md.basalforcings.num_basins]);
|
---|
62 | md = checkfield(md,'fieldname','basalforcings.islocal','values',[0 1]);
|
---|
63 | md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'>=',0,'timeseries',1);
|
---|
64 | md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
|
---|
65 | if length(md.basalforcings.melt_anomaly)>1,
|
---|
66 | md = checkfield(md,'fieldname','basalforcings.melt_anomaly','NaN',1,'Inf',1,'timeseries',1);
|
---|
67 | end
|
---|
68 |
|
---|
69 | md = checkfield(md,'fieldname','basalforcings.tf','size',[1,1,numel(md.basalforcings.tf_depths)]);
|
---|
70 | for i=1:numel(md.basalforcings.tf_depths)
|
---|
71 | md = checkfield(md,'fieldname',['basalforcings.tf{' num2str(i) '}'],'field',md.basalforcings.tf{i},'size',[md.mesh.numberofvertices+1 NaN],'NaN',1,'Inf',1,'>=',0,'timeseries',1);
|
---|
72 | end
|
---|
73 |
|
---|
74 | end % }}}
|
---|
75 | function disp(self) % {{{
|
---|
76 | disp(sprintf(' ISMIP6 basal melt rate parameterization:'));
|
---|
77 | fielddisplay(self,'num_basins','number of basins the model domain is partitioned into [unitless]');
|
---|
78 | fielddisplay(self,'basin_id','basin number assigned to each node (unitless)');
|
---|
79 | fielddisplay(self,'gamma_0','melt rate coefficient (m/yr)');
|
---|
80 | fielddisplay(self,'tf_depths','Number of vertical layers in ocean thermal forcing dataset');
|
---|
81 | fielddisplay(self,'tf','thermal forcing (ocean temperature minus freezing point) (degrees C)');
|
---|
82 | fielddisplay(self,'delta_t','Ocean temperature correction per basin (degrees C)');
|
---|
83 | fielddisplay(self,'islocal','boolean to use the local version of the ISMIP6 melt rate parameterization (default false)');
|
---|
84 | fielddisplay(self,'geothermalflux','geothermal heat flux (W/m^2)');
|
---|
85 | fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) (m/yr)');
|
---|
86 | fielddisplay(self,'melt_anomaly','floating ice basal melt anomaly (m/yr)');
|
---|
87 |
|
---|
88 | end % }}}
|
---|
89 | function marshall(self,prefix,md,fid) % {{{
|
---|
90 |
|
---|
91 | yts=md.constants.yts;
|
---|
92 |
|
---|
93 | WriteData(fid,prefix,'name','md.basalforcings.model','data',7,'format','Integer');
|
---|
94 | WriteData(fid,prefix,'object',self,'fieldname','num_basins','format','Integer');
|
---|
95 | WriteData(fid,prefix,'object',self,'fieldname','basin_id','data',self.basin_id-1,'name','md.basalforcings.basin_id','format','IntMat','mattype',2); %0-indexed
|
---|
96 | WriteData(fid,prefix,'object',self,'fieldname','gamma_0','format','Double','scale',1./yts);
|
---|
97 | WriteData(fid,prefix,'object',self,'fieldname','tf_depths','format','DoubleMat','name','md.basalforcings.tf_depths');
|
---|
98 | WriteData(fid,prefix,'object',self,'fieldname','tf','format','MatArray','name','md.basalforcings.tf','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
|
---|
99 | WriteData(fid,prefix,'object',self,'fieldname','delta_t','format','DoubleMat','name','md.basalforcings.delta_t','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
|
---|
100 | WriteData(fid,prefix,'object',self,'fieldname','islocal','format','Boolean');
|
---|
101 | WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','name','md.basalforcings.geothermalflux','mattype',1,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
|
---|
102 | WriteData(fid,prefix,'object',self,'fieldname','groundedice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
|
---|
103 | WriteData(fid,prefix,'object',self,'fieldname','melt_anomaly','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
|
---|
104 |
|
---|
105 | end % }}}
|
---|
106 | end
|
---|
107 | end
|
---|