cape.pykes.case: Kestrel individual-case module

This module provides interfaces to run a single case of Kestrel from the case folder. It also provides tools such as GetCurrentIter(), which determines how many cases have been run.

The functions of this module expect to be run from a Kestrel case folder created by cape.pykes.

class cape.pykes.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

Versions:
  • 2021-11-05 @ddalle: v1.0

  • 2023-07-10 @ddalle: v1.1; instance method

getx_iter()

Get the most recent iteration number

Call:
>>> n = runner.getx_iter()
Inputs:
runner: CaseRunner

Controller to run one case of solver

Outputs:
n: int | None

Last iteration number

Versions:
  • 2021-11-05 @ddalle: v1.0

  • 2023-07-10 @ddalle: v1.1; instance method

getx_restart_iter()

Get the iteration at which a case would restart

Call:
>>> n = runner.getx_restart_iter()
Inputs:
runner: CaseRunner

Controller to run one case of solver

Outputs:
n: int | None

Last iteration number

Versions:
  • 2024-04-18 @ddalle: v1.0

init_post()

Custom initialization for pyfun

Call:
>>> runner.init_post()
Inputs:
runner: CaseRunner

Controller to run one case of solver

Versions:
  • 2023-07-10 @ddalle: v1.0

prepare_files(j: int)

Prepare files appropriate to run phase j

Call:
>>> runner.prepare_files(j)
Inputs:
runner: CaseRunner

Controller to run one case of solver

j: int

Phase number

Versions:
  • 2021-11-02 @ddalle: v1.0

  • 2023-07-10 @ddalle: v1.1; instance method

read_xml(j=None)

Read Kestrel .xml control file for one phase

Call:
>>> xml = read_xml(rc=None, j=None)
Inputs:
runner: CaseRunner

Controller to run one case of solver

j: {None} | int

Phase number

Outputs:
xml: JobXML

XML control file interface

Versions:
  • 2021-11-02 @ddalle: v1.0

  • 2023-07-10 @ddalle: v1.1; instance method

run_phase(j: int)

Run one pass of one phase

Call:
>>> runner.run_phase(j)
Inputs:
runner: CaseRunner

Controller to run one case of solver

j: int

Phase number

Versions:
  • 2021-11-02 @ddalle: v1.0

  • 2023-07-10 @ddalle: v1.1; instance method

cape.pykes.case.get_glob_latest(fglb)

Find the most recently edited file matching a glob

Call:
>>> fname = get_glob_latest(fglb)
Inputs:
fglb: str

Glob for targeted file names

Outputs:
fname: str

Name of file matching glob that was most recently edited

Versions:
  • 2016-12-19 @ddalle: v1.0

  • 2022-01-28 @ddalle: v1.1; was GetFromGlob()

Link the most recent file to a generic Tecplot file name

Call:
>>> link_glob_latest(fname, fglb)
Inputs:
fname: str

Name of unmarked file, like Components.i.plt

fglb: str

Glob for marked file names

Versions:
  • 2016-10-24 @ddalle: v1.0

  • 2022-01-28 @ddalle: v1.1; was LinKFromGlob()

Link the most recent Tecplot files to fixed file names

Call:
>>> link_plt(fdir=None)
Inputs:
fdir: {None} | str

Specific folder in which to find latest file

Versions:
  • 2022-01-28 @ddalle: v1.0

cape.pykes.case.run_kestrel() int

Setup and run the appropriate Kestrel command

This function runs one phase, but may restart the case by recursing if settings prescribe it.

Call:
>>> run_kestrel()
Versions:
  • 2021-10-21 @ddalle: v1.0

  • 2023-07-10 @ddalle: v2.0; use CaseRunner