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