Hello,
I want to put a wave source on a point on the left edge of a rectangular domain. In the previous step I modeled a wave in a rectangular domain with Dirichlet boundary condition on the boundaries and a Gaussian impulse at the center of the domain at t=0 (initial condition). This is my code:
from dolfin import *
import numpy as np
c=1500
mesh = RectangleMesh(Point(-2,-1), Point(2,1),200,100)
V=FunctionSpace(mesh, "Lagrange", 1)
Time variables
dt = 0.000013; t = 0; T = 0.0004
init="exp(-10(x[0]x[0]+ x[1]*x[1]))"
g = Expression(init,t=0)
Previous and current solution
u1= interpolate(g, V)
u0= interpolate(g, V)
Variational problem at each time
u = TrialFunction(V)
v = TestFunction(V)
a = uvdx + dtdtccinner(grad(u), grad(v))dx
L = 2u1vdx-u0vdx
bc = DirichletBC(V, 0,"on_boundary")
u=Function(V)
while t <= T:
g.t=t
solve(a == L, u, bc)
u0.assign(u1)
u1.assign(u)
t += dt
plot(u, interactive=True)
Now I want to put a wave source at the center of the left edge of the domain with an equation like U=Sin(10*t) in which "t" varies from 0 to "T". Could you please help me and tell me how I can define such a boundary condition? Thanks in advance for your help.