Skip to content

unsupported operand type(s) for * for dataclass that does not define array_context attribute in compiled_lsrk45 #289

@majosm

Description

@majosm

@anderson2981 ran into an error in the wall-enabled prediction driver when using compiled_lsrk45:

  File "emirge/mirgecom/mirgecom/steppers.py", line 425, in advance_state
    _advance_state_stepper_func(
  File "emirge/mirgecom/mirgecom/steppers.py", line 159, in _advance_state_stepper_func
    state = timestepper(state=state, t=t, dt=dt, rhs=compiled_rhs)
  File "prediction.py", line 1471, in _compiled_stepper_wrapper
    return compiled_lsrk45_step(actx, state, t, dt, rhs)
  File "emirge/grudge/grudge/shortcuts.py", line 58, in compiled_lsrk45_step
    y, residual = update(y, a, b, h, rhs_val)
  File "emirge/arraycontext/arraycontext/impl/pytato/compile.py", line 336, in __call__
    output_template = self.f(
  File "emirge/grudge/grudge/shortcuts.py", line 38, in _lsrk45_update
    residual = a*residual + h*rhs_val
TypeError: unsupported operand type(s) for *: 'Placeholder' and 'WallVars'

Here WallVars is a dataclass defined in a similar manner to ConservedVars, with (at least) one distinction: it does not define an array_context method (and does not set _cls_has_array_context_attr=True) (code).

The above error doesn't occur with the regular rk4_step, and it also goes away if I define an array_context method in WallVars. Is this a bug, or is there a reason that it needs to define an array_context method in order to work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions