PDESolver User Interface
Invoking the Code
This page describes the API for running the code, as well as utility scripts that provide simple operation of the code.
The entry point for running the code is the function run_solver
PDESolver.run_solver
— Function.This function provides a way to invoke any physics solver based on the specification of the physics in the input file.
The physics module must have already been registered using register_physics
This function is equivalent to solvePDE
, it is maintained here for legacy purposes only.
Inputs
input_file: an AbstractString specifying the path to the input file
Outputs
mesh: the AbstractMesh object used during the solve
sbp: the SBP operator used by the solver
eqn: the AbstractSolutionData object during the solve. At exit, eqn.q_vec should have the final solution in it
opts: the options dictionary
Each physics module is required to register itself when using PhysicsModule
is run. When using this API to invoke the code, users should be sure to have loaded the required physics module before calling run_solver
.
In order to facilitate running the code, the script src/startup.jl
loads all the physics modules and passes the first command line argument as the input file name
Registering ICs and BCs
These functions allow users to register new initial conditions and boundary conditions without modifying the source code
PDESolver.registerIC
— Function.This function registers a new initial condition function with the specified physics module. The function must have the signature:
ICfunc(mesh::AbstractMesh, sbp::AbstractSBP, eqn:AbstractSolutionData{Tsol}, opts:Dict, q_vec::AbstractVector{Tsol})
where q_vec is a vector of length numDof that will be populated with the initial condition. If the function is used to provide the exact solution for an unsteady problem (for calculating the error via the exact_soln_func
key in the options dictionary), then it should use eqn.params.t as the current time value.
This function does not attempt to verify that the functor has the correct signature, so the user should take care to ensure it is correct for the physics module.
The physics module must have an associative container called ICDict
that accepts Strings as keys and functions as values.
It is an error to register two functions under the same name or to register one function under two different names.
Inputs:
mod: physics module to register the function with
fname: name associated with the function, used as the value for the
for any key in the options dictionary that specifies an initial
condition function
func: the function itself
Outputs:
none
PDESolver.registerBC
— Function.This function registers a new boundary condition functor with the specified physics module. The exact signature of the functor varies by physics module. The purpose of the functor is to calculate the flux across a boundary at a particular node. It usually takes in the solution values at that node, as well as the coordinates and mapping jacobian. The params type is typically used to dispatch to different methods for 2D or 3D, if needed. Generally, this functor will calculate the boundary state and then call a numerical flux function of some kind to compute the flux.
This function does not attempt to verify that the functor has the correct signature, so the user should take care to ensure it is correct for the physics module.
It is an error to register two functors with the same name or the same functor under two different names. An exception is made for "reanalysisBC", because it is special.
Inputs
mod: module to register the the functor with
fname: the name associated with this function, used as the value for any key in the options dictionary that specifies a boundary condition, for example
BC1_name
func: the functor itself
Outputs
none
Notes For Implementers
This function works by utilizing mod.BCDict
, which must be an associative collection mapping BC names to functors.
Interactive Functions
These functions are useful for inspecting the state of the front-end.
PDESolver.printICNames
— Function.Print all initial condition names for a given physics module
Inputs:
mod: the module to print the ICs for
f: the IO to print to, defaults to STDOUT
Outputs: none
PDESolver.printBCNames
— Function.Like printICNames, but for boundary conditions, see that function for details
PDESolver.printPhysicsModules
— Function.Prints the name of all currently registered physics modules and the module name itself