version 0.6.0
Loading...
Searching...
No Matches

Explicit discretization of the diffusion equation for a scalar equation defined on cells. More...

Namespaces

module  mod_discretize_cell_explicit_diffusion_term_o2
 Compute cell explicit diffusion term with centered second order scheme.
 

Functions

subroutine mod_compute_cell_diffusion_term_explicit_centered::compute_cell_diffusion_term_explicit_centered_o2 (div_grad_phi, phi, flux_coef)
 Compute the diffusive term of an equation defined on cells.
 
subroutine mod_compute_cell_diffusion_term_explicit_centered::compute_cell_diffusion_term_explicit_centered_o4 (div_grad_phi, phi, flux_coef)
 Compute the diffusive term of an equation defined on cells - \( 4^{th} \) order.
 
subroutine mod_integrate_cell_diffusion_term_explicit_generic::integrate_cell_diffusion_term_explicit_euler (phi_output, time_step, temporal_coefficient, diffusion_coefficient, face_diffusion_coefficient, phi_n, temporal_stability_factor, boundary_condition, equation_has_immersed_boundaries, equation_diffusion_term_scheme, ibc_variable, equation_isd_target)
 Compute the cell field \( \phi \) from the integration of \( a_t\frac{\partial \phi}{\partial t}=\nabla \cdot (D\nabla\phi) \) with Euler first order temporal scheme.
 
subroutine mod_integrate_cell_diffusion_term_explicit_generic::integrate_cell_diffusion_term_explicit_rk2 (phi_output, time_step, temporal_coefficient, diffusion_coefficient, face_diffusion_coefficient, phi_n, temporal_stability_factor, boundary_condition, equation_has_immersed_boundaries, equation_diffusion_term_scheme, ibc_variable, equation_isd_target)
 Compute the cell field \( \phi \) from the integration of \( a_t\frac{\partial \phi}{\partial t}=\nabla \cdot (D\nabla\phi) \) with the canonical RK2 temporal scheme.
 

Detailed Description

This directory provides a set of routines to discretize a scalar diffusion equation defined, in a conservative way, on cells such as:

\[ \frac{\partial \phi}{\partial t} = \nabla \cdot \left( k(\mathbf{x},t) \nabla \phi \right) \]

with a given diffusion coefficient field \( k(\mathbf{x},t) \) ( \( D \)).

For 2D, the term becomes:

\begin{align} \nabla \cdot ( D \nabla \phi)_{0,0} =& \frac{1}{\delta x_0} F_{+\frac12} \phi_{+\frac12,0} -\frac{1}{\delta x_0} \left(F_{+\frac12} + F_{-\frac12}\right) \phi_{0,0} +\frac{1}{\delta x_0} F_{-\frac12} \phi_{-\frac12,0} \\ +& \frac{1}{\delta y_0} G_{+\frac12} \phi_{0,+\frac12} -\frac{1}{\delta y_0} \left(G_{+\frac12} + G_{-\frac12}\right) \phi_{0,0} +\frac{1}{\delta y_0} G_{-\frac12} \phi_{0,-\frac12} \,. \end{align}

where \( \mathbf{F} = (F, G) \) (flux_coef), \( F_{+1/2,0} = \frac{D_{+1/2,0}}{\delta x_{+1/2}} \), is the face diffusive flux coefficients, and \( \delta x_0 \) and \( \delta y_0 \) is the size of the cell \( (0,0) \).

Spatial discretization

For now, only the canonical \( 2^{nd} \) and \( 4^{th} \) order center schemes are implemented.

Function Documentation

◆ compute_cell_diffusion_term_explicit_centered_o2()

subroutine mod_compute_cell_diffusion_term_explicit_centered::compute_cell_diffusion_term_explicit_centered_o2 ( double precision, dimension(:,:,:), intent(inout) div_grad_phi,
double precision, dimension(:,:,:), intent(in) phi,
type(t_face_field), intent(in) flux_coef )

The term writes:

\begin{align} \nabla \cdot ( D \nabla \phi)_{0,0} =& \frac{1}{\delta x_0} F_{+\frac12} \phi_{+\frac12,0} -\frac{1}{\delta x_0} \left(F_{+\frac12} + F_{-\frac12}\right) \phi_{0,0} +\frac{1}{\delta x_0} F_{-\frac12} \phi_{-\frac12,0} \\ +& \frac{1}{\delta y_0} G_{+\frac12} \phi_{0,+\frac12} -\frac{1}{\delta y_0} \left(G_{+\frac12} + G_{-\frac12}\right) \phi_{0,0} +\frac{1}{\delta y_0} G_{-\frac12} \phi_{0,-\frac12} \,. \end{align}

