cape.pyfun.case: FUN3D case control module¶
This module contains the important function case.run_fun3d(),
which actually runs nodet or nodet_mpi, along with the utilities
that support it.
It also contains FUN3D-specific versions of some of the generic methods
from cape.case. For instance the function GetCurrentIter()
determines how many FUN3D iterations have been run in the current
folder, which is obviously a solver-specific task. It also contains the
function LinkPLT(), which creates links to fixed Tecplot file
names from the most recent output created by FUN3D.
All of the functions from cape.case are imported here. Thus they
are available unless specifically overwritten by specific
cape.pyfun versions.
- class cape.pyfun.case.CaseRunner(fdir=None)¶
- check_error()¶
Check for errors before continuing
Currently the following checks are performed.
Check for NaN residual in the output file
- Call:
>>> ierr = runner.check_error())
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Outputs:
- ierr:
int Return code
- ierr:
- Versions:
2016-04-18
@ddalle: v1.02023-06-02
@ddalle: v1.1; returnbool; don’t raise2023-07-06
@ddalle: v1.2; instance method
- copy_hist(j: int)¶
Copy all FM and residual histories
- Call:
>>> runner.copy_hist(j)
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- j:
int Phase number to use for storing histories
- runner:
- Versions:
2016-10-28
@ddalle: v1.0 (CopyHist)2023-07-06
@ddalle: v1.1; instance method
- 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)2023-07-06
@ddalle: v1.1; instance method
- get_plt_file(stem: str = 'tec_boundary')¶
Get most recent boundary
pltfile and its metadata- Call:
>>> fplt, n, i0, i1 = runner.get_plt_file() >>> fplt, n, i0, i1 = runner.get_plt_file(stem)
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Outputs:
- Versions:
2016-12-20
@ddalle: v1.0 (GetPltFile)2023-07-06
@ddalle: v1.1; instance method- 2024-03-25
@ddalle: v2.0 add stem imput
search for files w/o
_timestep{n}in nameinclude previous runs in n if appropriate
more accurate accounting for FUN3D/s iter resets
- 2024-03-25
- get_project_baserootname() str¶
Read namelist and return base project name w/o adapt counter
This would be
"pyfun"instead of"pyfun03", for example.- Call:
>>> rname = runner.get_project_baserootname()
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Outputs:
- rname:
str Project rootname
- rname:
- Versions:
2024-03-22
@ddalle: v1.0
- get_project_rootname(j=None)¶
Read namelist and return project namelist
- Call:
>>> rname = runner.get_project_rootname(j=None)
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- j: {
None} |int Phase number
- runner:
- Outputs:
- rname:
str Project rootname
- rname:
- Versions:
2015-10-19
@ddalle: v1.02023-07-05
@ddalle: v1.1; instance method
- getx_iter()¶
Calculate most recent FUN3D iteration
- Call:
>>> n = runner.getx_iter()
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Outputs:
- n:
int Iteration number
- n:
- Versions:
2015-10-19
@ddalle: v1.02016-04-28
@ddalle: v1.1;Flow/folder2023-06-27
@ddalle: v2.0; instance method
- getx_iter_history()¶
Get the most recent iteration number for a history file
- Call:
>>> nh, n = runner.getx_history_iter()
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Outputs:
- Versions:
2015-10-20
@ddalle: v1.02016-04-28
@ddalle: v1.1; forFlow/folder2016-10-29
@ddalle: v1.2; handle Fun3D iteration reset2017-02-23
@ddalle: v1.3; handle adapt project shift2023-06-27
@ddalle: v2.0; instance method
- getx_iter_running()¶
Get the most recent iteration number for a running file
- Call:
>>> n = case.GetRunningIter()
- Outputs:
- n:
int|None Most recent iteration number
- n:
- Versions:
2015-10-19
@ddalle: v1.02016-04-28
@ddalle: v1.1; handleFlow/folder2023-05-27
@ddalle; v2.0; instance method
- getx_phase(n: int)¶
Determine the phase number based on files in folder
- Call:
>>> i = case.GetPhaseNumber(rc)
- Inputs:
- rc:
RunControlOpts Options interface for run control
- rc:
- Outputs:
- i:
int Most appropriate phase number for a restart
- i:
- Versions:
2014-10-02
@ddalle: v1.0 (cape.pycart)2015-10-19
@ddalle: v1.0 (GetPhaseNumber)2023-07-06
@ddalle: v1.1; instance method
- getx_restart_iter()¶
Calculate number of iteration if case should restart
- Call:
>>> nr = runner.gets_restart_iter()
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Outputs:
- nr:
int Restart iteration number
- nr:
- Versions:
2015-10-19
@ddalle: v1.02016-04-19
@ddalle: v1.1; check STDIO2020-01-15
@ddalle: v1.2; sort globs better2023-07-05
@ddalle: v1.3; moved to instance method
- init_post()¶
Custom initialization for pyfun
- Call:
>>> runner.init_post()
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Versions:
2023-06-28
@ddalle: v1.0
- link_plt()¶
Link the most recent Tecplot files to fixed file names
- Call:
>>> runner.link_plt()
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Versions:
2016-10-24
@ddalle: v1.0 (LinkPLT)2023-07-06
@ddalle: v1.1; instance method
- prepare_files(j: int)¶
Prepare file names appropriate to run phase i of FUN3D
- Call:
>>> runner.prepare_files(j)
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- j:
int Phase number
- runner:
- Versions:
2016-04-14
@ddalle: v1.02023-07-06
@ddalle: v1.1; instance method
- prepare_warmstart()¶
Process WarmStart settings and copy files if appropriate
- Call:
>>> warmstart = runner.prepare_warmstart()
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- runner:
- Outputs:
- warmstart:
True|False Whether or not case is a valid warm-start
- warmstart:
- Versions:
2023-03-14
@ddalle: v1.0 (PrepareWarmStart)2023-07-06
@ddalle: v1.1; instance method
- 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
- j: {
None} |int Phase number
- runner:
- Outputs:
- nml:
cape.pyfun.namelist.Namelist Namelist interface
- nml:
- Versions:
2015-10-19
@ddalle: v1.02023-06-27
@ddalle: v2.0; instance method
- run_nodet_adapt(j: int)¶
Run Fun3D nodet with adaptation for refine/one
- Call:
>>> runner.prepare_files(j)
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- j:
int Phase number
- runner:
- Versions:
2023-07-12
@jmeeroff: v1.0; fromrun_phase
- 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:
2016-04-13
@ddalle: v1.0 (RunPhase())2023-06-02
@ddalle: v2.02023-06-27
@ddalle: v3.0, instance method
- run_refine_translate(j: int)¶
Run refine transalte to create input meshb file for adaptation
- Call:
>>> runner.prepare_files(j)
- Inputs:
- runner:
CaseRunner Controller to run one case of solver
- j:
int Phase number
- runner:
- Versions:
2023-07-17
@jmeeroff: v1.0; fromrun_phase
- set_restart_iter(n=None)¶
Set a given check file as the restart point
- Call:
>>> runner.set_restart_iter(n=None)
- Inputs:
- rc:
RunControlOpts Run control options
- n: {
None}int Restart iteration number, defaults to latest available
- rc:
- Versions:
2014-10-02
@ddalle: v1.0 (SetRestartIter)2023-03-14
@ddalle: v1.1; add WarmStart2023-07-06
@ddalle: v1.2; instance method
- cape.pyfun.case.GetFromGlob(fglb, fname=None)¶
Find the most recently edited file matching a glob
- Call:
>>> fname = case.GetFromGlob(fglb, fname=None) >>> fname = case.GetFromGlob(fglbs, fname=None)
- Inputs:
- Outputs:
- fbest:
str Name of file matching glob that was most recently modified
- fbest:
- Versions:
2016-12-19
@ddalle: v1.02023-02-03
@ddalle: v1.1; add fname input2023-03-26
@ddalle: v1.2; multiple fglbs
- cape.pyfun.case.GetPltFile()¶
Get most recent boundary
pltfile and its metadata
- cape.pyfun.case.LinkFromGlob(fname, fglb)¶
Link the most recent file to a generic Tecplot file name
- Call:
>>> case.LinkFromGlob(fname, fglb) >>> case.LinkFromGlob(fname, fglbs)
- Inputs:
- Versions:
2016-10-24
@ddalle: v1.02023-03-26
@ddalle: v1.1; multiple fglbs
- cape.pyfun.case.LinkPLT()¶
Link the most recent Tecplot files to fixed file names
- Call:
>>> LinkPLT()
- Versions:
2016-10-24
@ddalle: v1.02023-07-06
@ddalle: v1.1; useCaseRunner
- cape.pyfun.case.run_fun3d()¶
Setup and run the appropriate FUN3D command
- Call:
>>> run_fun3d()
- Versions:
2015-10-19
@ddalle: v1.02016-04-05
@ddalle: v1.1; add AFLR3 hook2023-07-06
@ddalle: v2.0; useCaseRunner