1 | %BASAL FORCINGS class definition
|
---|
2 | %
|
---|
3 | % Usage:
|
---|
4 | % basalforcings=basalforcings();
|
---|
5 |
|
---|
6 | classdef basalforcings
|
---|
7 | properties (SetAccess=public)
|
---|
8 | melting_rate = NaN;
|
---|
9 | melting_rate_correction = NaN;
|
---|
10 | geothermalflux = NaN;
|
---|
11 | end
|
---|
12 | methods
|
---|
13 | function createxml(obj,fid) % {{{
|
---|
14 | fprintf(fid, '\n\n');
|
---|
15 | fprintf(fid, '%s\n', '<!-- basalforcings -->');
|
---|
16 | fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n', '<parameter key ="melting_rate" type="', class(obj.melting_rate),'" default="', num2str(obj.melting_rate),'">', ' <section name="basalforcings" />',' <help> basal melting rate (positive if melting) [m/yr] </help>','</parameter>');
|
---|
17 | fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n', '<parameter key ="melting_rate_correction" type="', class(obj.melting_rate_correction),'" default="', num2str(obj.melting_rate_correction),'">', ' <section name="basalforcings" />',' <help> additional melting applied to compensate for dh/dt [m/yr] </help>','</parameter>');
|
---|
18 | fprintf(fid,'%s%s%s%s%s\n%s\n%s\n', '<parameter key ="geothermalflux" type="', class(obj.geothermalflux),'" default="', num2str(obj.geothermalflux),'">', ' <section name="basalforcings" />',' <help> geothermal heat flux [W/m^2] </help>','</parameter>');
|
---|
19 |
|
---|
20 | end % }}}
|
---|
21 | function obj = basalforcings(varargin) % {{{
|
---|
22 | switch nargin
|
---|
23 | case 0
|
---|
24 | obj=setdefaultparameters(obj);
|
---|
25 | otherwise
|
---|
26 | error('constructor not supported');
|
---|
27 | end
|
---|
28 | end % }}}
|
---|
29 | function self = initialize(self,md) % {{{
|
---|
30 |
|
---|
31 | if isnan(self.melting_rate),
|
---|
32 | self.melting_rate=zeros(md.mesh.numberofvertices,1);
|
---|
33 | disp(' no basalforcings.melting_rate specified: values set as zero');
|
---|
34 | end
|
---|
35 |
|
---|
36 | end % }}}
|
---|
37 | function obj = setdefaultparameters(obj) % {{{
|
---|
38 |
|
---|
39 | end % }}}
|
---|
40 | function md = checkconsistency(obj,md,solution,analyses) % {{{
|
---|
41 |
|
---|
42 | if ismember(MasstransportAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.ismasstransport==0),
|
---|
43 | md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'forcing',1);
|
---|
44 | end
|
---|
45 | if ismember(BalancethicknessAnalysisEnum(),analyses),
|
---|
46 | md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
|
---|
47 | end
|
---|
48 | if ismember(ThermalAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.isthermal==0),
|
---|
49 | md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'forcing',1);
|
---|
50 | md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
|
---|
51 | end
|
---|
52 | end % }}}
|
---|
53 | function disp(obj) % {{{
|
---|
54 | disp(sprintf(' basal forcings parameters:'));
|
---|
55 |
|
---|
56 | fielddisplay(obj,'melting_rate','basal melting rate (positive if melting) [m/yr]');
|
---|
57 | fielddisplay(obj,'melting_rate_correction','additional melting applied to compensate for dh/dt [m/yr]');
|
---|
58 | fielddisplay(obj,'geothermalflux','geothermal heat flux [W/m^2]');
|
---|
59 |
|
---|
60 | end % }}}
|
---|
61 | function marshall(obj,md,fid) % {{{
|
---|
62 |
|
---|
63 | yts=365.0*24.0*3600.0;
|
---|
64 |
|
---|
65 | WriteData(fid,'object',obj,'fieldname','melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
|
---|
66 | WriteData(fid,'object',obj,'fieldname','melting_rate_correction','format','DoubleMat','mattype',1,'scale',1./yts);
|
---|
67 | WriteData(fid,'object',obj,'fieldname','geothermalflux','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
|
---|
68 | end % }}}
|
---|
69 | end
|
---|
70 | end
|
---|