implementations.problem_classes.Boussinesq_2D_FD_imex module¶
- class boussinesq_2d_imex(nvars=None, c_s=0.3, u_adv=0.02, Nfreq=0.01, x_bounds=None, z_bounds=None, order_upw=5, order=4, gmres_maxiter=500, gmres_restart=10, gmres_tol_limit=1e-05)[source]¶
Bases:
ptype
This class implements the two-dimensional Boussinesq equations for different boundary conditions with
\[\frac{\partial u}{\partial t} + U \frac{\partial u}{\partial x} + \frac{\partial p}{\partial x} = 0,\]\[\frac{\partial w}{\partial t} + U \frac{\partial w}{\partial x} + \frac{\partial p}{\partial z} = 0,\]\[\frac{\partial b}{\partial t} + U \frac{\partial b}{\partial x} + N^2 w = 0,\]\[\frac{\partial p}{\partial t} + U \frac{\partial p}{\partial x} + c^2 (\frac{\partial u}{\partial x} + \frac{\partial w}{\partial z}) = 0.\]They can be derived from the linearized Euler equations by a transformation of variables [1].
- Parameters:
nvars (list of tuple, optional) – List of number of unknowns nvars, e.g.
nvars=[(4, 300, 3)]
.c_s (float, optional) – Acoustic velocity \(c_s\).
u_adv (float, optional) – Advection speed \(U\).
Nfreq (float, optional) – Stability frequency.
x_bounds (list, optional) – Domain in x-direction.
z_bounds (list, optional) – Domain in z-direction.
order_upwind (int, optional) – Order of upwind scheme for discretization.
order (int, optional) – Order for discretization.
gmres_maxiter (int, optional) – Maximum number of iterations for GMRES solver.
gmres_restart (int, optional) – Number of iterations between restarts in GMRES solver.
gmres_tol_limit (float, optional) – Tolerance for GMRES solver to terminate.
- N¶
List of number of unknowns.
- Type:
list
- bc_hor¶
Contains type of boundary conditions for both boundaries for both dimensions.
- Type:
list
- bc_ver¶
Contains type of boundary conditions for both boundaries for both dimemsions, e.g.
'neumann'
or'dirichlet'
.
- xx¶
List of np.ndarrays for mesh in x-direction.
- Type:
np.ndarray
- zz¶
List of np.ndarrays for mesh in z-direction.
- Type:
np.ndarray
- h¶
Mesh size.
- Type:
float
- Id¶
Identity matrix for the equation of appropriate size.
- Type:
sp.sparse.eye
- M¶
Boussinesq 2D Matrix.
- Type:
np.ndarray
- D_upwind¶
Boussinesq 2D Upwind matrix for discretization.
- Type:
sp.csc_matrix
- gmres_logger¶
Logger for GMRES solver.
- Type:
object
References
- dtype_f¶
alias of
imex_mesh
- dtype_u¶
alias of
mesh
- eval_f(u, t)[source]¶
Routine to evaluate both parts of the right-hand side.
- Parameters:
u (dtype_u) – Current values of the numerical solution.
t (float) – Current time the numerical solution is computed.
- Returns:
f – Right-hand side divided into two parts.
- Return type:
dtype_f
- solve_system(rhs, factor, u0, t)[source]¶
Simple linear solver for \((I - factor \cdot A) \vec{u} = \vec{rhs}\) using GMRES.
- Parameters:
rhs (dtype_f) – Right-hand side for the nonlinear system.
factor (float) – Abbrev. for the node-to-node stepsize (or any other factor required).
u0 (dtype_u) – Initial guess for the iterative solver (not used here so far).
t (float) – Current time (e.g. for time-dependent BCs).
- Returns:
me – The solution as mesh.
- Return type:
dtype_u