Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HLL numerical flux #648

Merged
merged 50 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
50e1b6d
Stab wildly at extricating HLL out of NS.
MTCam Apr 27, 2022
cc7cc4c
Test all the flux options in inviscid testing.
MTCam Apr 27, 2022
8688b21
Test all the numerical flux funcs in slipwall flux test.
MTCam Apr 27, 2022
5b21d7a
Correct some interface mistakes.
MTCam Apr 27, 2022
738c2c8
Accept unknown arguments that are unused.
MTCam Apr 27, 2022
4c43e92
Use new flux routine in autoignition example.
MTCam Apr 28, 2022
8f13b89
Merge branch 'main' into add-hll-flux
MTCam Apr 28, 2022
4e72608
Change doc to match book, switch implementation to look like doc.
MTCam Apr 28, 2022
1138e69
Remove kwargs, re-use of q_int/ext
MTCam Apr 28, 2022
6f8c52c
Sharpen/correct documentation
MTCam Apr 28, 2022
1f833cf
Updates from @majosm review.
MTCam Apr 29, 2022
589b7c9
Do not run pytest in parallel until #647
MTCam Apr 29, 2022
c1d7d2c
Sharpen documentation per @majosm review.
MTCam Apr 29, 2022
72bc8a5
Rename numerical flux routines +_facial_
MTCam Apr 29, 2022
d799371
Merge branch 'main' into add-hll-flux
MTCam May 2, 2022
5f4c957
Undo production customization
MTCam May 2, 2022
785adcd
Bug fix symbolic test from #654
MTCam May 2, 2022
21f8a9c
Merge branch 'main' into add-hll-flux
MTCam May 2, 2022
3e9c795
remove vtk from default install
matthiasdiener May 5, 2022
06724b4
add vtk for test
matthiasdiener May 5, 2022
ac55ca5
Merge branch 'rm-vtk' into add-hll-flux
MTCam May 5, 2022
ec6b38b
Merge branch 'main' into add-hll-flux
MTCam May 6, 2022
1573f23
Re-comment production customization
MTCam May 6, 2022
9d5c19f
Merge branch 'main' into add-hll-flux
MTCam May 6, 2022
4168efb
Eliminate the flux middle layer per @majosm review.
MTCam May 7, 2022
569d632
Sync with production
MTCam May 7, 2022
f53a29d
Fix up overlooked errors in doc and test import
MTCam May 7, 2022
90d5fce
Sharpen up and explain interface choice.
MTCam May 7, 2022
2ba385d
Remove redundant comments
MTCam May 7, 2022
4b8a522
Sync with production
MTCam May 8, 2022
c1311df
Correct a grammar mistake.
MTCam May 9, 2022
5064642
Remove kwargs (again), add doc for HLL
MTCam May 9, 2022
2255077
Correct misspelling, remove kwargs
MTCam May 9, 2022
17dec78
Apply quicky doc changes from review.
MTCam May 10, 2022
06886c5
Correct eqn form
MTCam May 10, 2022
9fed239
Merge remote-tracking branch 'origin/add-hll-flux' into save-my-changes
MTCam May 10, 2022
9042e4a
Reword
MTCam May 10, 2022
e58c306
Address review suggestions
MTCam May 10, 2022
923fbff
Fix docs per review comments.
MTCam May 10, 2022
6c9675e
More doc updates, fallout from other changes.
MTCam May 10, 2022
4d6359e
Fix typo in eqn doc viscous
MTCam May 10, 2022
6bb900d
Clean up mark up for boundary quantity definitions.
MTCam May 10, 2022
b9a1aea
Ambiguate return types for pair-type flux funcs.
MTCam May 10, 2022
8f66f87
Ambiguate return types for pair-type flux funcs.
MTCam May 10, 2022
f021349
Ambiguate return types for pair-type flux funcs.
MTCam May 10, 2022
2482bb2
Remove superflous section of the num flux doc.
MTCam May 10, 2022
d540004
Remove dissipative flux options, and convenience wrappers for operators.
MTCam May 11, 2022
15a6264
Update docs per removed flux functions
MTCam May 11, 2022
de7b37a
Fix formula expn
MTCam May 11, 2022
4e8f68a
Sharpen docs per review
MTCam May 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
MINIFORGE_INSTALL_DIR=.miniforge3
. "$MINIFORGE_INSTALL_DIR/bin/activate" testing
cd test
python -m pip install pytest-xdist
python -m pytest -n auto --cov=mirgecom --durations=0 --tb=native --junitxml=pytest.xml --doctest-modules -rxsw . ../doc/*.rst ../doc/*/*.rst
python -m pip install pytest
python -m pytest --cov=mirgecom --durations=0 --tb=native --junitxml=pytest.xml --doctest-modules -rxsw . ../doc/*.rst ../doc/*/*.rst

