`unsupported operand type(s) for *` for dataclass that does not define `array_context` attribute in `compiled_lsrk45`
- Dominant language
- Python
- Stars
- 14
- Forks
- 18
- Avg merge
- 26m
- Merged PRs (30d)
- 1
Description
@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](https://github.com/illinois-ceesd/drivers_y2-prediction/blob/31891df1a1121acebbf6f350c86a73bceedebbb0/prediction.py#L925-L934)).
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?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.