First level routines to discretize PDE term by term on cells. More...
Namespaces | |
module | mod_cell_scalar_implicit_discretization_collection |
Module that encapsulates all cell scalar term by term discretization modules. | |
module | enum_cell_advection_term_scheme |
Enumeration modules associated to cell scalar advection term discretization. | |
module | enum_cell_diffusion_term_scheme |
Enumeration modules associated to cell scalar diffusion term discretization. | |
Functions | |
subroutine | mod_discretize_cell_advection_term::discretize_cell_advection_term (matrix, coefficient, divergence, equation_advection_term_discretization_type, equation_advection_term_scheme, equation_has_div_u_advection_term, equation_has_immersed_boundaries, equation_ib_has_one_sided_inner_discretization, equation_ib_inner_discretization_order, equation_stencil, time_step_n, time_step, equation_cfl_cell_advection, scalar_field_n, equation_explicit_time_order_discretization, flux_type, boundary_condition, equation_ls_map, velocity_nm1, velocity_n, velocity, work_cell_field, equation_advection_term_splitting_scheme, equation_splitting_time_coef, directional_splitting, ibc_variable, equation_isd_target) |
Discretize the advection term, explicitly or implicitly. | |
subroutine | mod_discretize_cell_diffusion_term::discretize_cell_diffusion_term (matrix, equation_diffusion_term_discretization_type, equation_diffusion_term_scheme, equation_diffusion_explicit_time_order_discretization, equation_has_immersed_boundaries, ibc_variable, equation_isd_target, equation_stencil, equation_ls_map, time_step, equation_cfl_cell_diffusion, scalar_field_n, work_cell_field, boundary_condition, temporal_coefficient, diffusion_coefficient, face_diffusion_coefficient, extra_inside_gradient_coef_diff) |
Discretize the advection term. | |
subroutine | mod_discretize_cell_poisson_equation::discretize_cell_poisson_equation (matrix, rhs, diffusion_coefficient, equation_source_term, linear_term, ibc_variable, equation_isd_target, boundary_condition, equation_diffusion_term_discretization_type, equation_diffusion_term_scheme, equation_has_linear_term, equation_has_ghost_boundary_cells, equation_has_immersed_boundaries, equation_stencil, equation_ls_map, equation_name) |
Discretize the poisson (or advection/diffusion) equation defined on cells. | |
subroutine | mod_discretize_cell_transport_equation::discretize_cell_transport_equation (matrix, rhs, coefficient, diffusion_coefficient, velocity_nm1, velocity_n, velocity_np1, divergence, equation_source_term, scalar_field_n, scalar_field_nm1, scalar_field_nm2, linear_term, boundary_condition, ibc_variable, equation_isd_target, equation_time_step, equation_time_step_n, equation_time_step_nm1, equation_time_order_discretization, equation_cfl_advection, equation_cfl_diffusion, equation_explicit_time_order_discretization, equation_flux_type, equation_has_source_term, equation_has_temporal_term, equation_has_advection_term, equation_has_div_u_advection_term, equation_has_diffusion_term, equation_has_linear_term, equation_has_ghost_boundary_cells, equation_has_immersed_boundaries, equation_ib_has_one_sided_inner_discretization, equation_ib_inner_discretization_order, equation_fully_explicit, equation_use_explicit_terms_accumulator, equation_advection_term_discretization_type, equation_advection_term_scheme, equation_diffusion_term_discretization_type, equation_diffusion_term_scheme, equation_diffusion_explicit_time_order_discretization, equation_advection_term_splitting_scheme, equation_splitting_time_coef, equation_advection_term_dir_split, equation_stencil, equation_ls_map, is_matrix_invertible_local, equation_name, equation_explicit_terms_accumulator_n, equation_explicit_terms_accumulator_nm1, equation_explicit_terms_accumulator_nm2) |
Discretize the transport (or advection/diffusion) equation defined on cells. | |
In this directory you will find the first level of routines to solve PDE term by term on cell based variables.
subroutine mod_discretize_cell_advection_term::discretize_cell_advection_term | ( | double precision, dimension(:), intent(inout) | matrix, |
double precision, dimension(:,:,:), intent(in) | coefficient, | ||
double precision, dimension(:,:,:), intent(in) | divergence, | ||
integer, intent(in) | equation_advection_term_discretization_type, | ||
integer, intent(in) | equation_advection_term_scheme, | ||
logical, intent(in) | equation_has_div_u_advection_term, | ||
logical, intent(in) | equation_has_immersed_boundaries, | ||
logical, intent(in) | equation_ib_has_one_sided_inner_discretization, | ||
integer, dimension (:), intent(in) | equation_ib_inner_discretization_order, | ||
type(t_cell_stencil), intent(in) | equation_stencil, | ||
double precision, intent(in) | time_step_n, | ||
double precision, intent(in) | time_step, | ||
double precision, intent(inout) | equation_cfl_cell_advection, | ||
double precision, dimension(:,:,:), intent(in) | scalar_field_n, | ||
integer, intent(in) | equation_explicit_time_order_discretization, | ||
type(t_fv_flux), intent(in) | flux_type, | ||
type(t_boundary_condition), intent(in) | boundary_condition, | ||
type(t_ls_map), intent(in) | equation_ls_map, | ||
type(t_face_field), intent(in) | velocity_nm1, | ||
type(t_face_field), intent(in) | velocity_n, | ||
type(t_face_field), intent(in) | velocity, | ||
double precision, dimension(:,:,:), intent(inout), allocatable | work_cell_field, | ||
integer, intent(in) | equation_advection_term_splitting_scheme, | ||
double precision, dimension (3), intent(inout) | equation_splitting_time_coef, | ||
logical, intent(in) | directional_splitting, | ||
type(t_immersed_boundary_condition), dimension(:), intent(in) | ibc_variable, | ||
integer, dimension(:), intent(in) | equation_isd_target ) |
The term writes:
\[ \varrho \mathbf{u}^{n+1} \cdot \nabla \varphi^{n+1} = \varrho \nabla \cdot (\mathbf{u}^{n+1} \varphi^{n+1}) - \varphi^{n+1} \nabla \cdot \mathbf{u}^{n+1} \]
This term can be treated implicitly or explicitly. In the first case, discretization coefficients are added to the matrix of the linear system. In the other case, the term is added to the right-hand side.
Since the Navier-Stokes equation are solved before other advection and diffusion equations, velocity at time \( t^{n+1} \) is known at this stage.
[in,out] | matrix | matrix of the linear system |
[in] | coefficient | the coefficient field |
[in] | divergence | the velocity divergence \( \nabla \cdot \mathbf{u}^{n} \) |
[in] | equation_advection_term_discretization_type | the temporal discretization type implicit_discretization or explicit_discretization |
[in] | equation_advection_term_scheme | the temporal discrete scheme, see enum_cell_advection_term_scheme |
[in] | equation_has_div_u_advection_term | if true, add \( -c \nabla \cdot u \) to the RHS for pure advection |
[in] | equation_has_immersed_boundaries | if true, adapt discretization to immersed boundaries |
[in] | equation_ib_has_one_sided_inner_discretization | if true, uncentered discretization on first inner node |
[in] | equation_ib_inner_discretization_order | set the convergence order of the inner discretization method |
[in] | equation_stencil | equation stencil structure |
[in] | time_step_n | the previous time step \( \delta t^{n} = t^{n} - t^{n-1} \) |
[in] | time_step | the current time step \( \delta t = t^{n+1} - t^{n} \) |
[in] | equation_cfl_cell_advection | |
[in] | scalar_field_n | the scalar field at time \( t^{n} \). |
[in] | equation_explicit_time_order_discretization | the time discretization order for computing the advection with the explicit scheme (Euler, NSSP32, NSSP53) |
[in] | flux_type | the flux type to use for the explicit advection (type_fv_flux) |
[in] | boundary_condition | the boundary conditions of the cell scalar |
[in] | equation_ls_map | |
[in] | velocity_nm1 | velocity field at \( t^{n-1} \) |
[in] | velocity_n | velocity field at \( t^n \) |
[in] | velocity | velocity field at \( t^{n+1} \) |
[in] | work_cell_field | |
[in] | equation_advection_term_splitting_scheme | |
[in] | equation_splitting_time_coef | |
[in] | directional_splitting | |
[in] | ibc_variable | |
[in] | equation_isd_target |
subroutine mod_discretize_cell_diffusion_term::discretize_cell_diffusion_term | ( | double precision, dimension(:), intent(inout) | matrix, |
integer, intent(in) | equation_diffusion_term_discretization_type, | ||
integer, intent(in) | equation_diffusion_term_scheme, | ||
integer, intent(in) | equation_diffusion_explicit_time_order_discretization, | ||
logical, intent(in) | equation_has_immersed_boundaries, | ||
type(t_immersed_boundary_condition), dimension(:), intent(in) | ibc_variable, | ||
integer, dimension(:), intent(in) | equation_isd_target, | ||
type(t_cell_stencil), intent(in) | equation_stencil, | ||
type(t_ls_map), intent(in) | equation_ls_map, | ||
double precision, intent(in) | time_step, | ||
double precision, intent(inout) | equation_cfl_cell_diffusion, | ||
double precision, dimension(:,:,:), intent(in) | scalar_field_n, | ||
double precision, dimension(:,:,:), intent(inout) | work_cell_field, | ||
type(t_boundary_condition), intent(in) | boundary_condition, | ||
double precision, dimension(:,:,:), intent(in), optional | temporal_coefficient, | ||
double precision, dimension(:,:,:), intent(in), optional | diffusion_coefficient, | ||
type(t_face_field), intent(inout), optional | face_diffusion_coefficient, | ||
double precision, dimension(:,:,:), intent(in), optional | extra_inside_gradient_coef_diff ) |
The term writes:
\begin{align} \nabla \cdot ( D \nabla \phi)_{0,0} =& \frac{1}{\delta x_0} \frac{D_{+\frac12,0}}{\delta x_{+\frac12}} \phi_{+1,0} -\frac{1}{\delta x_0} \left(\frac{D_{+\frac12,0}}{\delta x_{+\frac12}} + \frac{D_{-\frac12,0}}{\delta x_{-\frac12}}\right) \phi_{0,0} +\frac{1}{\delta x_0} \frac{D_{-\frac12,0}}{\delta x_{-\frac12}} \phi_{-1,0} \\ +& \frac{1}{\delta y_0} \frac{D_{0,+\frac12}}{\delta y_{+\frac12}} \phi_{0,+1} -\frac{1}{\delta y_0} \left(\frac{D_{0,+\frac12}}{\delta y_{+\frac12}} + \frac{D_{0,-\frac12}}{\delta y_{-\frac12}}\right) \phi_{0,0} +\frac{1}{\delta y_0} \frac{D_{0,-\frac12}}{\delta y_{-\frac12}} \phi_{0,-1} \,. \end{align}
Either cell or face diffusion coefficients must be given as an argument. When cell diffusion coefficient is given, they are interpolated on face nodes using interpolate_diffusion_coef
(harmonic interpolation).
[in,out] | matrix | matrix of linear system |
[in] | equation_diffusion_term_discretization_type | |
[in] | equation_diffusion_term_scheme | |
[in] | equation_diffusion_explicit_time_order_discretization | |
[in] | equation_has_immersed_boundaries | |
[in] | ibc_variable | instance of immersed_boundary_condition associated to \( \phi^{n} \) |
[in] | equation_isd_target | immersed subdomain target array of the equation |
[in] | equation_stencil | |
[in] | equation_ls_map | |
[in] | time_step | |
[in,out] | equation_cfl_cell_diffusion | |
[in] | scalar_field_n | the field at time \(t^{n}\) |
[in,out] | work_cell_field | |
[in] | boundary_condition | |
[in] | temporal_coefficient | the coefficient that is in front of the \(\partial_t \phi\) term. |
[in] | diffusion_coefficient | |
[in,out] | face_diffusion_coefficient | (opt) |
[in] | extra_inside_gradient_coef_diff | (opt): a coefficient ( \(c\)) that modifies the diffusion coefficient such that \( k' = (1+c)*k \). |
subroutine mod_discretize_cell_poisson_equation::discretize_cell_poisson_equation | ( | double precision, dimension(:), intent(inout) | matrix, |
double precision, dimension(:), intent(inout) | rhs, | ||
double precision, dimension(:,:,:), intent(in) | diffusion_coefficient, | ||
double precision, dimension(:,:,:), intent(in) | equation_source_term, | ||
double precision, dimension(:,:,:), intent(in) | linear_term, | ||
type(t_immersed_boundary_condition), dimension(:), intent(inout), allocatable | ibc_variable, | ||
integer, dimension(:), intent(in), allocatable | equation_isd_target, | ||
type(t_boundary_condition), intent(in) | boundary_condition, | ||
integer, intent(in) | equation_diffusion_term_discretization_type, | ||
integer, intent(in) | equation_diffusion_term_scheme, | ||
logical, intent(in) | equation_has_linear_term, | ||
logical, intent(in) | equation_has_ghost_boundary_cells, | ||
logical, intent(in) | equation_has_immersed_boundaries, | ||
type(t_cell_stencil), intent(in) | equation_stencil, | ||
type(t_ls_map), intent(in) | equation_ls_map, | ||
character(len=*), intent(in) | equation_name ) |
[in] | matrix | matrix of the linear system. |
[in] | rhs | right-hand side of the linear system. |
[in] | diffusion_coefficient | Coefficient of diffusion. |
[in] | equation_source_term | Source term added to the right-hand side. |
[in] | linear_term | Contains the coefficient in front of the linear term. |
[in] | ibc_variable | Boundary conditions on immersed boundaries. |
[in] | equation_isd_target | Subset of immersed boundary list. |
[in] | boundary_condition | the boundary conditions of the cell scalar |
[in] | equation_diffusion_term_discretization_type | Type of discretization (implicit/explicit) the diffusion term. |
[in] | equation_diffusion_term_scheme | Numerical scheme of the diffusion term |
[in] | equation_has_linear_term | Flag to enable the linear term. |
[in] | equation_has_ghost_boundary_cells | Flag to enable the ghost cells into the linear system |
[in] | equation_has_immersed_boundaries | Flag to enable immersed boundaries. |
[in] | equation_stencil | Stencil description. |
[in] | equation_ls_map | Structure used to map the general numbering to the linear system numbering. |
[in] | equation_name | Name of the equation used to display a message. |
subroutine mod_discretize_cell_transport_equation::discretize_cell_transport_equation | ( | double precision, dimension(:), intent(inout) | matrix, |
double precision, dimension(:), intent(inout) | rhs, | ||
double precision, dimension(:,:,:), intent(in) | coefficient, | ||
double precision, dimension(:,:,:), intent(in) | diffusion_coefficient, | ||
type(t_face_field), intent(in) | velocity_nm1, | ||
type(t_face_field), intent(in) | velocity_n, | ||
type(t_face_field), intent(in) | velocity_np1, | ||
double precision, dimension(:,:,:), intent(in) | divergence, | ||
double precision, dimension(:,:,:), intent(in) | equation_source_term, | ||
double precision, dimension(:,:,:), intent(in) | scalar_field_n, | ||
double precision, dimension(:,:,:), intent(in) | scalar_field_nm1, | ||
double precision, dimension(:,:,:), intent(in) | scalar_field_nm2, | ||
double precision, dimension(:,:,:), intent(in) | linear_term, | ||
type(t_boundary_condition), intent(in) | boundary_condition, | ||
type(t_immersed_boundary_condition), dimension(:), intent(in) | ibc_variable, | ||
integer, dimension(:), intent(in) | equation_isd_target, | ||
double precision, intent(in) | equation_time_step, | ||
double precision, intent(in) | equation_time_step_n, | ||
double precision, intent(in) | equation_time_step_nm1, | ||
integer, intent(in) | equation_time_order_discretization, | ||
double precision, intent(inout) | equation_cfl_advection, | ||
double precision, intent(inout) | equation_cfl_diffusion, | ||
integer, intent(in) | equation_explicit_time_order_discretization, | ||
type(t_fv_flux), intent(in) | equation_flux_type, | ||
logical, intent(in) | equation_has_source_term, | ||
logical, intent(in) | equation_has_temporal_term, | ||
logical, intent(in) | equation_has_advection_term, | ||
logical, intent(in) | equation_has_div_u_advection_term, | ||
logical, intent(in) | equation_has_diffusion_term, | ||
logical, intent(in) | equation_has_linear_term, | ||
logical, intent(in) | equation_has_ghost_boundary_cells, | ||
logical, intent(in) | equation_has_immersed_boundaries, | ||
logical, intent(in) | equation_ib_has_one_sided_inner_discretization, | ||
integer, dimension(:), intent(in) | equation_ib_inner_discretization_order, | ||
logical, intent(in) | equation_fully_explicit, | ||
logical, intent(in) | equation_use_explicit_terms_accumulator, | ||
integer, intent(in) | equation_advection_term_discretization_type, | ||
integer, intent(in) | equation_advection_term_scheme, | ||
integer, intent(in) | equation_diffusion_term_discretization_type, | ||
integer, intent(in) | equation_diffusion_term_scheme, | ||
integer, intent(in) | equation_diffusion_explicit_time_order_discretization, | ||
integer, intent(in) | equation_advection_term_splitting_scheme, | ||
double precision, dimension (3), intent(inout) | equation_splitting_time_coef, | ||
logical, intent(in) | equation_advection_term_dir_split, | ||
type(t_cell_stencil), intent(in) | equation_stencil, | ||
type(t_ls_map), intent(in) | equation_ls_map, | ||
logical, intent(in) | is_matrix_invertible_local, | ||
character(len=*), intent(in) | equation_name, | ||
double precision, dimension(:,:,:), intent(inout) | equation_explicit_terms_accumulator_n, | ||
double precision, dimension(:,:,:), intent(inout) | equation_explicit_terms_accumulator_nm1, | ||
double precision, dimension(:,:,:), intent(inout) | equation_explicit_terms_accumulator_nm2 ) |
[in] | matrix | matrix of the linear system. |
[in] | rhs | right-hand side of the linear system. |
[in] | coefficient | Coefficient in front of the time and advection term. |
[in] | diffusion_coefficient | Coefficient of diffusion. |
[in] | velocity_nm1 | velocity field at \( t^{n-1} \) |
[in] | velocity_n | velocity field at \( t^n \) |
[in] | velocity_np1 | velocity field at \( t^{n+1} \) |
[in] | divergence | Divergence of the velocity. |
[in] | equation_source_term | Source term added to the right-hand side. |
[in] | scalar_field_n | Scalar field at previous time iteration. |
[in] | scalar_field_nm1 | Scalar field at time iteration n-1. |
[in] | scalar_field_nm2 | Scalar field at time iteration n-2. |
[in] | linear_term | Contains the coefficient in front of the linear term. |
[in] | boundary_condition | the boundary conditions of the cell scalar |
[in] | ibc_variable | Boundary conditions on immersed boundaries. |
[in] | equation_isd_target | Subset of immersed boundary list. |
[in] | equation_time_step | the current time step \( \delta t^{n} = t^{n+1} - t^{n} \) |
[in] | equation_time_step_n | the previous time step \( \delta t^{n-1} = t^{n} - t^{n-1} \) |
[in] | equation_time_step_nm1 | the previous time step \( \delta t^{n-2} = t^{n-1} - t^{n-2} \) |
[in] | equation_time_order_discretization | the time discretization order for the equation (SBDF), 1 or 2 |
[in,out] | equation_cfl_advection | |
[in,out] | equation_cfl_diffusion | |
[in] | equation_explicit_time_order_discretization | the time discretization order for computing the advection with the explicit scheme (Euler, NSSP32, NSSP53) |
[in] | equation_flux_type | the flux type to use for the explicit advection (type_fv_flux) |
[in] | equation_has_source_term | Flag to enable the source term. |
[in] | equation_has_temporal_term | Flag to enable the temporal term. |
[in] | equation_has_advection_term | Flag to enable the advection term. |
[in] | equation_has_div_u_advection_term | Flag to enable the div(u⃗) advection term |
[in] | equation_has_diffusion_term | Flag to enable the diffusion term. |
[in] | equation_has_linear_term | Flag to enable the linear term. |
[in] | equation_has_ghost_boundary_cells | Flag to enable the ghost cells into the linear system |
[in] | equation_has_immersed_boundaries | Flag to enable immersed boundaries. |
[in] | equation_ib_has_one_sided_inner_discretization | |
[in] | equation_ib_inner_discretization_order | |
[in] | equation_fully_explicit | |
[in] | equation_use_explicit_terms_accumulator | |
[in] | equation_advection_term_discretization_type | Type of discretization (implicit/explicit) the advection term. |
[in] | equation_advection_term_scheme | Numerical scheme of the advection term (upwind, etc.). |
[in] | equation_diffusion_term_discretization_type | Type of discretization (implicit/explicit) the diffusion term. |
[in] | equation_diffusion_term_scheme | Numerical scheme of the diffusion term |
[in] | equation_diffusion_explicit_time_order_discretization | |
[in] | equation_advection_term_splitting_scheme | |
[in,out] | equation_splitting_time_coef | |
[in] | equation_advection_term_dir_split | |
[in] | equation_stencil | Stencil description. |
[in] | equation_ls_map | Structure used to map the general numbering to the linear system numbering. |
[in] | is_matrix_invertible_local | Flag to require a null right-hand side integral. |
[in] | equation_name | Name of the equation used to display a message. |
[in,out] | equation_explicit_terms_accumulator_n | the current accumulator of explicit terms at time \( t^{n+1/2} \) (mean) |
[in,out] | equation_explicit_terms_accumulator_nm1 | the accumulator of explicit terms at time \( t^{n-1/2} \) (mean) |
[in,out] | equation_explicit_terms_accumulator_nm2 | the accumulator of explicit terms at time \( t^{n-3/2} \) (mean) |