cape.pykes.cntl
: Kestrel control module¶
This module provides tools to quickly setup basic or complex Kestrel 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.pykes.cntl >>> cntl = cape.pykes.cntl.Cntl("pyKes.json") >>> cntl <cape.pyfun.Cntl(nCase=892)> >>> cntl.x.GetFullFolderNames(0) 'poweroff/m1.5a0.0b0.0'
An instance of this cape.pykes.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.
), and possibly others.
Attribute
Class
cntl.x
cntl.opts
cntl.DataBook
cntl.JobXML
cape.cntl.Cntl
class, so any methods available to the CAPE
class are also available here.
- class cape.pykes.cntl.Cntl(fname=None)¶
Class for handling global options and setup for Kestrel
This class is intended to handle all settings used to describe a group of Kestrel cases.
The settings are read from a JSON file.
Defaults are read from the file
options/pyKes.default.json
.- Call:
>>> cntl = Cntl(fname="pyKes.json")
- Inputs:
- fname:
str
Name of pyKes input file
- fname:
- Outputs:
- cntl:
cape.pykes.cntl.Cntl
Instance of the pyKes control class
- cntl:
- Data members:
- Versions:
2015-10-16
@ddalle
: Started
- ApplyCase(i, nPhase=None, **kw)¶
Apply settings from cntl.opts to an individual case
This rewrites each run namelist file and the
case.json
file in the specified directories.- Call:
>>> cntl.ApplyCase(i, nPhase=None)
- Inputs:
- cntl:
cape.pyfun.cntl.Cntl
FUN3D control interface
- i:
int
Case number
- nPhase: {
None
} | positiveint
Last phase number (default determined by PhaseSequence)
- cntl:
- Versions:
2016-03-31
@ddalle
: Version 1.0
- ArchivePWD(phantom=False)¶
Archive a single case in the current folder ($PWD)
- Call:
>>> cntl.ArchivePWD(phantom=False)
- Inputs:
- cntl:
cape.pyfun.cntl.Cntl
CAPE main control instance
- phantom:
True
| {False
} Write actions to
archive.log
; only delete ifFalse
- cntl:
- Versions:
2017-03-10
@ddalle
: Firstcape.pyfun
version2017-12-15
@ddalle
: Added phantom option
- CheckMesh(i)¶
Check if the mesh for case i is prepared
- CleanPWD(phantom=False)¶
Archive a single case in the current folder ($PWD)
- Call:
>>> cntl.CleanPWD(phantom=False)
- Inputs:
- cntl:
cape.pyfun.cntl.Cntl
Instance of control interface
- phantom:
True
| {False
} Write actions to
archive.log
; only delete ifFalse
- cntl:
- Versions:
2017-03-10
@ddalle
: Version 1.02017-12-15
@ddalle
: Added phantom option
- ExtendCase(i, n=1, j=None, imax=None)¶
Add iterations to case i by repeating the last phase
- Call:
>>> cntl.ExtendCase(i, n=1, j=None, imax=None)
- Inputs:
- cntl:
cape.pykes.cntl.Cntl
CAPE main control instance
- i:
int
Run index
- n: {
1
} | positiveint
Add n times steps to the total iteration count
- j: {
None
} | nonnegativeint
Apply to phase j, by default use the last phase
- imax: {
None
} | nonnegativeint
Use imax as the maximum iteration count
- cntl:
- Versions:
2022-07-26
@ddalle
: Version 1.0
- FindXMLPaths(j=0)¶
Find all Path and File elements
- Call:
>>> elems = cntl.FindXMLPaths(j=0)
- Inputs:
- cntl:
cape.pykes.cntl.Cntl
Run matrix control interface
- j: {
0
} |int
Phase number
- cntl:
- Outputs:
- elems:
list
[Element
] List of XML elements
- elems:
- Versions:
2021-10-25
@ddalle
: Version 1.0
- GetMeshFileNames(j=0)¶
Get list of copy/link files from both JSON and XML
- PrepareCase(i)¶
Prepare a case for running if necessary
- PrepareJobXML(i)¶
Write
pykes.xml
file(s) for case i
- PrepareMesh(i)¶
Prepare the mesh for case i if necessary
- ReadJobXML(j=0, q=True)¶
Read the
fun3d.nml
file- Call:
>>> cntl.ReadNamelist(j=0, q=True)
- Inputs:
- cntl:
cape.pykes.cntl.Cntl
Run matrix control interface
- j: {
0
} |int
Phase number
- q: {
True
} |False
Option read to JobXML, else JobXML0
- cntl:
- Versions:
2021-10-18
@ddalle
: Version 1.0
- SkeletonPWD(phantom=False)¶
Delete most files in current folder, leaving only a skeleton
- Call:
>>> cntl.SkeletonPWD(phantom=False)
- Inputs:
- cntl:
cape.pyfun.cntl.Cntl
CAPE main control instance
- phantom:
True
| {False
} Write actions to
archive.log
; only delete ifFalse
- cntl:
- Versions:
2017-12-14
@ddalle
: Version 1.0
- WritePBS(i)¶
Write the PBS script(s) for a given case
- cli(*a, **kw)¶
Command-line interface
- Call:
>>> cntl.cli(*a, **kw)
- Inputs:
- cntl:
cape.pykes.cntl.Cntl
CAPE main control instance
- kw:
dict
(True
|False
|str
) Unprocessed keyword arguments
- cntl:
- Outputs:
- cmd:
None
|str
Name of command that was processed, if any
- cmd:
- Versions:
2018-10-19
@ddalle
: Content frombin/
executables
- get_job_name(j=0)¶
Get “job name” for phase j
- init_post()¶
Do
__init__()
actions specific topyfun
- Call:
>>> cntl.init_post()
- Inputs:
- cntl:
cape.cntl.Cntl
CAPE run matrix control instance
- cntl:
- Versions:
2023-07-10
@ddalle
: v1.0