cape.pyover.case
: OVERFLOW case control module¶
This module contains the important function run_overflow()
, which
actually runs overrunmpi
or whichever executable is specified by the
user, along with the utilities that support it.
It also contains OVERFLOW-specific versions of some of the generic
methods from cape.cfdx.case
. For instance the function
GetCurrentIter()
determines how many OVERFLOW iterations have been
run in the current folder, which is obviously a solver-specific task. It
also contains the function LinkQ()
and LinkX()
which creates
links to fixed file names from the most recent output created by
OVERFLOW, which is useful for creating simpler Tecplot layouts, for
example.
All of the functions from cape.case
are imported here. Thus they
are available unless specifically overwritten by specific
cape.pyover
versions.
- class cape.pyover.case.CaseRunner(fdir=None)¶
- finalize_files(j: int)¶
Clean up files after running one cycle of phase j
- Call:
>>> runner.finalize_files(j)
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- j:
int
Phase number
- runner:
- Versions:
2016-04-14
@ddalle
: v1.0 (FinalizeFiles
)
- get_prefix(j=None)¶
Read OVERFLOW file prefix
- Call:
>>> rname = runner.get_prefix(j=None)
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- j: {
None
} |int
Phase number
- runner:
- Outputs:
- rname:
str
Project prefix
- rname:
- Versions:
2016-02-01
@ddalle
: v1.0 (GetPrefix
)2023-07-08
@ddalle
: v1.1; instance method
- get_stop_iter()¶
Get iteration at which to stop by reading
STOP
fileIf the file exists but is empty, returns
0
; if file does not exist, returnsNone
; and otherwise reads the iteration- Call:
>>> qstop, nstop = runner.get_stop_iter()
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- runner:
- Outputs:
- nstop:
int
|None
Iteration at which to stop, if any
- nstop:
- Versions:
2017-03-07
@ddalle
: v1.0 (GetStopIter
)2023-07-08
@ddalle
: v1.1; instance method
- getx_history_iter()¶
Get the most recent iteration number for a history file
This function uses the last line from the file
run.resid
- Call:
>>> n = runner.getx_history_iter()
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- runner:
- Outputs:
- Versions:
2016-02-01
@ddalle
: v1.0 (GetHistoryIter
)2023-07-08
@ddalle
: v1.1; instance method
- getx_iter()¶
Get the most recent iteration number for OVERFLOW case
- Call:
>>> n = runner.getx_iter()
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- runner:
- Outputs:
- n:
int
|None
Last iteration number
- n:
- Versions:
2015-10-19
@ddalle
: v1.0 (GetCurrentIter
)2023-07-08
@ddalle
: v1.1; instance method
- getx_out_iter()¶
Get the most recent iteration number for a running file
This function uses the last line from the file
resid.out
- Call:
>>> n = runner.getx_out_iter()
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- runner:
- Outputs:
- n:
int
|None
Most recent iteration number
- n:
- Versions:
2016-02-02
@ddalle
: v1.0 (GetOutIter
)2023-07-08
@ddalle
: v1.1; instance method
- getx_phase(n: int)¶
Get the appropriate input number based on results available
- Call:
>>> j = runner.getx_phase(n)
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- n:
int
Iteration number
- runner:
- Outputs:
- j:
int
Most appropriate phase number for a restart
- j:
- Versions:
2014-10-02
@ddalle
: v1.0 (cape.pycart.case
)2015-12-29
@ddalle
: v1.0 (cape.pyfun.case
)2016-02-03
@ddalle
: v1.0 (GetPhaseNumber
)2017-01-13
@ddalle
: v1.1; no fullrun.%02.*
seq2023-07-09
@ddalle
: v1.2; rename, instance method
- getx_restart_iter()¶
Get total iteration number of most recent flow file
- Call:
>>> n = runner.getx_restart_iter()
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- runner:
- Outputs:
- n:
int
Index of most recent check file
- n:
- Versions:
2015-10-19
@ddalle
: v1.0
- getx_running_iter()¶
Get the most recent iteration number for a running file
This function uses the last line from the file
resid.tmp
- Call:
>>> n = runner.getx_running_iter()
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- runner:
- Outputs:
- n:
int
|None
Most recent iteration number
- n:
- Versions:
2016-02-01
@ddalle
: v1.0 (GetRunningIter
)2023-07-08
@ddalle
: v1.2; instance method
- init_post()¶
Custom initialization for
pyover
- Call:
>>> runner.init_post()
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- runner:
- Versions:
2023-07-08
@ddalle
: v1.0
- read_namelist(j=None)¶
Read case namelist file
- Call:
>>> nml = runner.read_namelist(j=None)
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- i: {
None
} | nonnegativeint
Phase number (0-based)
- runner:
- Outputs:
- nml:
OverNamelist
Namelist interface
- nml:
- Versions:
2015-12-29
@ddalle
: v1.0 (cape.pyfun.case
)2015-02-02
@ddalle
: v1.0 (GetNamelist
)2016-12-12
@ddalle
: v1.1; i kwarg2023-07-09
@ddalle
: v1l.1; rename, instance method
- run_phase(j: int)¶
Run one phase using appropriate commands
- Call:
>>> runner.run_phase(j)
- Inputs:
- runner:
CaseRunner
Controller to run one case of solver
- j:
int
Phase number
- runner:
- Versions:
2023-06-05
@ddalle
: v1.0; fromrun_overflow
2023-07-08
@ddalle
; v1.1; instance method
- write_stop_iter(n=0)¶
Create a
STOP
file and optionally set the stop iteration- Call:
>>> runner.write_stop_iter(n)
- Inputs:
- n:
None
| {0
} | positiveint
Iteration at which to stop; empty file if
0
orNone
- n:
- Versions:
2017-03-07
@ddalle
: v1.0 (WriteStopIter
)2023-06-05
@ddalle
: v2.0; use context manager2023-07-08
@ddalle
: v2.1; rename, instance method
- cape.pyover.case.EditSplitmqI(fin, fout, qin, qout)¶
Edit the I/O file names in a
splitmq
/splitmx
input file
- cape.pyover.case.GetLatest(glb)¶
Get the most recent file matching a glob or list of globs
- cape.pyover.case.GetQ()¶
Find most recent
q.*
file, withq.avg
taking precedence- Call:
>>> fq = GetQ()
- Outputs:
- fq:
None
|str
Name of most recent averaged
q
file or newestq
file
- fq:
- Versions:
2016-12-29
@ddalle
: v1.0
- cape.pyover.case.GetQFile(fqi='q.pyover.p3d')¶
Get most recent OVERFLOW
q
file and its associated iterationsAveraged solution files, such as
q.avg
take precedence.- Call:
>>> fq, n, i0, i1 = GetQFile(fqi="q.pyover.p3d")
- Inputs:
- fqi: {q.pyover.p3d} | q.pyover.avg | q.pyover.vol |
str
Target Overflow solution file after linking most recent files
- fqi: {q.pyover.p3d} | q.pyover.avg | q.pyover.vol |
- Outputs:
- Versions:
2016-12-30
@ddalle
: v1.02017-03-28
@ddalle
: v1.1; from`lineLoad` to ``case
- cape.pyover.case.GetX()¶
Get the most recent
x.*
file- Call:
>>> fx = GetX()
- Outputs:
- fx:
None
|str
Name of most recent
x.save
or similar file
- fx:
- Versions:
2016-12-29
@ddalle
: v1.0
- cape.pyover.case.LinkLatest(fsrc, fname)¶
Create a symbolic link, but clean up existing links
This prevents odd behavior when using
os.symlink()
when the link already exists. It performs no action (rather than raising an error) when the source file does not exist or isNone
. Finally, if fname is already a full file, no action is taken.
- cape.pyover.case.LinkQ()¶
Link the most recent
q.*
file to a fixed file name- Call:
>>> LinkQ()
- Versions:
2016-09-06
@ddalle
: v1.02016-12-29
@ddalle
: Moved file search toGetQ()
- cape.pyover.case.LinkX()¶
Link the most recent
x.*
file to a fixed file name- Call:
>>> LinkX()
- Versions:
2016-09-06
@ddalle
: v1.0
- cape.pyover.case.checkqavg(fname)¶
Check the number of iterations in a
q.avg
fileThis function works by attempting to read a Fortran record at the very end of the file with exactly one (single-precision) integer. The function tries both little- and big-endian interpretations. If both methods fail, it returns
1
to indicate that theq
file is a single-iteration solution.
- cape.pyover.case.checkqt(fname)¶
Check the iteration number or time in a
q
file
- cape.pyover.case.run_overflow()¶
Setup and run the appropriate OVERFLOW command
- Call:
>>> run_overflow()
- Versions:
2016-02-02
@ddalle
: v1.02021-10-08
@ddalle
: v1.12023-07-08
@ddalle
: v2.0; use CaseRunner