[9642] | 1 | %PROGNOSTIC class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % prognostic=prognostic();
|
---|
| 5 |
|
---|
| 6 | classdef prognostic
|
---|
| 7 | properties (SetAccess=public)
|
---|
[10981] | 8 | spcthickness = NaN;
|
---|
[11237] | 9 | min_thickness = 0;
|
---|
[10981] | 10 | hydrostatic_adjustment = 0;
|
---|
| 11 | stabilization = 0;
|
---|
| 12 | vertex_pairing = NaN;
|
---|
| 13 | penalty_factor = 0;
|
---|
[13975] | 14 | requested_outputs = NaN;
|
---|
[9642] | 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 |
|
---|
[11237] | 33 | %Minimum ice thickness that can be used
|
---|
| 34 | obj.min_thickness=1;
|
---|
| 35 |
|
---|
[9642] | 36 | %Hydrostatic adjustment
|
---|
| 37 | obj.hydrostatic_adjustment='Absolute';
|
---|
| 38 | end % }}}
|
---|
[12706] | 39 | function md = checkconsistency(obj,md,solution,analyses) % {{{
|
---|
[9854] | 40 |
|
---|
[13395] | 41 | %Early return
|
---|
| 42 | if ~ismember(PrognosticAnalysisEnum(),analyses) | (solution==TransientSolutionEnum() & md.transient.isprognostic==0), return; end
|
---|
[9854] | 43 |
|
---|
[12706] | 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);
|
---|
[13975] | 48 | if ~isempty(md.prognostic.requested_outputs),
|
---|
| 49 | md = checkfield(md,'prognostic.requested_outputs','size',[NaN 1]);
|
---|
| 50 | end
|
---|
[9854] | 51 |
|
---|
[9739] | 52 | end % }}}
|
---|
[9642] | 53 | function disp(obj) % {{{
|
---|
| 54 | disp(sprintf(' Prognostic solution parameters:'));
|
---|
[15396] | 55 | fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint) [m]');
|
---|
| 56 | fielddisplay(obj,'min_thickness','minimum ice thickness allowed [m]');
|
---|
[9821] | 57 | fielddisplay(obj,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' ');
|
---|
[15396] | 58 | fielddisplay(obj,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin');
|
---|
[9642] | 59 |
|
---|
[9821] | 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');
|
---|
[13975] | 63 | fielddisplay(obj,'requested_outputs','additional outputs requested');
|
---|
[9642] | 64 |
|
---|
| 65 | end % }}}
|
---|
[15396] | 66 | function marshall(obj,md,fid) % {{{
|
---|
| 67 | WriteData(fid,'object',obj,'fieldname','spcthickness','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
|
---|
[11237] | 68 | WriteData(fid,'object',obj,'fieldname','min_thickness','format','Double');
|
---|
[13395] | 69 | WriteData(fid,'data',StringToEnum(obj.hydrostatic_adjustment),'format','Integer','enum',PrognosticHydrostaticAdjustmentEnum());
|
---|
[10981] | 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');
|
---|
[13975] | 73 | WriteData(fid,'object',obj,'fieldname','requested_outputs','format','DoubleMat','mattype',3);
|
---|
[10981] | 74 | end % }}}
|
---|
[9642] | 75 | end
|
---|
| 76 | end
|
---|