Implicit discretization of a scalar equation defined on cells. More...
Topics | |
Cell advection term | |
Implicit advection schemes of a scalar equation defined on cells. | |
Boundary condition treatment | |
Boundary condition treatment of a scalar equation defined on cells. | |
Cell diffusion term | |
Implicit diffusion schemes of a scalar equation defined on cells. | |
Cell linear system preparation | |
Cell linear system preparation of a scalar equation defined on cells. | |
Functions | |
subroutine | mod_impose_cell_value::impose_cell_value (matrix, rhs, position, value, stencil_size, equation_ls_map) |
Impose the linear system to yield the given value at the given position. | |
This directory provides a set of routines to discretize a scalar advection-diffusion equation defined on cells. The general form of the equation is:
\[ \varrho \bigg( \underbrace{ \frac {\alpha \varphi^{n+1} + \beta \varphi^n + \gamma \varphi^{n-1} } {\Delta t}}_{\text{temporal term}} + \underbrace{ \mathbf{u^{n+1}} \cdot \nabla \tilde{\varphi} }_{\text{advection term}} \bigg) = \underbrace{ \nabla \cdot \left( D \nabla \varphi^{n+1} \right)}_{\text{diffusive term}} \]
where \(\varphi\) is the scalar field, \(D\) the diffusion coefficient, and \( \varrho \) an advection coefficient. The discretization of the advection term can be done either implicitly ( \( \tilde{\varphi}=\varphi^{n+1} \)) or eventually ( \( \tilde{\varphi}=\varphi^{n} \)).
This equation becomes a linear system by the discretization process. The matrix and the right-hand side are constructed by the routines defined here in a term-by-term fashion.
First of all, some routines are designed to simply build-up le linear system:
add_diagonal_cell_matrix
adds array elements to the diagonal terms of the matrix.add_rhs_cell
adds array elements to the right-hand side.impose_cell_value
sets the linear system to get a specific value at a specific position.finalize_cell_linear_system
should be called to complete the build-up.Routine discretize_cell_transport_equation
can be used to discretize the whole equation (see solver_energy.f90
for instance)
These routines are related to the terms described above.
add_cell_advection_term
adds the advection term in both explicit and implicit versions. See the routine's documentation for details.The enumerator enum_cell_advection_term_scheme is useful to provide arguments.
add_cell_diffusion_term_centered_o2
add the diffusion term.The functions set_diffusion_flux_coef
and set_diffusion_flux_coef_2
are useful to provide the arguments.
The boundary conditions are imposed by the following routines:
apply_bc_on_ghost_b_cells
(explicit)add_cell_bc
(implicit)apply_immersed_boundary_condition_cell
adds boundary condition to immersed boundaries, which most probably adds ghost nodes to the system.These routines contribute to the setup of the linear system:
set_cell_stencil_indices
subroutine mod_impose_cell_value::impose_cell_value | ( | double precision, dimension(:), intent(inout) | matrix, |
double precision, dimension(:), intent(inout) | rhs, | ||
double precision, dimension(3), intent(in) | position, | ||
double precision, intent(in) | value, | ||
integer, intent(in) | stencil_size, | ||
type(t_ls_map), intent(in) | equation_ls_map ) |
This routine modifies the linear system such as the solution will yield the given value at the given position. Pretty brutal, this routine has been implemented to fix ill-posed linear system such as the Laplace equation with Neumann boundary conditions everywhere.