1 | function ismodelselfconsistent(md),
|
---|
2 | %ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem.
|
---|
3 | %
|
---|
4 | % Usage:
|
---|
5 | % ismodelselfconsistent(md),
|
---|
6 |
|
---|
7 | %initialize consistency as true
|
---|
8 | md.private.isconsistent=true;
|
---|
9 |
|
---|
10 | %Get solution and associated analyses
|
---|
11 | solution=md.private.solution;
|
---|
12 | [analyses,numanalyses]=AnalysisConfiguration(solution);
|
---|
13 |
|
---|
14 | %Go through a model field, check that it is a class, and call checkconsistency
|
---|
15 | fields=properties('model');
|
---|
16 | for i=1:length(fields),
|
---|
17 | field=fields{i};
|
---|
18 |
|
---|
19 | %Some properties do not need to be checked
|
---|
20 | if ismember(field,{'results' 'debug' 'radaroverlay'}),
|
---|
21 | continue;
|
---|
22 | end
|
---|
23 |
|
---|
24 | %Check that current field is an object
|
---|
25 | if ~isobject(md.(field))
|
---|
26 | md=checkmessage(md,['field ''' char(field) ''' is not an object']);
|
---|
27 | end
|
---|
28 |
|
---|
29 | %Check consistency of the object
|
---|
30 | if verLessThan('matlab', '7.6')
|
---|
31 | md=checkconsistency(md.(field),md,solution,analyses);
|
---|
32 | else
|
---|
33 | md=md.(field).checkconsistency(md,solution,analyses);
|
---|
34 | end
|
---|
35 | end
|
---|
36 |
|
---|
37 | %error message if mode is not consistent
|
---|
38 | if md.private.isconsistent==false,
|
---|
39 | error('Model not consistent, see messages above');
|
---|
40 | end
|
---|
41 | end
|
---|
42 |
|
---|
43 | function [analyses,numanalyses]=AnalysisConfiguration(solutiontype), % {{{
|
---|
44 | %ANALYSISCONFIGURATION - return type of analyses, number of analyses
|
---|
45 | %
|
---|
46 | % Usage:
|
---|
47 | % [analyses, numanalyses]=AnalysisConfiguration(solutiontype);
|
---|
48 |
|
---|
49 |
|
---|
50 |
|
---|
51 | switch solutiontype,
|
---|
52 |
|
---|
53 | case DiagnosticSolutionEnum,
|
---|
54 | numanalyses=5;
|
---|
55 | analyses=[DiagnosticHorizAnalysisEnum;DiagnosticVertAnalysisEnum;DiagnosticHutterAnalysisEnum;SurfaceSlopeAnalysisEnum;BedSlopeAnalysisEnum];
|
---|
56 |
|
---|
57 | case SteadystateSolutionEnum,
|
---|
58 | numanalyses=7;
|
---|
59 | analyses=[DiagnosticHorizAnalysisEnum;DiagnosticVertAnalysisEnum;DiagnosticHutterAnalysisEnum;SurfaceSlopeAnalysisEnum;BedSlopeAnalysisEnum;ThermalAnalysisEnum;MeltingAnalysisEnum];
|
---|
60 |
|
---|
61 | case ThermalSolutionEnum,
|
---|
62 | numanalyses=2;
|
---|
63 | analyses=[ThermalAnalysisEnum;MeltingAnalysisEnum];
|
---|
64 |
|
---|
65 | case EnthalpySolutionEnum,
|
---|
66 | numanalyses=1;
|
---|
67 | analyses=[EnthalpyAnalysisEnum];
|
---|
68 |
|
---|
69 | case PrognosticSolutionEnum,
|
---|
70 | numanalyses=1;
|
---|
71 | analyses=[PrognosticAnalysisEnum];
|
---|
72 |
|
---|
73 | case BalancethicknessSolutionEnum,
|
---|
74 | numanalyses=1;
|
---|
75 | analyses=[BalancethicknessAnalysisEnum];
|
---|
76 |
|
---|
77 | case SurfaceSlopeSolutionEnum,
|
---|
78 | numanalyses=1;
|
---|
79 | analyses=[SurfaceSlopeAnalysisEnum];
|
---|
80 |
|
---|
81 | case BedSlopeSolutionEnum,
|
---|
82 | numanalyses=1;
|
---|
83 | analyses=[BedSlopeAnalysisEnum];
|
---|
84 |
|
---|
85 | case TransientSolutionEnum,
|
---|
86 | numanalyses=9;
|
---|
87 | analyses=[DiagnosticHorizAnalysisEnum;DiagnosticVertAnalysisEnum;DiagnosticHutterAnalysisEnum;SurfaceSlopeAnalysisEnum;BedSlopeAnalysisEnum;ThermalAnalysisEnum;MeltingAnalysisEnum;EnthalpyAnalysisEnum;PrognosticAnalysisEnum];
|
---|
88 |
|
---|
89 | case FlaimSolutionEnum,
|
---|
90 | numanalyses=1;
|
---|
91 | analyses=[FlaimAnalysisEnum];
|
---|
92 |
|
---|
93 | case HydrologySolutionEnum,
|
---|
94 | numanalyses=3;
|
---|
95 | analyses=[BedSlopeAnalysisEnum;SurfaceSlopeAnalysisEnum;HydrologyAnalysisEnum];
|
---|
96 |
|
---|
97 | otherwise
|
---|
98 | error('%s%s%s',' solution type: ',EnumToString(solutiontype),' not supported yet!');
|
---|
99 |
|
---|
100 | end % }}}
|
---|