Problem with Solving a PDE with tow Neumann Boundary Conditions

Asked by Roman Moritz

Hey Guys
First I'm totaly new in this

I try to solve an elastostatic PDE with two Neumann Boundarys over an simple UnitSquare
the first Boundary holds for y=0, the second on the other Boundarys

I tried to define the Boundarys like its done in the Tutorial 1.5.3 Multiple Neumann, Robin and Dirichlet conditions and i came to this:

from dolfin import *

#Mesh erstellen (Einheitsquadrat mit 6*4 Quadratunterteilungen und 48 Dreiecken)
mesh= UnitSquare(6,4)

#Def. des Finiten Elementraums
V=VectorFunctionSpace(mesh,"Lagrange",1)

#def. Neumann Boundarys
boundary_parts=MeshFunction("uint",mesh,mesh.topology().dim()-1)

tol = 1E-14
class NeumannBoundary1(SubDomain):
 def inside(self, x ,on_boundary):
  return x[1] < tol and on_boundary
nm_boundary= NeumannBoundary1()
nm_boundary.mark(boundary_parts,0)

class NeumannBoundary2(SubDomain):
 def inside(self, x ,on_boundary):
  return x[1] > tol and on_boundary
nm_boundary2= NeumannBoundary2()
nm_boundary2.mark(boundary_parts,1)
#def. Variationsproblem

u=TrialFunction(V)
v=TestFunction(V)
f=Constant((10,12))
g=Constant((5,5))
c=Constant((0,0))
eu=(1/2)*(nabla_grad(u)[:,:]+nabla_grad(u)[:,:].T)
ev=(1/2)*(nabla_grad(v)+nabla_grad(v).T)
a=((0.5*tr(eu)*tr(ev))+(tr(eu.T*ev)))*dx
L=inner(f,v)*dx + inner(g,v)*ds(0) + inner(c,v)*ds(1)

#Loesung berechnen
b=assemble(L,exterior_facet_domains=boundary_parts)
u=Function(V)
solve(a==b,u)

in this case i get the error "No Jacobian form specified for nonlinear variational problem.", but i dont see why this is an nonlinear Problem

if i just try solve(a==L,u) i get "Unable to extract common cell; missing cell definition in form or expression"

even if i delete the Boundary integrals and just write L=inner(f,v)*dx i get this error

so please help me out

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Roman Moritz
Solved:
Last query:
Last reply:
Revision history for this message
Johan Hake (johan-hake) said :
#1

On 07/12/2012 11:31 PM, Roman Moritz wrote:
> New question #202993 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/202993
>
> Hey Guys
> First I'm totaly new in this
>
> I try to solve an elastostatic PDE with two Neumann Boundarys over an simple UnitSquare
> the first Boundary holds for y=0, the second on the other Boundarys
>
> I tried to define the Boundarys like its done in the Tutorial 1.5.3 Multiple Neumann, Robin and Dirichlet conditions and i came to this:
>
>
>
>
> from dolfin import *
>
> #Mesh erstellen (Einheitsquadrat mit 6*4 Quadratunterteilungen und 48 Dreiecken)
> mesh= UnitSquare(6,4)
>
> #Def. des Finiten Elementraums
> V=VectorFunctionSpace(mesh,"Lagrange",1)
>
> #def. Neumann Boundarys
> boundary_parts=MeshFunction("uint",mesh,mesh.topology().dim()-1)
>
> tol = 1E-14
> class NeumannBoundary1(SubDomain):
> def inside(self, x ,on_boundary):
> return x[1] < tol and on_boundary
> nm_boundary= NeumannBoundary1()
> nm_boundary.mark(boundary_parts,0)
>
> class NeumannBoundary2(SubDomain):
> def inside(self, x ,on_boundary):
> return x[1] > tol and on_boundary
> nm_boundary2= NeumannBoundary2()
> nm_boundary2.mark(boundary_parts,1)
> #def. Variationsproblem
>
> u=TrialFunction(V)
> v=TestFunction(V)
> f=Constant((10,12))
> g=Constant((5,5))
> c=Constant((0,0))
> eu=(1/2)*(nabla_grad(u)[:,:]+nabla_grad(u)[:,:].T)
> ev=(1/2)*(nabla_grad(v)+nabla_grad(v).T)
> a=((0.5*tr(eu)*tr(ev))+(tr(eu.T*ev)))*dx
> L=inner(f,v)*dx + inner(g,v)*ds(0) + inner(c,v)*ds(1)
>
> #Loesung berechnen
> b=assemble(L,exterior_facet_domains=boundary_parts)
> u=Function(V)
> solve(a==b,u)

When using the a==L syntax of solve both a and L needs to be forms.

> in this case i get the error "No Jacobian form specified for nonlinear variational problem.", but i dont see why this is an nonlinear Problem
>
> if i just try solve(a==L,u) i get "Unable to extract common cell; missing cell definition in form or expression"

It looks like:

   eu=(1/2)*(nabla_grad(u)[:,:]+nabla_grad(u)[:,:].T)

is zero.

Johan

> even if i delete the Boundary integrals and just write L=inner(f,v)*dx i get this error
>
> so please help me out
>
>
>

Revision history for this message
Roman Moritz (r-moritz) said :
#2

Hey Thx i wrote sym(grad(u)) instead 1/2)*(nabla_grad(u)[:,:]+nabla_grad(u)[:,:].T) and it works now.

but i dont see why 1/2)*(nabla_grad(u)[:,:]+nabla_grad(u)[:,:].T) = 0