[9621] | 1 | %CONSTANTS class definition
|
---|
[9599] | 2 | %
|
---|
| 3 | % Usage:
|
---|
[9621] | 4 | % constants=constants();
|
---|
[9599] | 5 |
|
---|
[9621] | 6 | classdef constants
|
---|
[9599] | 7 | properties (SetAccess=public)
|
---|
[10981] | 8 | g = 0;
|
---|
| 9 | yts = 0;
|
---|
| 10 | referencetemperature = 0;
|
---|
[9599] | 11 | end
|
---|
| 12 | methods
|
---|
[9621] | 13 | function obj = constants(varargin) % {{{
|
---|
[9599] | 14 | switch nargin
|
---|
| 15 | case 0
|
---|
| 16 | obj=setdefaultparameters(obj);
|
---|
| 17 | otherwise
|
---|
| 18 | error('constructor not supported');
|
---|
| 19 | end
|
---|
| 20 | end % }}}
|
---|
| 21 | function obj = setdefaultparameters(obj) % {{{
|
---|
| 22 |
|
---|
[9621] | 23 | %acceleration due to gravity (m/s^2)
|
---|
| 24 | obj.g=9.81;
|
---|
| 25 |
|
---|
| 26 | %converstion from year to seconds
|
---|
| 27 | obj.yts=365*24*3600;
|
---|
| 28 |
|
---|
| 29 | %the reference temperature for enthalpy model (cf Aschwanden)
|
---|
| 30 | obj.referencetemperature=223.15;
|
---|
| 31 |
|
---|
[9599] | 32 | end % }}}
|
---|
[9853] | 33 | function flag = checkconsistency(obj,md,solution,analyses) % {{{
|
---|
[9730] | 34 |
|
---|
[9860] | 35 | checkfield(md,'constants.g','>',0,'size',[1 1]);
|
---|
| 36 | checkfield(md,'constants.yts','>',0,'size',[1 1]);
|
---|
| 37 | checkfield(md,'constants.referencetemperature','size',[1 1]);
|
---|
[9749] | 38 |
|
---|
[9730] | 39 | end % }}}
|
---|
[9799] | 40 | function disp(obj) % {{{
|
---|
| 41 | disp(sprintf(' constants parameters:'));
|
---|
| 42 |
|
---|
| 43 | fielddisplay(obj,'g','gravitational acceleration');
|
---|
[11237] | 44 | fielddisplay(obj,'yts','number of seconds in a year');
|
---|
[9799] | 45 | fielddisplay(obj,'referencetemperature','reference temperature used in the enthalpy model');
|
---|
| 46 |
|
---|
| 47 | end % }}}
|
---|
[10981] | 48 | function marshall(obj,fid) % {{{
|
---|
| 49 | WriteData(fid,'object',obj,'fieldname','g','format','Double');
|
---|
| 50 | WriteData(fid,'object',obj,'fieldname','yts','format','Double');
|
---|
| 51 | WriteData(fid,'object',obj,'fieldname','referencetemperature','format','Double');
|
---|
| 52 | end % }}}
|
---|
[9599] | 53 | end
|
---|
| 54 | end
|
---|