This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

frequency domain problem

0 votes

Hello
I want to solve the wave equation in the time frequency domain. Domain is a rectangle and the wave is propagating from a sourcepoint (with value equal to 1 and located on the left edge of the domain). Here is the equation I have to solve:
enter image description here

The frequency domain is : [0,10] and the frequency increment is 1. When I run my code I get this error:


Traceback (most recent call last):
File "/home/jafar/m.py", line 48, in
A, b = assemble_system(a, L, bc)
*** Error: Unable to creating dolfin.Form.
*** Reason: Expecting subdomain data for a single domain only..
*** Where: This error was encountered inside form.py.


Here is a part of my code:

# constants
mu=E/(2*(1+Poisson))
lambd=E*Poisson/((1+Poisson)*(1-2*Poisson))
dens=2700

V=VectorFunctionSpace(mesh1, 'CG', 1)
# frequency variables
d_omega = 1; step = 0; omega = 10
# Variational problem
F = mu*inner(grad(u), grad(v))*dx+(lambd+mu)*div(u)*div(v)*dx + dens*d_omega*d_omega*inner(u,v)*dx
a = rhs(F)
L = lhs(F)
#Boundary condition
W_const = Constant((0.0, 0.0))
bc = DirichletBC(V, W_const, "on_boundary")
A, b = assemble_system(a, L, bc)
u=Function(V)
#Solve
while d_omega <= omega:
    A, b = assemble_system(a, L, bc)
    delta = PointSource(V.sub(0), Point(0., 1.5),1)
    delta.apply(b)
    solve(A, u.vector(), b)
    step += d_omega
    plot(u, interactive=False)

This is a frequency-domain problem. I think the error might be related to this part of the variational problem (I am not sure):

dens*d_omega*d_omega*inner(u,v)*dx

Could you please help me fix this error?
Thanks

asked Mar 12, 2016 by Ramon FEniCS Novice (340 points)

If you are solving the elastodynamics problem in the frequency domain you must be very careful with the treatment of the displacements because they are complex-valued.

In the forum exist many discussions about how to formulate these kind of problem using fenics (knowing that fenics, at the moment, does not support complex numbers). Take a look to this questions: link.

1 Answer

+1 vote
 
Best answer

Hi,
consider one of these two options (obviously both of they are equivalent):

Option 1:

F = mu*inner(grad(u), grad(v))*dx+(lambd+mu)*div(u)*div(v)*dx + dens*d_omega*d_omega*inner(u,v)*dx + inner(Constant((0.0, 0.0)),v)*dx
a = lhs(F)
L = rhs(F)

Option 2:

a = mu*inner(grad(u), grad(v))*dx + (lambd+mu)*div(u)*div(v)*dx + dens*d_omega*d_omega*inner(u,v)*dx
L = inner(Constant((0.0, 0.0)),v)*dx
answered Mar 12, 2016 by hernan_mella FEniCS Expert (19,460 points)
selected Mar 13, 2016 by Ramon

That is, all the terms in the original variational formulation had a trial function and so the rhs (terms with test function only) was empty. Herman's option 1 fixes this.

...