cape.pylava.runinpfile: Interface to LAVA-Cartesian input files¶
This module provides the class CartInputFile, which is used to
parse and modify the C-like input file to LAVA-Cartesian
- class cape.pylava.runinpfile.CartFileList(opt: str, fp: IOBase | None = None)¶
Reader for a “list” of LAVA-Cartesian input files
This refers to list-like contents of
[]brackets, e.g.[ mach, cp ]
- class cape.pylava.runinpfile.CartFileSection(sec: str, fp: IOBase | None = None)¶
Reader for a “section” of LAVA-Cartesian input files
This refers to dict-like contents of
{}braces, e.g.{ mach = 4.5 alpha = 2.0 }
- class cape.pylava.runinpfile.CartInputFile(fname: str | None = None)¶
Interface to LAVA-Cartesian input files
- Call:
>>> inp = CartInputFile(fname=None)
- Inputs:
- fname: {
None} |str Name of input file
- fname: {
- Outputs:
- inp:
CartInputFile Interface to one LAVA-Cartesian input file
- inp:
- apply_dict(d: dict, parent: str | None = None)¶
Apply a
dictof options torun.inputsinterface- Call:
>>. opts.apply_dict(d, parent=None)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- d:
dict Dictionary of options to apply
- parent: {
None} |str Used for recursion
- opts:
- Versions:
2025-07-16
@ddalle: v1.0
- get_alpha()¶
Get freestream angle of attack
- Call:
>>> a = opts.get_alpha()
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- a:
float Angle of attack [deg]
- a:
- Versions:
2025-05-09
@ddalle: v1.0
- get_beta() float¶
Set freestream sideslip angle
- Call:
>>> b = opts.set_beta()
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- b:
float Sideslip angle [deg]
- b:
- Versions:
2025-05-09
@ddalle: v1.0
- get_density() float¶
Get freestream static density
- Call:
>>> rho = opts.get_density()
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- rho:
float Static density [kg/m^3]
- rho:
- Versions:
2025-05-09
@ddalle: v1.0
- get_nstep() int¶
Get number of time steps to take
- Call:
>>> n = opts.get_nstep()
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- n:
int Number of time steps to take
- n:
- Versions:
2025-05-09
@ddalle: v1.0
- get_opt(sec: str, opt: str, vdef=None) Any¶
Get value of an option
You can use
.in opt ot access subsections. For exampleopts.get_opt("cartesian", "output.surface.frequency")
- Call:
>>> v = opts.get_opt(sec, opt, vdef=None)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- sec:
str Name of section
- opt:
str Name of option or subsection(s) and option
- vdef: {
None} |object Default value if opt is not set
- opts:
- Outputs:
- val:
object Value of opt
- val:
- Versions:
2025-05-07
@ddalle: v1.0
- get_pressure() float¶
Get freestream static pressure
- Call:
>>> p = opts.get_pressure()
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- p:
float Static pressure [Pa]
- p:
- Versions:
2025-05-09
@ddalle: v1.0
- get_refarea() float¶
Get solution reference area
- Call:
>>> aref = opts.set_reflength()
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- aref:
float Reference area [m^2]
- aref:
- Versions:
2025-05-09
@ddalle: v1.0
- get_refcond(opt: str) Any¶
Get option from
reference conditionssection- Call:
>>> v = opts.get_refcond(opt)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opt:
str Name of option within section
- opts:
- Outputs:
- v:
object Value of the option
- v:
- Versions:
2025-05-09
@ddalle: v1.0
- get_refdx() float¶
Set solution reference grid size
- Call:
>>> opts.set_refdx(dx)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- ds:
float Reference grid scale [m]
- ds:
- Versions:
2025-05-09
@ddalle: v1.0
- get_reflength() float¶
Get solution reference length
- Call:
>>> lref = opts.set_reflength(lref)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- lref:
float Reference length [m]
- lref:
- Versions:
2025-05-09
@ddalle: v1.0
- get_temperature() float¶
Get freestream static temperature
- Call:
>>> t = opts.get_temperature()
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- t:
float Static temperature [K]
- t:
- Versions:
2025-05-09
@ddalle: v1.0
- get_uref() float¶
Set solution reference velocity
- Call:
>>> uref = opts.get_uref()
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opts:
- Outputs:
- uref:
float Reference velocity [m/s]
- uref:
- Versions:
2025-05-09
@ddalle: v1.0
- set_alpha(a: float)¶
Set freestream angle of attack
- Call:
>>> opts.set_alpha(a)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- a:
float Angle of attack [deg]
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_beta(b: float)¶
Set freestream sideslip angle
- Call:
>>> opts.set_beta(b)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- b:
float Sideslip angle [deg]
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_density(r: float)¶
Set freestream static density
- Call:
>>> opts.set_density(r)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- r:
float Static density [kg/m^3]
- opts:
- Versions:
2025-07-15
@ddalle: v1.0
- set_mach(m: float)¶
Set freestream Mach number
- Call:
>>> opts.set_mach(m)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- m:
float Mach number
- opts:
- Versions:
2025-07-15
@ddalle: v1.0
- set_nstep(n: int)¶
Set number of time steps to take
- Call:
>>> opts.set_nstep(n)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- n:
int Number of time steps to take
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_opt(sec: str, opt: str, val: Any)¶
Set value of an option
You can use
.in opt ot access subsections. For exampleopts.set_opt("cartesian", "output.surface.frequency", 50)
- Call:
>>> v = opts.set_opt(sec, opt, val)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- sec:
str Name of section
- opt:
str Name of option or subsection(s) and option
- val:
object Value of opt to set
- opts:
- Versions:
2025-05-07
@ddalle: v1.0
- set_pressure(p: float)¶
Set freestream static pressure
- Call:
>>> opts.set_pressure(p)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- p:
float Static pressure [Pa]
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_refarea(aref: float)¶
Set solution reference length
- Call:
>>> opts.set_reflength(aref)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- aref:
float Reference area [m^2]
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_refcond(opt: str, v: Any)¶
Set option in
reference conditionssection- Call:
>>> opts.set_refcond(opt, v)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- opt:
str Name of option within section
- v:
object Value of the option
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_refdx(dx: float)¶
Set solution reference grid size
- Call:
>>> opts.set_refdx(dx)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- ds:
float Reference grid scale [m]
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_reflength(lref: float)¶
Set solution reference length
- Call:
>>> opts.set_reflength(lref)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- lref:
float Reference length [m]
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_temperature(t: float)¶
Set freestream static temperature
- Call:
>>> opts.set_pressure(p)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- t:
float Static temperature [K]
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- set_uref(uref: float)¶
Set solution reference velocity
- Call:
>>> opts.set_uref(uref)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- uref:
float Reference velocity [m/s]
- opts:
- Versions:
2025-05-09
@ddalle: v1.0
- write(fname: str | None = None)¶
Write contents to
.varsfile- Call:
>>> opts.write(fname=None)
- Inputs:
- opts:
CartInputFile LAVA-cartesian input file interface
- fname: {
None} |str File name to write
- opts:
- Versions:
2025-07
@ddalle: v1.0
- cape.pylava.runinpfile.assert_nextstr(c: str, target: str, desc=None)¶
Check if a string matches a specified target
- Call:
>>> assert_nextstr(c, target, desc=None)
- Inputs:
- Raises:
ValueErrorif c does not match target
- Versions:
2024-02-23
@ddalle: v1.0
- cape.pylava.runinpfile.assert_regex(c: str, regex, desc=None)¶
Check if a string matches a compiled regular expression
- Call:
>>> assert_regex(c, regex, desc=None)
- Inputs:
- Raises:
ValueErrorif c does not match regex
- Versions:
2024-02-23
@ddalle: v1.0
- cape.pylava.runinpfile.to_text(val: object, indent: int = 0) str¶
Convert appropriate Python value to
.varsfile text
- cape.pylava.runinpfile.to_val(txt: str)¶
Convert
.varsfile text to a Python valueThis only applies to single entries and does not parse lists, etc.
- Call:
>>> v = to_val(txt)
- Inputs:
- txt:
str Any valid text for a single value in a
.varsfile
- txt:
- Outputs:
- v:
object Interpreted value, number, string, boolean, or
None
- v:
- Versions:
2025-05-07
@ddalle: v1.02025-05-19
@ddalle: v1.1; support['a'^3]syntax