source: issm/trunk-jpl/src/m/classes/calvingdev.m@ 22045

Last change on this file since 22045 was 22045, checked in by Mathieu Morlighem, 8 years ago

CHG: allowing 2d fields for calvingdev

File size: 2.4 KB
RevLine 
[19034]1%CALVINGDEV class definition
2%
3% Usage:
4% calvingdev=calvingdev();
5
6classdef calvingdev
7 properties (SetAccess=public)
[21626]8 stress_threshold_groundedice = 0.;
9 stress_threshold_floatingice = 0.;
[19034]10 meltingrate = NaN;
11 end
12 methods
[19040]13 function self = calvingdev(varargin) % {{{
[19034]14 switch nargin
15 case 0
[19040]16 self=setdefaultparameters(self);
[19034]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),
[19040]24 self.(fieldname) = inputstruct.(fieldname);
[19034]25 end
26 end
27 otherwise
28 error('constructor not supported');
29 end
30 end % }}}
[19158]31 function self = extrude(self,md) % {{{
32 self.meltingrate=project3d(md,'vector',self.meltingrate,'type','node');
33 end % }}}
[19040]34 function self = setdefaultparameters(self) % {{{
[19034]35
[21626]36 %Default sigma max
37 self.stress_threshold_groundedice = 1e6;
38 self.stress_threshold_floatingice = 150e3;
[19034]39 end % }}}
[19040]40 function md = checkconsistency(self,md,solution,analyses) % {{{
[19034]41 %Early return
[21049]42 if (~strcmp(solution,'TransientSolution') | md.transient.ismovingfront==0), return; end
[19034]43
[22045]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);
[20736]46 md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'Inf',1,'timeseries',1,'>=',0);
[19034]47 end % }}}
[19040]48 function disp(self) % {{{
[19034]49 disp(sprintf(' Calving Pi parameters:'));
[21626]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]');
[19040]52 fielddisplay(self,'meltingrate','melting rate at given location [m/a]');
[19034]53
54 end % }}}
[20690]55 function marshall(self,prefix,md,fid) % {{{
[20896]56 yts=md.constants.yts;
[20916]57 WriteData(fid,prefix,'name','md.calving.law','data',2,'format','Integer');
[22045]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);
[21631]60 WriteData(fid,prefix,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1./yts);
[19034]61 end % }}}
62 end
63end
Note: See TracBrowser for help on using the repository browser.