Replies: 1 comment 1 reply
-
The Dirac delta is not supported by grid = pde.CartesianGrid([[-1, 1]], 64)
field = pde.ScalarField(grid)
field.insert([0], 1) where the last line inserts a certain integral value (in this case |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use$\delta(x)$ as initial condition but i am getting the following error:
ValueError Traceback (most recent call last)
ValueError: Error from parse_expr with transformed code: "Symbol ('sympy' ).DiracDelta (Symbol ('x' ))"
The above exception was the direct cause of the following exception: AttributeError: 'Symbol' object has no attribute 'DiracDelta'
Below is my code. What am I doing wrong? Even if i use 'DiracDelta(x)' instead of 'sympy.DiracDelta' since expressions are passed using the sympy package, I still have the same error. I need help please.
grid = pde.CartesianGrid([[-1, 1]], 64) # generate grid
field = pde.ScalarField.from_expression(grid,'sympy.DiracDelta(x)') # generate initial condition
eq = pde.PDE({"p": "d_dx(p * (a+(b*x))) + (0.05 * laplace(p))"},
consts={'a':0.02,
'b':0.13},
bc={"value": 0})
res = eq.solve(field, 15, dt=0.01,)
Beta Was this translation helpful? Give feedback.
All reactions