source: issm/oecreview/Archive/23390-24306/ISSM-23768-23769.diff@ 24307

Last change on this file since 24307 was 24307, checked in by Mathieu Morlighem, 5 years ago

NEW: adding Archive/23390-24306

File size: 4.7 KB
RevLine 
[24307]1Index: ../trunk-jpl/src/m/classes/basalforcingsismip6.m
2===================================================================
3--- ../trunk-jpl/src/m/classes/basalforcingsismip6.m (nonexistent)
4+++ ../trunk-jpl/src/m/classes/basalforcingsismip6.m (revision 23769)
5@@ -0,0 +1,86 @@
6+%ISMIP6 BASAL FORCINGS class definition
7+%
8+% Usage:
9+% basalforcingsismip6=basalforcingsismip6();
10+
11+classdef basalforcingsismip6
12+ properties (SetAccess=public)
13+ basin_id = NaN;
14+ gamma_0 = 0.;
15+ tf = NaN;
16+ tf_depths = 0.;
17+ delta_t = NaN;
18+ geothermalflux = NaN;
19+ groundedice_melting_rate = NaN;
20+ end
21+ methods
22+ function self = extrude(self,md) % {{{
23+ self.basin_id=project3d(md,'vector',self.basin_id,'type','element','layer',1);
24+ self.tf=project3d(md,'vector',self.tf,'type','element','layer',1);
25+ self.delta_t=project3d(md,'vector',self.delta_t,'type','element','layer',1);
26+ self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','element','layer',1); %bedrock only gets geothermal flux
27+ self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1);
28+ end % }}}
29+ function self = basalforcingspico(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+ end % }}}
54+ function md = checkconsistency(self,md,solution,analyses) % {{{
55+
56+ md = checkfield(md,'fieldname','basalforcings.basin_id','Inf',1,'>=',0,'<=',md.basalforcings.num_basins,'size',[md.mesh.numberofelements 1]);
57+ md = checkfield(md,'fieldname','basalforcings.gamma_0','numel',1,'NaN',1,'Inf',1,'>',0);
58+ md = checkfield(md,'fieldname','basalforcings.tf','Inf',1,'NaN',1);
59+ md = checkfield(md,'fieldname','basalforcings.tf_depths','numel',1,'NaN',1,'Inf',1,'>',0);
60+ md = checkfield(md,'fieldname','basalforcings.delta_t','NaN',1,'Inf',1,'size',[md.basalforcings.num_basins NaN]);
61+ md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'>=',0,'timeseries',1);
62+ md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
63+
64+ end % }}}
65+ function disp(self) % {{{
66+ disp(sprintf(' ISMIP6 basal melt rate parameterization:'));
67+ fielddisplay(self,'basin_id','basin number assigned to each node (unitless)');
68+ fielddisplay(self,'gamma_0','melt rate coefficient (m/yr)');
69+ fielddisplay(self,'tf','thermal forcing (ocean temperature minus freezing point) (degrees C)');
70+ fielddisplay(self,'tf_depths','Number of vertical layers in ocean thermal forcing dataset');
71+ fielddisplay(self,'delta_t','Ocean temperature correction per basin (degrees C)');
72+ fielddisplay(self,'geothermalflux','geothermal heat flux (W/m^2)');
73+ fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) (m/yr)');
74+
75+ end % }}}
76+ function marshall(self,prefix,md,fid) % {{{
77+
78+ %NEED TO ADD TF
79+ yts=md.constants.yts;
80+
81+ WriteData(fid,prefix,'name','md.basalforcings.model','data',5,'format','Integer');
82+ WriteData(fid,prefix,'object',self,'fieldname','basin_id','data',self.basin_id-1,'name','md.basalforcings.basin_id','format','IntMat','mattype',2); %0-indexed
83+ WriteData(fid,prefix,'object',self,'fieldname','gamma_0','format','Double');
84+ WriteData(fid,prefix,'object',self,'fieldname','tf_depths','format','DoubleMat','name','md.basalforcings.tf_depths','yts',md.constants.yts);
85+ WriteData(fid,prefix,'object',self,'fieldname','delta_t','format','DoubleMat','name','md.basalforcings.delta_t','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
86+ WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','name','md.basalforcings.geothermalflux','mattype',1,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
87+ 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);
88+
89+ end % }}}
90+ end
91+end
Note: See TracBrowser for help on using the repository browser.