cape.pyus.casecntl: US3D Case control module

This module contains the important function casecntl.run_us3d(), which actually runs us3d or us3d_mpi, along with the utilities that support it.

It also contains US3D-specific versions of some of the generic methods from cape.case. For instance the function GetCurrentIter() determines how many US3D iterations have been run in the current folder, which is obviously a solver-specific task.

cape.pyus.casecntl.GetInputInp(rc=None, j=None)

Read case namelist input.inp file

Call:
>>> inp = pyUS.casecntl.GetInputInp(rc=None, j=None)
Inputs:
rc: cape.pyus.options.runControl.RunControl

Run control options

j: int

Phase number

Outputs:
inp: pyUS.inputinpfile.InputInp

Interface to input.inp

Versions:
  • 2019-06-27 @ddalle: First version

cape.pyus.casecntl.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 = casecntl.GetPBSScript(i=None)
Inputs:
i: int

Run index

Outputs:
fpbs: str

Name of PBS script to call

Versions:
  • 2014-12-01 @ddalle: First version

  • 2020-04-27 @ddalle: US3D version

cape.pyus.casecntl.GetPhaseNumber(rc)

Determine the phase number based on files in folder

Call:
>>> i = casecntl.GetPhaseNumber(rc)
Inputs:
rc: cape.pyfun.options.runControl.RunControl

Options interface for run control

Outputs:
i: int

Most appropriate phase number for a restart

Versions:
  • 2020-10-02 @ddalle: Placeholder version

cape.pyus.casecntl.PrepareFiles(rc, i=None)

Prepare file names appropriate to run phase i of FUN3D

Call:
>>> PrepareFiles(rc, i=None)
Inputs:
rc: cape.pyus.options.runControl.RunControl

Options interface from case.json

i: int

Phase number

Versions:
  • 2016-04-14 @ddalle: First version

cape.pyus.casecntl.ReadCaseJSON()

Read RunControl settings for local case

Call:
>>> rc = pyUS.casecntl.ReadCaseJSON()
Outputs:
rc: cape.pyus.options.runControl.RunControl

Options interface for run control settings

Versions:
  • 2014-10-02 @ddalle: First version

  • 2015-10-19 @ddalle: FUN3D version

cape.pyus.casecntl.RunPhase(rc, i)

Run one phase using appropriate commands

Call:
>>> RunPhase(rc, i)
Inputs:
rc: cape.pyus.options.runControl.RunControl

Options interface from case.json

i: int

Phase number

Versions:
  • 2020-04-16 @ddalle: Starter version

cape.pyus.casecntl.RunUS3DGenBC(rc, i)

Execute us3d-genbc

Call:
>>> RunUS3DPrepar(rc, i)
Inputs:
rc: cape.pyus.options.runControl.RunControl

Options interface from case.json

i: int

Phase number, does nothing if i is not 0

Versions:
  • 2020-04-16 @ddalle: First version

cape.pyus.casecntl.RunUS3DPrepar(rc, i)

Execute us3d-prepar

Call:
>>> RunUS3DPrepar(rc, i)
Inputs:
rc: cape.pyus.options.runControl.RunControl

Options interface from case.json

i: int

Phase number, does nothing if i is not 0

Versions:
  • 2020-04-16 @ddalle: First version

cape.pyus.casecntl.StartCase()

Start a case by either submitting it or calling locally

Call:
>>> casecntl.StartCase()
Versions:
  • 2014-10-06 @ddalle: First version

  • 2015-10-19 @ddalle: Copied from cape.pycart

  • 2020-04-27 @ddalle: Copied from cape.pyus

cape.pyus.casecntl.WriteStartTime(tic, rc, i, fname='pyus_start.dat')

Write the start time in tic

Call:
>>> WriteStartTime(tic, rc, i, fname="pyus_start.dat")
Inputs:
tic: datetime.datetime

Time to write into data file

rc: pyOver.options.runControl.RunControl

Options interface

i: int

Phase number

fname: {"pyus_start.dat"} | str

Name of file containing run start times

Versions:
  • 2016-08-31 @ddalle: First version

  • 2019-06-27 @ddalle: US3D version

cape.pyus.casecntl.WriteUserTime(tic, rc, i, fname='pyus_time.dat')

Write time usage since time tic to file

Call:
>>> toc = WriteUserTime(tic, rc, i, fname="pyus_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

Outputs:
toc: datetime.datetime

Time at which time delta was measured

Versions:
  • 2015-12-09 @ddalle: First version

  • 2019-06-27 @ddalle: US3D version

cape.pyus.casecntl.run_us3d()

Setup and run the appropriate US3D command

Call:
>>> pyUS.casecntl.run_us3d()
Versions:
  • 2019-06-27 @ddalle: Started