Changeset 7626
- Timestamp:
- 03/04/11 14:19:31 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/m/model/ismodelselfconsistent.m ¶
r7623 r7626 11 11 help ismodelselfconsistent 12 12 error('ismodelselfconsistent error message: wrong usage'); 13 end14 %}}}15 16 %recursive call for TRANSIENT {{{117 if (md.analysis_type==Transient2DSolutionEnum | md.analysis_type==Transient3DSolutionEnum),18 if md.dt<=0,19 error('model not consistent: field dt must be positive for a transient run')20 end21 22 %recursive call to ismodelselfconsistent23 if (md.dim==2),24 analysis=[DiagnosticSolutionEnum PrognosticSolutionEnum];25 else26 analysis=[DiagnosticSolutionEnum PrognosticSolutionEnum ThermalSolutionEnum];27 end28 29 for i=1:length(analysis),30 md.analysis_type=analysis(i);31 ismodelselfconsistent(md);32 end33 34 if(md.cfl_coefficient>1 | md.cfl_coefficient<0),35 error(['model not consistent: model ' md.name ' cfl_coefficient field should between 0 and 1']);36 end37 end38 %}}}39 %recursive call for STEADYSTATE{{{140 if md.analysis_type==SteadystateSolutionEnum,41 42 %NDT43 if md.dt~=0,44 error(['model not consistent: for a steadystate computation, dt must be zero.']);45 end46 47 %PRESSURE48 if isnans(md.pressure),49 error(['model not consistent: for a steadystate computation, the model must have an initial pressure, even lithostatic will do.']);50 end51 52 %eps:53 if isnan(md.eps_rel),54 error(['model not consistent: for a steadystate computation, eps_rel (relative convergence criterion) must be defined!']);55 end56 57 %recursive call to ismodelselfconsistent58 analysis=[DiagnosticSolutionEnum ThermalSolutionEnum];59 60 for i=1:length(analysis),61 md.analysis_type=analysis(i);62 ismodelselfconsistent(md);63 end64 65 end66 %}}}67 %recursive call for GROUNDINGLINEMIGRATION2D{{{168 if md.analysis_type==GroundingLineMigration2DSolutionEnum,69 if strcmpi(md.cluster.name,'none'),70 error(['model not consistent: ' md.analysis_type ' is only implemented in parallel mode !'])71 end72 73 if md.dt<=0,74 error('model not consistent: field dt must be positive for a transient run')75 end76 77 %recursive call to ismodelselfconsistent78 if (md.dim==2),79 analysis=[DiagnosticSolutionEnum PrognosticSolutionEnum];80 else81 error(['model not consistent: for a ' md.analysis_type ' computation, the grounding line module is only implemented in 2d !'])82 end83 84 for i=1:length(analysis),85 md.analysis_type=analysis(i);86 ismodelselfconsistent(md);87 end88 89 if(md.cfl_coefficient>1 | md.cfl_coefficient<0),90 error(['model not consistent: model ' md.name ' cfl_coefficient field should between 0 and 1']);91 end92 13 end 93 14 %}}} … … 276 197 IsConsistent(md.cluster); 277 198 %}}} 278 279 % Solution checks280 %DIAGNOSTIC{{{1281 if md.analysis_type==DiagnosticSolutionEnum,282 283 %HUTTER ON ICESHELF WARNING284 if any(md.elements_type==HutterApproximationEnum & md.elementoniceshelf),285 disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n'));286 end287 288 %SINGULAR289 if ~any(sum(md.spcvelocity(:,1:2),2)==2),290 error(['model not consistent: model ' md.name ' is not well posed (singular). You need at least one grid with fixed velocity!'])291 end292 293 %DIRICHLET IF THICKNESS <= 0294 if any(md.thickness<=0),295 pos=find(md.thickness<=0);296 if any(find(md.spcthickness(pos,1)==0)),297 error(['model not consistent: model ' md.name ' has some grids with 0 thickness']);298 end299 end300 301 %INITIAL VELOCITY302 if length(md.vx)==md.numberofgrids & length(md.vy)==md.numberofgrids,303 fields={'vx','vy'};304 checknan(md,fields);305 end306 end307 %}}}308 %PROGNOSTIC{{{1309 if md.analysis_type==PrognosticSolutionEnum,310 311 %INITIAL VELOCITIES312 fields={'vx','vy'};313 checksize(md,fields,[md.numberofgrids 1]);314 checknan(md,fields);315 316 %CHECK THAT WE ARE NOT FULLY CONSTRAINED317 if (md.dim==2),318 if isempty(find(~md.spcthickness(:,1))),319 error(['model not consistent: model ' md.name ' is totally constrained for prognostic, no need to solve!']);320 end321 end322 323 end324 %}}}325 %THERMAL {{{1326 %THERMAL STEADY AND THERMAL TRANSIENT327 if md.analysis_type==ThermalSolutionEnum,328 329 %EXTRUSION330 if (md.dim==2),331 error(['model not consistent: for a ' md.analysis_type ' computation, the model must be 3d, extrude it first!'])332 end333 334 %CHECK THAT WE ARE NOT FULLY CONSTRAINED335 if isempty(find(~md.spctemperature(:,1))),336 error(['model not consistent: model ' md.name ' is totally constrained for temperature, no need to solve!']);337 end338 339 %VELOCITIES AND PRESSURE340 fields={'vx','vy','vz','pressure','geothermalflux'};341 checksize(md,fields,[md.numberofgrids 1]);342 checknan(md,fields);343 344 end345 346 %THERMAL TRANSIENT347 if md.analysis_type==ThermalSolutionEnum & md.dt~=0,348 349 %DT and NDT350 fields={'dt','ndt'};351 checkgreaterstrict(md,fields,0);352 353 %INITIAL TEMPERATURE, MELTING AND ACCUMULATION354 fields={'temperature','accumulation_rate','melting_rate'};355 checksize(md,fields,[md.numberofgrids 1]);356 checknan(md,fields);357 358 %INITIAL TEMPERATURE359 fields={'temperature','spctemperature(:,2)','observed_temperature'};360 checkgreater(md,fields,0)361 362 end363 %}}}364 %BALANCEDTHICKNESS{{{1365 if md.analysis_type==BalancedthicknessSolutionEnum366 367 %VELOCITIES MELTING AND ACCUMULATION368 fields={'vx','vy','accumulation_rate','melting_rate','dhdt'};369 checksize(md,fields,[md.numberofgrids 1]);370 checknan(md,fields);371 372 %SPC373 % if ~md.prognostic_DG,374 % if any(md.spcthickness(find(md.gridonboundary))~=1),375 % error(['model not consistent: model ' md.name ' should have all the nodes on boundary constrained in field spcthickness']);376 % end377 % end378 379 %Triangle with zero velocity380 if any(sum(abs(md.vx(md.elements)),2)==0 & sum(abs(md.vy(md.elements)),2)==0)381 error('model not consistent: at least one triangle has all its vertices with a zero velocity');382 end383 end384 %}}}385 %BALANCEDVELOCITIES{{{1386 if md.analysis_type==BalancedvelocitiesSolutionEnum387 388 %VELOCITIES MELTING AND ACCUMULATION389 fields={'vx','vy','accumulation_rate','melting_rate'};390 checksize(md,fields,[md.numberofgrids 1]);391 checknan(md,fields);392 393 %SPC394 if any(md.spcvelocity(find(md.gridonboundary),[1:2])~=1),395 error(['model not consistent: model ' md.name ' should have all the nodes on boundary constrained in field spcvelocity']);396 end397 end398 %}}}399 199 %CONTROL{{{1 400 200 if md.control_analysis, … … 488 288 %}}} 489 289 490 end 290 %Solution specific check 291 %TRANSIENT {{{1 292 if (md.analysis_type==Transient2DSolutionEnum | md.analysis_type==Transient3DSolutionEnum), 293 294 if md.dt<=0, 295 error('model not consistent: field dt must be positive for a transient run') 296 end 297 298 if(md.cfl_coefficient>1 | md.cfl_coefficient<0), 299 error(['model not consistent: model ' md.name ' cfl_coefficient field should between 0 and 1']); 300 end 301 end 302 %}}} 303 %STEADYSTATE{{{1 304 if md.analysis_type==SteadystateSolutionEnum, 305 306 %NDT 307 if md.dt~=0, 308 error(['model not consistent: for a steadystate computation, dt must be zero.']); 309 end 310 311 %eps: 312 if isnan(md.eps_rel), 313 error(['model not consistent: for a steadystate computation, eps_rel (relative convergence criterion) must be defined!']); 314 end 315 end 316 %}}} 317 %GROUNDINGLINEMIGRATION2D{{{1 318 if md.analysis_type==GroundingLineMigration2DSolutionEnum, 319 if strcmpi(md.cluster.name,'none'), 320 error(['model not consistent: ' md.analysis_type ' is only implemented in parallel mode !']) 321 end 322 323 if md.dt<=0, 324 error('model not consistent: field dt must be positive for a transient run') 325 end 326 327 %recursive call to ismodelselfconsistent 328 if (md.dim~=2), 329 error(['model not consistent: for a ' md.analysis_type ' computation, the grounding line module is only implemented in 2d !']) 330 end 331 332 if(md.cfl_coefficient>1 | md.cfl_coefficient<0), 333 error(['model not consistent: model ' md.name ' cfl_coefficient field should between 0 and 1']); 334 end 335 end 336 %}}} 337 %ANALYSESCHECKS {{{1 338 [analyses,numanalyses,solutioncore]=SolutionConfiguration(md.analysis_type); 339 for i=1:numanalyses, 340 checkforanalysis(md,analyses(i)); 341 end 342 %}}} 343 end 344 345 %analysis checks 346 %checkforanalysis {{{1 347 function checkforanalysis(md,analysis_enum) 348 349 switch(analysis_enum), 350 case DiagnosticHorizAnalysisEnum, 351 % {{{2 352 %SINGULAR 353 if ~any(sum(md.spcvelocity(:,1:2),2)==2), 354 error(['model not consistent: model ' md.name ' is not well posed (singular). You need at least one grid with fixed velocity!']) 355 end 356 357 %DIRICHLET IF THICKNESS <= 0 358 if any(md.thickness<=0), 359 pos=find(md.thickness<=0); 360 if any(find(md.spcthickness(pos,1)==0)), 361 error(['model not consistent: model ' md.name ' has some grids with 0 thickness']); 362 end 363 end 364 365 %INITIAL VELOCITY 366 if ~isempty(md.vx) & ~isempty(md.vy), 367 fields={'vx','vy'}; 368 checknan(md,fields); 369 checksize(md,fields,[md.numberofgrids 1]); 370 end 371 %}}} 372 case DiagnosticVertAnalysisEnum, 373 % {{{2 374 if md.dim==3, 375 % No checks for now 376 end 377 %}}} 378 case DiagnosticHutterAnalysisEnum, 379 % {{{2 380 %HUTTER ON ICESHELF WARNING 381 if any(md.elements_type==HutterApproximationEnum & md.elementoniceshelf), 382 disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n')); 383 end 384 %}}} 385 case BedSlopeAnalysisEnum, 386 % {{{2 387 % No checks for now 388 %}}} 389 case SurfaceSlopeAnalysisEnum, 390 % {{{2 391 % No checks for now 392 %}}} 393 case PrognosticAnalysisEnum, 394 % {{{2 395 %INITIAL VELOCITIES 396 fields={'vx','vy'}; 397 checksize(md,fields,[md.numberofgrids 1]); 398 checknan(md,fields); 399 400 %CHECK THAT WE ARE NOT FULLY CONSTRAINED 401 if (md.dim==2), 402 if isempty(find(~md.spcthickness(:,1))), 403 error(['model not consistent: model ' md.name ' is totally constrained for prognostic, no need to solve!']); 404 end 405 end 406 %}}} 407 case ThermalAnalysisEnum, 408 % {{{2 409 %EXTRUSION 410 if (md.dim==2), 411 error(['model not consistent: for a ' md.analysis_type ' computation, the model must be 3d, extrude it first!']) 412 end 413 414 %CHECK THAT WE ARE NOT FULLY CONSTRAINED 415 if isempty(find(~md.spctemperature(:,1))), 416 error(['model not consistent: model ' md.name ' is totally constrained for temperature, no need to solve!']); 417 end 418 419 %VELOCITIES AND PRESSURE 420 fields={'vx','vy','vz','pressure','geothermalflux'}; 421 checksize(md,fields,[md.numberofgrids 1]); 422 checknan(md,fields); 423 424 %THERMAL TRANSIENT 425 if md.dt~=0, 426 427 %DT and NDT 428 fields={'dt','ndt'}; 429 checkgreaterstrict(md,fields,0); 430 431 %INITIAL TEMPERATURE, MELTING AND ACCUMULATION 432 fields={'temperature','accumulation_rate','melting_rate'}; 433 checksize(md,fields,[md.numberofgrids 1]); 434 checknan(md,fields); 435 436 %INITIAL TEMPERATURE 437 fields={'temperature','spctemperature(:,2)','observed_temperature'}; 438 checkgreater(md,fields,0) 439 end 440 %}}} 441 case MeltingAnalysisEnum, 442 % {{{2 443 % No checks for now 444 %}}} 445 case BalancedthicknessAnalysisEnum, 446 % {{{2 447 %VELOCITIES MELTING AND ACCUMULATION 448 fields={'vx','vy','accumulation_rate','melting_rate','dhdt'}; 449 checksize(md,fields,[md.numberofgrids 1]); 450 checknan(md,fields); 451 452 %SPC 453 % if ~md.prognostic_DG, 454 % if any(md.spcthickness(find(md.gridonboundary))~=1), 455 % error(['model not consistent: model ' md.name ' should have all the nodes on boundary constrained in field spcthickness']); 456 % end 457 % end 458 459 %Triangle with zero velocity 460 if any(sum(abs(md.vx(md.elements)),2)==0 & sum(abs(md.vy(md.elements)),2)==0) 461 error('model not consistent: at least one triangle has all its vertices with a zero velocity'); 462 end 463 %}}} 464 case BalancedvelocitiesAnalysisEnum, 465 % {{{2 466 %VELOCITIES MELTING AND ACCUMULATION 467 fields={'vx','vy','accumulation_rate','melting_rate'}; 468 checksize(md,fields,[md.numberofgrids 1]); 469 checknan(md,fields); 470 471 %SPC 472 if any(md.spcvelocity(find(md.gridonboundary),[1:2])~=1), 473 error(['model not consistent: model ' md.name ' should have all the nodes on boundary constrained in field spcvelocity']); 474 end 475 %}}} 476 otherwise 477 disp(['WARNING: no check implemented for analysis ' EnumToString(analysis_enum) '!']); 478 error('stop') 479 end 480 481 end 482 %}}} 491 483 492 484 %checks additional functions
Note:
See TracChangeset
for help on using the changeset viewer.