[9642] | 1 | %PROGNOSTIC class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % prognostic=prognostic();
|
---|
| 5 |
|
---|
| 6 | classdef prognostic
|
---|
| 7 | properties (SetAccess=public)
|
---|
[10981] | 8 | spcthickness = NaN;
|
---|
| 9 | hydrostatic_adjustment = 0;
|
---|
| 10 | stabilization = 0;
|
---|
| 11 | vertex_pairing = NaN;
|
---|
| 12 | penalty_factor = 0;
|
---|
[9642] | 13 | end
|
---|
| 14 | methods
|
---|
| 15 | function obj = prognostic(varargin) % {{{
|
---|
| 16 | switch nargin
|
---|
| 17 | case 0
|
---|
| 18 | obj=setdefaultparameters(obj);
|
---|
| 19 | case 1
|
---|
| 20 | in=varargin{1};
|
---|
| 21 | if (isa(in,'numeric') & in==0),
|
---|
| 22 | % requesting templates do nothing
|
---|
| 23 | else
|
---|
| 24 | error('constructor not supported');
|
---|
| 25 | end
|
---|
| 26 | otherwise
|
---|
| 27 | error('constructor not supported');
|
---|
| 28 | end
|
---|
| 29 | end % }}}
|
---|
| 30 | function obj = setdefaultparameters(obj) % {{{
|
---|
| 31 |
|
---|
| 32 | %Type of stabilization to use 0:nothing 1:artificial_diffusivity 3:Discontinuous Galerkin
|
---|
| 33 | obj.stabilization=1;
|
---|
| 34 |
|
---|
| 35 | %Factor applied to compute the penalties kappa=max(stiffness matrix)*10^penalty_factor
|
---|
| 36 | obj.penalty_factor=3;
|
---|
| 37 |
|
---|
| 38 | %Hydrostatic adjustment
|
---|
| 39 | obj.hydrostatic_adjustment='Absolute';
|
---|
| 40 | end % }}}
|
---|
[9853] | 41 | function checkconsistency(obj,md,solution,analyses) % {{{
|
---|
[9854] | 42 |
|
---|
| 43 | %Early return,
|
---|
| 44 | if ~ismember(PrognosticAnalysisEnum,analyses), return; end
|
---|
| 45 |
|
---|
[9862] | 46 | checkfield(md,'prognostic.spcthickness','forcing',1);
|
---|
| 47 | checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
|
---|
| 48 | checkfield(md,'prognostic.stabilization','values',[0 1 3]);
|
---|
[9854] | 49 |
|
---|
[9739] | 50 | end % }}}
|
---|
[9642] | 51 | function disp(obj) % {{{
|
---|
| 52 | disp(sprintf(' Prognostic solution parameters:'));
|
---|
[9821] | 53 | fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint)');
|
---|
| 54 | fielddisplay(obj,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' ');
|
---|
[9646] | 55 | fielddisplay(obj,'stabilization','0->no, 1->artificial_diffusivity, 3->discontinuous Galerkin');
|
---|
[9642] | 56 |
|
---|
[9821] | 57 | disp(sprintf('\n %s','Penalty options:'));
|
---|
| 58 | fielddisplay(obj,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset');
|
---|
| 59 | fielddisplay(obj,'vertex_pairing','pairs of vertices that are penalized');
|
---|
[9642] | 60 |
|
---|
| 61 | end % }}}
|
---|
[10981] | 62 | function marshall(obj,fid) % {{{
|
---|
| 63 | WriteData(fid,'object',obj,'fieldname','spcthickness','format','DoubleMat','mattype',1);
|
---|
| 64 | WriteData(fid,'data',StringToEnum(obj.hydrostatic_adjustment),'format','Integer','enum',PrognosticHydrostaticAdjustmentEnum);
|
---|
| 65 | WriteData(fid,'object',obj,'fieldname','stabilization','format','Integer');
|
---|
| 66 | WriteData(fid,'object',obj,'fieldname','vertex_pairing','format','DoubleMat','mattype',3);
|
---|
| 67 | WriteData(fid,'object',obj,'fieldname','penalty_factor','format','Double');
|
---|
| 68 | end % }}}
|
---|
[9642] | 69 | end
|
---|
| 70 | end
|
---|