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

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

NEW: adding Archive/23390-24306

File size: 4.7 KB
  • ../trunk-jpl/src/m/classes/basalforcingsismip6.m

     
     1%ISMIP6 BASAL FORCINGS class definition
     2%
     3%   Usage:
     4%      basalforcingsismip6=basalforcingsismip6();
     5
     6classdef basalforcingsismip6
     7        properties (SetAccess=public)
     8                basin_id                  = NaN;
     9                gamma_0                   = 0.;
     10                tf                        = NaN;
     11                tf_depths                 = 0.;
     12                delta_t                   = NaN;
     13                geothermalflux            = NaN;
     14                groundedice_melting_rate  = NaN;
     15        end
     16        methods
     17                function self = extrude(self,md) % {{{
     18                        self.basin_id=project3d(md,'vector',self.basin_id,'type','element','layer',1);
     19                        self.tf=project3d(md,'vector',self.tf,'type','element','layer',1);
     20                        self.delta_t=project3d(md,'vector',self.delta_t,'type','element','layer',1);
     21                        self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','element','layer',1); %bedrock only gets geothermal flux
     22                        self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1);
     23                end % }}}
     24                function self = basalforcingspico(varargin) % {{{
     25                        switch nargin
     26                                case 0
     27                                        self=setdefaultparameters(self);
     28                                case 1
     29                                        self=setdefaultparameters(self);
     30                                        self=structtoobj(self,varargin{1});
     31                                otherwise
     32                                        error('constructor not supported');
     33                        end
     34                end % }}}
     35                function self = initialize(self,md) % {{{
     36                        if self.gamma_0 == 0,
     37                                self.gamma_0 = 14477;
     38                                disp('      no basalforcings.gamma_0 specified: value set to 14477 m/yr');
     39                        end
     40                        if isnan(self.groundedice_melting_rate),
     41                                self.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1);
     42                                disp('      no basalforcings.groundedice_melting_rate specified: values set as zero');
     43                        end
     44
     45                end % }}}
     46                function self = setdefaultparameters(self) % {{{
     47                        self.gamma_0 = 14477; %m/yr
     48                end % }}}
     49                function md = checkconsistency(self,md,solution,analyses) % {{{
     50
     51                                md = checkfield(md,'fieldname','basalforcings.basin_id','Inf',1,'>=',0,'<=',md.basalforcings.num_basins,'size',[md.mesh.numberofelements 1]);
     52                                md = checkfield(md,'fieldname','basalforcings.gamma_0','numel',1,'NaN',1,'Inf',1,'>',0);
     53                                md = checkfield(md,'fieldname','basalforcings.tf','Inf',1,'NaN',1);
     54                                md = checkfield(md,'fieldname','basalforcings.tf_depths','numel',1,'NaN',1,'Inf',1,'>',0);
     55                                md = checkfield(md,'fieldname','basalforcings.delta_t','NaN',1,'Inf',1,'size',[md.basalforcings.num_basins NaN]);
     56                                md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'>=',0,'timeseries',1);
     57                                md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
     58
     59                end % }}}
     60                function disp(self) % {{{
     61                        disp(sprintf('   ISMIP6 basal melt rate parameterization:'));
     62                        fielddisplay(self,'basin_id','basin number assigned to each node (unitless)');
     63                        fielddisplay(self,'gamma_0','melt rate coefficient (m/yr)');
     64                        fielddisplay(self,'tf','thermal forcing (ocean temperature minus freezing point) (degrees C)');
     65                        fielddisplay(self,'tf_depths','Number of vertical layers in ocean thermal forcing dataset');
     66                        fielddisplay(self,'delta_t','Ocean temperature correction per basin (degrees C)');
     67                        fielddisplay(self,'geothermalflux','geothermal heat flux (W/m^2)');
     68                        fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) (m/yr)');
     69
     70                end % }}}
     71                function marshall(self,prefix,md,fid) % {{{
     72
     73         %NEED TO ADD TF
     74                        yts=md.constants.yts;
     75
     76                        WriteData(fid,prefix,'name','md.basalforcings.model','data',5,'format','Integer');
     77                        WriteData(fid,prefix,'object',self,'fieldname','basin_id','data',self.basin_id-1,'name','md.basalforcings.basin_id','format','IntMat','mattype',2);   %0-indexed
     78                        WriteData(fid,prefix,'object',self,'fieldname','gamma_0','format','Double');
     79                        WriteData(fid,prefix,'object',self,'fieldname','tf_depths','format','DoubleMat','name','md.basalforcings.tf_depths','yts',md.constants.yts);
     80                        WriteData(fid,prefix,'object',self,'fieldname','delta_t','format','DoubleMat','name','md.basalforcings.delta_t','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
     81                        WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','name','md.basalforcings.geothermalflux','mattype',1,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
     82                        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);
     83
     84                end % }}}
     85        end
     86end
Note: See TracBrowser for help on using the repository browser.