Applying neumann boundary condition on top surface

Asked by Bahram on 2013-05-01

I want to model a plate with a load on top of it and the displacement at the bottom of the plate is zero.
I am not sure how I can specify where to apply the load since I have my Neuman BC inside my weak formulation.I wrote modify my code but the result doesn't seems right. any suggestion?

Here is my code:
The PDE is Helmholtz type PDE. I just simplify the problem by fixing the frequency of the load.
the equation is :
Divergence(stress(vec(x), w)) + w^2 * density * u( vec(x),w)=0
BC: Stress(vec(x),w) n(x)=T(x,w)


# Create mesh and define function space
mesh = UnitCubeMesh(30, 4, 30)
V = VectorFunctionSpace(mesh, "Lagrange", 1)

# Defining Domain
class Left(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 0.0)

class Right(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 1.0)

class Bottom(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[1], 0.0)

class Top(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[1], 1.0)
# Initialize sub-domain instances
left = Left()
top = Top()
right = Right()
bottom = Bottom()

# Initialize mesh function for interior domains
domains = CellFunction("uint", mesh)

# Initialize mesh function for boundary domains
boundaries = FacetFunction("uint", mesh)
left.mark(boundaries, 1)
top.mark(boundaries, 2)
right.mark(boundaries, 3)
bottom.mark(boundaries, 4)
bc = DirichletBC(V, (0.0, 0.0, 0.0), boundaries,4)
# Define new measures associated with the interior domains and exterior boundaries

#dx = Measure("dx")[domains]
ds = Measure("ds")[boundaries]

#bottom = compile_subdomains("x[2] == 0")
#top = compile_subdomains("x[2] == 1")
# Define Dirichlet boundary (x = 0 or x = 1)
#c = Expression(("0.0", "0.0", "0.0"))
#bc = DirichletBC(V, c, bottom)

# Define trial and test functions
u = TrialFunction(V)
v = TestFunction(V)
f = Expression(("0.0", "scale*sin(w0*pi)","0.0"), w0 = w, scale = Magnitude )
# Elasticity parameters
E, nu = 10.0, 0.3
mu = E / (2.0*(1.0 + nu))
lmbda = E*nu / ((1.0 + nu)*(1.0 - 2.0*nu))
def sigma(v):
    return 2.0*mu*sym(grad(v)) + lmbda*tr(sym(grad(v)))*Identity(v.cell().d)

a = inner(sigma(u), sym(grad(v)))*dx -po*w*w *inner(v,u)*dx
L = inner(f,v)*ds(2)

# Compute solution
u = Function(V)
solve(a == L, u, bc)

# Save solution in VTK format
file = File("Elastic.pvd")
file << u

# Plot solution

Question information

English Edit question
FEniCS Project Edit question
No assignee Edit question
Last query:
Last reply:
Nick Davies (ntd14) said : #1

Im not sure I understand what you are asking. The code solves fine for me. Do you think the displacements are to low? or are you wanting a time dependent solution? Information on time dependent problems are available here and there is also some examples in the book.

Johannes Ring (johannr) said : #2

FEniCS no longer uses Launchpad for Questions & Answers. Please consult the documentation on the FEniCS web page for where and how to (re)post your question:

Can you help with this problem?

Provide an answer of your own, or ask Bahram for more information if necessary.

To post a message you must log in.