Changeset 14874
- Timestamp:
- 05/03/13 15:55:08 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/solve/solve.py
r14872 r14874 1 import datetime 2 import os 3 import shutil 4 from pairoptions import * 5 from process_solve_options import * 6 from EnumDefinitions import * 7 from EnumToString import EnumToString 8 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 model 17 18 Usage: 19 md=solve(md,solutionenum,varargin) 20 where varargin is a list of paired arguments of string OR enums 21 22 solution types available comprise: 23 - DiagnosticSolutionEnum 24 - PrognosticSolutionEnum 25 - ThermalSolutionEnum 26 - SteadystateSolutionEnum 27 - TransientSolutionEnum... 28 - BalancethicknessSolutionEnum 29 - BedSlopeSolutionEnum 30 - SurfaceSlopeSolutionEnum 31 - HydrologySolutionEnum 32 - FlaimSolutionEnum 33 34 extra options: 35 - loadonly : does not solve. only load results 36 37 Examples: 38 md=solve(md,DiagnosticSolutionEnum); 39 """ 40 41 #recover and process solve options 42 options=pairoptions('solution_type',solutionenum,*args) 43 options=process_solve_options(options) 44 45 #recover some fields 46 md.private.solution=options['solution_type'] 47 cluster=md.cluster 48 49 #check model consistency 50 print "checking model consistency" 51 if solutionenum == FlaimSolutionEnum(): 52 md.private.isconsistent=True 53 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 unique 61 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 models 65 #fields needs to be carried out. 66 if md.qmu.isdakota: 67 md=preqmu(md,options) 68 69 #flaim analysis 1 70 if options['solution_type'] == FlaimSolutionEnum(): 2 71 md=flaim_sol(md,options)
Note:
See TracChangeset
for help on using the changeset viewer.