Hi,
I'm attempting to save problem parameters by defining a constant field 'One' and then saving One*C in the snapshots. This works for C != 0, but for C = 0 it throws a dtype error. My question is; is there a way around this error? Or a better way of saving parameters in snapshots?
Thanks,
Matt
Error:
```
Traceback (most recent call last):
File "/reserved/local/mcrowe/Dedalus3_Scripts/Georgi_Modons/modon_1_layer.py", line 194, in <module>
snap.add_task(One*alpha, name='alpha')
File "/local/mcrowe/miniconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/evaluator.py", line 453, in add_task
super().add_task(*args, **kw)
File "/local/mcrowe/miniconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/evaluator.py", line 310, in add_task
task['dtype'] = op.dtype
^^^^^^^^
AttributeError: 'int' object has no attribute 'dtype'
```
Code to replicate this:
```
import numpy as np
import dedalus.public as d3
a,b = 1, 0
coords = d3.CartesianCoordinates('x', 'y')
dist = d3.Distributor(coords, dtype=np.float64)
psi = dist.Field(name='psi')
One = dist.Field(name='One')
One['g'] = 1.0
problem = d3.IVP([psi], namespace=locals())
problem.add_equation("dt(psi) = 1")
solver = problem.build_solver(d3.RK222)
solver.stop_sim_time = 10
snap = solver.evaluator.add_file_handler('test_snap', sim_dt=1, max_writes=100)
snap.add_task(One*a, name='a')
snap.add_task(One*b, name='b')
while solver.proceed:
solver.step(0.01)
```
--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dedalus-users/9e8d502b-4166-425b-944b-8d32fde57ebfn%40googlegroups.com.