source: issm/trunk/src/m/classes/basalforcingsismip6.m@ 26744

Last change on this file since 26744 was 26744, checked in by Mathieu Morlighem, 3 years ago

merged trunk-jpl and trunk for revision 26742

File size: 6.0 KB
RevLine 
[23769]1%ISMIP6 BASAL FORCINGS class definition
2%
3% Usage:
4% basalforcingsismip6=basalforcingsismip6();
5
6classdef basalforcingsismip6
7 properties (SetAccess=public)
[23777]8 num_basins = 0;
[23769]9 basin_id = NaN;
10 gamma_0 = 0.;
11 tf = NaN;
[23777]12 tf_depths = NaN;
[23769]13 delta_t = NaN;
[23906]14 islocal = 0;
[23769]15 geothermalflux = NaN;
16 groundedice_melting_rate = NaN;
[24044]17 melt_anomaly = NaN;
[23769]18 end
19 methods
20 function self = extrude(self,md) % {{{
21 self.basin_id=project3d(md,'vector',self.basin_id,'type','element','layer',1);
[24010]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');
[23769]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);
[24044]27 self.melt_anomaly=project3d(md,'vector',self.melt_anomaly,'type','element','layer',1); %bedrock only gets geothermal flux
[23769]28 end % }}}
[23777]29 function self = basalforcingsismip6(varargin) % {{{
[23769]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
[23906]53 self.islocal = false;
[23769]54 end % }}}
55 function md = checkconsistency(self,md,solution,analyses) % {{{
56
[23777]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);
[26744]61 md = checkfield(md,'fieldname','basalforcings.delta_t','NaN',1,'Inf',1,'numel',md.basalforcings.num_basins,'size',[1,md.basalforcings.num_basins]);
[23906]62 md = checkfield(md,'fieldname','basalforcings.islocal','values',[0 1]);
[23777]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);
[24044]65 if length(md.basalforcings.melt_anomaly)>1,
66 md = checkfield(md,'fieldname','basalforcings.melt_anomaly','NaN',1,'Inf',1,'timeseries',1);
67 end
[23769]68
[23781]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
[23769]74 end % }}}
75 function disp(self) % {{{
76 disp(sprintf(' ISMIP6 basal melt rate parameterization:'));
[23777]77 fielddisplay(self,'num_basins','number of basins the model domain is partitioned into [unitless]');
[23769]78 fielddisplay(self,'basin_id','basin number assigned to each node (unitless)');
79 fielddisplay(self,'gamma_0','melt rate coefficient (m/yr)');
[23777]80 fielddisplay(self,'tf_depths','Number of vertical layers in ocean thermal forcing dataset');
[23769]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)');
[23906]83 fielddisplay(self,'islocal','boolean to use the local version of the ISMIP6 melt rate parameterization (default false)');
[23769]84 fielddisplay(self,'geothermalflux','geothermal heat flux (W/m^2)');
85 fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) (m/yr)');
[24044]86 fielddisplay(self,'melt_anomaly','floating ice basal melt anomaly (m/yr)');
[23769]87
88 end % }}}
89 function marshall(self,prefix,md,fid) % {{{
90
91 yts=md.constants.yts;
92
[23781]93 WriteData(fid,prefix,'name','md.basalforcings.model','data',7,'format','Integer');
[23777]94 WriteData(fid,prefix,'object',self,'fieldname','num_basins','format','Integer');
[23769]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
[23799]96 WriteData(fid,prefix,'object',self,'fieldname','gamma_0','format','Double','scale',1./yts);
[23781]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);
[23769]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);
[23906]100 WriteData(fid,prefix,'object',self,'fieldname','islocal','format','Boolean');
[23769]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);
[24044]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);
[23769]104
105 end % }}}
106 end
107end
Note: See TracBrowser for help on using the repository browser.