How can I specify a point-like source for the wave equation? #41
Unanswered
ShaikhaTheGreen
asked this question in
Q&A
Replies: 1 comment 3 replies
-
There is no special implementation of a delta-function, but you can in principle use any spatial field in the definition of the pde. I thus suggest to create a field that mimics the delta-impulse: grid = pde.CartesianGrid([[0, 16], [0, 16]], 64)
point = pde.ScalarField(grid) # create empty field
point.add_interpolated([8, 8], 1) # add a point source at a given location
point.plot() You can then use this field in your definition of the PDE: speed = 0.01
frequency = 10
source = f"sin(2*pi*{frequency}*t)"
eq = PDE(
{
"u": f"v",
"v": f"{speed}**2 * laplace(u) + {source} * point"
}, bc=[{"value": 0}, {"derivative":0}],
consts={'point': point}
) Note that you need to specify explicitly what constants are defined for |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Again thanks for your contribution!
I want to add a source to my wave function simulation at a specific location in the domain. I'm currently writing it in this way:
where my source

f(x) = sin(2*pi*f*t)
I came to know that if I wanted the source
f(x)
to be at location x=0, then I should implement something like:using the impulse function.
How can I implement this? Is there any specific syntax to do it?
Beta Was this translation helpful? Give feedback.
All reactions