source: issm/trunk/src/m/classes/constants.m@ 11237

Last change on this file since 11237 was 11237, checked in by Eric.Larour, 13 years ago

merged trunk-jpl and trunk for revision 11236

File size: 1.6 KB
Line 
1%CONSTANTS class definition
2%
3% Usage:
4% constants=constants();
5
6classdef constants
7 properties (SetAccess=public)
8 g = 0;
9 yts = 0;
10 referencetemperature = 0;
11 end
12 methods
13 function obj = constants(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 %acceleration due to gravity (m/s^2)
31 obj.g=9.81;
32
33 %converstion from year to seconds
34 obj.yts=365*24*3600;
35
36 %the reference temperature for enthalpy model (cf Aschwanden)
37 obj.referencetemperature=223.15;
38
39 end % }}}
40 function flag = checkconsistency(obj,md,solution,analyses) % {{{
41
42 checkfield(md,'constants.g','>',0,'size',[1 1]);
43 checkfield(md,'constants.yts','>',0,'size',[1 1]);
44 checkfield(md,'constants.referencetemperature','size',[1 1]);
45
46 end % }}}
47 function disp(obj) % {{{
48 disp(sprintf(' constants parameters:'));
49
50 fielddisplay(obj,'g','gravitational acceleration');
51 fielddisplay(obj,'yts','number of seconds in a year');
52 fielddisplay(obj,'referencetemperature','reference temperature used in the enthalpy model');
53
54 end % }}}
55 function marshall(obj,fid) % {{{
56 WriteData(fid,'object',obj,'fieldname','g','format','Double');
57 WriteData(fid,'object',obj,'fieldname','yts','format','Double');
58 WriteData(fid,'object',obj,'fieldname','referencetemperature','format','Double');
59 end % }}}
60 end
61end
Note: See TracBrowser for help on using the repository browser.