Error at simple 1D poisson Problem

84 views
Skip to first unread message

Vicente Gomez Herrera (Guest Researcher)

unread,
Feb 13, 2025, 12:25:45 PMFeb 13
to Dedalus Users
I'm trying to implement a Linear Boundary Value problems solver, but there's a weird error coming up, not sure what's going wrong

import numpy as np
import matplotlib.pyplot as plt
import dedalus.public as d3
import logging
logger = logging.getLogger(__name__)


# Parameters
N = 32


# Basis
coord = d3.Coordinate('x')
dist = d3.Distributor(coord, dtype=np.complex128)
basis = d3.ChebyshevT(coord, N, bounds=(-1, 1))

# Fields
u = dist.Field(bases=basis)
tau_1 = dist.Field(name='tau_1', bases=basis)
tau_2 = dist.Field(name='tau_2', bases=basis)

# Substitutions
x = dist.local_grid(basis)

f = dist.Field(bases = basis)
f['g'] = 1 + 0*x

dx = lambda A: d3.Differentiate(A, coord)
lift_basis = basis.derivative_basis(2)
lift = lambda A, n: d3.Lift(A, lift_basis, n)

problem = d3.LBVP([u,tau_1, tau_2],  namespace=locals())
problem.add_equation("dx(dx(u)) +  lift(tau_1,-1) + lift(tau_2,-2) = f")
problem.add_equation("u(x=-1)=0")
problem.add_equation("u(x=1)=0")

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

Seems that the lift function is having an issue, specifically I get the error:


Traceback (most recent call last):

  File "/Users/vgomezherrera/Downloads/dedalus_poisson_try.py", line 33, in <module>

    problem.add_equation("dx(dx(u)) +  lift(tau_1,-1) + lift(tau_2,-2) = f")

  File "/Users/vgomezherrera/opt/anaconda3/envs/dedalus3/lib/python3.11/site-packages/dedalus/core/problems.py", line 72, in add_equation

    LHS = eval(LHS_str, namespace)

          ^^^^^^^^^^^^^^^^^^^^^^^^

  File "<string>", line 1, in <module>

  File "/Users/vgomezherrera/Downloads/dedalus_poisson_try.py", line 30, in <lambda>

    lift = lambda A, n: d3.Lift(A, lift_basis, n)

                        ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/vgomezherrera/opt/anaconda3/envs/dedalus3/lib/python3.11/site-packages/dedalus/tools/dispatch.py", line 35, in __call__

    raise NotImplementedError("No subclasses of {} found for the supplied arguments: {}, {}".format(cls, args, kw))

NotImplementedError: No subclasses of <class 'dedalus.core.operators.Lift'> found for the supplied arguments: (<Field 4802393104>, <dedalus.core.basis.Jacobi object at 0x120a9a4d0>, -1), {'out': None}



Jeffrey S. Oishi

unread,
Feb 13, 2025, 12:30:29 PMFeb 13
to dedalu...@googlegroups.com
Hi,

In 1-D, the taus are just scalar values, so they should not have bases attached to them.

Substitute

tau_1 = dist.Field(name='tau_1')
tau_2 = dist.Field(name='tau_2')

in your code, and it should run.

Jeff

--
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 visit https://groups.google.com/d/msgid/dedalus-users/a534baad-b624-40b5-89e0-7d955d98d510n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages