Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix construction for Gradient of Curl (cartesian) #299

Closed
lecoanet opened this issue Jul 17, 2024 · 2 comments
Closed

Matrix construction for Gradient of Curl (cartesian) #299

lecoanet opened this issue Jul 17, 2024 · 2 comments
Assignees

Comments

@lecoanet
Copy link
Member

I think there's a problem with matrix construction involving the gradient of the curl of a vector in cartesian geometry. Here is a simple example:

import numpy as np
import dedalus.public as d3

coords = d3.CartesianCoordinates('x','y','z')
dist = d3.Distributor(coords, dtype=np.float64)
xbasis = d3.ComplexFourier(coords['x'], size=64, bounds=(0, 1), dealias=3/2)
ybasis = d3.ComplexFourier(coords['y'], size=64, bounds=(0, 1), dealias=3/2)

v = dist.VectorField(coords, name='v', bases=(xbasis,ybasis))
B0 = dist.VectorField(coords,name='B0',bases=ybasis)

problem = d3.IVP(variables=[v], namespace=locals())
problem.add_equation("dt(v) + B0@grad(curl(v)) = 0")

solver = problem.build_solver(d3.SBDF2)

If you run this, you get an error raise SymbolicParsingError("Must build NCC matrices with same variables.") from here. It is complaining that vars does not match with self._ncc_vars. The latter are [v] as expected.

However, the issue seems to be that CartesianGradient is calling

arg.expression_matrices(subproblem, [self.operand])

here when trying to evaluate dx(curl(v)), which means that expression_matrices is called with vars=[curl(v)]. This means that vars doesn't match with self._ncc_vars yielding the above error. I'm not sure what is supposed to be occurring here, but I seem to remember having a similar issue in the past.

@lecoanet
Copy link
Member Author

This issue is related to the following thread on the users list: https://groups.google.com/u/2/g/dedalus-users/c/n2iYFs4WSQI

@kburns
Copy link
Member

kburns commented Jul 18, 2024

Related to or same as #264.

@kburns kburns closed this as completed Jul 18, 2024
@kburns kburns closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants