Skip to content

Commit

Permalink
fix pylint 3 errors, modernize wave-op
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener authored and inducer committed Oct 13, 2023
1 parent 03d5f8a commit a2e4349
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions examples/wave/wave-op-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
from meshmode.dof_array import DOFArray
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa

from grudge.dof_desc import as_dofdesc, DOFDesc, DISCR_TAG_BASE, DISCR_TAG_QUAD
from grudge.dof_desc import as_dofdesc, DISCR_TAG_BASE, DISCR_TAG_QUAD
from grudge.trace_pair import TracePair
from grudge.discretization import DiscretizationCollection
from grudge.discretization import make_discretization_collection
from grudge.shortcuts import make_visualizer, compiled_lsrk45_step

import grudge.op as op
Expand Down Expand Up @@ -92,7 +92,7 @@ def wave_flux(actx, dcoll, c, w_tpair):
v=0.5 * v_jump * normal,
)

return op.project(dcoll, dd, dd.with_dtag("all_faces"), c*flux_weak)
return op.project(dcoll, dd, dd.with_domain_tag("all_faces"), c*flux_weak)


class _WaveStateTag:
Expand All @@ -101,8 +101,8 @@ class _WaveStateTag:

def wave_operator(actx, dcoll, c, w, quad_tag=None):
dd_base = as_dofdesc("vol")
dd_vol = DOFDesc("vol", quad_tag)
dd_faces = DOFDesc("all_faces", quad_tag)
dd_vol = as_dofdesc("vol", quad_tag)
dd_faces = as_dofdesc("all_faces", quad_tag)
dd_btag = as_dofdesc(BTAG_ALL).with_discr_tag(quad_tag)

def interp_to_surf_quad(utpair):
Expand Down Expand Up @@ -180,7 +180,8 @@ def bump(actx, dcoll, t=0):


def main(ctx_factory, dim=2, order=3,
visualize=False, lazy=False, use_quad=False, use_nonaffine_mesh=False):
visualize=False, lazy=False, use_quad=False, use_nonaffine_mesh=False,
no_diagnostics=False):
cl_ctx = ctx_factory()
queue = cl.CommandQueue(cl_ctx)

Expand Down Expand Up @@ -234,7 +235,7 @@ def main(ctx_factory, dim=2, order=3,
from meshmode.discretization.poly_element import \
QuadratureSimplexGroupFactory, \
default_simplex_group_factory
dcoll = DiscretizationCollection(
dcoll = make_discretization_collection(
actx, local_mesh,
discr_tag_to_group_factory={
DISCR_TAG_BASE: default_simplex_group_factory(base_dim=dim, order=order),
Expand Down Expand Up @@ -282,7 +283,7 @@ def rhs(t, w):

if istep % 10 == 0:
stop = time.time()
if args.no_diagnostics:
if no_diagnostics:
if comm.rank == 0:
logger.info(f"step: {istep} t: {t} "
f"wall: {stop-start} ")
Expand Down Expand Up @@ -340,6 +341,7 @@ def rhs(t, w):
visualize=args.visualize,
lazy=args.lazy,
use_quad=args.quad,
use_nonaffine_mesh=args.nonaffine)
use_nonaffine_mesh=args.nonaffine,
no_diagnostics=args.no_diagnostics)

# vim: foldmethod=marker
2 changes: 1 addition & 1 deletion grudge/dof_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def as_identifier(self) -> str:
raise ValueError(f"unexpected domain tag: '{self.domain_tag}'")

if isinstance(self.discretization_tag, str):
discr_id = _to_identifier(name)
discr_id = _to_identifier(self.discretization_tag)
elif issubclass(self.discretization_tag, DISCR_TAG_QUAD):
discr_id = "_quad"
elif self.discretization_tag is DISCR_TAG_BASE:
Expand Down

0 comments on commit a2e4349

Please sign in to comment.