Changeset 2366 for issm/trunk/src/m/classes/public/ismodelselfconsistent.m
- Timestamp:
- 10/02/09 13:19:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/ismodelselfconsistent.m
r2357 r2366 5 5 % ismodelselfconsistent(md), 6 6 7 %tolerance we use in litmus tests for the consistency of the model7 %tolerance we use in litmus checks for the consistency of the model 8 8 tolerance=10^-12; 9 9 … … 71 71 if strcmpi(md.type,'2d'), 72 72 fields={'pressureload'}; 73 testsize(md,fields,[NaN 3]);73 checksize(md,fields,[NaN 3]); 74 74 elseif strcmpi(md.type,'3d'), 75 75 fields={'pressureload'}; 76 testsize(md,fields,[NaN 5]);76 checksize(md,fields,[NaN 5]); 77 77 end 78 78 … … 81 81 'rho_ice','rho_water','B','elementoniceshelf','surface','thickness','bed','g','lowmem','sparsity','nsteps','maxiter',... 82 82 'tolx','np','eps_res','exclusive','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'}; 83 testnan(md,fields);83 checknan(md,fields); 84 84 85 85 %FIELDS >= 0 … … 87 87 'rho_ice','rho_water','B','elementoniceshelf','thickness','g','eps_res','eps_rel','eps_abs','nsteps','maxiter','tolx','exclusive',... 88 88 'sparsity','lowmem','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'}; 89 testgreater(md,fields,0);89 checkgreater(md,fields,0); 90 90 91 91 %FIELDS > 0 … … 93 93 'rho_ice','rho_water','B','thickness','g','eps_res','eps_rel','eps_abs','maxiter','tolx',... 94 94 'sparsity','deltaH','DeltaH','timeacc','timedec'}; 95 testgreaterstrict(md,fields,0);95 checkgreaterstrict(md,fields,0); 96 96 97 97 %SIZE NUMBEROFELEMENTS 98 98 fields={'elements','p','q','elementoniceshelf','n','elementonbed'}; 99 testlength(md,fields,md.numberofelements);99 checklength(md,fields,md.numberofelements); 100 100 101 101 %SIZE NUMBEROFGRIDS 102 102 fields={'x','y','z','B','drag','spcvelocity','melting','accumulation','surface','thickness','bed','gridonbed','gridonsurface'}; 103 testlength(md,fields,md.numberofgrids);103 checklength(md,fields,md.numberofgrids); 104 104 105 105 %THICKNESS = SURFACE - BED … … 155 155 %NAN VALUES 156 156 fields={'time','np'}; 157 testnan(md,fields);157 checknan(md,fields); 158 158 159 159 %FIELD > 0 160 160 fields={'time','np'}; 161 testgreaterstrict(md,fields,0);161 checkgreaterstrict(md,fields,0); 162 162 163 163 end … … 221 221 %INITIAL VELOCITIES 222 222 fields={'vx','vy'}; 223 testsize(md,fields,[md.numberofgrids 1]);224 testnan(md,fields);223 checksize(md,fields,[md.numberofgrids 1]); 224 checknan(md,fields); 225 225 226 226 end … … 260 260 %VELOCITIES AND PRESSURE 261 261 fields={'vx','vy','vz','pressure'}; 262 testsize(md,fields,[md.numberofgrids 1]);263 testnan(md,fields);262 checksize(md,fields,[md.numberofgrids 1]); 263 checknan(md,fields); 264 264 265 265 end … … 270 270 %DT and NDT 271 271 fields={'dt','ndt'}; 272 testgreaterstrict(md,fields,0);272 checkgreaterstrict(md,fields,0); 273 273 274 274 %INITIAL TEMPERATURE, MELTING AND ACCUMULATION 275 275 fields={'temperature','accumulation','melting'}; 276 testsize(md,fields,[md.numberofgrids 1]);276 checksize(md,fields,[md.numberofgrids 1]); 277 277 278 278 end … … 288 288 %LENGTH CONTROL FIELDS 289 289 fields={'maxiter','optscal','fit','cm_jump'}; 290 testlength(md,fields,md.nsteps);290 checklength(md,fields,md.nsteps); 291 291 292 292 %FIT … … 297 297 %OBSERVED VELOCITIES 298 298 fields={'vx_obs','vy_obs'}; 299 testsize(md,fields,[md.numberofgrids 1]);300 testnan(md,fields);299 checksize(md,fields,[md.numberofgrids 1]); 300 checknan(md,fields); 301 301 302 302 %DIRICHLET IF THICKNESS <= 0 … … 320 320 end %end function 321 321 322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TESTFUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%323 324 function testlength(md,fields,fieldlength)325 % TESTSIZE - testlength of a field322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CHECK FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 323 324 function checklength(md,fields,fieldlength) 325 %CHECKSIZE - check length of a field 326 326 for i=1:length(fields), 327 327 if length(eval(['md.' fields{i}]))~=fieldlength, … … 331 331 end 332 332 333 function testsize(md,fields,fieldsize)334 % TESTSIZE - testsize of a field333 function checksize(md,fields,fieldsize) 334 %CHECKSIZE - check size of a field 335 335 for i=1:length(fields), 336 336 if isnan(fieldsize(1)), … … 350 350 end 351 351 352 function testnan(md,fields)353 % TESTNAN - testnan values of a field352 function checknan(md,fields) 353 %CHECKNAN - check nan values of a field 354 354 for i=1:length(fields), 355 355 if any(isnan(eval(['md.' fields{i}]))), … … 359 359 end 360 360 361 function testreal(md,fields)362 % TESTREAL - testreal values of a field361 function checkreal(md,fields) 362 %CHECKREAL - check real values of a field 363 363 for i=1:length(fields), 364 364 if any(eval(['~isreal(md.' fields{i} ')'])), … … 368 368 end 369 369 370 function testgreaterstrict(md,fields,lowerbound)371 % TESTGREATERSTRICT - testvalues of a field370 function checkgreaterstrict(md,fields,lowerbound) 371 %CHECKGREATERSTRICT - check values of a field 372 372 for i=1:length(fields), 373 373 if any(eval(['md.' fields{i} '<=' num2str(lowerbound) ])), … … 377 377 end 378 378 379 function testgreater(md,fields,lowerbound)380 % TESTGREATER - testvalues of a field379 function checkgreater(md,fields,lowerbound) 380 %CHECKGREATER - check values of a field 381 381 for i=1:length(fields), 382 382 if any(eval(['md.' fields{i} '<' num2str(lowerbound) ])), … … 386 386 end 387 387 388 function testlessstrict(md,fields,upperbound)389 % TESTLESSSTRICT - testvalues of a field388 function checklessstrict(md,fields,upperbound) 389 %CHECKLESSSTRICT - check values of a field 390 390 for i=1:length(fields), 391 391 if any(eval(['md.' fields{i} '>=' num2str(upperbound) ])), … … 395 395 end 396 396 397 function testless(md,fields,upperbound)398 % TESTLESS - testvalues of a field397 function checkless(md,fields,upperbound) 398 %CHECKLESS - check values of a field 399 399 for i=1:length(fields), 400 400 if any(eval(['md.' fields{i} '>' num2str(upperbound) ])),
Note:
See TracChangeset
for help on using the changeset viewer.