Changeset 2164
- Timestamp:
- 09/09/09 15:41:11 (15 years ago)
- Location:
- issm/trunk/src/m/classes/public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/ismodelselfconsistent.m
r2052 r2164 1 function bool=ismodelselfconsistent(md ,package),1 function bool=ismodelselfconsistent(md), 2 2 %ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem. 3 3 % 4 4 % Usage: 5 % bool=ismodelselfconsistent(md ,package),5 % bool=ismodelselfconsistent(md), 6 6 7 7 %tolerance we use in litmus tests for the consistency of the model 8 8 tolerance=10^-12; 9 if (nargin~= 2)9 if (nargin~=1 ) 10 10 help ismodelselfconsistent 11 11 error('ismodelselfconsistent error message: wrong usage'); … … 58 58 end 59 59 end 60 61 60 if (md.ismacayealpattyn==0 && md.ishutter==0 && md.isstokes==0), 62 61 disp(['no elements type set for this model. at least one of ismacayealpattyn, ishutter and isstokes need to be =1']); 62 bool=0;return; 63 end 64 if (md.analysis_type==DiagnosticAnalysisEnum & any(ismember(MacAyealFormulationEnum,md.elements_type(:,1)) & ismember(PattynFormulationEnum,md.elements_type(:,1)))) 65 disp(['coupling MacAyeal/Pattyn not implemented yet']); 66 bool=0;return; 67 end 68 if (md.isstokes & md.analysis_type==TransientAnalysisEnum()); 69 disp(['Stokes transient not implemented yet']); 63 70 bool=0;return; 64 71 end … … 167 174 end 168 175 169 %CLUSTER170 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 end174 175 176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLUTION CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 176 177 %QMU … … 306 307 %PARAMETERS 307 308 if md.analysis_type==ParametersAnalysisEnum, 308 309 %PACKAGE310 if ~strcmpi(package,'ice'),311 disp('parameter solution only supported by package ice yet');312 bool=0;return;313 end314 309 315 310 %OUTPUT … … 405 400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PACKAGE CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 406 401 407 %CIELO 408 if strcmpi(package,'cielo'), 402 %NAN VALUES 403 fields={'sparsity'}; 404 for i=1:length(fields), 405 if ~isempty(md.(fields{i})), 406 if any(isnan(md.(fields{i}))), 407 disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']); 408 bool=0; return; 409 end 410 end 411 end 412 413 %FIELD > 0 414 fields={'sparsity'}; 415 for i=1:length(fields), 416 if ~isempty(md.(fields{i})), 417 if any(md.(fields{i})<0), 418 disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']); 419 bool=0; return; 420 end 421 end 422 end 423 424 %FIELD ~= 0 425 fields={'sparsity'}; 426 for i=1:length(fields), 427 if ~isempty(md.(fields{i})), 428 if any(md.(fields{i})==0), 429 disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']); 430 bool=0; return; 431 end 432 end 433 end 434 435 %SPARSITY BETWEEN 0 AND 1 436 if ( (md.sparsity<=0) | (md.sparsity>1)), 437 disp(['model ' md.name ' sparsity should be inside the [0 1] range']); 438 bool=0; return; 439 end 440 441 %CONNECTIVITY 442 if strcmpi(md.type,'2d'), 443 if md.connectivity<9, 444 disp('connectivity should be at least 9 for 2d models'); 445 bool=0;return; 446 end 447 end 448 if strcmpi(md.type,'3d'), 449 if md.connectivity<24, 450 disp('connectivity should be at least 24 for 3d models'); 451 bool=0;return; 452 end 453 end 454 455 %LOWMEM = 0 or 1 456 if ((md.lowmem ~= 1) & (md.lowmem~=0)), 457 disp(['model ' md.name ' lowmem field should be 0 or 1']); 458 bool=0; return; 459 end 460 461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PARALLEL CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 462 463 if ~strcmpi(md.cluster,'none'), 409 464 410 465 %NAN VALUES 411 fields={' sparsity'};466 fields={'time','np'}; 412 467 for i=1:length(fields), 413 468 if ~isempty(md.(fields{i})), … … 420 475 421 476 %FIELD > 0 422 fields={' sparsity'};477 fields={'time','np'}; 423 478 for i=1:length(fields), 424 479 if ~isempty(md.(fields{i})), … … 431 486 432 487 %FIELD ~= 0 433 fields={' sparsity'};488 fields={'time','np'}; 434 489 for i=1:length(fields), 435 490 if ~isempty(md.(fields{i})), … … 441 496 end 442 497 443 %SPARSITY BETWEEN 0 AND 1 444 if ( (md.sparsity<=0) | (md.sparsity>1)), 445 disp(['model ' md.name ' sparsity should be inside the [0 1] range']); 446 bool=0; return; 447 end 448 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 462 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']); 466 bool=0; return; 467 end 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), 476 if ~isempty(md.(fields{i})), 477 if any(isnan(md.(fields{i}))), 478 disp(['model ' md.name ' has an NaN value in field ' fields{i} '!']); 479 bool=0; return; 480 end 481 end 482 end 483 484 %FIELD > 0 485 fields={'time','np'}; 486 for i=1:length(fields), 487 if ~isempty(md.(fields{i})), 488 if any(md.(fields{i})<0), 489 disp(['model ' md.name ' has a <0 value in field ' fields{i} '!']); 490 bool=0; return; 491 end 492 end 493 end 494 495 %FIELD ~= 0 496 fields={'time','np'}; 497 for i=1:length(fields), 498 if ~isempty(md.(fields{i})), 499 if any(md.(fields{i})==0), 500 disp(['model ' md.name ' has a =0 value in field ' fields{i} '!']); 501 bool=0; return; 502 end 503 end 504 end 505 506 end 507 508 end 509 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 498 end -
issm/trunk/src/m/classes/public/process_solve_options.m
r2104 r2164 6 6 % 7 7 % See also: SOLVE,RECOVER_SOLVE_OPTIONS 8 9 %package: is there one? check to ''cielo''10 found=0;11 for i=1:size(options,1),12 if strcmpi(options{i,1},'package'),13 package=options{i,2};14 found=1;15 break16 end17 end18 if ~found,19 disp('recover_solve_options info message: no ''package'' was provided, defaulting to ''cielo''');20 options(end+1,:)={'package' 'cielo'};21 package='cielo';22 end23 if ~ismemberi(package,{'cielo','ice','macayeal'}),24 error(['process_solve_options error message: package ' package ' not supported yet!']);25 end26 8 27 9 %analysis_type: check on this option, error out otherwise … … 71 53 analysis_type=eval([upper(analysis_type(1)) lower(analysis_type(2:end)) 'AnalysisEnum']); 72 54 end 73 if ~ismemberi(sub_analysis_type,{' none','horiz','adjoint','gradient','inverse','vert',''}),55 if ~ismemberi(sub_analysis_type,{'steady','transient','none','horiz','adjoint','gradient','inverse','vert',''}), 74 56 error(['process_solve_options error message: sub_analysis_type ' sub_analysis_type ' not supported yet!']); 75 57 else … … 120 102 %setup final options structure 121 103 outoptions.analysis_type=analysis_type; 122 outoptions.package=package;123 104 outoptions.sub_analysis_type=sub_analysis_type; 124 105 outoptions.qmudir=qmudir; -
issm/trunk/src/m/classes/public/solve.m
r2032 r2164 7 7 % arguments can be: 'analysis_type': 'diagnostic','thermal','prognostic','transient' 8 8 % arguments can be: 'sub_analysis_type': 'transient','steady','' (default if empty = 'steady') 9 % arguments can be: 'package': 'macayeal','ice','cielo' (default if not specified = 'cielo')10 9 % 11 10 % Examples: 12 % md=solve(md,'analysis_type','diagnostic' ,'package','cielo');13 % md=solve(md,'analysis_type','thermal','sub_analysis_type','transient' ,'package','ice');14 % md=solve(md,'analysis_type','thermal','sub_analysis_type','steady' ,'package','cielo');15 % md=solve(md,'analysis_type','thermal' ,'package','cielo');11 % md=solve(md,'analysis_type','diagnostic'); 12 % md=solve(md,'analysis_type','thermal','sub_analysis_type','transient'); 13 % md=solve(md,'analysis_type','thermal','sub_analysis_type','steady'); 14 % md=solve(md,'analysis_type','thermal'); 16 15 17 16 %some checks on list of arguments … … 27 26 md.analysis_type=options.analysis_type; 28 27 md.sub_analysis_type=options.sub_analysis_type; 29 package=options.package;30 28 31 %Use package to set solution namespace 32 usenamespace(package); 33 34 if ~ismodelselfconsistent(md,package), 29 if ~ismodelselfconsistent(md), 35 30 error(' '); %previous error messages should explain what is going on. 36 31 end … … 94 89 md.analysis_type=AnalysisTypeFromEnum(options.analysis_type); 95 90 md.sub_analysis_type=AnalysisTypeFromEnum(options.sub_analysis_type); 96 97 %re-add the paths98 addpath(genpath_ice([ISSM_DIR '/src/m/solutions/macayeal']));99 addpath(genpath_ice([ISSM_DIR '/src/m/solutions/ice']));100 addpath(genpath_ice([ISSM_DIR '/src/m/solutions/cielo']));101 addpath(genpath_ice([ISSM_DIR '/bin']));
Note:
See TracChangeset
for help on using the changeset viewer.