where \( \mathbf{F} = (F, G) \) (flux_coef) is the face diffusive flux coefficients, and \( \delta x_0 \) and \( \delta y_0 \) is the size of the cell \( (0,0) \).

Note
  • As described in Cell diffusion term, a central schema of order 2 is used (regular mesh).
  • No treatment of boundary condition is done here.
Todo
check order with irregular grids

◆ compute_cell_diffusion_term_explicit_centered_o4()

subroutine mod_compute_cell_diffusion_term_explicit_centered::compute_cell_diffusion_term_explicit_centered_o4 ( double precision, dimension(:,:,:), intent(inout) div_grad_phi,
double precision, dimension(:,:,:), intent(in) phi,
type(t_face_field), intent(in) flux_coef )
Note
  • As described in Cell diffusion term, a central schema of order 2 is used (regular mesh).
  • No treatment of boundary condition is done here.
Todo
[AJ] Generalize \( 4^{th} \) order scheme for rectilinear grids.

◆ integrate_cell_diffusion_term_explicit_euler()

subroutine mod_integrate_cell_diffusion_term_explicit_generic::integrate_cell_diffusion_term_explicit_euler ( double precision, dimension(:,:,:), intent(out) phi_output,
double precision, intent(in) time_step,
double precision, dimension(:,:,:), intent(in) temporal_coefficient,
double precision, dimension(:,:,:), intent(in) diffusion_coefficient,
type(t_face_field), intent(in) face_diffusion_coefficient,
double precision, dimension(:,:,:), intent(in) phi_n,
double precision, intent(in) temporal_stability_factor,
type(t_boundary_condition), intent(in) boundary_condition,
logical, intent(in) equation_has_immersed_boundaries,
integer, intent(in) equation_diffusion_term_scheme,
type(t_immersed_boundary_condition), dimension(:), intent(in) ibc_variable,
integer, dimension(:), intent(in) equation_isd_target )
Parameters
[out]phi_output\( \phi^{n+1} \)
[in]time_stepthe time step
[in]temporal_coefficientthe physical parameter of temporal term \( a_t \)
[in]diffusion_coefficientthe physical parameter multiplying the gradient of the field \( D \)
[in]face_diffusion_coefficientdivided by spatial step: \( F_{+\frac12,0} = \frac{D_{+\frac12,0}}{\delta x_{+\frac12}} \)
[in]phi_n\( \phi^{n} \)
[in]temporal_stability_factorthe cfl coefficient to use (depending on the time and space schemes)
[in]boundary_conditionthe boundary conditions for cell centered \( \phi \)
[in]equation_has_immersed_boundariesfor immersed boundary cell update
[in]equation_diffusion_term_schemediscretization scheme of the diffusion term
[in]ibc_variableinstance of immersed_boundary_condition associated to \( \phi^{n} \)
[in]equation_isd_targetimmersed subdomain target array of the equation

◆ integrate_cell_diffusion_term_explicit_rk2()

subroutine mod_integrate_cell_diffusion_term_explicit_generic::integrate_cell_diffusion_term_explicit_rk2 ( double precision, dimension(:,:,:), intent(out) phi_output,
double precision, intent(in) time_step,
double precision, dimension(:,:,:), intent(in) temporal_coefficient,
double precision, dimension(:,:,:), intent(in) diffusion_coefficient,
type(t_face_field), intent(in) face_diffusion_coefficient,
double precision, dimension(:,:,:), intent(in) phi_n,
double precision, intent(in) temporal_stability_factor,
type(t_boundary_condition), intent(in) boundary_condition,
logical, intent(in) equation_has_immersed_boundaries,
integer, intent(in) equation_diffusion_term_scheme,
type(t_immersed_boundary_condition), dimension(:), intent(in) ibc_variable,
integer, dimension(:), intent(in) equation_isd_target )
Parameters
[out]phi_output\( \phi^{n+1} \)
[in]time_stepthe time step
[in]temporal_coefficientthe physical parameter of temporal term \( a_t \)
[in]diffusion_coefficientthe physical parameter multiplying the gradient of the field \( D \)
[in]face_diffusion_coefficientdivided by spatial step: \( F_{+\frac12,0} = \frac{D_{+\frac12,0}}{\delta x_{+\frac12}} \)
[in]phi_n\( \phi^{n} \)
[in]temporal_stability_factorthe cfl coefficient to use (depending on the time and space schemes)
[in]boundary_conditionthe boundary conditions for cell centered \( \phi \)
[in]equation_has_immersed_boundariesfor immersed boundary cell update
[in]equation_diffusion_term_schemediscretization scheme of the diffusion term
[in]ibc_variableinstance of immersed_boundary_condition associated to \( \phi^{n} \)
[in]equation_isd_targetimmersed subdomain target array of the equation