[2164] | 1 | function bool=ismodelselfconsistent(md),
|
---|
[1] | 2 | %ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem.
|
---|
| 3 | %
|
---|
| 4 | % Usage:
|
---|
[2164] | 5 | % bool=ismodelselfconsistent(md),
|
---|
[1] | 6 |
|
---|
| 7 | %tolerance we use in litmus tests for the consistency of the model
|
---|
| 8 | tolerance=10^-12;
|
---|
[2164] | 9 | if (nargin~=1 )
|
---|
[27] | 10 | help ismodelselfconsistent
|
---|
| 11 | error('ismodelselfconsistent error message: wrong usage');
|
---|
[1] | 12 | end
|
---|
| 13 |
|
---|
[1670] | 14 | %initialize output
|
---|
| 15 | bool=1;
|
---|
| 16 |
|
---|
[27] | 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMMON CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
| 18 |
|
---|
| 19 | %COUNTER
|
---|
| 20 | if md.counter<3,
|
---|
| 21 | disp(['model ' md.name ' is not correctly configured. You forgot one step in the following sequence (mesh, geography, parameterize)!']);
|
---|
| 22 | bool=0;return;
|
---|
[1] | 23 | end
|
---|
| 24 |
|
---|
[27] | 25 | %NAME
|
---|
[1] | 26 | if isempty(md.name),
|
---|
| 27 | disp(['model is not correctly configured: missing name!']);
|
---|
| 28 | bool=0;return;
|
---|
| 29 | end
|
---|
| 30 |
|
---|
[27] | 31 | %MESH
|
---|
[1] | 32 | if md.numberofelements<=0,
|
---|
| 33 | disp(['model ' md.name ' does not have any elements!']);
|
---|
| 34 | bool=0; return;
|
---|
| 35 | end
|
---|
| 36 | if md.numberofgrids<=0,
|
---|
| 37 | disp(['model ' md.name ' does not have any grids!']);
|
---|
| 38 | bool=0; return;
|
---|
| 39 | end
|
---|
| 40 |
|
---|
[27] | 41 | %ELEMENTSTYPE
|
---|
[1] | 42 | if size(md.elements_type,1)~=md.numberofelements | size(md.elements_type,2)~=2,
|
---|
| 43 | disp(['Types of elements have not been set properly, run setelementstype first'])
|
---|
| 44 | bool=0;return;
|
---|
| 45 | end
|
---|
[1651] | 46 | if any(ones(md.numberofelements,1)-((md.elements_type(:,1)==HutterFormulationEnum) + (md.elements_type(:,1)==MacAyealFormulationEnum) + (md.elements_type(:,1)==PattynFormulationEnum)))
|
---|
[1] | 47 | disp(['Types of elements have not been set properly, run setelementstype first'])
|
---|
| 48 | bool=0;return;
|
---|
| 49 | end
|
---|
[1651] | 50 | if any(ones(md.numberofelements,1)-((md.elements_type(:,2)==StokesFormulationEnum) + (md.elements_type(:,2)==NoneFormulationEnum)))
|
---|
[1] | 51 | disp(['Types of elements have not been set properly, run setelementstype first'])
|
---|
| 52 | bool=0;return;
|
---|
| 53 | end
|
---|
| 54 | if strcmpi(md.type,'2d'),
|
---|
[1651] | 55 | if (ismember(PattynFormulationEnum,md.elements_type(:,1)) | ismember(StokesFormulationEnum,md.elements_type(:,2))),
|
---|
[1] | 56 | disp(['For a 2d model, only MacAyeal''s and Hutter''s elements are allowed']);
|
---|
| 57 | bool=0;return;
|
---|
| 58 | end
|
---|
| 59 | end
|
---|
[358] | 60 | if (md.ismacayealpattyn==0 && md.ishutter==0 && md.isstokes==0),
|
---|
| 61 | disp(['no elements type set for this model. at least one of ismacayealpattyn, ishutter and isstokes need to be =1']);
|
---|
| 62 | bool=0;return;
|
---|
| 63 | end
|
---|
[2164] | 64 | if (md.analysis_type==DiagnosticAnalysisEnum & any(ismember(MacAyealFormulationEnum,md.elements_type(:,1)) & ismember(PattynFormulationEnum,md.elements_type(:,1))))
|
---|
| 65 | disp(['coupling MacAyeal/Pattyn not implemented yet']);
|
---|
| 66 | bool=0;return;
|
---|
| 67 | end
|
---|
| 68 | if (md.isstokes & md.analysis_type==TransientAnalysisEnum());
|
---|
| 69 | disp(['Stokes transient not implemented yet']);
|
---|
| 70 | bool=0;return;
|
---|
| 71 | end
|
---|
[358] | 72 |
|
---|
[1796] | 73 | %ICEFRONT
|
---|
| 74 | if strcmpi(md.type,'2d'),
|
---|
| 75 | if size(md.pressureload,2)~=3 ,
|
---|
| 76 | disp(['pressureload in ' md.name ' shoud have three columns']);
|
---|
| 77 | bool=0;return;
|
---|
| 78 | end
|
---|
| 79 | elseif strcmpi(md.type,'3d'),
|
---|
| 80 | if size(md.pressureload,2)~=5 ,
|
---|
| 81 | disp(['pressureload in ' md.name ' shoud have five columns']);
|
---|
| 82 | bool=0;return;
|
---|
| 83 | end
|
---|
| 84 | end
|
---|
[358] | 85 |
|
---|
[27] | 86 | %NO NAN
|
---|
[1755] | 87 | fields={'numberofelements','numberofgrids','x','y','z','drag','drag_type','p','q',...
|
---|
[27] | 88 | 'rho_ice','rho_water','B','elementoniceshelf','surface','thickness','bed','g','lowmem','sparsity','nsteps','maxiter',...
|
---|
[1666] | 89 | 'tolx','np','eps_res','exclusive','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'};
|
---|
[27] | 90 | for i=1:length(fields),
|
---|
[806] | 91 | if ~isempty(md.(fields{i})),
|
---|
| 92 | if any(isnan(md.(fields{i}))),
|
---|
[681] | 93 | disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']);
|
---|
[27] | 94 | bool=0; return;
|
---|
| 95 | end
|
---|
[1] | 96 | end
|
---|
| 97 | end
|
---|
| 98 |
|
---|
[1666] | 99 | %FIELDS >= 0
|
---|
[1755] | 100 | fields={'numberofelements','numberofgrids','elements','drag','drag_type','p','q',...
|
---|
[1666] | 101 | 'rho_ice','rho_water','B','elementoniceshelf','thickness','g','eps_res','eps_rel','eps_abs','nsteps','maxiter','tolx','exclusive',...
|
---|
[27] | 102 | 'sparsity','lowmem','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'};
|
---|
| 103 | for i=1:length(fields),
|
---|
[806] | 104 | if ~isempty(md.(fields{i})),
|
---|
| 105 | if any(md.(fields{i})<0),
|
---|
[681] | 106 | disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']);
|
---|
[27] | 107 | bool=0; return;
|
---|
[1] | 108 | end
|
---|
| 109 | end
|
---|
| 110 | end
|
---|
[27] | 111 | if any(md.p<=0),
|
---|
| 112 | disp(['model ' md.name ' has some p<0 friction coefficientsin sliding law']);
|
---|
| 113 | bool=0; return;
|
---|
| 114 | end
|
---|
[1] | 115 |
|
---|
[27] | 116 | %FIELDS ~=0
|
---|
[1755] | 117 | fields={'numberofelements','numberofgrids','elements','drag_type',...
|
---|
[1666] | 118 | 'rho_ice','rho_water','B','thickness','g','eps_res','eps_rel','eps_abs','maxiter','tolx',...
|
---|
[27] | 119 | 'sparsity','deltaH','DeltaH','timeacc','timedec'};
|
---|
| 120 | for i=1:length(fields),
|
---|
[806] | 121 | if ~isempty(md.(fields{i})),
|
---|
| 122 | if any(md.(fields{i})==0),
|
---|
[681] | 123 | disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']);
|
---|
[27] | 124 | bool=0; return;
|
---|
| 125 | end
|
---|
[1] | 126 | end
|
---|
| 127 | end
|
---|
| 128 |
|
---|
[27] | 129 | %SIZE NUMBEROFELEMENTS
|
---|
| 130 | fields={'elements','p','q','elementoniceshelf','n','elementonbed'};
|
---|
| 131 | for i=1:size(fields,2),
|
---|
[806] | 132 | if (size(md.(fields{i}),1)~=md.numberofelements),
|
---|
[681] | 133 | disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofelements) '!']);
|
---|
[27] | 134 | bool=0; return;
|
---|
| 135 | end
|
---|
| 136 | end
|
---|
| 137 |
|
---|
| 138 | %SIZE NUMBEROFGRIDS
|
---|
[1757] | 139 | fields={'x','y','z','B','drag','spcvelocity','melting','accumulation','surface','thickness','bed','gridonbed','gridonsurface'};
|
---|
[27] | 140 | for i=1:length(fields),
|
---|
[806] | 141 | if length(md.(fields{i}))~=md.numberofgrids,
|
---|
[681] | 142 | disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofgrids) '!']);
|
---|
[27] | 143 | bool=0; return;
|
---|
| 144 | end
|
---|
| 145 | end
|
---|
| 146 |
|
---|
| 147 | %THICKNESS = SURFACE - BED
|
---|
[681] | 148 | if any((md.thickness-md.surface+md.bed)>tolerance),
|
---|
[27] | 149 | disp(['model ' md.name ' violates the equality thickness=surface-bed!']);
|
---|
| 150 | bool=0; return;
|
---|
| 151 | end
|
---|
| 152 |
|
---|
| 153 | %RIFTS
|
---|
| 154 | if md.numrifts,
|
---|
| 155 | if ~strcmpi(md.type,'2d'),
|
---|
| 156 | disp(['Models with rifts are only supported in 2d for now!']);
|
---|
[1] | 157 | bool=0;return;
|
---|
| 158 | end
|
---|
| 159 | end
|
---|
[27] | 160 | if ~isstruct(md.rifts),
|
---|
[1222] | 161 | if ~isnan(md.rifts),
|
---|
| 162 | if ~isempty(find(md.segmentmarkers>=2)),
|
---|
| 163 | %We have segments with rift markers, but no rift structure!
|
---|
| 164 | disp(['model ' md.name ' should be processed for rifts (run meshprocessrifts)!']);
|
---|
| 165 | bool=0; return;
|
---|
| 166 | end
|
---|
[27] | 167 | end
|
---|
| 168 | end
|
---|
[1] | 169 |
|
---|
[27] | 170 | %ARTIFICIAL DIFFUSIVITY
|
---|
[1] | 171 | if ~isscalar(md.artificial_diffusivity),
|
---|
| 172 | disp('artificial_diffusivity should be a scalar (1 or 0)');
|
---|
| 173 | bool=0;return;
|
---|
| 174 | end
|
---|
| 175 |
|
---|
[27] | 176 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLUTION CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
[804] | 177 | %QMU
|
---|
[966] | 178 | if md.qmu_analysis,
|
---|
| 179 | if md.qmu_params.evaluation_concurrency~=1,
|
---|
| 180 | disp(['concurrency should be set to 1 when running dakota in library mode']);
|
---|
| 181 | bool=0;return;
|
---|
| 182 | end
|
---|
[1111] | 183 | if ~isempty(md.part),
|
---|
| 184 | if numel(md.part)~=md.numberofgrids,
|
---|
| 185 | disp(['user supplied partition for qmu analysis should have size md.numberofgrids x 1 ']);
|
---|
| 186 | bool=0;return;
|
---|
| 187 | end
|
---|
| 188 | if find(md.part)>=md.numberofgrids,
|
---|
| 189 | disp(['user supplied partition should be indexed from 0 (c-convention)']);
|
---|
| 190 | bool=0;return;
|
---|
| 191 | end
|
---|
| 192 | if md.npart~=md.numberofgrids,
|
---|
| 193 | disp(['user supplied partition should have same size as md.npart']);
|
---|
| 194 | bool=0;return;
|
---|
| 195 | end
|
---|
| 196 |
|
---|
| 197 | end
|
---|
[2052] | 198 | if md.eps_rel>10^-3,
|
---|
| 199 | disp(['for qmu analysis, eps_rel should be least than 10^-5, 10^-15 being a better value']);
|
---|
| 200 | bool=0;return;
|
---|
| 201 | end
|
---|
[804] | 202 | end
|
---|
[27] | 203 |
|
---|
| 204 | %DIAGNOSTIC
|
---|
[1781] | 205 | if md.analysis_type==DiagnosticAnalysisEnum,
|
---|
[27] | 206 |
|
---|
| 207 | %HUTTER ON ICESHELF WARNING
|
---|
[1651] | 208 | if any(md.elements_type(:,1)==HutterFormulationEnum & md.elementoniceshelf),
|
---|
[27] | 209 | disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n'));
|
---|
| 210 | end
|
---|
| 211 |
|
---|
| 212 | %SINGULAR
|
---|
[1755] | 213 | if ~any(sum(md.spcvelocity(:,1:3),2)==3),
|
---|
[27] | 214 | disp(['model ' md.name ' is not well posed (singular). You need at least one grid with fixed velocity!'])
|
---|
[1] | 215 | bool=0;return;
|
---|
| 216 | end
|
---|
| 217 |
|
---|
[27] | 218 | %DIRICHLET IF THICKNESS <= 0
|
---|
[681] | 219 | if any(md.thickness<=0),
|
---|
[27] | 220 | pos=find(md.thickness<=0);
|
---|
[1755] | 221 | if any(find(md.spcthickness(pos,1)==0)),
|
---|
[27] | 222 | disp(['model ' md.name ' has some grids with 0 thickness']);
|
---|
| 223 | bool=0; return;
|
---|
| 224 | end
|
---|
| 225 | end
|
---|
[1] | 226 | end
|
---|
| 227 |
|
---|
[27] | 228 | %PROGNOSTIC
|
---|
[1781] | 229 | if md.analysis_type==PrognosticAnalysisEnum,
|
---|
[1] | 230 |
|
---|
[27] | 231 | %VELOCITIES
|
---|
| 232 | if (size(md.vx,1)~=md.numberofgrids | size(md.vy,1)~=md.numberofgrids),
|
---|
[1] | 233 | disp(['a 3d velocity is required. Run ''diagnostic'' solution first!'])
|
---|
[27] | 234 | bool=0; return;
|
---|
[1] | 235 | end
|
---|
| 236 | end
|
---|
| 237 |
|
---|
[1867] | 238 | %STEADYSTATE
|
---|
| 239 | if md.analysis_type==SteadystateAnalysisEnum,
|
---|
[1901] | 240 | %NDT
|
---|
| 241 | if md.dt~=0,
|
---|
[1917] | 242 | disp(['For a steadystate computation, dt must be zero.']);
|
---|
[1901] | 243 | bool=0;return;
|
---|
| 244 | end
|
---|
[1787] | 245 | %PRESSURE
|
---|
| 246 | if isnans(md.pressure),
|
---|
[1862] | 247 | disp(['For a steadystate computation, the model must have an initial pressure, even lithostatic will do.']);
|
---|
[1787] | 248 | bool=0;return;
|
---|
| 249 | end
|
---|
| 250 |
|
---|
| 251 | %eps:
|
---|
| 252 | if isnan(md.eps_rel),
|
---|
[1862] | 253 | disp(['For a steadystate computation, eps_rel (relative convergence criterion) must be defined!']);
|
---|
[1787] | 254 | bool=0;return;
|
---|
| 255 | end
|
---|
| 256 |
|
---|
| 257 | %dim:
|
---|
| 258 | if strcmpi(md.type,'2d'),
|
---|
[1862] | 259 | disp(['For a steadystate computation, model needs to be 3d']);
|
---|
[1787] | 260 | bool=0;return;
|
---|
| 261 | end
|
---|
| 262 | end
|
---|
| 263 |
|
---|
[27] | 264 | %THERMAL STEADY AND THERMAL TRANSIENT
|
---|
[1781] | 265 | if md.analysis_type==ThermalAnalysisEnum,
|
---|
[27] | 266 |
|
---|
| 267 | %EXTRUSION
|
---|
| 268 | if strcmp(md.type,'2d'),
|
---|
[465] | 269 | disp(['For a ' md.analysis_type ' computation, the model must be 3d, extrude it first!'])
|
---|
[1] | 270 | bool=0;return;
|
---|
| 271 | end
|
---|
[27] | 272 |
|
---|
| 273 | %VELOCITIES AND PRESSURE
|
---|
[1311] | 274 | if (length(md.vx)~=md.numberofgrids | length(md.vy)~=md.numberofgrids | length(md.vz)~=md.numberofgrids),
|
---|
[27] | 275 | disp(['a 3d velocity is required. Run ''diagnostic'' solution first!'])
|
---|
[1] | 276 | bool=0;return;
|
---|
| 277 | end
|
---|
[1311] | 278 | if (length(md.pressure)~=md.numberofgrids),
|
---|
[27] | 279 | disp(['pressure is required. Run ''diagnostic'' solution first!'])
|
---|
| 280 | bool=0;return;
|
---|
| 281 | end
|
---|
[1] | 282 | end
|
---|
| 283 |
|
---|
[1311] | 284 | %THERMAL TRANSIENT
|
---|
[1901] | 285 | if md.analysis_type==ThermalAnalysisEnum & md.dt~=0
|
---|
[27] | 286 |
|
---|
| 287 | %DT and NDT
|
---|
| 288 | fields={'dt','ndt'};
|
---|
| 289 | for i=1:length(fields),
|
---|
[806] | 290 | if any(md.(fields{i})<0),
|
---|
[681] | 291 | disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']);
|
---|
[27] | 292 | bool=0; return;
|
---|
| 293 | end
|
---|
| 294 | end
|
---|
| 295 |
|
---|
[1311] | 296 | %INITIAL TEMPERATURE, MELTING AND ACCUMULATION
|
---|
| 297 | if (length(md.temperature)~=md.numberofgrids),
|
---|
| 298 | disp(['An initial temperature is needed for a transient thermal computation'])
|
---|
[1] | 299 | bool=0;return;
|
---|
| 300 | end
|
---|
[1311] | 301 | if (length(md.temperature)~=md.numberofgrids | length(md.accumulation)~=md.numberofgrids | length(md.melting)~=md.numberofgrids),
|
---|
| 302 | disp(['The initial temperature, melting or accumulation should be a list and not a structure'])
|
---|
| 303 | bool=0;return;
|
---|
| 304 | end
|
---|
[1] | 305 | end
|
---|
| 306 |
|
---|
[27] | 307 | %PARAMETERS
|
---|
[1781] | 308 | if md.analysis_type==ParametersAnalysisEnum,
|
---|
[27] | 309 |
|
---|
| 310 | %OUTPUT
|
---|
| 311 | if ~iscell(md.parameteroutput)
|
---|
| 312 | disp(['parameteroutput field must be a cell, example {''strainrate'',''stress'',''deviatoricstress'',''viscousheating''}']);
|
---|
| 313 | bool=0; return;
|
---|
| 314 | end
|
---|
| 315 | for i=1:length(md.parameteroutput)
|
---|
| 316 | if ~strcmpi(md.parameteroutput(i),'strainrate') & ~strcmpi(md.parameteroutput(i),'stress') & ~strcmpi(md.parameteroutput(i),'deviatoricstress') & ~strcmpi(md.parameteroutput(i),'viscousheating') ...
|
---|
| 317 | & ~strcmpi(md.parameteroutput(i),'pressure_elem') & ~strcmpi(md.parameteroutput(i),'stress_bed') & ~strcmpi(md.parameteroutput(i),'stress_surface')
|
---|
| 318 | disp(['one of the parameteroutput is not supported yet']);
|
---|
| 319 | bool=0; return;
|
---|
| 320 | end
|
---|
| 321 | end
|
---|
| 322 | %VELOCITY
|
---|
[1] | 323 | if ~(size(md.vx,1)==md.numberofgrids & size(md.vy,1)==md.numberofgrids & (size(md.vz,1)==md.numberofgrids | strcmpi(md.type,'2d')))
|
---|
| 324 | disp(['velocities are required!']);
|
---|
| 325 | bool=0;return;
|
---|
| 326 | end
|
---|
[27] | 327 |
|
---|
| 328 | %HUTTER
|
---|
[1651] | 329 | if any(md.elements_type(:,1)==HutterFormulationEnum);
|
---|
[1] | 330 | disp(['The model has Hutter''s elements. Impossible to compute parameters']);
|
---|
| 331 | bool=0;return;
|
---|
| 332 | end
|
---|
| 333 | end
|
---|
| 334 |
|
---|
[27] | 335 | %CONTROL
|
---|
[1907] | 336 | if md.control_analysis,
|
---|
[1] | 337 |
|
---|
[27] | 338 | %CONTROL TYPE
|
---|
[45] | 339 | if ~ischar(md.control_type),
|
---|
| 340 | disp('control_type should be a string');
|
---|
[1] | 341 | bool=0;return;
|
---|
| 342 | end
|
---|
| 343 |
|
---|
[27] | 344 | %LENGTH CONTROL FIELDS
|
---|
[1] | 345 | if (length(md.maxiter)~=md.nsteps | length(md.optscal)~=md.nsteps | length(md.fit)~=md.nsteps)
|
---|
| 346 | disp('maxiter, optscal and fit must have the length specified by nsteps')
|
---|
| 347 | bool=0;return;
|
---|
| 348 | end
|
---|
[27] | 349 |
|
---|
| 350 | %FIT
|
---|
[1] | 351 | if sum((double(md.fit==1) + double(md.fit==0) + double(md.fit==2))==1)~=md.nsteps
|
---|
| 352 | disp('wrong fits: fit should be a vector of size nsteps holding 0, 1 and 2 only')
|
---|
| 353 | bool=0;return;
|
---|
| 354 | end
|
---|
| 355 |
|
---|
[27] | 356 | %OBSERVED VELOCITIES
|
---|
| 357 | fields={'vx_obs','vy_obs'};
|
---|
| 358 | for i=1:length(fields),
|
---|
[806] | 359 | if any(length(md.(fields{i}))~=md.numberofgrids),
|
---|
[681] | 360 | disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofgrids) '!']);
|
---|
[1] | 361 | bool=0; return;
|
---|
| 362 | end
|
---|
| 363 | end
|
---|
[1361] | 364 |
|
---|
| 365 | %SINGULAR
|
---|
[1755] | 366 | if ~any(sum(md.spcvelocity(:,1:3),2)==3),
|
---|
[1361] | 367 | disp(['model ' md.name ' is not well posed (singular). You need at least one grid with fixed velocity!'])
|
---|
| 368 | bool=0;return;
|
---|
| 369 | end
|
---|
| 370 |
|
---|
| 371 | %DIRICHLET IF THICKNESS <= 0
|
---|
| 372 | if any(md.thickness<=0),
|
---|
| 373 | pos=find(md.thickness<=0);
|
---|
[1755] | 374 | if any(find(md.spcthickness(pos,1)==0)),
|
---|
[1361] | 375 | disp(['model ' md.name ' has some grids with 0 thickness']);
|
---|
| 376 | bool=0; return;
|
---|
| 377 | end
|
---|
| 378 | end
|
---|
[1] | 379 | end
|
---|
| 380 |
|
---|
[27] | 381 | %QMU
|
---|
[465] | 382 | if strcmpi(md.analysis_type,'qmu'),
|
---|
[27] | 383 | if ~strcmpi(md.cluster,'none'),
|
---|
| 384 | if md.waitonlock==0,
|
---|
| 385 | disp(['model is not correctly configured: waitonlock should be activated when running qmu in parallel mode!']);
|
---|
| 386 | bool=0;return;
|
---|
[1] | 387 | end
|
---|
| 388 | end
|
---|
| 389 | end
|
---|
| 390 |
|
---|
[132] | 391 | %MESH2GRID
|
---|
[1781] | 392 | if md.analysis_type==Mesh2gridAnalysisEnum,
|
---|
[132] | 393 | if ~strcmpi(md.cluster,'none'),
|
---|
| 394 | disp(['model is not correctly configured: mesh2grid not supported in parallel yet!']);
|
---|
| 395 | bool=0;return;
|
---|
| 396 | end
|
---|
| 397 | end
|
---|
| 398 |
|
---|
| 399 |
|
---|
[27] | 400 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PACKAGE CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
[1] | 401 |
|
---|
[2164] | 402 | %NAN VALUES
|
---|
| 403 | fields={'sparsity'};
|
---|
| 404 | for i=1:length(fields),
|
---|
| 405 | if ~isempty(md.(fields{i})),
|
---|
| 406 | if any(isnan(md.(fields{i}))),
|
---|
| 407 | disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']);
|
---|
| 408 | bool=0; return;
|
---|
| 409 | end
|
---|
| 410 | end
|
---|
| 411 | end
|
---|
[1] | 412 |
|
---|
[2164] | 413 | %FIELD > 0
|
---|
| 414 | fields={'sparsity'};
|
---|
| 415 | for i=1:length(fields),
|
---|
| 416 | if ~isempty(md.(fields{i})),
|
---|
| 417 | if any(md.(fields{i})<0),
|
---|
| 418 | disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']);
|
---|
| 419 | bool=0; return;
|
---|
| 420 | end
|
---|
| 421 | end
|
---|
| 422 | end
|
---|
| 423 |
|
---|
| 424 | %FIELD ~= 0
|
---|
| 425 | fields={'sparsity'};
|
---|
| 426 | for i=1:length(fields),
|
---|
| 427 | if ~isempty(md.(fields{i})),
|
---|
| 428 | if any(md.(fields{i})==0),
|
---|
| 429 | disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']);
|
---|
| 430 | bool=0; return;
|
---|
| 431 | end
|
---|
| 432 | end
|
---|
| 433 | end
|
---|
| 434 |
|
---|
| 435 | %SPARSITY BETWEEN 0 AND 1
|
---|
| 436 | if ( (md.sparsity<=0) | (md.sparsity>1)),
|
---|
| 437 | disp(['model ' md.name ' sparsity should be inside the [0 1] range']);
|
---|
| 438 | bool=0; return;
|
---|
| 439 | end
|
---|
| 440 |
|
---|
| 441 | %CONNECTIVITY
|
---|
| 442 | if strcmpi(md.type,'2d'),
|
---|
| 443 | if md.connectivity<9,
|
---|
| 444 | disp('connectivity should be at least 9 for 2d models');
|
---|
| 445 | bool=0;return;
|
---|
| 446 | end
|
---|
| 447 | end
|
---|
| 448 | if strcmpi(md.type,'3d'),
|
---|
| 449 | if md.connectivity<24,
|
---|
| 450 | disp('connectivity should be at least 24 for 3d models');
|
---|
| 451 | bool=0;return;
|
---|
| 452 | end
|
---|
| 453 | end
|
---|
| 454 |
|
---|
| 455 | %LOWMEM = 0 or 1
|
---|
| 456 | if ((md.lowmem ~= 1) & (md.lowmem~=0)),
|
---|
| 457 | disp(['model ' md.name ' lowmem field should be 0 or 1']);
|
---|
| 458 | bool=0; return;
|
---|
| 459 | end
|
---|
| 460 |
|
---|
| 461 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PARALLEL CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
| 462 |
|
---|
| 463 | if ~strcmpi(md.cluster,'none'),
|
---|
| 464 |
|
---|
[27] | 465 | %NAN VALUES
|
---|
[2164] | 466 | fields={'time','np'};
|
---|
[27] | 467 | for i=1:length(fields),
|
---|
[806] | 468 | if ~isempty(md.(fields{i})),
|
---|
| 469 | if any(isnan(md.(fields{i}))),
|
---|
[681] | 470 | disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']);
|
---|
[27] | 471 | bool=0; return;
|
---|
| 472 | end
|
---|
| 473 | end
|
---|
| 474 | end
|
---|
[1] | 475 |
|
---|
[27] | 476 | %FIELD > 0
|
---|
[2164] | 477 | fields={'time','np'};
|
---|
[27] | 478 | for i=1:length(fields),
|
---|
[806] | 479 | if ~isempty(md.(fields{i})),
|
---|
| 480 | if any(md.(fields{i})<0),
|
---|
[681] | 481 | disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']);
|
---|
[27] | 482 | bool=0; return;
|
---|
| 483 | end
|
---|
| 484 | end
|
---|
| 485 | end
|
---|
[1] | 486 |
|
---|
[27] | 487 | %FIELD ~= 0
|
---|
[2164] | 488 | fields={'time','np'};
|
---|
[27] | 489 | for i=1:length(fields),
|
---|
[806] | 490 | if ~isempty(md.(fields{i})),
|
---|
| 491 | if any(md.(fields{i})==0),
|
---|
[681] | 492 | disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']);
|
---|
[27] | 493 | bool=0; return;
|
---|
| 494 | end
|
---|
| 495 | end
|
---|
[1] | 496 | end
|
---|
| 497 |
|
---|
| 498 | end
|
---|