version 0.6.0
Partial Differential Equations on faces

Topics

 Stress tensor divergence term
 Add to matrix the viscous stress term of Navier equation.
 

Functions

subroutine mod_discretize_gravity_term::discretize_gravity_term (face_gravity_term, density_gravity_term_boussinesq_face, density_face_n, density_face_np1, density_face_star, gravity_vector, discretization_method, is_boussinesq_approximation)
 Discretize the gravity term. More...
 
subroutine mod_discretize_face_temporal_term::discretize_face_temporal_term (matrix, rhs, density_face_n, density_face_star, velocity_n, velocity_nm1, equation_time_step, equation_time_step_n, equation_time_order_discretization, is_momentum_preserving_method, equation_stencil, equation_ls_map)
 Discretize the advection term. More...
 
subroutine mod_discretize_nonlinear_momentum_term::discretize_nonlinear_momentum_term (matrix, navier_nonlinear_term_discretization_type, navier_nonlinear_term_scheme, navier_has_div_u_advection_term, is_navier_momentum_preserving_method, navier_has_immersed_boundaries, navier_ib_has_one_sided_inner_discretization, navier_isd_target, navier_ib_inner_discretization_order, density_face_n, density_face_star, divergence_extrapolated, time_step_nm1, time_step, cfl_navier_advection, velocity_extrapolated, velocity_nm1, velocity_n, explicit_time_order_discretization, flux_type, explicit_nonlinear_term_n, navier_stencil, navier_ls_map, boundary_condition)
 Add nonlinear momentum term to the given linear system. More...
 

Detailed Description

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

Function Documentation

◆ discretize_face_temporal_term()

subroutine mod_discretize_face_temporal_term::discretize_face_temporal_term ( double precision, dimension(:), intent(inout)  matrix,
double precision, dimension(:), intent(inout)  rhs,
type(t_face_field), intent(in)  density_face_n,
type(t_face_field), intent(in)  density_face_star,
type(t_face_field), intent(in)  velocity_n,
type(t_face_field), intent(in)  velocity_nm1,
double precision, intent(in)  equation_time_step,
double precision, intent(in)  equation_time_step_n,
integer, intent(in)  equation_time_order_discretization,
logical, intent(in)  is_momentum_preserving_method,
type(t_face_stencil), intent(in)  equation_stencil,
type(t_face_ls_map), intent(in)  equation_ls_map 
)

This term is treated implicitly thanks to backward first order Euler scheme or a second order Backward Differentiation Formula.

The diagonal of the matrix and the right-hand-side are modified accordingly to the scheme chosen.

Parameters
[in,out]matrix,rhslinear system
[in]density_face_n
[in]density_face_star
[in]velocity_n
[in]velocity_nm1
[in]equation_time_step
[in]equation_time_step_n
[in]equation_time_order_discretization
[in]is_momentum_preserving_method
[in]equation_stencil
[in]equation_ls_map

◆ discretize_gravity_term()

subroutine mod_discretize_gravity_term::discretize_gravity_term ( type(t_face_field), intent(inout)  face_gravity_term,
type(t_face_field), intent(in)  density_gravity_term_boussinesq_face,
type(t_face_field), intent(in)  density_face_n,
type(t_face_field), intent(in)  density_face_np1,
type(t_face_field), intent(in)  density_face_star,
double precision, dimension(3)  gravity_vector,
integer, intent(in)  discretization_method,
logical, intent(in)  is_boussinesq_approximation 
)
Parameters
[in,out]face_gravity_termthe resulting gravity term (that have to be added to RHS)
[in]density_gravity_facethe (possibly) 'density gravity' field (usualy computed thanks to an EOS for density). If it's not allocated, we won't use it.
[in]density_face_nthe density field at time \( t_n \)
[in]density_face_np1the density field at time \( t_{n+1} \) (or a predicted approximation)
[in]gravity_vectorthe gravity vector, ie. usualy \( g={0,-9.8,0} \)
[in]discretization_methodthe temporal discretization method: explicit, semi-implicit or Crank-Nicolson (
See also
enum_time_method_discretization)
Todo:
Replace 'density_gravity_face' by a more practical strategy

◆ discretize_nonlinear_momentum_term()

