Skip to content

Commit

Permalink
Add __array_ufunc__=None to relevant dataclasses (#1090)
Browse files Browse the repository at this point in the history
  • Loading branch information
MTCam authored Dec 4, 2024
1 parent c447683 commit 37f7dfa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions examples/mixture-tpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ def my_write_viz(step, t, state, dv, exact=None, resid=None):
exact = initializer(x_vec=nodes, eos=eos, time=t)
if resid is None:
resid = state - exact
viz_fields = [("cv", state), ("dv", dv)]
viz_fields = [("cv", state), ("dv", dv),
("resid", resid), ("exact", exact)]
from mirgecom.simutil import write_visfile
write_visfile(dcoll, viz_fields, visualizer, vizname=casename,
step=step, t=t, overwrite=True, vis_timer=vis_timer,
Expand Down Expand Up @@ -356,7 +357,7 @@ def my_pre_step(step, t, dt, state):
if do_viz:
if exact is None:
exact = initializer(x_vec=nodes, eos=eos, time=t)
resid = state - exact
resid = fluid_state.cv - exact
my_write_viz(step=step, t=t, state=cv, dv=dv, exact=exact,
resid=resid)

Expand Down
5 changes: 3 additions & 2 deletions examples/mixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ def my_write_viz(step, t, state, dv, exact=None, resid=None):
exact = initializer(x_vec=nodes, eos=eos, time=t)
if resid is None:
resid = state - exact
viz_fields = [("cv", state), ("dv", dv)]
viz_fields = [("cv", state), ("dv", dv),
("resid", resid), ("exact", exact)]
from mirgecom.simutil import write_visfile
write_visfile(dcoll, viz_fields, visualizer, vizname=casename,
step=step, t=t, overwrite=True, vis_timer=vis_timer,
Expand Down Expand Up @@ -350,7 +351,7 @@ def my_pre_step(step, t, dt, state):
if do_viz:
if exact is None:
exact = initializer(x_vec=nodes, eos=eos, time=t)
resid = state - exact
resid = fluid_state.cv - exact
my_write_viz(step=step, t=t, state=cv, dv=dv, exact=exact,
resid=resid)

Expand Down
2 changes: 2 additions & 0 deletions mirgecom/fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ def replace(self, **kwargs):
from dataclasses import replace
return replace(self, **kwargs)

__array_ufunc__ = None


def _aux_shape(ary, leading_shape):
""":arg leading_shape: a tuple with which ``ary.shape`` is expected to begin."""
Expand Down
2 changes: 2 additions & 0 deletions mirgecom/wall_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def array_context(self):
"""Return an array context for the :class:`SolidWallConservedVars` object."""
return get_container_context_recursively(self.mass)

__array_ufunc__ = False


@dataclass_array_container
@dataclass(frozen=True, eq=False)
Expand Down

0 comments on commit 37f7dfa

Please sign in to comment.