cape.pycart.case
: Case Control Module¶
This module contains the important function case.run_flowCart()
, which
actually runs flowCart
or aero.csh
, along with the utilities that
support it.
For instance, it contains function to determine how many iterations have been
run, what the working folder is (e.g. .
, adapt00
, etc.), and what
command-line options to run.
It also contains Cart3D-specific versions of some of the generic methods from
cape.case
. All of the functions in that module are also available here.
- cape.pycart.case.CaseAutoInputs(rc, j=0)¶
Run
autoInputs
if necessary- Call:
>>> CaseAutoInputs(rc)
- Inputs:
- rc:
cape.options.runControl.RunControl
Case options interface from
cape.json
- j: {
0
} |int
Phase number
- rc:
- Versions:
2016-04-06
@ddalle
: Version 1.0
- cape.pycart.case.CaseCubes(rc, j=0)¶
Run
cubes
andmgPrep
to create multigrid volume mesh- Call:
>>> CaseCubes(rc, j=0)
- Inputs:
- rc:
cape.options.runControl.RunControl
Case options interface from
case.json
- j: {
0
} |int
Phase number
- rc:
- Versions:
2016-04-06
@ddalle
: Version 1.0
- cape.pycart.case.CheckFailed()¶
Check the
flowCart.out
file for a failure- Call:
>>> q = pyCart.case.CheckFailed()
- Outputs:
- q:
bool
Whether or not the last line of flowCart.out contains ‘fail’
- q:
- Versions:
2015-01-02
@ddalle
: Version 1.0
- cape.pycart.case.CheckSuccess(rc=None, i=None)¶
Check iteration counts and residual change for most recent run
- Call:
>>> CheckSuccess(rc=None, i=None)
- Inputs:
- rc:
pyCart.options.runControl.RunControl
Options interface from
case.json
- i:
int
Phase number
- rc:
- Versions:
2016-03-04
@ddalle
: Version 1.0
- cape.pycart.case.CheckUnsteadyHistory(fname='history.dat')¶
Check if the current history ends with an unsteady iteration
- Call:
>>> q = pyCart.case.CheckUnsteadyHistory(fname='history.dat')
- Inputs:
- fname:
str
Name of file to read
- fname:
- Outputs:
- q:
float
Whether or not the last iteration of fname has a ‘.’ in it
- q:
- Versions:
2014-12-17
@ddalle
: Version 1.0
- cape.pycart.case.FinalizeFiles(rc, i=None)¶
Clean up files names after running one cycle of phase i
- Call:
>>> FinalizeFiles(rc, i=None)
- Inputs:
- rc:
pyCart.options.runControl.RunControl
Options interface from
case.json
- i:
int
Phase number
- rc:
- Versions:
2016-03-04
@ddalle
: Version 1.0
- cape.pycart.case.GetCheckResubIter()¶
Get total iteration number of most recent check file
This is the sum of the most recent steady iteration and unsteady iteration.
- Call:
>>> n = pyCart.case.GetRestartIter()
- Outputs:
- n:
int
Index of most recent check file
- n:
- Versions:
2014-11-28
@ddalle
: Version 1.02014-11-29
@ddalle
: This was renamed fromGetRestartIter()
- cape.pycart.case.GetCurrentIter()¶
Get the residual of the most recent iteration including unsaved progress
- Call:
>>> n = pyCart.case.GetCurrentIter()
- Outputs:
- n:
int
Most recent index written to
history.dat
- n:
- Versions:
2014-11-28
@ddalle
: v1.02023-06-06
@ddalle
: v1.1; checkadapt??/FLOW/
- cape.pycart.case.GetCurrentResid()¶
Get the most recent iteration including unsaved progress
Iteration numbers from time-accurate restarts are corrected to match the global iteration numbering.
- Call:
>>> L1 = pyCart.case.GetCurrentResid()
- Outputs:
- L1:
float
Last L1 residual
- L1:
- Versions:
2015-01-02
@ddalle
: Version 1.0
- cape.pycart.case.GetFirstResid()¶
Get the first iteration
- Call:
>>> L1 = pyCart.case.GetFirstResid()
- Outputs:
- L1:
float
First L1 residual
- L1:
- Versions:
2015-07-22
@ddalle
: Version 1.0
- cape.pycart.case.GetHistoryIter(fname='history.dat')¶
Get the most recent iteration number from a
history.dat
file- Call:
>>> n = pyCart.case.GetHistoryIter(fname='history.dat')
- Inputs:
- fname:
str
Name of file to read
- fname:
- Outputs:
- n:
float
Last iteration number
- n:
- Versions:
2014-11-24
@ddalle
: Version 1.0
- cape.pycart.case.GetHistoryResid(fname='history.dat')¶
Get the last residual in a
history.dat
file- Call:
>>> L1 = pyCart.case.GetHistoryResid(fname='history.dat')
- Inputs:
- fname:
str
Name of file to read
- fname:
- Outputs:
- L1:
float
Last L1 residual
- L1:
- Versions:
2015-01-02
@ddalle
: Version 1.0
- cape.pycart.case.GetPBSScript(i=None)¶
Determine the file name of the PBS script to call
This is a compatibility function for cases that do or do not have multiple PBS scripts in a single run directory
- Call:
>>> fpbs = pyCart.case.GetPBSScript(i=None)
- Inputs:
- i:
int
Phase number
- i:
- Outputs:
- fpbs:
str
Name of PBS script to call
- fpbs:
- Versions:
2014-12-01
@ddalle
: Version 1.0
- cape.pycart.case.GetPhaseNumber(rc)¶
Determine the appropriate input number based on results available
- Call:
>>> i = pyCart.case.GetPhaseNumber(rc)
- Inputs:
- rc:
pyCart.options.runControl.RunControl
Options interface for flowCart
- rc:
- Outputs:
- i:
int
Most appropriate phase number for a restart
- i:
- Versions:
2014-10-02
@ddalle
: Version 1.0
- cape.pycart.case.GetRestartIter()¶
Get total iteration number of most recent check file
This is the sum of the most recent steady iteration and unsteady iteration.
- Call:
>>> n = pyCart.case.GetRestartIter()
- Outputs:
- n:
int
Index of most recent check file
- n:
- Versions:
2014-11-28
@ddalle
: Version 1.0
- cape.pycart.case.GetSteadyIter()¶
Get iteration number of most recent steady check file
- Call:
>>> n = pyCart.case.GetSteadyIter()
- Outputs:
- n:
int
Index of most recent check file
- n:
- Versions:
2014-10-02
@ddalle
: Version 1.02014-11-28
@ddalle
: Renamed fromGetRestartIter()
- cape.pycart.case.GetTriqFile()¶
Get most recent
triq
file and its associated iterations- Call:
>>> ftriq, n, i0, i1 = GetTriqFile()
- Outputs:
- ftriq:
str
Name of
triq
file- n:
int
Number of iterations included
- i0:
int
First iteration in the averaging
- i1:
int
Last iteration in the averaging
- ftriq:
- Versions:
2015-09-16
@ddalle
: Version 1.0- 2021-12-09
@ddalle
: Version 1.1 Check for
adapt??/
folder w/otriq
file
- 2021-12-09
- cape.pycart.case.GetUnsteadyIter()¶
Get iteration number of most recent unsteady check file
- Call:
>>> n = pyCart.case.GetUnsteadyIter()
- Outputs:
- n:
int
Index of most recent check file
- n:
- Versions:
2014-11-28
@ddalle
: Version 1.0
- cape.pycart.case.GetWorkingFolder()¶
Get working folder,
.
,adapt??/
, oradapt??/FLOW/
This function must be called from the top level of a case.
- Call:
>>> fdir = GetWorkingFolder()
- Outputs:
- fdir:
str
Most recently used working folder with a history file
- fdir:
- Versions:
2014-11-24
@ddalle
: v1.02023-06-05
@ddalle
: v2.0; supportadapt??/FLOW/
- cape.pycart.case.LinkFromGlob(fname, fglb, isplit=-2, csplit='.')¶
Link the most recent file to a basic unmarked file name
The function will attempt to map numbered or adapted file names using the most recent iteration or adaptation. The following gives examples of links that could be created using
Components.i.plt
for fname andComponents.[0-9]*.plt
for fglb.Components.i.plt
(no link)Components.01000.plt
–>Components.i.plt
adapt03/Components.i.plt
–>Components.i.plt
- Call:
>>> pyCart.case.LinkFromGlob(fname, fglb, isplit=-2, csplit='.')
- Inputs:
- fname:
str
Name of unmarked file, like
Components.i.plt
- fglb:
str
Glob for marked file names
- isplit:
int
Which value of
f.split()
to use to get index number- csplit:
str
Character on which to split to find indices, usually
'.'
- fname:
- Versions:
2015-11-20
@ddalle
: Version 1.0
- cape.pycart.case.LinkPLT()¶
Link the most recent Tecplot files to fixed file names
Uses file names
Components.i.plt
andcutPlanes.plt
- Call:
>>> pyCart.case.LinkPLT()
- Versions:
2015-03-10
@ddalle
: Version 1.02015-11-20
@ddalle
: Delegate work and support*.dat
files
- cape.pycart.case.PrepareFiles(rc, i=None)¶
Prepare file names appropriate to run phase i of Cart3D
- Call:
>>> PrepareFiles(rc, i=None)
- Inputs:
- rc:
pyCart.options.runControl.RunControl
Options interface from
case.json
- i:
int
Phase number
- rc:
- Versions:
2016-03-04
@ddalle
: Version 1.0
- cape.pycart.case.ReadCaseJSON()¶
Read flowCart settings for local case
- Call:
>>> rc = pyCart.case.ReadCaseJSON()
- Outputs:
- rc:
pyCart.options.runControl.RunControl
Options interface for run
- rc:
- Versions:
2014-10-02
@ddalle
: Version 1.0
- cape.pycart.case.RestartCase(i0=None)¶
Restart a case by either submitting it or calling with a system command
This version of the command is called within
run_flowCart()
after running a phase or attempting to run a phase.- Call:
>>> pyCart.case.RetartCase(i0=None)
- Inputs:
- i0:
int
|None
Run sequence index of the previous run
- i0:
- Versions:
2014-10-06
@ddalle
: Version 1.02015-11-08
@ddalle
: Added resubmit/continue functionality2015-12-28
@ddalle
: Split fromStartCase()
- cape.pycart.case.RunAdaptive(rc, i)¶
Run one phase using adaptive commands
- Call:
>>> RunAdaptive(rc, i)
- Inputs:
- rc:
pyCart.options.runControl.RunControl
Options interface from
case.json
- i:
int
Phase number
- rc:
- Versions:
2016-03-04
@ddalle
: Version 1.0
- cape.pycart.case.RunFixed(rc, i)¶
Run
flowCart
the nominal way- Call:
>>> RunFixed(rc, i)
- Inputs:
- rc:
pyCart.options.runControl.RunControl
Options interface from
case.json
- i:
int
Phase number
- rc:
- Versions:
2016-03-04
@ddalle
: Version 1.0
- cape.pycart.case.RunPhase(rc, i)¶
Run one phase using appropriate commands
- Call:
>>> RunPhase(rc, i)
- Inputs:
- rc:
pyCart.options.runControl.RunControl
Options interface from
case.json
- i:
int
Phase number
- rc:
- Versions:
2016-03-04
@ddalle
: Version 1.0
- cape.pycart.case.RunWithRestarts(rc, i)¶
Run
flowCart
a few iterations at a time for averaging purposes- Call:
>>> RunWithRestarts(rc, i)
- Inputs:
- rc:
pyCart.options.runControl.RunControl
Options interface from
case.json
- i:
int
Phase number
- rc:
- Versions:
2016-03-04
@ddalle
: Version 1.0
- cape.pycart.case.SetRestartIter(n=None, ntd=None)¶
Set a given check file as the restart point
- Call:
>>> pyCart.case.SetRestartIter(n=None, ntd=None)
- Inputs:
- n:
int
Restart iteration number, defaults to most recent available
- ntd:
int
Unsteady iteration number
- n:
- Versions:
2014-10-02
@ddalle
: Version 1.02014-11-28
@ddalle
: Added time-accurate compatibility
- cape.pycart.case.StartCase()¶
Start a case by either submitting it or calling with a system command
- Call:
>>> pyCart.case.StartCase()
- Versions:
2014-10-06
@ddalle
: Version 1.02015-11-08
@ddalle
: Added resubmit/continue functionality2015-12-28
@ddalle
: SplitRestartCase()
- cape.pycart.case.StopCase()¶
Stop a case by deleting its PBS job and removing
RUNNING
file- Call:
>>> pyCart.case.StopCase()
- Versions:
2014-12-27
@ddalle
: Version 1.0
- cape.pycart.case.WriteStartTime(tic, rc, i, fname='pycart_start.dat')¶
Write the start time in tic
- Call:
>>> WriteStartTime(tic, rc, i, fname="pycart_start.dat")
- Inputs:
- tic:
datetime.datetime
Time to write into data file
- rc:
pyOver.options.runControl.RunControl
Options interface
- i:
int
Phase number
- fname: {
"pycart_start.dat"
} |str
Name of file containing run start times
- tic:
- Versions:
2016-08-31
@ddalle
: Version 1.0
- cape.pycart.case.WriteUserTime(tic, rc, i, fname='pycart_time.dat')¶
Write time usage since time tic to file
- Call:
>>> toc = WriteUserTime(tic, rc, i, fname="pycart_time.dat")
- Inputs:
- tic:
datetime.datetime
Time from which timer will be measured
- rc:
pyCart.options.runControl.RunControl
Options interface
- i:
int
Phase number
- fname:
str
Name of file containing CPU usage history
- tic:
- Outputs:
- toc:
datetime.datetime
Time at which time delta was measured
- toc:
- Versions:
2015-12-09
@ddalle
: Version 1.0
- cape.pycart.case.run_flowCart()¶
Setup and run
flowCart
,mpi_flowCart
command- Call:
>>> run_flowCart()
- Versions:
2014-10-02
@ddalle
: Version 1.02014-12-18
@ddalle
: Version 1.1; AddedTarAdapt()
2021-10-08
@ddalle
: Version 1.2; removed args