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

Add to matrix the viscous stress term of Navier equation. More...

Functions/Subroutines

subroutine mod_set_mu_velocity_gradient::set_mu_velocity_gradient (mu_velocity_gradient, viscosity, viscosity_edge)
 Compute stress coefficients from the viscosity array.
 
subroutine mod_discretize_div_tensor_term::discretize_div_tensor_term (matrix, viscosity, density_face, divergence, time_step_n, time_step, cfl_navier_diffusion, velocity_nm1, velocity_n, explicit_div_tensor_term_n, navier_stencil, navier_ls_map, viscosity_edge)
 Add viscous stress term into Navier equation.
 

Detailed Description

The following routines adds the viscous stress term into the Navier-Stokes equation, using a central scheme.

Note
  • The implicit formulation only supports a 2nd order central scheme.
  • The explicit formulation supports 2nd and 4th order central schemes.
  • The explicit formulation uses the canonical first order Euler temporal scheme for sub iterations when \( \Delta t > \Delta t_{max,CFL} \).
  • The explicit formulation implements the boundary conditions during the sub iterations.
Warning
Boudary conditions are not treated here.

Rationale

The viscous stress term is:

\begin{equation*} \nabla \cdot \mathbf{S} (\mathbf{u}) = \nabla \cdot \Big( \mu \big( \nabla\mathbf{u} + ^\mathsf{t}\!\nabla\mathbf{u} \big) \Big) - \frac{2}{3} \nabla \big( \mu \nabla \cdot \mathbf{u} \big) \end{equation*}

where \(\mathbf{u}\) is the velocity vector, \(\mu\) is the dynamic viscosity, and \(\mathbf{S}\) is the viscous stress tensor. Once discretized and vectorized, this term becomes a matrix product of some matrix \(\mathtt{D}\) and the velocity column-matrix \(\mathtt{U}\) where \(\mathtt{D}\) depends on the viscosity \(\mu\). For implicit formulation, the matrix \(-\mathtt{D}\) is added to the Navier linear system, whereas for explicit formulation, the product \(\mathtt{DU}\) is done.

To add the matrix \(-\mathtt{D}\) into some linear system, just do:

call discretize_div_tensor_term(matrix, navier_stencil_size, viscosity)
Todo
[AJ]:: Generalize explicit formulation to rectilinear grids. Currently only supports Cartesian grids.

Function/Subroutine Documentation

◆ discretize_div_tensor_term()

subroutine mod_discretize_div_tensor_term::discretize_div_tensor_term ( double precision, dimension(:), intent(inout) matrix,
double precision, dimension(:,:,:), intent(in) viscosity,
type(t_face_field), intent(in) density_face,
double precision, dimension(:,:,:), intent(in) divergence,
double precision, intent(in) time_step_n,
double precision, intent(in) time_step,
double precision, intent(inout) cfl_navier_diffusion,
type(t_face_field), intent(in) velocity_nm1,
type(t_face_field), intent(in) velocity_n,
type(t_face_field), intent(inout) explicit_div_tensor_term_n,
type(t_face_stencil), intent(in) navier_stencil,
type(t_face_ls_map), intent(in) navier_ls_map,
type(t_edge_field), intent(in), optional viscosity_edge )

This routine calls the set_mu_velocity_gradient routine to compute the stress coefficients from the viscosity argument and calls the add_face_div_symmetric_tensor_term_centered_o2 routine to build the matrix \(-\mathtt{D}\) and add it into the argument a or build the RHS.

◆ set_mu_velocity_gradient()

subroutine mod_set_mu_velocity_gradient::set_mu_velocity_gradient ( type(t_face_vector_gradient), intent(inout) mu_velocity_gradient,
double precision, dimension(nx,ny,nz), intent(in) viscosity,
type(t_edge_field), intent(in), optional viscosity_edge )

The viscosity is interpolated by routines interpolate_viscosity_xy, …_xz, …_yz.

Discretization is done on one cell behind physical boundaries for diagonal terms of the tensor