1 | function bool=ismodelselfconsistent(md,package),
|
---|
2 | %ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem.
|
---|
3 | %
|
---|
4 | % Usage:
|
---|
5 | % bool=ismodelselfconsistent(md,package),
|
---|
6 |
|
---|
7 | %tolerance we use in litmus tests for the consistency of the model
|
---|
8 | tolerance=10^-12;
|
---|
9 | if (nargin~=2 )
|
---|
10 | help ismodelselfconsistent
|
---|
11 | error('ismodelselfconsistent error message: wrong usage');
|
---|
12 | end
|
---|
13 |
|
---|
14 | %initialize output
|
---|
15 | bool=1;
|
---|
16 |
|
---|
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;
|
---|
23 | end
|
---|
24 |
|
---|
25 | %NAME
|
---|
26 | if isempty(md.name),
|
---|
27 | disp(['model is not correctly configured: missing name!']);
|
---|
28 | bool=0;return;
|
---|
29 | end
|
---|
30 |
|
---|
31 | %MESH
|
---|
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 |
|
---|
41 | %ELEMENTSTYPE
|
---|
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
|
---|
46 | if any(ones(md.numberofelements,1)-((md.elements_type(:,1)==HutterFormulationEnum) + (md.elements_type(:,1)==MacAyealFormulationEnum) + (md.elements_type(:,1)==PattynFormulationEnum)))
|
---|
47 | disp(['Types of elements have not been set properly, run setelementstype first'])
|
---|
48 | bool=0;return;
|
---|
49 | end
|
---|
50 | if any(ones(md.numberofelements,1)-((md.elements_type(:,2)==StokesFormulationEnum) + (md.elements_type(:,2)==NoneFormulationEnum)))
|
---|
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'),
|
---|
55 | if (ismember(PattynFormulationEnum,md.elements_type(:,1)) | ismember(StokesFormulationEnum,md.elements_type(:,2))),
|
---|
56 | disp(['For a 2d model, only MacAyeal''s and Hutter''s elements are allowed']);
|
---|
57 | bool=0;return;
|
---|
58 | end
|
---|
59 | end
|
---|
60 |
|
---|
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 |
|
---|
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
|
---|
78 |
|
---|
79 | %NO NAN
|
---|
80 | fields={'numberofelements','numberofgrids','x','y','z','drag','drag_type','p','q',...
|
---|
81 | 'rho_ice','rho_water','B','elementoniceshelf','surface','thickness','bed','g','lowmem','sparsity','nsteps','maxiter',...
|
---|
82 | 'tolx','np','eps_res','exclusive','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'};
|
---|
83 | for i=1:length(fields),
|
---|
84 | if ~isempty(md.(fields{i})),
|
---|
85 | if any(isnan(md.(fields{i}))),
|
---|
86 | disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']);
|
---|
87 | bool=0; return;
|
---|
88 | end
|
---|
89 | end
|
---|
90 | end
|
---|
91 |
|
---|
92 | %FIELDS >= 0
|
---|
93 | fields={'numberofelements','numberofgrids','elements','drag','drag_type','p','q',...
|
---|
94 | 'rho_ice','rho_water','B','elementoniceshelf','thickness','g','eps_res','eps_rel','eps_abs','nsteps','maxiter','tolx','exclusive',...
|
---|
95 | 'sparsity','lowmem','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'};
|
---|
96 | for i=1:length(fields),
|
---|
97 | if ~isempty(md.(fields{i})),
|
---|
98 | if any(md.(fields{i})<0),
|
---|
99 | disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']);
|
---|
100 | bool=0; return;
|
---|
101 | end
|
---|
102 | end
|
---|
103 | end
|
---|
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
|
---|
108 |
|
---|
109 | %FIELDS ~=0
|
---|
110 | fields={'numberofelements','numberofgrids','elements','drag_type',...
|
---|
111 | 'rho_ice','rho_water','B','thickness','g','eps_res','eps_rel','eps_abs','maxiter','tolx',...
|
---|
112 | 'sparsity','deltaH','DeltaH','timeacc','timedec'};
|
---|
113 | for i=1:length(fields),
|
---|
114 | if ~isempty(md.(fields{i})),
|
---|
115 | if any(md.(fields{i})==0),
|
---|
116 | disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']);
|
---|
117 | bool=0; return;
|
---|
118 | end
|
---|
119 | end
|
---|
120 | end
|
---|
121 |
|
---|
122 | %SIZE NUMBEROFELEMENTS
|
---|
123 | fields={'elements','p','q','elementoniceshelf','n','elementonbed'};
|
---|
124 | for i=1:size(fields,2),
|
---|
125 | if (size(md.(fields{i}),1)~=md.numberofelements),
|
---|
126 | disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofelements) '!']);
|
---|
127 | bool=0; return;
|
---|
128 | end
|
---|
129 | end
|
---|
130 |
|
---|
131 | %SIZE NUMBEROFGRIDS
|
---|
132 | fields={'x','y','z','B','drag','spcvelocity','melting','accumulation','surface','thickness','bed','gridonbed','gridonsurface'};
|
---|
133 | for i=1:length(fields),
|
---|
134 | if length(md.(fields{i}))~=md.numberofgrids,
|
---|
135 | disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofgrids) '!']);
|
---|
136 | bool=0; return;
|
---|
137 | end
|
---|
138 | end
|
---|
139 |
|
---|
140 | %THICKNESS = SURFACE - BED
|
---|
141 | if any((md.thickness-md.surface+md.bed)>tolerance),
|
---|
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!']);
|
---|
150 | bool=0;return;
|
---|
151 | end
|
---|
152 | end
|
---|
153 | if ~isstruct(md.rifts),
|
---|
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
|
---|
160 | end
|
---|
161 | end
|
---|
162 |
|
---|
163 | %ARTIFICIAL DIFFUSIVITY
|
---|
164 | if ~isscalar(md.artificial_diffusivity),
|
---|
165 | disp('artificial_diffusivity should be a scalar (1 or 0)');
|
---|
166 | bool=0;return;
|
---|
167 | end
|
---|
168 |
|
---|
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 |
|
---|
175 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLUTION CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
176 | %QMU
|
---|
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
|
---|
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
|
---|
197 | end
|
---|
198 |
|
---|
199 | %DIAGNOSTIC
|
---|
200 | if md.analysis_type==DiagnosticAnalysisEnum,
|
---|
201 |
|
---|
202 | %HUTTER ON ICESHELF WARNING
|
---|
203 | if any(md.elements_type(:,1)==HutterFormulationEnum & md.elementoniceshelf),
|
---|
204 | disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n'));
|
---|
205 | end
|
---|
206 |
|
---|
207 | %SINGULAR
|
---|
208 | if ~any(sum(md.spcvelocity(:,1:3),2)==3),
|
---|
209 | disp(['model ' md.name ' is not well posed (singular). You need at least one grid with fixed velocity!'])
|
---|
210 | bool=0;return;
|
---|
211 | end
|
---|
212 |
|
---|
213 | %DIRICHLET IF THICKNESS <= 0
|
---|
214 | if any(md.thickness<=0),
|
---|
215 | pos=find(md.thickness<=0);
|
---|
216 | if any(find(md.spcthickness(pos,1)==0)),
|
---|
217 | disp(['model ' md.name ' has some grids with 0 thickness']);
|
---|
218 | bool=0; return;
|
---|
219 | end
|
---|
220 | end
|
---|
221 | end
|
---|
222 |
|
---|
223 | %PROGNOSTIC
|
---|
224 | if md.analysis_type==PrognosticAnalysisEnum,
|
---|
225 |
|
---|
226 | %VELOCITIES
|
---|
227 | if (size(md.vx,1)~=md.numberofgrids | size(md.vy,1)~=md.numberofgrids),
|
---|
228 | disp(['a 3d velocity is required. Run ''diagnostic'' solution first!'])
|
---|
229 | bool=0; return;
|
---|
230 | end
|
---|
231 | end
|
---|
232 |
|
---|
233 | %STEADYSTATE
|
---|
234 | if md.analysis_type==SteadystateAnalysisEnum,
|
---|
235 | %NDT
|
---|
236 | if md.dt~=0,
|
---|
237 | disp(['For a steadystate computation, ndt must be zero.']);
|
---|
238 | bool=0;return;
|
---|
239 | end
|
---|
240 | %PRESSURE
|
---|
241 | if isnans(md.pressure),
|
---|
242 | disp(['For a steadystate computation, the model must have an initial pressure, even lithostatic will do.']);
|
---|
243 | bool=0;return;
|
---|
244 | end
|
---|
245 |
|
---|
246 | %eps:
|
---|
247 | if isnan(md.eps_rel),
|
---|
248 | disp(['For a steadystate computation, eps_rel (relative convergence criterion) must be defined!']);
|
---|
249 | bool=0;return;
|
---|
250 | end
|
---|
251 |
|
---|
252 | %dim:
|
---|
253 | if strcmpi(md.type,'2d'),
|
---|
254 | disp(['For a steadystate computation, model needs to be 3d']);
|
---|
255 | bool=0;return;
|
---|
256 | end
|
---|
257 | end
|
---|
258 |
|
---|
259 | %THERMAL STEADY AND THERMAL TRANSIENT
|
---|
260 | if md.analysis_type==ThermalAnalysisEnum,
|
---|
261 |
|
---|
262 | %EXTRUSION
|
---|
263 | if strcmp(md.type,'2d'),
|
---|
264 | disp(['For a ' md.analysis_type ' computation, the model must be 3d, extrude it first!'])
|
---|
265 | bool=0;return;
|
---|
266 | end
|
---|
267 |
|
---|
268 | %VELOCITIES AND PRESSURE
|
---|
269 | if (length(md.vx)~=md.numberofgrids | length(md.vy)~=md.numberofgrids | length(md.vz)~=md.numberofgrids),
|
---|
270 | disp(['a 3d velocity is required. Run ''diagnostic'' solution first!'])
|
---|
271 | bool=0;return;
|
---|
272 | end
|
---|
273 | if (length(md.pressure)~=md.numberofgrids),
|
---|
274 | disp(['pressure is required. Run ''diagnostic'' solution first!'])
|
---|
275 | bool=0;return;
|
---|
276 | end
|
---|
277 | end
|
---|
278 |
|
---|
279 | %THERMAL TRANSIENT
|
---|
280 | if md.analysis_type==ThermalAnalysisEnum & md.dt~=0
|
---|
281 |
|
---|
282 | %DT and NDT
|
---|
283 | fields={'dt','ndt'};
|
---|
284 | for i=1:length(fields),
|
---|
285 | if any(md.(fields{i})<0),
|
---|
286 | disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']);
|
---|
287 | bool=0; return;
|
---|
288 | end
|
---|
289 | end
|
---|
290 |
|
---|
291 | %INITIAL TEMPERATURE, MELTING AND ACCUMULATION
|
---|
292 | if (length(md.temperature)~=md.numberofgrids),
|
---|
293 | disp(['An initial temperature is needed for a transient thermal computation'])
|
---|
294 | bool=0;return;
|
---|
295 | end
|
---|
296 | if (length(md.temperature)~=md.numberofgrids | length(md.accumulation)~=md.numberofgrids | length(md.melting)~=md.numberofgrids),
|
---|
297 | disp(['The initial temperature, melting or accumulation should be a list and not a structure'])
|
---|
298 | bool=0;return;
|
---|
299 | end
|
---|
300 | end
|
---|
301 |
|
---|
302 | %PARAMETERS
|
---|
303 | if md.analysis_type==ParametersAnalysisEnum,
|
---|
304 |
|
---|
305 | %PACKAGE
|
---|
306 | if ~strcmpi(package,'ice'),
|
---|
307 | disp('parameter solution only supported by package ice yet');
|
---|
308 | bool=0;return;
|
---|
309 | end
|
---|
310 |
|
---|
311 | %OUTPUT
|
---|
312 | if ~iscell(md.parameteroutput)
|
---|
313 | disp(['parameteroutput field must be a cell, example {''strainrate'',''stress'',''deviatoricstress'',''viscousheating''}']);
|
---|
314 | bool=0; return;
|
---|
315 | end
|
---|
316 | for i=1:length(md.parameteroutput)
|
---|
317 | if ~strcmpi(md.parameteroutput(i),'strainrate') & ~strcmpi(md.parameteroutput(i),'stress') & ~strcmpi(md.parameteroutput(i),'deviatoricstress') & ~strcmpi(md.parameteroutput(i),'viscousheating') ...
|
---|
318 | & ~strcmpi(md.parameteroutput(i),'pressure_elem') & ~strcmpi(md.parameteroutput(i),'stress_bed') & ~strcmpi(md.parameteroutput(i),'stress_surface')
|
---|
319 | disp(['one of the parameteroutput is not supported yet']);
|
---|
320 | bool=0; return;
|
---|
321 | end
|
---|
322 | end
|
---|
323 | %VELOCITY
|
---|
324 | if ~(size(md.vx,1)==md.numberofgrids & size(md.vy,1)==md.numberofgrids & (size(md.vz,1)==md.numberofgrids | strcmpi(md.type,'2d')))
|
---|
325 | disp(['velocities are required!']);
|
---|
326 | bool=0;return;
|
---|
327 | end
|
---|
328 |
|
---|
329 | %HUTTER
|
---|
330 | if any(md.elements_type(:,1)==HutterFormulationEnum);
|
---|
331 | disp(['The model has Hutter''s elements. Impossible to compute parameters']);
|
---|
332 | bool=0;return;
|
---|
333 | end
|
---|
334 | end
|
---|
335 |
|
---|
336 | %CONTROL
|
---|
337 | if md.analysis_type==ControlAnalysisEnum,
|
---|
338 |
|
---|
339 | %CONTROL TYPE
|
---|
340 | if ~ischar(md.control_type),
|
---|
341 | disp('control_type should be a string');
|
---|
342 | bool=0;return;
|
---|
343 | end
|
---|
344 |
|
---|
345 | %LENGTH CONTROL FIELDS
|
---|
346 | if (length(md.maxiter)~=md.nsteps | length(md.optscal)~=md.nsteps | length(md.fit)~=md.nsteps)
|
---|
347 | disp('maxiter, optscal and fit must have the length specified by nsteps')
|
---|
348 | bool=0;return;
|
---|
349 | end
|
---|
350 |
|
---|
351 | %FIT
|
---|
352 | if sum((double(md.fit==1) + double(md.fit==0) + double(md.fit==2))==1)~=md.nsteps
|
---|
353 | disp('wrong fits: fit should be a vector of size nsteps holding 0, 1 and 2 only')
|
---|
354 | bool=0;return;
|
---|
355 | end
|
---|
356 |
|
---|
357 | %OBSERVED VELOCITIES
|
---|
358 | fields={'vx_obs','vy_obs'};
|
---|
359 | for i=1:length(fields),
|
---|
360 | if any(length(md.(fields{i}))~=md.numberofgrids),
|
---|
361 | disp(['model ' md.name ' field ' fields{i} ' should be of size ' num2str(md.numberofgrids) '!']);
|
---|
362 | bool=0; return;
|
---|
363 | end
|
---|
364 | end
|
---|
365 |
|
---|
366 | %SINGULAR
|
---|
367 | if ~any(sum(md.spcvelocity(:,1:3),2)==3),
|
---|
368 | disp(['model ' md.name ' is not well posed (singular). You need at least one grid with fixed velocity!'])
|
---|
369 | bool=0;return;
|
---|
370 | end
|
---|
371 |
|
---|
372 | %DIRICHLET IF THICKNESS <= 0
|
---|
373 | if any(md.thickness<=0),
|
---|
374 | pos=find(md.thickness<=0);
|
---|
375 | if any(find(md.spcthickness(pos,1)==0)),
|
---|
376 | disp(['model ' md.name ' has some grids with 0 thickness']);
|
---|
377 | bool=0; return;
|
---|
378 | end
|
---|
379 | end
|
---|
380 | end
|
---|
381 |
|
---|
382 | %QMU
|
---|
383 | if strcmpi(md.analysis_type,'qmu'),
|
---|
384 | if ~strcmpi(md.cluster,'none'),
|
---|
385 | if md.waitonlock==0,
|
---|
386 | disp(['model is not correctly configured: waitonlock should be activated when running qmu in parallel mode!']);
|
---|
387 | bool=0;return;
|
---|
388 | end
|
---|
389 | end
|
---|
390 | end
|
---|
391 |
|
---|
392 | %MESH2GRID
|
---|
393 | if md.analysis_type==Mesh2gridAnalysisEnum,
|
---|
394 | if ~strcmpi(md.cluster,'none'),
|
---|
395 | disp(['model is not correctly configured: mesh2grid not supported in parallel yet!']);
|
---|
396 | bool=0;return;
|
---|
397 | end
|
---|
398 | end
|
---|
399 |
|
---|
400 |
|
---|
401 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PACKAGE CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
402 |
|
---|
403 | %CIELO
|
---|
404 | if strcmpi(package,'cielo'),
|
---|
405 |
|
---|
406 | %NAN VALUES
|
---|
407 | fields={'sparsity'};
|
---|
408 | for i=1:length(fields),
|
---|
409 | if ~isempty(md.(fields{i})),
|
---|
410 | if any(isnan(md.(fields{i}))),
|
---|
411 | disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']);
|
---|
412 | bool=0; return;
|
---|
413 | end
|
---|
414 | end
|
---|
415 | end
|
---|
416 |
|
---|
417 | %FIELD > 0
|
---|
418 | fields={'sparsity'};
|
---|
419 | for i=1:length(fields),
|
---|
420 | if ~isempty(md.(fields{i})),
|
---|
421 | if any(md.(fields{i})<0),
|
---|
422 | disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']);
|
---|
423 | bool=0; return;
|
---|
424 | end
|
---|
425 | end
|
---|
426 | end
|
---|
427 |
|
---|
428 | %FIELD ~= 0
|
---|
429 | fields={'sparsity'};
|
---|
430 | for i=1:length(fields),
|
---|
431 | if ~isempty(md.(fields{i})),
|
---|
432 | if any(md.(fields{i})==0),
|
---|
433 | disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']);
|
---|
434 | bool=0; return;
|
---|
435 | end
|
---|
436 | end
|
---|
437 | end
|
---|
438 |
|
---|
439 | %SPARSITY BETWEEN 0 AND 1
|
---|
440 | if ( (md.sparsity<=0) | (md.sparsity>1)),
|
---|
441 | disp(['model ' md.name ' sparsity should be inside the [0 1] range']);
|
---|
442 | bool=0; return;
|
---|
443 | end
|
---|
444 |
|
---|
445 | %CONNECTIVITY
|
---|
446 | if strcmpi(md.type,'2d'),
|
---|
447 | if md.connectivity<9,
|
---|
448 | disp('connectivity should be at least 9 for 2d models');
|
---|
449 | bool=0;return;
|
---|
450 | end
|
---|
451 | end
|
---|
452 | if strcmpi(md.type,'3d'),
|
---|
453 | if md.connectivity<24,
|
---|
454 | disp('connectivity should be at least 24 for 3d models');
|
---|
455 | bool=0;return;
|
---|
456 | end
|
---|
457 | end
|
---|
458 |
|
---|
459 | %LOWMEM = 0 or 1
|
---|
460 | if ((md.lowmem ~= 1) & (md.lowmem~=0)),
|
---|
461 | disp(['model ' md.name ' lowmem field should be 0 or 1']);
|
---|
462 | bool=0; return;
|
---|
463 | end
|
---|
464 |
|
---|
465 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PARALLEL CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
466 |
|
---|
467 | if ~strcmpi(md.cluster,'none'),
|
---|
468 |
|
---|
469 | %NAN VALUES
|
---|
470 | fields={'time','np'};
|
---|
471 | for i=1:length(fields),
|
---|
472 | if ~isempty(md.(fields{i})),
|
---|
473 | if any(isnan(md.(fields{i}))),
|
---|
474 | disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']);
|
---|
475 | bool=0; return;
|
---|
476 | end
|
---|
477 | end
|
---|
478 | end
|
---|
479 |
|
---|
480 | %FIELD > 0
|
---|
481 | fields={'time','np'};
|
---|
482 | for i=1:length(fields),
|
---|
483 | if ~isempty(md.(fields{i})),
|
---|
484 | if any(md.(fields{i})<0),
|
---|
485 | disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']);
|
---|
486 | bool=0; return;
|
---|
487 | end
|
---|
488 | end
|
---|
489 | end
|
---|
490 |
|
---|
491 | %FIELD ~= 0
|
---|
492 | fields={'time','np'};
|
---|
493 | for i=1:length(fields),
|
---|
494 | if ~isempty(md.(fields{i})),
|
---|
495 | if any(md.(fields{i})==0),
|
---|
496 | disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']);
|
---|
497 | bool=0; return;
|
---|
498 | end
|
---|
499 | end
|
---|
500 | end
|
---|
501 |
|
---|
502 | end
|
---|
503 |
|
---|
504 | end
|
---|
505 |
|
---|
506 | %ICE and MACAYEAL
|
---|
507 | if (strcmpi(package,'ice') | strcmpi(package,'macayeal')),
|
---|
508 |
|
---|
509 | if (isnan(md.eps_rel) & isnan(md.eps_abs)),
|
---|
510 | disp(['At least eps_rel must be positive since eps_res not supported by package ' package '!']);
|
---|
511 | bool=0; return;
|
---|
512 | end
|
---|
513 |
|
---|
514 | end
|
---|