Solving a second order PDE with LBVP

101 views
Skip to first unread message

Balu P

unread,
Sep 16, 2024, 12:40:43 PM9/16/24
to Dedalus Users
Hi,

I am new to Dedalus and am trying to use it to solve my problem. I am trying to solve a second-order PDE given by N*psi_xx + M*psi_xz + Xi*psi_zz = s (where the subscripts denote partial differentiation, N, M, and Xi are functions of x and z and 's' is a source function - a delta function modeled as a Gaussian) using LBVP solver. I went through the tutorials and example codes to implement my problem. A few parts of my code are given below:

.
.
.
xbasis = d3.RealFourier(coords['x'],size=Nx,bounds=(0,Lr))
zbasis = d3.Chebyshev(coords['z'],size=Nz,bounds=(-Lz,0))

#Fields
psi = dist.Field(name='psi',bases=(xbasis,zbasis))
n = dist.Field(name='n',bases=(xbasis,zbasis))
m = dist.Field(name='m',bases=(xbasis,zbasis))
xi = dist.Field(name='xi',bases=(xbasis,zbasis))
tau_1 = dist.Field(name='tau_1', bases=xbasis)
tau_2 = dist.Field(name='tau_2', bases=xbasis)

.
.
#Substitutions
lift_basis = zbasis.derivative_basis(1)
lift = lambda A: d3.Lift(A, lift_basis, -1)
dx = lambda A: d3.Differentiate(A, coords['x'])
dz = lambda A: d3.Differentiate(A, coords['z'])

dzpsi = dz(psi) + lift(tau_1)
dz2psi = dz(dzpsi) + lift(tau_2)

.
.
.
#Problem
problem = d3.LBVP([psi, tau_1, tau_2], namespace=locals())
problem.add_equation("n*dx(dx(psi)) + m*dz(dx(psi)) + xi*dz2psi = s")
problem.add_equation("psi(z=-Lz) = 0")
problem.add_equation("dz(psi)(z=0) = 0")

#Solver
solver = problem.build_solver()
solver.solve()
.
.

I have not given here the expressions for n, m, and xi as they are big. I apologize for that.  When I run this code, I get a memory error ('Not enough memory to perform factorization').  I compiled the code without the coefficients in the equation, and the code ran fine. May I know if the implementation above is correct? I have a doubt, especially on the 'RealFourier' basis, as I found (from this Google group) that double Chebyshev (with tau terms) is not supported yet. Should I just run this code on a machine with larger memory?

Please let me know if any more information is needed. Thanks a lot in advance. 

-Ramana.

Daniel Lecoanet

unread,
Sep 17, 2024, 9:36:37 AM9/17/24
to dedalu...@googlegroups.com
Hi Ramana,

If n and m depend on both x and z then the matrices that represent your linear operator are very large, and it may require prohibitively high amounts of memory to perform the matrix solve. It would help if these NCCs could be represented by only a few Fourier terms and only a few Chebyshev polynomials. Hope that helps,

Daniel

On Sep 16, 2024, at 12:41 PM, Balu P <balu...@gmail.com> wrote:

Hi,
--
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/8a6015d3-e82b-47c0-a121-0af0df38ae2bn%40googlegroups.com.

Balu P

unread,
Sep 19, 2024, 3:42:40 PM9/19/24
to Dedalus Users
Hi Daniel,

All the NCCs in the equation are some functions of the Gaussian, so, they can't be written in a few Fourier or Chebyshev terms. I now understand the issue. I will look for alternative ways of solving. 

Thanks for the reply,
Ramana.

Reply all
Reply to author
Forward
0 new messages