cape.pyover.cntl
: OVERFLOW control module¶
This module provides tools to quickly setup basic or complex OVERFLOW run matrices and serve as an executive for pre-processing, running, post-processing, and managing the solutions. A collection of cases combined into a run matrix can be loaded using the following commands.
>>> import cape.pyover.fun3d >>> cntl = cape.pyover.cntl.Cntl("pyOver.json") >>> cntl <cape.pyover.Cntl(nCase=907)> >>> cntl.x.GetFullFolderNames(0) 'poweroff/m1.5a0.0b0.0'
An instance of this cape.pyover.cntl.Cntl
class has many
attributes, which include the run matrix (cntl.x
), the options
interface (cntl.opts
), and optionally the data book
(cntl.DataBook
), the appropriate input files (such as
cntl.Namelist
), and possibly others.
Attribute
Class
cntl.x
cape.runmatrix.RunMatrix
cntl.opts
cntl.DataBook
cntl.Namelist
cape.pyover.namelist.Namelist
Finally, the Cntl
class is subclassed from the
cape.cfdx.cntl.Cntl
class, so any methods available to the CAPE
class are also available here.
- class cape.pyover.cntl.Cntl(fname=None)¶
Class for handling global options and setup for OVERFLOW
This class is intended to handle all settings used to describe a group of OVERFLOW cases. For situations where it is not sufficiently customized, it can be used partially, e.g., to set up a Mach/alpha sweep for each single control variable setting.
The settings are read from a JSON file, which is robust and simple to read, but has the disadvantage that there is no support for comments. Hopefully the various names are descriptive enough not to require explanation.
- Call:
>>> cntl = cape.pyover.Cntl(fname="pyOver.json")
- Inputs:
- fname:
str
Name of cape.pyover input file
- fname:
- Outputs:
- cntl:
cape.pyfun.cntl.Cntl
Instance of the cape.pyover control class
- cntl:
- Data members:
- cntl.opts:
dict
Dictionary of options for this case (directly from fname)
- cntl.x:
cape.pyover.runmatrix.RunMatrix
Values and definitions for variables in the run matrix
- cntl.Namelist:
cape.pyover.overnmlfile.OverNamelist
Interface to
over.namelist
OVERFLOW input file- cntl.RootDir:
str
Absolute path to the root directory
- cntl.opts:
- Versions:
2015-10-16
@ddalle
: Started2016-02-02
@ddalle
: v1.02023-05-31
@jmeeroff
: v1.1
- ApplyCase(i, nPhase=None, **kw)¶
Apply settings from cntl.opts to a set of cases
This rewrites each run namelist file and the
case.json
file in the specified directories.
- CheckError(i)¶
Check if a case has a failure
- CheckNone(v=False)¶
Check if the current folder has the necessary files to run
- Call:
>>> q = cntl.CheckNone(v=False)
- Inputs:
- cntl:
cape.pyfun.cntl.Cntl
Instance of control class containing relevant parameters
- v:
True
| {False
} Verbose flag
- cntl:
- Outputs:
q:
True
|False
- Versions:
2015-10-19
@ddalle
: v1.02017-02-22
@ddalle
: v1.1; add v
- CheckUsedPhase(i, v=False)¶
Check maximum phase number run at least once
- Call:
>>> j, n = cntl.CheckUsedPhase(i, v=False)
- Inputs:
- cntl:
cape.cfdx.cntl.Cntl
Instance of control class containing relevant parameters
- i:
int
Index of the case to check (0-based)
- v:
True
| {False
} Verbose flag; prints messages if n is
None
- cntl:
- Outputs:
- Versions:
2017-06-29
@ddalle
: v1.02017-07-11
@ddalle
: v1.1; add v
- GetConfig(i)¶
Get the configuration (if any) for case i
If there is no config or similar run matrix variable, return the name of the group folder
- GetMeshFileNames(i=None)¶
Return the list of mesh files
- Call:
>>> fname = cntl.GetMeshFileNames()
- Inputs:
- cntl:
cape.pyfun.cntl.Cntl
Instance of control class containing relevant parameters
- cntl:
- Outputs:
- Versions:
2016-02-01
@ddalle
: v1.0
- GetNamelistVar(sec, key, j=0)¶
Get a namelist variable’s value
The JSON file overrides the value from the namelist file
- GetPrefix(j=0)¶
Get the project root name or OVERFLOW file prefix
- GetSurfBCState(key, i, grid=None)¶
Get stagnation pressure and temperature ratios
- Call:
>>> p0, T0 = cntl.GetSurfBC(key, i, grid=None)
- Inputs:
- Outputs:
- Versions:
2016-08-29
@ddalle
: v1.0
- GetSurfCTState(key, i, grid=None)¶
Get stagnation pressure and temp. ratios for SurfCT key
- Call:
>>> p0, T0 = cntl.GetSurfCTState(key, i, grid=None)
- Inputs:
- Outputs:
- Versions:
2016-08-29
@ddalle
: v1.0
- PrepareCase(i)¶
Prepare a case for running if it is not already prepared
- Call:
>>> cntl.PrepareCase(i)
- Inputs:
- cntl:
cape.pyfun.cntl.Cntl
Instance of control class containing relevant parameters
- i:
int
Index of case to prepare/analyze
- cntl:
- Versions:
2015-10-19
@ddalle
: v1.0
- PrepareNamelist(i, nPhase=None)¶
Write
over.namelist
for run case iThe optional input nPhase can be used to right additional phases that are not part of the default PhaseSequence, which can be useful when only a subset of cases in the run matrix will require additional phases.
- Call:
>>> cntl.PrepareNamelist(i, nPhase=None)
- Inputs:
- Versions:
2016-02-01
@ddalle
: v1.02016-12-13
@ddalle
: v1.1; add second input2022-01-25
@ddalle
: v1.2; reread nml each call
- ReadCaseNamelist(i: int, j=None)¶
Read namelist from case i, phase j if possible
- Call:
>>> nml = cntl.ReadCaseNamelist(i, rc=None, j=None)
- Inputs:
- Outputs:
- nml:
None
|OverNamelist
Namelist interface is possible
- nml:
- Versions:
2016-12-12
@ddalle
: v1.02023-11-06
@ddalle
: v2.0; useCaseRunner
- ReadNamelist(j=0, q=True)¶
Read the OVERFLOW namelist template
- SetSurfBC(key, i, CT=False)¶
Set a surface BC for one key using IBTYP 153
- StopCases(n=0, **kw)¶
Stop one or more cases by writing a
STOP
file
- WriteConfig(i, fname='Config.xml')¶
Write configuration file
- cli(*a, **kw)¶
Command-line interface
- init_post()¶
Do
__init__()
actions specific topyover
- Call:
>>> cntl.init_post()
- Inputs:
- cntl:
cape.cfdx.cntl.Cntl
CAPE run matrix control instance
- cntl:
- Versions:
2023-05-31
@jmeeroff
: v1.0