version 0.6.0
Loading...
Searching...
No Matches
Partial Differential Equations on cells

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.
 

Detailed Description

In this directory you will find the first level of routines to solve PDE term by term on cell based variables.

Function Documentation

◆ discretize_cell_advection_term()

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.

Parameters
[in,out]matrixmatrix of the linear system
[in]coefficientthe coefficient field
[in]divergencethe velocity divergence \( \nabla \cdot \mathbf{u}^{n} \)
[in]equation_advection_term_discretization_typethe temporal discretization type implicit_discretization or explicit_discretization
[in]equation_advection_term_schemethe temporal discrete scheme, see enum_cell_advection_term_scheme
[in]equation_has_div_u_advection_termif true, add \( -c \nabla \cdot u \) to the RHS for pure advection
[in]equation_has_immersed_boundariesif true, adapt discretization to immersed boundaries
[in]equation_ib_has_one_sided_inner_discretizationif true, uncentered discretization on first inner node
[in]equation_ib_inner_discretization_orderset the convergence order of the inner discretization method
[in]equation_stencilequation stencil structure
[in]time_step_nthe previous time step \( \delta t^{n} = t^{n} - t^{n-1} \)
[in]time_stepthe current time step \( \delta t = t^{n+1} - t^{n} \)
[in]equation_cfl_cell_advection
[in]scalar_field_nthe scalar field at time \( t^{n} \).
[in]equation_explicit_time_order_discretizationthe time discretization order for computing the advection with the explicit scheme (Euler, NSSP32, NSSP53)
[in]flux_typethe flux type to use for the explicit advection (type_fv_flux)
[in]boundary_conditionthe boundary conditions of the cell scalar
[in]equation_ls_map
[in]velocity_nm1velocity field at \( t^{n-1} \)
[in]velocity_nvelocity field at \( t^n \)
[in]velocityvelocity 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
Todo
Consider velocity interpolation when STRETCHED RECTILINEAR MESH are used.

◆ discretize_cell_diffusion_term()

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).

Note
  • As described in Cell diffusion term, a central scheme of order 2 (or 4) is used (regular mesh).
  • No treatment of boundary condition is done here for implicit formulation.
  • Boundary condition is also done here for explicit sub iteration formulation.
  • First order Euler time discretization is used for explicit diffusion sub iterations if \(\delta t > \delta t_{max cfl}\).
  • \( \nabla \cdot (D \nabla p) \) for constant coefficient Poisson equation, hereby called Pconst, (A fast pressure-correction methdo for incompressible two-fluid flows, Dodd & Ferrante 2014) is also performed.
  • Pconst is discretized with a second order explicit central difference.
  • Pconst must be given face diffusion coefficients (hard coded before calling this subroutine).
Parameters
[in,out]matrixmatrix 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_variableinstance of immersed_boundary_condition associated to \( \phi^{n} \)
[in]equation_isd_targetimmersed 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_nthe field at time \(t^{n}\)
[in,out]work_cell_field
[in]boundary_condition
[in]temporal_coefficientthe 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 \).

◆ discretize_cell_poisson_equation()

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 )
Parameters
[in]matrixmatrix of the linear system.
[in]rhsright-hand side of the linear system.
[in]diffusion_coefficientCoefficient of diffusion.
[in]equation_source_termSource term added to the right-hand side.
[in]linear_termContains the coefficient in front of the linear term.
[in]ibc_variableBoundary conditions on immersed boundaries.
[in]equation_isd_targetSubset of immersed boundary list.
[in]boundary_conditionthe boundary conditions of the cell scalar
[in]equation_diffusion_term_discretization_typeType of discretization (implicit/explicit) the diffusion term.
[in]equation_diffusion_term_schemeNumerical scheme of the diffusion term
[in]equation_has_linear_termFlag to enable the linear term.
[in]equation_has_ghost_boundary_cellsFlag to enable the ghost cells into the linear system
[in]equation_has_immersed_boundariesFlag to enable immersed boundaries.
[in]equation_stencilStencil description.
[in]equation_ls_mapStructure used to map the general numbering to the linear system numbering.
[in]equation_nameName of the equation used to display a message.

◆ discretize_cell_transport_equation()

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 )
Parameters
[in]matrixmatrix of the linear system.
[in]rhsright-hand side of the linear system.
[in]coefficientCoefficient in front of the time and advection term.
[in]diffusion_coefficientCoefficient of diffusion.
[in]velocity_nm1velocity field at \( t^{n-1} \)
[in]velocity_nvelocity field at \( t^n \)
[in]velocity_np1velocity field at \( t^{n+1} \)
[in]divergenceDivergence of the velocity.
[in]equation_source_termSource term added to the right-hand side.
[in]scalar_field_nScalar field at previous time iteration.
[in]scalar_field_nm1Scalar field at time iteration n-1.
[in]scalar_field_nm2Scalar field at time iteration n-2.
[in]linear_termContains the coefficient in front of the linear term.
[in]boundary_conditionthe boundary conditions of the cell scalar
[in]ibc_variableBoundary conditions on immersed boundaries.
[in]equation_isd_targetSubset of immersed boundary list.
[in]equation_time_stepthe current time step \( \delta t^{n} = t^{n+1} - t^{n} \)
[in]equation_time_step_nthe previous time step \( \delta t^{n-1} = t^{n} - t^{n-1} \)
[in]equation_time_step_nm1the previous time step \( \delta t^{n-2} = t^{n-1} - t^{n-2} \)
[in]equation_time_order_discretizationthe 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_discretizationthe time discretization order for computing the advection with the explicit scheme (Euler, NSSP32, NSSP53)
[in]equation_flux_typethe flux type to use for the explicit advection (type_fv_flux)
[in]equation_has_source_termFlag to enable the source term.
[in]equation_has_temporal_termFlag to enable the temporal term.
[in]equation_has_advection_termFlag to enable the advection term.
[in]equation_has_div_u_advection_termFlag to enable the div(u⃗) advection term
[in]equation_has_diffusion_termFlag to enable the diffusion term.
[in]equation_has_linear_termFlag to enable the linear term.
[in]equation_has_ghost_boundary_cellsFlag to enable the ghost cells into the linear system
[in]equation_has_immersed_boundariesFlag 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_typeType of discretization (implicit/explicit) the advection term.
[in]equation_advection_term_schemeNumerical scheme of the advection term (upwind, etc.).
[in]equation_diffusion_term_discretization_typeType of discretization (implicit/explicit) the diffusion term.
[in]equation_diffusion_term_schemeNumerical 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_stencilStencil description.
[in]equation_ls_mapStructure used to map the general numbering to the linear system numbering.
[in]is_matrix_invertible_localFlag to require a null right-hand side integral.
[in]equation_nameName of the equation used to display a message.
[in,out]equation_explicit_terms_accumulator_nthe current accumulator of explicit terms at time \( t^{n+1/2} \) (mean)
[in,out]equation_explicit_terms_accumulator_nm1the accumulator of explicit terms at time \( t^{n-1/2} \) (mean)
[in,out]equation_explicit_terms_accumulator_nm2the accumulator of explicit terms at time \( t^{n-3/2} \) (mean)