subroutine mod_discretize_nonlinear_momentum_term::discretize_nonlinear_momentum_term ( double precision, dimension(:), intent(inout)  matrix,
integer, intent(in)  navier_nonlinear_term_discretization_type,
integer, intent(in)  navier_nonlinear_term_scheme,
logical, intent(in)  navier_has_div_u_advection_term,
logical, intent(in)  is_navier_momentum_preserving_method,
logical, intent(in)  navier_has_immersed_boundaries,
logical, intent(in)  navier_ib_has_one_sided_inner_discretization,
integer, dimension(:), intent(in)  navier_isd_target,
integer, dimension(:), intent(in)  navier_ib_inner_discretization_order,
type(t_face_field), intent(in)  density_face_n,
type(t_face_field), intent(in)  density_face_star,
double precision, dimension(:,:,:), intent(in)  divergence_extrapolated,
double precision, intent(in)  time_step_nm1,
double precision, intent(in)  time_step,
double precision, intent(inout)  cfl_navier_advection,
type(t_face_field), intent(inout)  velocity_extrapolated,
type(t_face_field), intent(inout)  velocity_nm1,
type(t_face_field), intent(inout)  velocity_n,
integer, intent(in)  explicit_time_order_discretization,
type(t_fv_flux), intent(in)  flux_type,
type(t_face_field), intent(inout)  explicit_nonlinear_term_n,
type(t_face_stencil), intent(in)  navier_stencil,
type(t_face_ls_map), intent(in)  navier_ls_map,
type(t_boundary_condition_face), intent(in)  boundary_condition 
)

The nonlinear momentum term is written as follows:

\[ \rho \mathbf{u} \mathbf{\nabla} \mathbf{u} = \rho \nabla \cdot (\mathbf{u} \otimes \mathbf{u}) - \rho \mathbf{u} \nabla \cdot(\mathbf{u}), \]

where each term is discretized separately. The term \(\nabla \cdot (\mathbf{u} \otimes \mathbf{u})\) is a vector that can be decomposed as:

\[ \nabla \cdot (\mathbf{u} \otimes \mathbf{u}) = \left[ \begin{matrix} \nabla \cdot (u \times \mathbf{u}) \\ \nabla \cdot (v \times \mathbf{u}) \\ \nabla \cdot (w \times \mathbf{u}) \end{matrix} \right] \]

