1 | %CALVINGDEV class definition
|
---|
2 | %
|
---|
3 | % Usage:
|
---|
4 | % calvingdev=calvingdev();
|
---|
5 |
|
---|
6 | classdef calvingdev
|
---|
7 | properties (SetAccess=public)
|
---|
8 | stress_threshold_groundedice = 0.;
|
---|
9 | stress_threshold_floatingice = 0.;
|
---|
10 | meltingrate = NaN;
|
---|
11 | end
|
---|
12 | methods
|
---|
13 | function self = calvingdev(varargin) % {{{
|
---|
14 | switch nargin
|
---|
15 | case 0
|
---|
16 | self=setdefaultparameters(self);
|
---|
17 | case 1
|
---|
18 | inputstruct=varargin{1};
|
---|
19 | list1 = properties('calvingdev');
|
---|
20 | list2 = fieldnames(inputstruct);
|
---|
21 | for i=1:length(list1)
|
---|
22 | fieldname = list1{i};
|
---|
23 | if ismember(fieldname,list2),
|
---|
24 | self.(fieldname) = inputstruct.(fieldname);
|
---|
25 | end
|
---|
26 | end
|
---|
27 | otherwise
|
---|
28 | error('constructor not supported');
|
---|
29 | end
|
---|
30 | end % }}}
|
---|
31 | function self = extrude(self,md) % {{{
|
---|
32 | self.meltingrate=project3d(md,'vector',self.meltingrate,'type','node');
|
---|
33 | end % }}}
|
---|
34 | function self = setdefaultparameters(self) % {{{
|
---|
35 |
|
---|
36 | %Default sigma max
|
---|
37 | self.stress_threshold_groundedice = 1e6;
|
---|
38 | self.stress_threshold_floatingice = 150e3;
|
---|
39 | end % }}}
|
---|
40 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
41 | %Early return
|
---|
42 | if (~strcmp(solution,'TransientSolution') | md.transient.ismovingfront==0), return; end
|
---|
43 |
|
---|
44 | md = checkfield(md,'fieldname','calving.stress_threshold_groundedice','>',0,'nan',1,'Inf',1);
|
---|
45 | md = checkfield(md,'fieldname','calving.stress_threshold_floatingice','>',0,'nan',1,'Inf',1);
|
---|
46 | md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'Inf',1,'timeseries',1,'>=',0);
|
---|
47 | end % }}}
|
---|
48 | function disp(self) % {{{
|
---|
49 | disp(sprintf(' Calving Pi parameters:'));
|
---|
50 | fielddisplay(self,'stress_threshold_groundedice','sigma_max applied to grounded ice only [Pa]');
|
---|
51 | fielddisplay(self,'stress_threshold_floatingice','sigma_max applied to floating ice only [Pa]');
|
---|
52 | fielddisplay(self,'meltingrate','melting rate at given location [m/a]');
|
---|
53 |
|
---|
54 | end % }}}
|
---|
55 | function marshall(self,prefix,md,fid) % {{{
|
---|
56 | yts=md.constants.yts;
|
---|
57 | WriteData(fid,prefix,'name','md.calving.law','data',2,'format','Integer');
|
---|
58 | WriteData(fid,prefix,'object',self,'fieldname','stress_threshold_groundedice','format','DoubleMat','mattype',1);
|
---|
59 | WriteData(fid,prefix,'object',self,'fieldname','stress_threshold_floatingice','format','DoubleMat','mattype',1);
|
---|
60 | WriteData(fid,prefix,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1./yts);
|
---|
61 | end % }}}
|
---|
62 | end
|
---|
63 | end
|
---|