source: issm/trunk/src/m/classes/prognostic.m@ 9862

Last change on this file since 9862 was 9862, checked in by Mathieu Morlighem, 13 years ago

Done with model consistency checks

File size: 2.5 KB
Line 
1%PROGNOSTIC class definition
2%
3% Usage:
4% prognostic=prognostic();
5
6classdef prognostic
7 properties (SetAccess=public)
8 spcthickness = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
9 hydrostatic_adjustment = modelfield('default',0,'marshall',true,'preprocess','StringToEnum','format','Integer');
10 stabilization = modelfield('default',0,'marshall',true,'format','Integer');
11 vertex_pairing = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
12 penalty_factor = modelfield('default',0,'marshall',true,'format','Double');
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 %first, use the defaults provided by the properties definition above.
33 fieldnames=fields(obj);
34 for i=1:length(fieldnames),
35 fieldname=fieldnames{i};
36 obj.(fieldname)=obj.(fieldname).default;
37 end
38
39 %Type of stabilization to use 0:nothing 1:artificial_diffusivity 3:Discontinuous Galerkin
40 obj.stabilization=1;
41
42 %Factor applied to compute the penalties kappa=max(stiffness matrix)*10^penalty_factor
43 obj.penalty_factor=3;
44
45 %Hydrostatic adjustment
46 obj.hydrostatic_adjustment='Absolute';
47 end % }}}
48 function checkconsistency(obj,md,solution,analyses) % {{{
49
50 %Early return,
51 if ~ismember(PrognosticAnalysisEnum,analyses), return; end
52
53 checkfield(md,'prognostic.spcthickness','forcing',1);
54 checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
55 checkfield(md,'prognostic.stabilization','values',[0 1 3]);
56
57 end % }}}
58 function disp(obj) % {{{
59 disp(sprintf(' Prognostic solution parameters:'));
60 fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint)');
61 fielddisplay(obj,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' ');
62 fielddisplay(obj,'stabilization','0->no, 1->artificial_diffusivity, 3->discontinuous Galerkin');
63
64 disp(sprintf('\n %s','Penalty options:'));
65 fielddisplay(obj,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset');
66 fielddisplay(obj,'vertex_pairing','pairs of vertices that are penalized');
67
68 end % }}}
69 end
70end
Note: See TracBrowser for help on using the repository browser.