I'm getting the following error when trying to run my simulation: "ValueError: Pencil (np.int64(0),) has 5
constant equations for 0 constant variables plus 3 differential
equations / tau terms.", indicating that I'm not considering the right
number of equations, that I use wrong boundary conditions or that my
problem is ill-posed in general. I read several posts in this group, but couldn't find any way to get my things working.
I'm solving a 2D Newtonian incompressible channel flow. My variables are thus the pressure (p), the velocity components along the ex and ey directions (u,v) and a constant forcing term to impose a constant mass flow rate (Fdp). My equations are the equations for the first order formulation (I'm using Dedalus v2), the continuity equation, the momentum equations and the conditions for imposing a constant Fdp and a constant mass flow rate. The boundary conditions are a no-slip condition for the velocity and a gauge condition for the pressure.
The twist is that I'm not considering a straight channel. In fact, the width of my channel varies with x and I thus tried to use a coordinate mapping between the real coordinates (x,y) and the mapped coordinates (\xi,\eta) \in [-1,1] x [-1,1]. The first variable
is just a scaled version of x, but \eta is some kind of scaled y, with
the varying channel half width: \eta = y/\delta.
I would really appreciate some help on that subject. Thank you in advance for the support you provide and your time.
P.S.:
I provide an example of the problem definition below. To be clear,
delta_1 and delta_2 are respectively the 1st and 2nd derivatives of
\delta along \xi.
import dedalus.public as de
from dedalus.extras import flow_tools
import numpy as np
xi_basis = de.Fourier('xi',64,interval=(-1.0,1.0),dealias=3/2)
eta_basis = de.Chebyshev('eta',64,interval=(-1.0,1.0),dealias=3/2)
domain = de.Domain([xi_basis,eta_basis],grid_dtype=np.float64)
problem = de.IVP(domain,variables=['Fdp','p','u','v','u_eta','v_eta'])
problem.parameters['Re'] = Re
problem.parameters['Lx'] = Lx
problem.parameters['pi'] = np.pi
# Definition of delta
delta_max = 1.0
delta_min = 0.9
c0 = delta_min/delta_max
c1 = (delta_max-delta_min)/delta_max
problem.parameters['c0'] = c0
problem.parameters['c1'] = c1
problem.substitutions['delta'] = 'c1*(sin(pi*xi/2))**2 + c0'
problem.substitutions['delta_1'] = 'c1*sin(pi*xi)'
problem.substitutions['delta_2'] = '2*c1*cos(pi*xi)'
problem.substitutions['Adv(A,A_eta)'] = 'u*dxi(A)/Lx - delta_1*eta*u*A_eta/delta + v*A_eta/delta'
problem.substitutions['LapLinear(A)'] = 'dxi(dxi(A))/Lx**2'
problem.substitutions['LapNonLinear(A,A_eta)'] = 'deta(A_eta)/delta**2 + ((delta_1*eta/delta)**2)*deta(A_eta) - 2*eta*delta_1*dxi(A_eta)/(delta*Lx) + eta*(2*delta_1**2 - delta_2*delta)*A_eta/(delta**2)'
# 1ST ORDER FORMULATION
problem.add_equation("u_eta - deta(u) = 0")
problem.add_equation("v_eta - deta(v) = 0")
# CONTINUITY
problem.add_equation("dxi(u)/Lx = -v_eta/delta + delta_1*eta*u_eta/delta")
# MOMENTUM
problem.add_equation("dt(u) + dxi(p)/Lx - LapLinear(u)/Re + Fdp = delta_1*eta*deta(p)/delta - Adv(u,u_eta) + LapNonLinear(u,u_eta)/Re")
problem.add_equation("dt(v) - LapLinear(v)/Re = -deta(p)/delta - Adv(v,v_eta) + LapNonLinear(v,v_eta)/Re")
# FORCING
problem.add_equation("Fdp = 0", condition="(nxi != 0)")
problem.add_equation("deta(Fdp) = 0", condition="(nxi == 0)")
problem.add_equation("integ(u,'eta') = 2/delta", condition="(nxi == 0)")
# BOUNDARY CONDITIONS
problem.add_bc('left(u) = 0')
problem.add_bc('right(u) = 0')
problem.add_bc('left(v) = 0')
problem.add_bc('right(v) = 0', condition="(nxi != 0)")
problem.add_bc('left(p) = 0', condition="(nxi == 0)")
# BUILD THE SOLVER
solver = problem.build_solver(eval('de.timesteppers.' + 'RK443'))