You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I copied the KdV example into python and tried running it to find there was an error with the number of arguments in LinearRHS.
`# Error message
integrator.setup(dt)
File "/home/fpoulin/software/anaconda3/envs/shenfun/lib/python3.8/site-
packages/shenfun/utilities/integrators.py", line 195, in setup
L = self.LinearRHS(**self.params)
TypeError: LinearRHS() takes 0 positional arguments but 1 was given
`
`# KdV example
import numpy as np
from shenfun import *
N = 256
T = Basis(N, 'F', dtype='d')
u = TrialFunction(T)
v = TestFunction(T)
u_ = Array(T)
u_hat = Function(T)
def LinearRHS(**params):
return -inner(Dx(u, 0, 3), v)
k = T.wavenumbers(scaled=True, eliminate_highest_freq=True)
def NonlinearRHS(u, u_hat, rhs, **params):
rhs.fill(0)
u_[:] = T.backward(u_hat, u_)
rhs = T.forward(-0.5*u_**2, rhs)
return rhs*1j*k # return inner(grad(-0.5*Up**2), v)
A = 25.
B = 16.
x = T.points_and_weights()[0]
u_[:] = 3*A**2/np.cosh(0.5*A*(x-np.pi+2))**2 + 3*B**2/np.cosh(0.5*B*(x-np.pi+1))**2
u_hat = T.forward(u_, u_hat)
dt = 0.01/N**2
end_time = 0.006
integrator = ETDRK4(T, L=LinearRHS, N=NonlinearRHS)
integrator.setup(dt)
u_hat = integrator.solve(u_, u_hat, dt, (0, end_time))
`
The text was updated successfully, but these errors were encountered:
I copied the KdV example into python and tried running it to find there was an error with the number of arguments in LinearRHS.
`# Error message
`
`# KdV example
`
The text was updated successfully, but these errors were encountered: