Ignore:
Timestamp:
08/02/12 17:13:12 (13 years ago)
Author:
cborstad
Message:

merged trunk-jpl into trunk-jpl-damage through revision 12877

Location:
issm/branches/trunk-jpl-damage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/branches/trunk-jpl-damage

  • issm/branches/trunk-jpl-damage/src/m/model/solve.m

    r10969 r12878  
    2424%      md=solve(md,DiagnosticSolutionEnum);
    2525
    26 %recover options
     26%recover and process solve options
    2727options=pairoptions(varargin{:},'solution_type',solutionenum);
    28 
    29 %add default options
    3028options=process_solve_options(options);
    3129
    3230%recover some fields
    3331md.private.solution=options.solution_type;
     32cluster=md.cluster;
    3433
    3534%check model consistency
    3635disp('checking model consistency');
    3736if (solutionenum == FlaimSolutionEnum)
    38         modelconsistency(true);
    39         md.mesh.checkconsistency(md,solutionenum);
    40         md.flaim.checkconsistency(md,solutionenum);
    41         if ~modelconsistency()
    42                 error(' ');
     37        md.private.isconsistent=true;
     38        md=checkconsistency(md.mesh,md,solutionenum);
     39        md=checkconsistency(md.flaim,md,solutionenum);
     40        if md.private.isconsistent==false,
     41                error('Model not consistent, see messages above');
    4342        end
    4443else
     
    4645end
    4746
    48 %if running qmu analysis, some preprocessing of dakota files using
    49 %models fields needs to be carried out.
     47%First, build a runtime name that is unique
     48c=clock;
     49md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
     50
     51%if running qmu analysis, some preprocessing of dakota files using models
     52%fields needs to be carried out.
    5053if md.qmu.isdakota,
    5154        md=preqmu(md,options);
    5255end
    5356
    54 %Save model as is (in case of a crash)
    55 assignin('base',inputname(1),md);
    56 
    5757%flaim analysis
    58 if (md.private.solution == FlaimSolutionEnum)
     58if (options.solution_type == FlaimSolutionEnum)
    5959        md=flaim_sol(md,options);
    6060        md.private.solution=EnumToString(options.solution_type);
     
    6262end
    6363
    64 %Marshall model data into a binary file.
    65 marshall(md);
    66 
    67 %write a template file for issm to use, in parallel
    68 PetscFile(md.solver,[md.miscellaneous.name '.petsc']);
    69 
    70 %If running in parallel, we have a different way of launching the solution
    71 %sequences.
    72 if ~strcmpi(md.cluster.name,'none'),
    73         md=solveparallel(md,options);
     64%Do we load results only?
     65if options.loadonly, 
     66        md=loadresultsfromcluster(md);
    7467        return;
    7568end
    7669
    77 %Launch correct solution sequence
    78 md=issm(md,md.private.solution);
     70%Wite all input files
     71marshall(md);                                          % bin file
     72PetscFile(md.solver,[md.miscellaneous.name '.petsc']); % petsc file
     73BuildQueueScript(cluster,md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof); % queue file
     74
     75%we need to make sure we have PETSC support, otherwise, we run with only one cpu:
     76if ~ispetsc,
     77        disp('PETSC support not included, running on 1 cpu only!');
     78        cluster.np=1;
     79end
     80
     81%Stop here if batch mode
     82if strcmpi(options.batch,'yes')
     83        disp('batch mode requested: not launching job interactively');
     84        disp('launch solution sequence on remote cluster by hand');
     85        return;
     86end
     87
     88%Launch job
     89modelname = md.miscellaneous.name;
     90filelist  = {[modelname '.bin '] [modelname '.petsc '] [modelname '.queue ']};
     91if md.qmu.isdakota,
     92        filelist{end+1} = [modelname '.qmu.in'];
     93end
     94LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist);
     95
     96%did we even try to run? if so, wait on lock
     97if strcmpi(options.upload,'on'),
     98        disp('solve done uploading test decks');
     99        return;
     100end
     101
     102%wait on lock
     103if md.settings.waitonlock>0,
     104        %we wait for the done file
     105        islock=waitonlock(md);
     106        if islock==0, %no results to be loaded
     107                disp('The results must be loaded manually with md=loadresultsfromcluster(md).');
     108        else          %load results
     109                disp('loading results from cluster');
     110                md=loadresultsfromcluster(md);
     111        end
     112end
    79113
    80114%post processes qmu results if necessary
    81115if md.qmu.isdakota,
    82         md=postqmu(md);
    83         cd ..
    84116        if ~strncmpi(options.keep,'y',1)
    85117                system(['rm -rf qmu' num2str(feature('GetPid'))]);
    86118        end
    87119end
    88 
    89 %convert analysis type to string finally
    90 md.private.solution=EnumToString(options.solution_type);
Note: See TracChangeset for help on using the changeset viewer.