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