Hey Jeff, thanks for taking a look, I really appreciate it. So I updated the code per your suggestion (and tried a bunch of other things but I digress) to get
# Fields
p = dist.Field(name='p', bases=(xbasis,zbasis))
s = dist.Field(name='s', bases=(xbasis,zbasis))
u = dist.VectorField(coords, name='u', bases=(xbasis,zbasis))
tau_p = dist.Field(name='tau_p')
# Substitutions
nu = 1 / Reynolds
D = nu / Schmidt
x, z = dist.local_grids(xbasis, zbasis)
ex, ez = coords.unit_vector_fields(dist)
w = -d3.div(d3.skew(u))
# Problem
problem = d3.IVP([u, s, p, tau_p], namespace=locals())
problem.add_equation("dt(w) - nu*lap(w) = - u@grad(w)")
problem.add_equation("dt(s) - D*lap(s) = - u@grad(s)")
problem.add_equation("div(u) + tau_p = 0")
problem.add_equation("integ(p) = 0") # Pressure gauge
The output complained about a non-square system at the solver instantiation. OK, so as far as I can tell the dimensions on the LHS and RHS all match. I think the issue is the problem variables have one more dimension (u is 2D, whereas the matrix operators act on w which is 1D). When I make the fix
# Problem
problem = d3.IVP([w, s, p, tau_p], namespace=locals())
problem.add_equation("dt(w) - nu*lap(w) = - u@grad(w)")
problem.add_equation("dt(s) - D*lap(s) = - u@grad(s)")
problem.add_equation("tau_p = -
div(u)")
problem.add_equation("integ(p) = 0") # Pressure gauge
I get a linear problem variable error. Since it's visibly linear (I think), I assume the problem is putting a substitution as a problem variable. With this in mind, I'm thinking maybe the move is to start with w instead of u, and recover u through the Biot-Savart law. As a last point, when I try
# Problem
problem = d3.IVP([u, s, p, tau_p], namespace=locals())
problem.add_equation("dt(w) - nu*lap(w) = - u@grad(w)")
problem.add_equation("dt(s) - D*lap(s) = - u@grad(s)")
problem.add_equation("w + div(skew(u)) = 0")
problem.add_equation("div(u) + tau_p = 0")
problem.add_equation("integ(p) = 0") # Pressure gauge
I get a singularity error after a time step (expected since it just repeats the substitution), however this means it got past the square system problem! This is good!!! My takeaway is I need to add a line here that does nothing to the system without throwing singularities into the evolution. I'll experiment some more but I'd appreciate any more ideas you might have.