1. Discretization of @f$\nabla \cdot (\mathbf{u} \otimes

@f$u@f$-component.

It can be expanded into three terms:

\[ \nabla \cdot (u \times \mathbf{u}) = \underbrace{ \frac {\partial} {\partial x} \Big( u^\mu u^\nu \Big) }_{1} + \underbrace{ \frac {\partial} {\partial y} \Big( u^\mu v^\nu \Big) }_{2} + \underbrace{ \frac {\partial} {\partial z} \Big( u^\mu w^\nu \Big) }_{3} \]

where \(\mu\) and \(\nu\) can be either \(n\) or \(n+1\).

The discretization of this term must be performed at the x-face centers. The outer derivatives are discretized using finite volumes, i. e. by evaluating fluxes across a control volume around the x-face center (in bold lines in the schemes below). The inner derivatives are discretized by interpolation from x-face center values.

                   │N                                    │F
                   >           j+1                       >           k+1
           │  NW   │n  NE  │                     │  FW   │f  FE  │
          ─┼───∧━━━×━━━∧───┼─  j+1              ─┼───∧━━━×━━━∧───┼─  k+1
 y         │   ┃   │   ┃   │           z         │   ┃   │   ┃   │
 │        W>  w×  P>   ×e  >E  j       │        W>  w×  P>   ×e  >E  k
 o──x      │   ┃   │   ┃   │           ×──x      │   ┃   │   ┃   │
z         ─┼───∧━━━×━━━∧───┼─  j      y         ─┼───∧━━━×━━━∧───┼─  k
           │  SW   │s  SE  │                     │  RW   │r  RE  │
                   >                                     >
                   │S          j-1                       │R          k-1

          i-1 i-1  i   i  i+1                   i-1 i-1  i   i  i+1

which gives:

\[ \frac{1}{\mathtt{\Delta xu_i}} \Big( u^\mu_e u^\nu_e - u^\mu_w u^\nu_w \Big) + \frac{1}{\mathtt{\Delta y_j}} \Big( u^\mu_n v^\nu_n - u^\mu_s v^\nu_s \Big) + \frac{1}{\mathtt{\Delta z_k}} \Big( u^\mu_n w^\nu_n - u^\mu_s w^\nu_s \Big). \]

@f$v@f$-component.

It can be expanded into three terms:

\[ \nabla \cdot (v \times \mathbf{u}) = \underbrace{ \frac {\partial} {\partial x} \Big( v^\mu u^\nu \Big) }_{1} + \underbrace{ \frac {\partial} {\partial y} \Big( v^\mu v^\nu \Big) }_{2} + \underbrace{ \frac {\partial} {\partial z} \Big( v^\mu w^\nu \Big) }_{3} \]

where \(\mu\) and \(\nu\) can be either \(n\) or \(n+1\).

                │   N   │                                   │F
               ─┼───∧───┼─        j-1                       >           k+1
 y              │   n   │                 z         │  FS   │f  FN  │
 │            NW>━━━×━━━>NE       j       │        ─┼───∧━━━×━━━∧───┼─  k+1
 o──x      W    ┃   P   ┃    E            o──y      │   ┃   │   ┃   │
z        ───∧───×───∧───×───∧───  j      x         S>  s×  P>   ×n  >N  k
               w┃       ┃e                          │   ┃   │   ┃   │
              SW>━━━×━━━>SE       j-1              ─┼───∧━━━×━━━∧───┼─  k
                │   s   │                           │  RS   │r  RN  │
               ─┼───∧───┼─        j-1                       >
                │   S   │                                   │R          k-1

           i-1  i   i  i+1  i+1                    j-1 j-1  j   j  j+1

which gives:

\[ \frac{1}{\mathtt{\Delta x_i}} \Big( v^\mu_e u^\nu_e - v^\mu_w u^\nu_w \Big) + \frac{1}{\mathtt{\Delta yv_j}} \Big( v^\mu_n v^\nu_n - v^\mu_s v^\nu_s \Big) + \frac{1}{\mathtt{\Delta z_k}} \Big( v^\mu_n w^\nu_n - v^\mu_s w^\nu_s \Big). \]

@f$w@f$-component.

It can be expanded into three terms:

\[ \nabla \cdot (w \times \mathbf{u}) = \underbrace{ \frac {\partial} {\partial x} \Big( w^\mu u^\nu \Big) }_{1} + \underbrace{ \frac {\partial} {\partial y} \Big( w^\mu v^\nu \Big) }_{2} + \underbrace{ \frac {\partial} {\partial z} \Big( w^\mu w^\nu \Big) }_{3} \]

where \(\mu\) and \(\nu\) can be either \(n\) or \(n+1\).

                │   F   │                                │   F   │
               ─┼───∧───┼─        k-1                   ─┼───∧───┼─        k-1
 z              │   f   │                 z              │   f   │
 │            FW>━━━×━━━>FE       k       │            SW>━━━×━━━>FN       k
 ×──x      W    ┃   P   ┃    E            o──y      S    ┃   P   ┃    N
y        ───∧───×───∧───×───∧───  k      x        ───∧───×───∧───×───∧───  k
               w┃       ┃e                              s┃       ┃n
              RW>━━━×━━━>RE       k-1                  SW>━━━×━━━>RN       k-1
                │   r   │                                │   r   │
               ─┼───∧───┼─        k-1                   ─┼───∧───┼─        k-1
                │   R   │                                │   R   │

           i-1  i   i  i+1  i+1                     j-1  j   j  j+1  j+1

which gives:

\[ \frac{1}{\mathtt{\Delta x_i}} \Big( w^\mu_e u^\nu_e - w^\mu_w u^\nu_w \Big) + \frac{1}{\mathtt{\Delta y_j}} \Big( w^\mu_n v^\nu_n - w^\mu_s v^\nu_s \Big) + \frac{1}{\mathtt{\Delta zw_k}} \Big( w^\mu_n w^\nu_n - w^\mu_s w^\nu_s \Big). \]

2. Time discretization of velocities

Velocities at the interfaces can be obtained using second-order centered interpolation:

\[ u_e = \frac{u_E + u_P}{2}, \qquad u_w = \frac{u_W + u_P}{2}, \qquad u_n = \frac{u_S + u_P}{2}, \qquad u_s = \frac{u_S + u_P}{2}, \\ v_e = \frac{v_{NE} + v_{SE}}{2}, \qquad v_w = \frac{v_{NW} + v_{SW}}{2}, v_n = \frac{v_{NE} + v_{NW}}{2}, \qquad v_s = \frac{v_{SE} + v_{SW}}{2}, \]

or using first-order upwind interpolation:

\[ u_e = u_P\text{ if }a_e < 0\text{ else }u_E, \qquad u_w = u_W\text{ if }a_w < 0\text{ else }u_P, \qquad u_n = u_P\text{ if }b_s < 0\text{ else }u_S, \qquad u_s = u_N\text{ if }b_n < 0\text{ else }u_P, \]

or using second-order upwind interpolation.

Right-linearized, implicit discretization

In this case, \(\mu = n+1\) and \(\nu = n\). The nonlinear momentum term becomes a linear combination of \(u^{n+1}\):

\[ a_E u^{n+1}_E + a_N u^{n+1}_N + a_P u^{n+1}_P \cdots \]

The coefficients \(a_E, a_N, \ldots\) are determined using second-order centered discretization of \(u^n\) and:

  1. second-order centered discretization of \(u^{n+1}\)
  2. first-order upwind discretization of \(u^{n+1}\)
  3. second-order upwind discretization of \(u^{n+1}\)

Explicit discretization

In this case, \(\mu = n\) and \(\nu = n\). Second-order centered discretization is used for \(u^n\).