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