Skip to content
Closed
Show file tree
Hide file tree
Changes from 98 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
8e7ddda
Initial implementation of artificial viscosity for the euler equations
w-hagen Oct 28, 2020
59f80c3
Initial implementation of smoothness indicator
w-hagen Nov 1, 2020
122966e
Updated modal smoothness indicator to mode_ids to select highest mode
w-hagen Nov 3, 2020
598e4b6
Fixed updated artificial viscosity implementation to use desired equa…
w-hagen Nov 6, 2020
822d863
Add boundary condition function to return projected boundary solution
w-hagen Nov 6, 2020
e0f0ce4
Added double mach reflection example problem
w-hagen Nov 6, 2020
d35771a
Added double mach reflection example problem
w-hagen Nov 6, 2020
a71ac3b
Remove reference to unnecessary heat operator
w-hagen Nov 6, 2020
0f132eb
Fixed error in calculating face fluxes across ranks
w-hagen Nov 20, 2020
40656f3
Removed unessecary reference to heat operator
w-hagen Nov 20, 2020
d49de59
Fixed error in not distributing grid
w-hagen Nov 20, 2020
80e1a62
Added shock indicator and integrated with artificial viscosity
w-hagen Nov 20, 2020
0c25238
Added output field for shock indicator
w-hagen Nov 20, 2020
96fc18c
Modified stepping parameters for scaling tests
w-hagen Dec 1, 2020
446cace
Fixed artifical viscosity boundary conditions
w-hagen Jan 20, 2021
7a9a81d
Merge branch 'master' into av-mrg-master
MTCam Feb 3, 2021
bf67fc0
Bring back functions inadvertently removed in hand merge
MTCam Feb 3, 2021
f52b8b6
Minimum changes to bring boundary conditions up to date with mainline…
w-hagen Feb 4, 2021
37abb66
Merges the upstream master
MTCam Feb 4, 2021
703869a
Silence flake8.
MTCam Feb 4, 2021
f20059f
Silence pydocstyle
MTCam Feb 4, 2021
125ff51
Merge pull request #3 from w-hagen/silence-pydocstyle
w-hagen Feb 4, 2021
5c99ac1
Merge pull request #2 from w-hagen/silence-flake8
w-hagen Feb 4, 2021
d978414
merge updated master into artificial viscosity branch
w-hagen Feb 4, 2021
8d30def
Merge pull request #4 from w-hagen/av-mrg-master
w-hagen Feb 4, 2021
1340ea6
Remove un-needed make_obj_array calls
w-hagen Feb 4, 2021
067ad2b
Merge pull request #5 from w-hagen/remove-mkobjarray
w-hagen Feb 4, 2021
9d32a7a
Rework boundary conditions to avoid duplicating code
w-hagen Feb 4, 2021
3a13a05
Fix docstyle, remove unused import
w-hagen Feb 4, 2021
1b2b30e
Expose smoothness indicator parameters
w-hagen Feb 5, 2021
0dff5e5
Fixed boundary calls to self
w-hagen Feb 26, 2021
1b57517
Fixed flake8 line to long
w-hagen Feb 26, 2021
20221dd
Merge pull request #6 from w-hagen/av-boundary-rework
w-hagen Feb 26, 2021
f39deb2
Clean up AdiabaticSlipBoundary for artificial viscosity condition.
w-hagen Mar 2, 2021
6b9a29d
Added inital documentation to artificial viscosity routines (#8)
w-hagen Mar 12, 2021
d17ea87
fixed flake8 error
w-hagen Mar 12, 2021
5018f52
Merge branch 'artificial_viscosity' of github.com:w-hagen/mirgecom in…
w-hagen Mar 12, 2021
100b1c3
Fixed too long line
w-hagen Mar 12, 2021
9d0f8ed
Added tests to artificial viscosity routines. (#9)
w-hagen Mar 12, 2021
105fd83
Bring branch up to main
w-hagen Mar 12, 2021
5d22727
Merge branch 'artificial_viscosity' of github.com:w-hagen/mirgecom in…
w-hagen Mar 12, 2021
bf309fe
Fixed missed merge conflict.
w-hagen Mar 13, 2021
34b96bf
Fixed errors in dobule mach initialization.
w-hagen Mar 14, 2021
f52a165
Fixed error in initialization.
w-hagen Mar 14, 2021
c8858e4
Cleaned up artificial viscosity routines.
w-hagen Mar 14, 2021
1afa3d7
Fixed errors in calling gmsh
w-hagen Mar 14, 2021
a404a62
Add gmsh as requirement
w-hagen Mar 14, 2021
c1cd479
Fix some style issues and add temporary fix for Issue #280
w-hagen Mar 15, 2021
8b580e5
Fix documentation grammer.
w-hagen Mar 15, 2021
40364ac
Renamed shock parameters to be more descriptive.
w-hagen Mar 15, 2021
af24249
Added normal shock relations calculator to DoubleMahcReflection case.
w-hagen Mar 15, 2021
8a50f22
Remove linter changes for not my file
w-hagen Mar 15, 2021
77b0263
use viz_fields to visualize tagged cells.
w-hagen Mar 15, 2021
218cb52
Added interface parameter documentation.
w-hagen Mar 15, 2021
cb8be6a
Remove linting modification to simutil.py
w-hagen Mar 15, 2021
0f2d680
Fixed tests to reflect change in smoothness indicator parameters.
w-hagen Mar 15, 2021
834a98c
Update mirgecom/initializers.py
w-hagen Mar 26, 2021
f2654ab
Merge branch 'main' into artificial_viscosity
MTCam Apr 8, 2021
d72df2a
Refactor AV (#12)
MTCam Apr 25, 2021
afd9233
Merge branch 'main' into artificial_viscosity
MTCam Apr 26, 2021
8fc9771
Add some comments for docs, try to address @thomasgibson comments (#13)
MTCam Apr 26, 2021
0495f3b
Update examples/doublemach-mpi.py to get rank properly
w-hagen Apr 26, 2021
b93411b
Update logic to check if file exists
w-hagen Apr 26, 2021
3f336fd
Update documenatation
w-hagen Apr 26, 2021
8fa696e
Update documentation
w-hagen Apr 26, 2021
de305d9
Update documentation
w-hagen Apr 26, 2021
376ba33
Update documentation
w-hagen Apr 26, 2021
184e2cc
Update documentation
w-hagen Apr 26, 2021
1fea6b6
Update documentation
w-hagen Apr 26, 2021
f17e450
Update documentation
w-hagen Apr 26, 2021
9cd58d3
Update documentation
w-hagen Apr 26, 2021
cc2752a
Update documentation
w-hagen Apr 26, 2021
d78cdab
Update documentation
w-hagen Apr 26, 2021
d55666c
Update documentation
w-hagen Apr 26, 2021
06d171c
Fix flake8/docstyle issue
w-hagen Apr 27, 2021
974bcd4
Clean up doublemach case documentation and remove dim as parameter.
w-hagen Apr 27, 2021
f3e6a61
Tweak the doublemach docs and implementation just a bit (#15)
MTCam Apr 27, 2021
fbe4de3
Remove superfluous isinstance check
w-hagen Apr 27, 2021
7dfa814
Use added grudge functionality to get modal solution
w-hagen Apr 27, 2021
fa4ace9
Updated AV documentation to reflect new use of cv-specific fluid func…
w-hagen Apr 27, 2021
34e5ae4
Merge branch 'main' into artificial_viscosity
MTCam Apr 28, 2021
88f3530
remove commented out import
w-hagen Apr 28, 2021
bde0028
Fix sign error in doublemach case
w-hagen Apr 29, 2021
d58d27d
Merge branch 'main' into artificial_viscosity
MTCam Apr 29, 2021
13d2619
Replace join_conserved_vectors with np.stack per @majosm suggestion. …
MTCam Apr 29, 2021
1cb7979
Merge branch 'main' into artificial_viscosity
MTCam Apr 29, 2021
b3556c9
Rename vars more precisely in AV boundary routine. (#17)
MTCam Apr 29, 2021
ef9c67e
Make artificial viscosity documentation more general (#18)
thomasgibson Apr 29, 2021
961a5bb
Fixed spelling
w-hagen Apr 29, 2021
ea3dc35
Remove join_conserved_vectors
w-hagen Apr 30, 2021
326caf8
Merge branch 'main' into artificial_viscosity
MTCam May 4, 2021
56e5efd
Merge branch 'main' into artificial_viscosity
MTCam May 6, 2021
70a4696
Rewrite shock indicator, cache program and mode computations (#20)
thomasgibson May 6, 2021
7090d32
Update double mach example (#22)
thomasgibson May 6, 2021
445c5c8
Clean up object array handling in flux routines (#19)
majosm May 6, 2021
d185c95
Merge branch 'main' into artificial_viscosity
MTCam May 7, 2021
e2d7ddd
Sooth the bugbear.
MTCam May 7, 2021
3a61993
Unpoke the bugbear.
MTCam May 7, 2021
59df6df
AV misc fixes (#23)
majosm May 11, 2021
c0578f2
Rename modes_active_flag
w-hagen May 11, 2021
bfe3658
Merge branch 'main' into artificial_viscosity
MTCam May 13, 2021
fb44717
Merge branch 'main' into artificial_viscosity
MTCam May 14, 2021
557df33
Merge branch 'main' into artificial_viscosity
MTCam Jun 1, 2021
f9e7884
Merge branch 'main' into artificial_viscosity
MTCam Jun 4, 2021
d602975
Update mirgecom/artificial_viscosity.py for lazy eval
w-hagen Jun 25, 2021
07b4ebe
Merge branch 'main' into artificial_viscosity
MTCam Jun 25, 2021
90b924e
Fix up calls to be like main - CV array container stuff
MTCam Jun 25, 2021
a259e51
Update to make_conserved - CV array container stuff
MTCam Jun 25, 2021
2d42add
Update per CV array container
MTCam Jun 25, 2021
a06062c
Placate flake8
MTCam Jun 25, 2021
bbe0281
Update to latest APIs
MTCam Jun 25, 2021
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: 4 additions & 0 deletions doc/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ References
`DOI: <https://doi.org/10.1016/j.jcp.2011.09.003>`__
.. [Bassi_1997] F. Bassi and S. Rebay (1997), Journal of Computational Physics 131 \
`(DOI) <https://www.sciencedirect.com/science/article/pii/S0021999196955722?via%3Dihub>`__
.. [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>`__
4 changes: 4 additions & 0 deletions doc/operators/artificial_viscosity.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Artificial Viscosity
====================

.. automodule:: mirgecom.artificial_viscosity
2 changes: 1 addition & 1 deletion doc/operators/gas-dynamics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Gas Dynamics
.. automodule:: mirgecom.inviscid
.. automodule:: mirgecom.flux
.. automodule:: mirgecom.boundary
.. automodule:: mirgecom.euler
.. automodule:: mirgecom.euler
1 change: 1 addition & 0 deletions doc/operators/operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ Operators

wave-eq
diffusion
artificial_viscosity
gas-dynamics
259 changes: 259 additions & 0 deletions examples/doublemach-mpi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
"""Demonstrate double mach reflection."""

__copyright__ = """
Copyright (C) 2020 University of Illinois Board of Trustees
"""

__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import logging
import pyopencl as cl
import pyopencl.tools as cl_tools
from functools import partial

from meshmode.array_context import PyOpenCLArrayContext
from meshmode.dof_array import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.dof_desc import DTAG_BOUNDARY
from grudge.eager import EagerDGDiscretization
from grudge.shortcuts import make_visualizer


from mirgecom.euler import inviscid_operator, split_conserved
from mirgecom.artificial_viscosity import (
av_operator,
smoothness_indicator
)
from mirgecom.simutil import (
inviscid_sim_timestep,
sim_checkpoint,
create_parallel_grid,
ExactSolutionMismatch,
)
from mirgecom.io import make_init_message
from mirgecom.mpi import mpi_entry_point

from mirgecom.integrators import rk4_step
from mirgecom.steppers import advance_state
from mirgecom.boundary import AdiabaticSlipBoundary, PrescribedBoundary
from mirgecom.initializers import DoubleMachReflection
from mirgecom.eos import IdealSingleGas

logger = logging.getLogger(__name__)


def get_doublemach_mesh():
"""Generate or import a grid using `gmsh`.

Input required:
doubleMach.msh (read existing mesh)

This routine will generate a new grid if it does
not find the grid file (doubleMach.msh).
"""
from meshmode.mesh.io import (
read_gmsh,
generate_gmsh,
ScriptSource,
)
import os
meshfile = "doubleMach.msh"
if not os.path.exists(meshfile):
mesh = generate_gmsh(
ScriptSource("""
x0=1.0/6.0;
setsize=0.025;
Point(1) = {0, 0, 0, setsize};
Point(2) = {x0,0, 0, setsize};
Point(3) = {4, 0, 0, setsize};
Point(4) = {4, 1, 0, setsize};
Point(5) = {0, 1, 0, setsize};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(5) = {3, 4};
Line(6) = {4, 5};
Line(7) = {5, 1};
Line Loop(8) = {-5, -6, -7, -1, -2};
Plane Surface(8) = {8};
Physical Surface('domain') = {8};
Physical Curve('ic1') = {6};
Physical Curve('ic2') = {7};
Physical Curve('ic3') = {1};
Physical Curve('wall') = {2};
Physical Curve('out') = {5};
""", "geo"), force_ambient_dim=2, dimensions=2, target_unit="M")
else:
mesh = read_gmsh(meshfile, force_ambient_dim=2)

return mesh


@mpi_entry_point
def main(ctx_factory=cl.create_some_context):
"""Drive the example."""
cl_ctx = ctx_factory()
queue = cl.CommandQueue(cl_ctx)
actx = PyOpenCLArrayContext(
queue, allocator=cl_tools.MemoryPool(cl_tools.ImmediateAllocator(queue))
)

dim = 2
order = 3
# Too many steps for CI
# t_final = 1.0e-2
t_final = 1.0e-3
current_cfl = 0.1
current_dt = 1.0e-4
current_t = 0
eos = IdealSingleGas()
initializer = DoubleMachReflection()
casename = "doubleMach"

boundaries = {
DTAG_BOUNDARY("ic1"): PrescribedBoundary(initializer),
DTAG_BOUNDARY("ic2"): PrescribedBoundary(initializer),
DTAG_BOUNDARY("ic3"): PrescribedBoundary(initializer),
DTAG_BOUNDARY("wall"): AdiabaticSlipBoundary(),
DTAG_BOUNDARY("out"): AdiabaticSlipBoundary(),
}
constant_cfl = False
nstatus = 10
nviz = 100
rank = 0
checkpoint_t = current_t
current_step = 0
timestepper = rk4_step

s0 = -6.0
kappa = 1.0
alpha = 2.0e-2
from mpi4py import MPI

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

gen_grid = partial(get_doublemach_mesh)

local_mesh, global_nelements = create_parallel_grid(comm, gen_grid)

local_nelements = local_mesh.nelements

discr = EagerDGDiscretization(actx, local_mesh, order=order,
mpi_communicator=comm)
Comment thread
thomasgibson marked this conversation as resolved.

nodes = thaw(actx, discr.nodes())
current_state = initializer(nodes)

visualizer = make_visualizer(discr,
discr.order if discr.dim == 2 else discr.order)
initname = initializer.__class__.__name__
eosname = eos.__class__.__name__
init_message = make_init_message(
dim=dim,
order=order,
nelements=local_nelements,
global_nelements=global_nelements,
dt=current_dt,
t_final=t_final,
nstatus=nstatus,
nviz=nviz,
cfl=current_cfl,
constant_cfl=constant_cfl,
initname=initname,
eosname=eosname,
casename=casename,
)
if rank == 0:
logger.info(init_message)

get_timestep = partial(
inviscid_sim_timestep,
discr=discr,
t=current_t,
dt=current_dt,
cfl=current_cfl,
eos=eos,
t_final=t_final,
constant_cfl=constant_cfl,
)

def my_rhs(t, state):
return inviscid_operator(
discr, q=state, t=t, boundaries=boundaries, eos=eos
) + av_operator(
discr, t=t, q=state, boundaries=boundaries, alpha=alpha, eos=eos,
s0=s0, kappa=kappa
)

def my_checkpoint(step, t, dt, state):
cv = split_conserved(dim, state)
tagged_cells = smoothness_indicator(discr, cv.mass, s0=s0, kappa=kappa)
viz_fields = [("tagged cells", tagged_cells)]
return sim_checkpoint(
discr,
visualizer,
eos,
q=state,
vizname=casename,
step=step,
t=t,
dt=dt,
nstatus=nstatus,
nviz=nviz,
constant_cfl=constant_cfl,
comm=comm,
viz_fields=viz_fields,
overwrite=True,
)

try:
(current_step, current_t, current_state) = advance_state(
rhs=my_rhs,
timestepper=timestepper,
checkpoint=my_checkpoint,
get_timestep=get_timestep,
state=current_state,
t=current_t,
t_final=t_final,
)
except ExactSolutionMismatch as ex:
current_step = ex.step
current_t = ex.t
current_state = ex.state

# if current_t != checkpoint_t:
if rank == 0:
logger.info("Checkpointing final state ...")
my_checkpoint(
current_step,
t=current_t,
dt=(current_t - checkpoint_t),
state=current_state,
)

if current_t - t_final < 0:
raise ValueError("Simulation exited abnormally")


if __name__ == "__main__":
logging.basicConfig(format="%(message)s", level=logging.INFO)
main()

# vim: foldmethod=marker
1 change: 1 addition & 0 deletions examples/heat-source-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

@mpi_entry_point
def main():
"""Drive the example."""
cl_ctx = cl.create_some_context()
queue = cl.CommandQueue(cl_ctx)
actx = PyOpenCLArrayContext(queue,
Expand Down
Loading