implementations.problem_classes.AcousticAdvection_1D_FD_imex module¶
- class acoustic_1d_imex(nvars=None, cs=0.5, cadv=0.1, order_adv=5, waveno=5)[source]¶
Bases:
ptype
This class implements the one-dimensional acoustics advection equation on a periodic domain \([0, 1]\) fully investigated in [1]. The equations are given by
\[\frac{\partial u}{\partial t} + c_s \frac{\partial p}{\partial x} + U \frac{\partial u}{\partial x} = 0,\]\[\frac{\partial p}{\partial t} + c_s \frac{\partial u}{\partial x} + U \frac{\partial p}{\partial x} = 0.\]For initial data \(u(x, 0) \equiv 0\) and \(p(x, 0) = p_0 (x)\) the analytical solution is
\[u(x, t) = \frac{1}{2} p_0 (x - (U + c_s) t) - \frac{1}{2} p_0 (x - (U - c_s) t),\]\[p(x, t) = \frac{1}{2} p_0 (x - (U + c_s) t) + \frac{1}{2} p_0 (x - (U - c_s) t).\]The problem is implemented in the way that is used for IMEX time-stepping.
- Parameters:
nvars (int, optional) – Number of degrees of freedom.
cs (float, optional) – Sound velocity \(c_s\).
cadv (float, optional) – Advection speed \(U\).
order_adv (int, optional) – Order of which the advective derivative is discretized.
waveno (int, optional) – The wave number.
- mesh¶
1d mesh.
- Type:
np.1darray
- dx¶
Mesh size.
- Type:
float
- Dx¶
Matrix for the advection operator.
- Type:
scipy.csc_matrix
- Id¶
Sparse identity matrix.
- Type:
scipy.csc_matrix
- A¶
Matrix for the wave operator.
- Type:
scipy.csc_matrix
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 of the problem.
- Parameters:
u (dtype_u) – Current values of the numerical solution.
t (float) – Current time of the numerical solution is computed.
- Returns:
f – The 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}\).
- Parameters:
rhs (dtype_f) – Right-hand side for the linear 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