source: issm/trunk/src/m/classes/basalforcings.m@ 9854

Last change on this file since 9854 was 9854, checked in by Mathieu Morlighem, 13 years ago

Added all checks in objects

File size: 2.1 KB
Line 
1%BASAL FORCINGS class definition
2%
3% Usage:
4% basalforcings=basalforcings();
5
6classdef basalforcings
7 properties (SetAccess=public)
8 melting_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
9 melting_rate_correction = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
10 geothermalflux = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
11 end
12 methods
13 function obj = basalforcings(varargin) % {{{
14 switch nargin
15 case 0
16 obj=setdefaultparameters(obj);
17 case 1
18 in=varargin{1};
19 if (isa(in,'numeric') & in==0),
20 % requesting templates do nothing
21 else
22 error('constructor not supported');
23 end
24 otherwise
25 error('constructor not supported');
26 end
27 end % }}}
28 function obj = setdefaultparameters(obj) % {{{
29
30 %first, use the defaults provided by the properties definition above.
31 fieldnames=fields(obj);
32 for i=1:length(fieldnames),
33 fieldname=fieldnames{i};
34 obj.(fieldname)=obj.(fieldname).default;
35 end
36 end % }}}
37 function checkconsistency(obj,md,solution,analyses) % {{{
38
39 fields={'geothermalflux'};
40 %checksize(md,'basalforcings',fields,[md.mesh.numberofvertices 1]);
41 if ismember(PrognosticAnalysisEnum,analyses),
42 fields={'melting_rate'};
43 checkforcing(md,'basalforcings',fields);
44 end
45 if ismember(BalancethicknessAnalysisEnum,analyses),
46 fields={'melting_rate'};
47 checksize(md,'basalforcings',fields,[md.mesh.numberofvertices 1]);
48 checknan(md, 'basalforcings',fields);
49 end
50 if ismember(ThermalAnalysisEnum,analyses),
51 fields={'geothermalflux'};
52 checksize(md,'basalforcings',fields,[md.mesh.numberofvertices 1]);
53 checknan(md, 'basalforcings',fields);
54 end
55 end % }}}
56 function disp(obj) % {{{
57 disp(sprintf(' basal forcings parameters:'));
58
59 fielddisplay(obj,'melting_rate','basal melting rate (positive if melting)');
60 fielddisplay(obj,'melting_rate_correction','additional melting applied when the grounding line retreats');
61 fielddisplay(obj,'geothermalflux','geothermal heat flux [W/m^2]');
62
63 end % }}}
64 end
65end
Note: See TracBrowser for help on using the repository browser.