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