examples:
name: Examples
Expand Down
428 changes: 358 additions & 70 deletions doc/discretization.rst

Large diffs are not rendered by default.

Binary file added doc/figures/ElementBoundary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions doc/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,11 @@ References
`(DOI) <https://doi.org/10.1007/978-3-642-59721-3_14>`__
.. [Ihme_2014] Yu Lv and Matthias Ihme (2014) Journal of Computationsl Physics 270 105 \
`(DOI) <http://dx.doi.org/10.1016/j.jcp.2014.03.029>`__
.. [Persson_2012] P. Persson and J. Peraire, AIAA 44 \
`(DOI) <https://doi.org/10.2514/6.2006-112>`__
.. [Woodward_1984] Woodward and Colella, Journal of Computational Physics, 54 \
`(DOI) <https://doi.org/10.1016/0021-9991(84)90142-6>`__
.. [Toro_2009] Eleuterio F. Toro (2009), Riemann Solvers and Numerical Methods for Fluid Dynamics, Springer \
`(DOI) <http://doi.org/10.1007/978-3-540-49834-6>`__
.. [Mengaldo_2014] G. Mengaldo (2009), A Guide to the Implementation of Boundary Conditions in Compact \
High-Order Methods for Compressible Aerodynamics `(DOI) <https://doi.org/10.2514/6.2014-2923>`__
3 changes: 3 additions & 0 deletions examples/autoignition-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ def my_post_step(step, t, dt, state):
logmgr.tick_after()
return make_obj_array([cv, fluid_state.temperature]), dt

from mirgecom.inviscid import inviscid_facial_flux_rusanov

def my_rhs(t, state):
cv, tseed = state
from mirgecom.gas_model import make_fluid_state
Expand All @@ -561,6 +563,7 @@ def my_rhs(t, state):
return make_obj_array([
euler_operator(discr, state=fluid_state, time=t, boundaries=boundaries,
gas_model=gas_model,
inviscid_numerical_flux_func=inviscid_facial_flux_rusanov,
quadrature_tag=quadrature_tag)
+ eos.get_species_source_terms(cv, fluid_state.temperature),
0*tseed])
Expand Down
32 changes: 14 additions & 18 deletions mirgecom/boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Boundary Treatment Interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass FluidBoundary
.. autoclass:: FluidBoundary

