Skip to content

Commit

Permalink
Add option to turn off inviscid terms in CNS operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
MTCam authored Mar 28, 2023
1 parent 8946291 commit 5b57e5c
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions mirgecom/navierstokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def ns_operator(dcoll, gas_model, state, boundaries, *, time=0.0,
# Added to avoid repeated computation
# FIXME: See if there's a better way to do this
operator_states_quad=None,
grad_cv=None, grad_t=None):
grad_cv=None, grad_t=None, inviscid_terms_on=True):
r"""Compute RHS of the Navier-Stokes equations.
Parameters
Expand Down Expand Up @@ -397,6 +397,10 @@ def ns_operator(dcoll, gas_model, state, boundaries, *, time=0.0,
provided, the operator will calculate it with
:func:`~mirgecom.navierstokes.grad_t_operator`.
inviscid_terms_on
Optional boolean to turn OFF invsicid contributions to this operator.
Defaults to True.
Returns
-------
:class:`mirgecom.fluid.ConservedVars`
Expand Down Expand Up @@ -486,41 +490,30 @@ def ns_operator(dcoll, gas_model, state, boundaries, *, time=0.0,

# {{{ === Navier-Stokes RHS ===

# Compute the volume term for the divergence operator
vol_term = (

# Compute the volume contribution of the viscous flux terms
# using field values on the quadrature grid
viscous_flux(state=vol_state_quad,
# Compute the viscous volume and boundary terms for the divergence operator
vol_term = viscous_flux(state=vol_state_quad,
# Interpolate gradients to the quadrature grid
grad_cv=op.project(dcoll, dd_vol, dd_vol_quad, grad_cv),
grad_t=op.project(dcoll, dd_vol, dd_vol_quad, grad_t))

# Compute the volume contribution of the inviscid flux terms
# using field values on the quadrature grid
- inviscid_flux(state=vol_state_quad)
)

# Compute the boundary terms for the divergence operator
bnd_term = (

# All surface contributions from the viscous fluxes
viscous_flux_on_element_boundary(
bnd_term = viscous_flux_on_element_boundary(
dcoll, gas_model, boundaries, inter_elem_bnd_states_quad,
domain_bnd_states_quad, grad_cv, grad_cv_interior_pairs,
grad_t, grad_t_interior_pairs, quadrature_tag=quadrature_tag,
numerical_flux_func=viscous_numerical_flux_func, time=time,
dd=dd_vol)

# All surface contributions from the inviscid fluxes
- inviscid_flux_on_element_boundary(
# Add in the invsicd parts if enabled
if inviscid_terms_on:
vol_term = vol_term - inviscid_flux(state=vol_state_quad)
bnd_term = bnd_term - inviscid_flux_on_element_boundary(
dcoll, gas_model, boundaries, inter_elem_bnd_states_quad,
domain_bnd_states_quad, quadrature_tag=quadrature_tag,
numerical_flux_func=inviscid_numerical_flux_func, time=time,
dd=dd_vol)

)
ns_rhs = div_operator(dcoll, dd_vol_quad, dd_allfaces_quad, vol_term, bnd_term)

if return_gradients:
return ns_rhs, grad_cv, grad_t
return ns_rhs
Expand Down

0 comments on commit 5b57e5c

Please sign in to comment.