source: issm/oecreview/Archive/14312-15392/ISSM-14871-14872.diff@ 15393

Last change on this file since 15393 was 15393, checked in by Mathieu Morlighem, 12 years ago

NEW: adding Archive/14312-15392 for oecreview

File size: 3.0 KB
RevLine 
[15393]1Index: ../trunk-jpl/src/m/solve/solve.py
2===================================================================
3--- ../trunk-jpl/src/m/solve/solve.py (revision 14871)
4+++ ../trunk-jpl/src/m/solve/solve.py (revision 14872)
5@@ -1,72 +1,3 @@
6-import datetime
7-import os
8-import shutil
9-from pairoptions import *
10-from process_solve_options import *
11-from EnumDefinitions import *
12-from EnumToString import EnumToString
13-from ismodelselfconsistent import *
14-from marshall import *
15-from ispetsc import *
16-from waitonlock import *
17-from loadresultsfromcluster import *
18-
19-def solve(md,solutionenum,*args):
20- """
21- SOLVE - apply solution sequence for this model
22-
23- Usage:
24- md=solve(md,solutionenum,varargin)
25- where varargin is a list of paired arguments of string OR enums
26-
27- solution types available comprise:
28- - DiagnosticSolutionEnum
29- - PrognosticSolutionEnum
30- - ThermalSolutionEnum
31- - SteadystateSolutionEnum
32- - TransientSolutionEnum...
33- - BalancethicknessSolutionEnum
34- - BedSlopeSolutionEnum
35- - SurfaceSlopeSolutionEnum
36- - HydrologySolutionEnum
37- - FlaimSolutionEnum
38-
39- extra options:
40- - loadonly : does not solve. only load results
41-
42- Examples:
43- md=solve(md,DiagnosticSolutionEnum);
44- """
45-
46- #recover and process solve options
47- options=pairoptions('solution_type',solutionenum,*args)
48- options=process_solve_options(options)
49-
50- #recover some fields
51- md.private.solution=options['solution_type']
52- cluster=md.cluster
53-
54- #check model consistency
55- print "checking model consistency"
56- if solutionenum == FlaimSolutionEnum():
57- md.private.isconsistent=True
58- md.mesh.checkconsistency(md,solutionenum)
59- md.flaim.checkconsistency(md,solutionenum)
60- if not md.private.isconsistent:
61- raise RuntimeError("Model not consistent, see messages above.")
62- else:
63- ismodelselfconsistent(md)
64-
65- #First, build a runtime name that is unique
66- c=datetime.datetime.now()
67- 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())
68-
69- #if running qmu analysis, some preprocessing of dakota files using models
70- #fields needs to be carried out.
71- if md.qmu.isdakota:
72- md=preqmu(md,options)
73-
74- #flaim analysis
75 if options['solution_type'] == FlaimSolutionEnum():
76 md=flaim_sol(md,options)
77 [md.private.solution]=EnumToString(options['solution_type'])
78@@ -82,11 +13,6 @@
79 md.toolkits.ToolkitsFile(md.miscellaneous.name+'.toolkits') # toolkits file
80 cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof) # queue file
81
82- #we need to make sure we have PETSC support, otherwise, we run with only one cpu:
83- if not ispetsc():
84- print "PETSC support not included, running on 1 cpu only!"
85- cluster.np=1
86-
87 #Stop here if batch mode
88 if strcmpi(options['batch'],'yes'):
89 print 'batch mode requested: not launching job interactively'
Note: See TracBrowser for help on using the repository browser.