[9612] | 1 | %BASAL FORCINGS class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % basalforcings=basalforcings();
|
---|
| 5 |
|
---|
| 6 | classdef basalforcings
|
---|
| 7 | properties (SetAccess=public)
|
---|
[10981] | 8 | melting_rate = NaN;
|
---|
| 9 | melting_rate_correction = NaN;
|
---|
| 10 | geothermalflux = NaN;
|
---|
[9612] | 11 | end
|
---|
| 12 | methods
|
---|
[17806] | 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 % }}}
|
---|
[9612] | 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 % }}}
|
---|
[17806] | 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 % }}}
|
---|
[9612] | 37 | function obj = setdefaultparameters(obj) % {{{
|
---|
| 38 |
|
---|
| 39 | end % }}}
|
---|
[12706] | 40 | function md = checkconsistency(obj,md,solution,analyses) % {{{
|
---|
[9739] | 41 |
|
---|
[16137] | 42 | if ismember(MasstransportAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.ismasstransport==0),
|
---|
[17806] | 43 | md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'forcing',1);
|
---|
[9854] | 44 | end
|
---|
[13395] | 45 | if ismember(BalancethicknessAnalysisEnum(),analyses),
|
---|
[17806] | 46 | md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
|
---|
[9854] | 47 | end
|
---|
[13395] | 48 | if ismember(ThermalAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.isthermal==0),
|
---|
[17806] | 49 | md = checkfield(md,'fieldname','basalforcings.melting_rate','NaN',1,'forcing',1);
|
---|
| 50 | md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
|
---|
[9854] | 51 | end
|
---|
[9739] | 52 | end % }}}
|
---|
[9799] | 53 | function disp(obj) % {{{
|
---|
| 54 | disp(sprintf(' basal forcings parameters:'));
|
---|
| 55 |
|
---|
[15396] | 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]');
|
---|
[9799] | 58 | fielddisplay(obj,'geothermalflux','geothermal heat flux [W/m^2]');
|
---|
| 59 |
|
---|
| 60 | end % }}}
|
---|
[15396] | 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);
|
---|
[10981] | 68 | end % }}}
|
---|
[9612] | 69 | end
|
---|
| 70 | end
|
---|