DedalusProject / dedalus

A flexible framework for solving PDEs with modern spectral methods.
http://dedalus-project.org/
GNU General Public License v3.0
513 stars 121 forks source link

[d2] Possibly unintended behavior when interpolating at, e.g., 'z=Lz/2' #208

Closed afraser3 closed 2 years ago

afraser3 commented 2 years ago

Hi all,

Let's say you're running an IVP with Lz = 100. It turns out that, if you want to interpolate a field at z = Lz/2 as one of your analysis tasks, you'll get an error. But if you specifically interpolate at z = 50, it works fine. This happens even if you add 'Lz' = Lz as a parameter in your problem. Wasn't sure if this is intended behavior or not, so I thought I would flag it. Minimal working example based off of the 3D RBC example is attached (GitHub wouldn't let me upload a .py file so I put it into a .zip, hope this works). rayleigh_benard.py.zip

Adrian

kburns commented 2 years ago

Hi Adrian, in v2 you need to do problem.namespace['Lz'] = Lz to pass in numbers without casting them to constant fields, which aren't acceptable as inputs for interpolation, etc. Make sure to do this after defining all other substitutions and parameters, though.

afraser3 commented 2 years ago

Ahhh, yup, things work as expected after making that change. Sounds like this is intended behavior then, my mistake. Closing this.