cape.pyus.us3d: US3D control module¶
This module provides tools to quickly setup basic or complex US3D 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.pyus.us3d >>> cntl = cape.pyus.us3d.US3D("pyUS.json") >>> cntl <cape.pyus.US3D(nCase=892)> >>> cntl.x.GetFullFolderNames(0) 'poweroff/m1.5a0.0b0.0'
An instance of this cape.pyus.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.InputInp), and possibly others.
Attribute
Class
cntl.x
cape.pyus.RunMatrixcntl.opts
cntl.InputInp
Finally, the cape.pyus.cntl.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.pyus.cntl.Cntl(fname='pyUS.json')¶
Bases:
CntlClass for handling global options and setup for US3D.
This class is intended to handle all settings used to describe a group of US3D 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. The settings can be extended using Python modules if desired.
Defaults are read from the file
$CAPE/settings/pyUS.default.json.- Call:
>>> cntl = cape.pyus.Cntl(fname="pyUS.json")
- Inputs:
- fname: {
"pyUS.json"} |str Name of pyUS JSON control file
- fname: {
- Outputs:
- cntl:
cape.pyfun.cntl.Cntl Instance of control class
- cntl:
- Data members:
- Versions:
2019-06-04
@ddalle: Started
- CaseStartCase()¶
Start a case by either submitting it or running it
This function relies on
cape.pyus.case, and so it is customized for the US3D solver only in that it calls the correctcasemodule.- Call:
>>> pbs = cntl.CaseStartCase()
- Inputs:
- cntl:
cape.pyus.us3d.US3D US3D control interface
- cntl:
- Outputs:
- pbs:
intorNone PBS job ID if submitted successfully
- pbs:
- Versions:
2015-10-14
@ddalle: First version2019-06-27
@ddalle: US3D version
- CheckMesh(i)¶
Check if the mesh for case i is prepared
- Call:
>>> q = cntl.CheckMesh(i)
- Inputs:
- fun3d:
cape.pyus.cntl.Cntl Instance of control class
- i:
int Index of the case to check
- fun3d:
- Outputs:
- q:
bool Whether or not the mesh for case i is prepared
- q:
- Versions:
2015-10-19
@ddalle: First version2020-04-13
@ddalle: Forked fromcape.pyfun
- CheckMeshFiles(v=False)¶
Check for the mesh files in the present folder
- Call:
>>> q = cntl.CheckMeshFiles(v=False)
- Inputs:
- fun3d:
cape.pyfun.cntl.Cntl Instance of control class containing relevant parameters
- v:
True| {False} Verbose flag
- fun3d:
- Outputs:
- q:
True|False Whether current folder has the required mesh files
- q:
- Versions:
2016-04-11
@ddalle: First version2017-02-22
@ddalle: Added verbose option2020-04-13
@ddalle: Forked fromcape.pyfun
- GetInflowBC()¶
Find name(s) of freestream BC faces
- Call:
>>> compIDs = cntl.GetInflowBC()
- Inputs:
- cntl:
cape.pyus.cntl.Cntl Instance of US3D control class
- cntl:
- Outputs:
- Versions:
2020-04-28
@ddalle: First version
- GetInputInpVar(sec, key, j=0)¶
Get a
input.inpvariable’s valueThe JSON file overrides the value from the template file
- GetInputMeshFileNames()¶
Return the list of mesh files from file
- Call:
>>> fname = cntl.GetInputMeshFileNames()
- Inputs:
- cntl:
cape.pyus.cntl.Cntl Instance of control class
- cntl:
- Outputs:
- Versions:
2015-10-19
@ddalle: First version2020-04-13
@ddalle: Forked fromcape.pyfun
- GetProcessedMeshFileNames()¶
Return the list of mesh files that are written
- Call:
>>> fname = cntl.GetProcessedMeshFileNames()
- Inputs:
- cntl:
cape.pyus.cntl.Cntl Instance of control class
- cntl:
- Outputs:
- Versions:
2015-10-19
@ddalle: First version2020-04-13
@ddalle: Forked fromcape.pyfun
- GetProjectRootName(j=0)¶
Get the project root name
Right now this is just hard-coded
- Call:
>>> name = cntl.GetProjectName(j=0)
- Inputs:
- fun3d:
cape.pyfun.cntl.Cntl Instance of global pyFun settings object
- j:
int Phase number
- fun3d:
- Outputs:
- name:
str Project root name
- name:
- Versions:
2020-04-13
@ddalle: First version
- PrepareCase(i)¶
Prepare a case for running if it is not already prepared
- Call:
>>> cntl.PrepareCase(i)
- Inputs:
- fun3d:
cape.pyus.cntl.Cntl Instance of control class
- i:
int Index of case to prepare/analyze
- fun3d:
- Versions:
2015-10-19
@ddalle: Version 1.0 (pyfun)2020-04-13
@ddalle: Version 1.02022-04-13
@ddalle: Version 1.1; exec_modfunction()
- PrepareInputInp(i)¶
Prep and write
input.inpwith case-specific settings- Call:
>>> cntl.PrepareNamelist(i)
- Inputs:
- cntl:
cape.pyus.cntl.Cntl Instance of control class
- i:
int Run index
- cntl:
- Versions:
2020-04-13
@ddalle: First version
- PrepareInputInpFlightConditions(i)¶
Set flight conditions in
input.inp- Call:
>>> cntl.PrepareInputInpFlightConditions(i)
- Inputs:
- cntl:
cape.pyus.cntl.Cntl Instance of US3D control class
- i:
int Run index
- cntl:
- Versions:
2018-04-19
@ddalle: First version2020-04-13
@ddalle: Forked fromcape.pyfun
- PrepareMesh(i)¶
Prepare the mesh for case i if necessary
- Call:
>>> cntl.PrepareMesh(i)
- Inputs:
- cntl:
cape.pyus.cntl.Cntl Instance of control class
- i:
int Case index
- cntl:
- Versions:
2015-10-19
@ddalle: First version2020-04-13
@ddalle: Forked fromcape.pyfun
- ReadCaseInputInp(i, rc=None, j=None)¶
Read
input.inpfrom case i, phase j if possible- Call:
>>> inp = cntl.ReadCaseInputInp(i, rc=None, j=None)
- Inputs:
- Outputs:
- inp:
None|cape.pyus.inputinpfile.InputInp US3D input interface if possible
- inp:
- Versions:
2016-12-12
@ddalle: First version2019-06-27
@ddalle: From cape.pyus
- ReadInputInp(j=0, q=True)¶
Read the
input.inptemplate file- Call:
>>> cntl.InputInp(j=0, q=True)
- Inputs:
- cntl:
cape.pyus.us3d.US3D US3D control interface
- j:
int Phase number
- q: {
True} |False Whether or not to read to Namelist, else Namelist0
- cntl:
- Versions:
2015-10-16
@ddalle: First version2015-12-31
@ddalle: Added Namelist02019-06-27
@ddalle: Forked fromReadNamelist()
- process_mesh_filename(fname)¶
Return a mesh file name using the project root name
- Call:
>>> fout = cntl.process_mesh_filename(fname)
- Inputs:
- cntl:
cape.pyus.cntl.Cntl Instance of control class
- fname:
str Raw file name to be converted to case-folder file name
- cntl:
- Outputs:
- fout:
str Name of file name using project name as prefix
- fout:
- Versions:
2016-04-05
@ddalle: First version2020-04-13
@ddalle: Forked fromcape.pyfun