source:
issm/oecreview/Archive/14312-15392/ISSM-14871-14872.diff@
15393
Last change on this file since 15393 was 15393, checked in by , 12 years ago | |
---|---|
File size: 3.0 KB |
-
../trunk-jpl/src/m/solve/solve.py
1 import datetime2 import os3 import shutil4 from pairoptions import *5 from process_solve_options import *6 from EnumDefinitions import *7 from EnumToString import EnumToString8 from ismodelselfconsistent import *9 from marshall import *10 from ispetsc import *11 from waitonlock import *12 from loadresultsfromcluster import *13 14 def solve(md,solutionenum,*args):15 """16 SOLVE - apply solution sequence for this model17 18 Usage:19 md=solve(md,solutionenum,varargin)20 where varargin is a list of paired arguments of string OR enums21 22 solution types available comprise:23 - DiagnosticSolutionEnum24 - PrognosticSolutionEnum25 - ThermalSolutionEnum26 - SteadystateSolutionEnum27 - TransientSolutionEnum...28 - BalancethicknessSolutionEnum29 - BedSlopeSolutionEnum30 - SurfaceSlopeSolutionEnum31 - HydrologySolutionEnum32 - FlaimSolutionEnum33 34 extra options:35 - loadonly : does not solve. only load results36 37 Examples:38 md=solve(md,DiagnosticSolutionEnum);39 """40 41 #recover and process solve options42 options=pairoptions('solution_type',solutionenum,*args)43 options=process_solve_options(options)44 45 #recover some fields46 md.private.solution=options['solution_type']47 cluster=md.cluster48 49 #check model consistency50 print "checking model consistency"51 if solutionenum == FlaimSolutionEnum():52 md.private.isconsistent=True53 md.mesh.checkconsistency(md,solutionenum)54 md.flaim.checkconsistency(md,solutionenum)55 if not md.private.isconsistent:56 raise RuntimeError("Model not consistent, see messages above.")57 else:58 ismodelselfconsistent(md)59 60 #First, build a runtime name that is unique61 c=datetime.datetime.now()62 md.private.runtimename="%s-%02i-%02i-%04i-%02i-%02i-%02i-%i" % (md.miscellaneous.name,c.month,c.day,c.year,c.hour,c.minute,c.second,os.getpid())63 64 #if running qmu analysis, some preprocessing of dakota files using models65 #fields needs to be carried out.66 if md.qmu.isdakota:67 md=preqmu(md,options)68 69 #flaim analysis70 1 if options['solution_type'] == FlaimSolutionEnum(): 71 2 md=flaim_sol(md,options) 72 3 [md.private.solution]=EnumToString(options['solution_type']) … … 82 13 md.toolkits.ToolkitsFile(md.miscellaneous.name+'.toolkits') # toolkits file 83 14 cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof) # queue file 84 15 85 #we need to make sure we have PETSC support, otherwise, we run with only one cpu:86 if not ispetsc():87 print "PETSC support not included, running on 1 cpu only!"88 cluster.np=189 90 16 #Stop here if batch mode 91 17 if strcmpi(options['batch'],'yes'): 92 18 print 'batch mode requested: not launching job interactively'
Note:
See TracBrowser
for help on using the repository browser.