[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 |
|
---|
| 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 |
|
---|
[13018] | 100 | end
|
---|
[13005] | 101 | end % }}}
|
---|