Inviscid Boundary Conditions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -38,11 +38,11 @@
"""

import numpy as np
from meshmode.dof_array import thaw
from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from mirgecom.fluid import make_conserved
from grudge.trace_pair import TracePair
from mirgecom.inviscid import inviscid_facial_flux
from mirgecom.inviscid import inviscid_facial_flux_rusanov # default num flux

from abc import ABCMeta, abstractmethod

Expand All @@ -57,6 +57,7 @@ class FluidBoundary(metaclass=ABCMeta):
def inviscid_divergence_flux(self, discr, btag, eos, cv_minus, dv_minus,
**kwargs):
"""Get the inviscid boundary flux for the divergence operator."""
pass


class PrescribedFluidBoundary(FluidBoundary):
Expand All @@ -71,24 +72,19 @@ def __init__(self,
inviscid_boundary_flux_func=None,
# returns CV+, to be used in num flux func (prescribed soln)
boundary_state_func=None,
# Inviscid facial flux func given CV(+/-)
inviscid_facial_flux_func=None,
# Flux to be used in grad(Temperature) op
temperature_gradient_flux_func=None,
# Function returns boundary temperature_plus
boundary_temperature_func=None):
"""Initialize the PrescribedFluidBoundary and methods."""
self._bnd_state_func = boundary_state_func
self._inviscid_bnd_flux_func = inviscid_boundary_flux_func
self._inviscid_div_flux_func = inviscid_facial_flux_func
self._bnd_temperature_func = boundary_temperature_func

if not self._inviscid_bnd_flux_func and not self._bnd_state_func:
from warnings import warn
warn("Using dummy boundary: copies interior solution.", stacklevel=2)

if not self._inviscid_div_flux_func:
self._inviscid_div_flux_func = inviscid_facial_flux
if not self._bnd_state_func:
self._bnd_state_func = self._dummy_state_func
if not self._bnd_temperature_func:
Expand All @@ -100,29 +96,29 @@ def _dummy_temperature_func(self, temperature_minus, **kwargs):
def _dummy_state_func(self, state_minus, **kwargs):
return state_minus

def _boundary_quantity(self, discr, btag, quantity, **kwargs):
def _boundary_quantity(self, discr, btag, quantity, local=False, **kwargs):
"""Get a boundary quantity on local boundary, or projected to "all_faces"."""
if "local" in kwargs:
if kwargs["local"]:
return quantity
return discr.project(btag, btag.with_dtag("all_faces"), quantity)
return quantity if local else discr.project(
btag, btag.with_dtag("all_faces"), quantity)
majosm marked this conversation as resolved.
Show resolved Hide resolved

def inviscid_divergence_flux(self, discr, btag, gas_model, state_minus,
numerical_flux_func=inviscid_facial_flux_rusanov,
**kwargs):
"""Get the inviscid boundary flux for the divergence operator."""
# This one is when the user specified a function that directly
# prescribes the flux components at the boundary
if self._inviscid_bnd_flux_func:
return self._inviscid_bnd_flux_func(discr, btag, gas_model, state_minus,
**kwargs)
return self._inviscid_bnd_flux_func(
discr, btag, gas_model, state_minus,
numerical_flux_func=numerical_flux_func, **kwargs)
majosm marked this conversation as resolved.
Show resolved Hide resolved

state_plus = self._bnd_state_func(discr=discr, btag=btag,
gas_model=gas_model,
state_minus=state_minus, **kwargs)
boundary_state_pair = TracePair(btag, interior=state_minus,
exterior=state_plus)

return self._inviscid_div_flux_func(discr, state_tpair=boundary_state_pair)
normal = thaw(discr.normal(btag), state_minus.array_context)
return numerical_flux_func(boundary_state_pair, gas_model, normal)


class DummyBoundary(PrescribedFluidBoundary):
Expand Down Expand Up @@ -173,7 +169,7 @@ def adiabatic_slip_state(self, discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context

# Grab a unit normal to the boundary
nhat = thaw(actx, discr.normal(btag))
nhat = thaw(discr.normal(btag), actx)

# Subtract out the 2*wall-normal component
# of velocity from the velocity at the wall to
Expand Down
24 changes: 10 additions & 14 deletions mirgecom/euler.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@

from mirgecom.inviscid import (
inviscid_flux,
inviscid_facial_flux
inviscid_facial_flux_rusanov,
inviscid_flux_on_element_boundary
)

from mirgecom.operators import div_operator
from mirgecom.gas_model import (
project_fluid_state,
Expand All @@ -81,6 +83,7 @@ class _EulerTseedTag:


def euler_operator(discr, state, gas_model, boundaries, time=0.0,
inviscid_numerical_flux_func=inviscid_facial_flux_rusanov,
quadrature_tag=None):
r"""Compute RHS of the Euler flow equations.

Expand Down Expand Up @@ -176,20 +179,13 @@ def _interp_to_surf_quad(utpair):

# Compute volume contributions
inviscid_flux_vol = inviscid_flux(vol_state_quad)

# Compute interface contributions
inviscid_flux_bnd = (

# Interior faces
sum(inviscid_facial_flux(discr, state_pair)
for state_pair in interior_states_quad)

# Domain boundary faces
+ sum(
boundaries[btag].inviscid_divergence_flux(
discr, as_dofdesc(btag).with_discr_tag(quadrature_tag), gas_model,
state_minus=boundary_states_quad[btag], time=time)
for btag in boundaries)
)
inviscid_flux_bnd = \
inviscid_flux_on_element_boundary(
discr, gas_model, boundaries, interior_states_quad,
boundary_states_quad, quadrature_tag=quadrature_tag,
numerical_flux_func=inviscid_numerical_flux_func, time=time)

return -div_operator(discr, dd_quad_vol, dd_quad_faces,
inviscid_flux_vol, inviscid_flux_bnd)
Expand Down
Loading