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