cbcflow.schemes.utils module¶
Utility functions and classes shared between scheme implementations.
Modules:
Classes¶
-
class
cbcflow.schemes.utils.
NSSpacePoolMixed
(mesh, u_degree, p_degree, u_family='auto', p_family='auto')¶ Bases:
cbcflow.schemes.utils.spaces.NSSpacePool
A function space pool with custom named spaces for use with mixed Navier-Stokes schemes.
-
class
cbcflow.schemes.utils.
NSSpacePoolSplit
(mesh, u_degree, p_degree, u_family='auto', p_family='auto')¶ Bases:
cbcflow.schemes.utils.spaces.NSSpacePool
A function space pool with custom named spaces for use with split Navier-Stokes schemes.
-
class
cbcflow.schemes.utils.
NSSpacePool
(mesh, u_degree, p_degree, u_family='auto', p_family='auto')¶ A function space pool with custom named spaces for use with Navier-Stokes schemes.
-
DQ
¶ Vector valued space for pressure gradient.
-
DQ0
¶ Scalar valued space for pressure gradient component.
-
DU
¶ Vector valued space for gradients of single velocity components.
-
DU0
¶ Scalar valued space for gradient component of single velocity component.
-
DV
¶ Tensor valued space for gradients of velocity vector.
-
Q
¶ Scalar valued space for pressure.
-
U
¶ Scalar valued space for velocity components.
-
V
¶ Vector valued space for velocity vector.
-
W
¶ Mixed velocity-pressure space.
-
-
class
cbcflow.schemes.utils.
NSSpacePoolSegregated
(mesh, u_degree, p_degree, u_family='auto', p_family='auto')¶ Bases:
cbcflow.schemes.utils.spaces.NSSpacePool
A function space pool with custom named spaces for use with segregated Navier-Stokes schemes.
-
class
cbcflow.schemes.utils.
RhsGenerator
(space)¶ Bases:
object
Class for storing the instructions to create the RHS vector b. The two main purposes of this class are:
- make it easy to define the LHS and RHS in the same place
- make it easy to generate RHS from matrix-XXX products, where XXX may be either * a Constant (which can be projected to a vector at once) * an Expression (which must be projected each time, because its parameters may change) * a Function
Functions¶
-
cbcflow.schemes.utils.
make_rhs_pressure_bcs
(problem, spaces, bcs, v)¶
-
cbcflow.schemes.utils.
assign_ics_mixed
(up0, spaces, ics)¶ Assign initial conditions from ics to up0.
up0 is a mixed function in spaces.W = spaces.V * spaces.Q, while ics = (icu, icp); icu = (icu0, icu1, ...).
-
cbcflow.schemes.utils.
assign_ics_split
(u0, p0, spaces, ics)¶ Assign initial conditions from ics to u0, p0.
u0 is a vector valued function in spaces.V and p0 is a scalar function in spaces.Q, while ics = (icu, icp); icu = (icu0, icu1, ...).
-
cbcflow.schemes.utils.
compute_regular_timesteps
(problem)¶ Compute fixed timesteps for problem.
The first timestep will be T0 while the last timestep will be in the interval [T, T+dt).
Returns (dt, timesteps, start_timestep).
-
cbcflow.schemes.utils.
create_solver
(solver, preconditioner='default')¶ Create solver from arguments. Should be flexible to handle
- strings specifying the solver and preconditioner types
- PETScKrylovSolver/PETScPreconditioner objects
- petsc4py.PETSC.KSP/petsc4py.PETSC.pc objects
or any combination of the above
-
cbcflow.schemes.utils.
make_segregated_velocity_bcs
(problem, spaces, bcs)¶
-
cbcflow.schemes.utils.
make_velocity_bcs
(problem, spaces, bcs)¶
-
cbcflow.schemes.utils.
assign_ics_segregated
(u0, p0, spaces, ics)¶ Assign initial conditions from ics to u0[:], p0.
u0 is a list of scalar functions each in spaces.U and p0 is a scalar function in spaces.Q, while ics = (icu, icp); icu = (icu0, icu1, ...).
-
cbcflow.schemes.utils.
make_pressure_bcs
(problem, spaces, bcs)¶
-
cbcflow.schemes.utils.
make_mixed_velocity_bcs
(problem, spaces, bcs)¶