Index: ../trunk-jpl/src/m/classes/basalforcingsismip6.m =================================================================== --- ../trunk-jpl/src/m/classes/basalforcingsismip6.m (nonexistent) +++ ../trunk-jpl/src/m/classes/basalforcingsismip6.m (revision 23769) @@ -0,0 +1,86 @@ +%ISMIP6 BASAL FORCINGS class definition +% +% Usage: +% basalforcingsismip6=basalforcingsismip6(); + +classdef basalforcingsismip6 + properties (SetAccess=public) + basin_id = NaN; + gamma_0 = 0.; + tf = NaN; + tf_depths = 0.; + delta_t = NaN; + geothermalflux = NaN; + groundedice_melting_rate = NaN; + end + methods + function self = extrude(self,md) % {{{ + self.basin_id=project3d(md,'vector',self.basin_id,'type','element','layer',1); + self.tf=project3d(md,'vector',self.tf,'type','element','layer',1); + self.delta_t=project3d(md,'vector',self.delta_t,'type','element','layer',1); + self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','element','layer',1); %bedrock only gets geothermal flux + self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1); + end % }}} + function self = basalforcingspico(varargin) % {{{ + switch nargin + case 0 + self=setdefaultparameters(self); + case 1 + self=setdefaultparameters(self); + self=structtoobj(self,varargin{1}); + otherwise + error('constructor not supported'); + end + end % }}} + function self = initialize(self,md) % {{{ + if self.gamma_0 == 0, + self.gamma_0 = 14477; + disp(' no basalforcings.gamma_0 specified: value set to 14477 m/yr'); + end + if isnan(self.groundedice_melting_rate), + self.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1); + disp(' no basalforcings.groundedice_melting_rate specified: values set as zero'); + end + + end % }}} + function self = setdefaultparameters(self) % {{{ + self.gamma_0 = 14477; %m/yr + end % }}} + function md = checkconsistency(self,md,solution,analyses) % {{{ + + md = checkfield(md,'fieldname','basalforcings.basin_id','Inf',1,'>=',0,'<=',md.basalforcings.num_basins,'size',[md.mesh.numberofelements 1]); + md = checkfield(md,'fieldname','basalforcings.gamma_0','numel',1,'NaN',1,'Inf',1,'>',0); + md = checkfield(md,'fieldname','basalforcings.tf','Inf',1,'NaN',1); + md = checkfield(md,'fieldname','basalforcings.tf_depths','numel',1,'NaN',1,'Inf',1,'>',0); + md = checkfield(md,'fieldname','basalforcings.delta_t','NaN',1,'Inf',1,'size',[md.basalforcings.num_basins NaN]); + md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'>=',0,'timeseries',1); + md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1); + + end % }}} + function disp(self) % {{{ + disp(sprintf(' ISMIP6 basal melt rate parameterization:')); + fielddisplay(self,'basin_id','basin number assigned to each node (unitless)'); + fielddisplay(self,'gamma_0','melt rate coefficient (m/yr)'); + fielddisplay(self,'tf','thermal forcing (ocean temperature minus freezing point) (degrees C)'); + fielddisplay(self,'tf_depths','Number of vertical layers in ocean thermal forcing dataset'); + fielddisplay(self,'delta_t','Ocean temperature correction per basin (degrees C)'); + fielddisplay(self,'geothermalflux','geothermal heat flux (W/m^2)'); + fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) (m/yr)'); + + end % }}} + function marshall(self,prefix,md,fid) % {{{ + + %NEED TO ADD TF + yts=md.constants.yts; + + WriteData(fid,prefix,'name','md.basalforcings.model','data',5,'format','Integer'); + WriteData(fid,prefix,'object',self,'fieldname','basin_id','data',self.basin_id-1,'name','md.basalforcings.basin_id','format','IntMat','mattype',2); %0-indexed + WriteData(fid,prefix,'object',self,'fieldname','gamma_0','format','Double'); + WriteData(fid,prefix,'object',self,'fieldname','tf_depths','format','DoubleMat','name','md.basalforcings.tf_depths','yts',md.constants.yts); + WriteData(fid,prefix,'object',self,'fieldname','delta_t','format','DoubleMat','name','md.basalforcings.delta_t','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); + WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','name','md.basalforcings.geothermalflux','mattype',1,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); + 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); + + end % }}} + end +end