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

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

Checkmodelconsistency passes solution and analyses to the objects for further checks

File size: 2.6 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 if ~ismember(obj.stabilization,[0 1 3]),
50 checkmessage('prognostic.stabilization should be a scalar (0 or 1 or 3)');
51 end
52
53 if ~ismember(md.prognostic.hydrostatic_adjustment,{'Absolute' 'Incremental'}),
54 checkmessage(['model not consistent: model ' md.miscellaneous.name ' prognostic.hydrostatic_adjustment field should be AbsoluteEnum or IncrementalEnum']);
55 end
56 end % }}}
57 function disp(obj) % {{{
58 disp(sprintf(' Prognostic solution parameters:'));
59 fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint)');
60 fielddisplay(obj,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' ');
61 fielddisplay(obj,'stabilization','0->no, 1->artificial_diffusivity, 3->discontinuous Galerkin');
62
63 disp(sprintf('\n %s','Penalty options:'));
64 fielddisplay(obj,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset');
65 fielddisplay(obj,'vertex_pairing','pairs of vertices that are penalized');
66
67 end % }}}
68 end
69end
Note: See TracBrowser for help on using the repository browser.