Mixed problem where one unknown function is defined on the boundary

Asked by Xavier Raynaud

I want to solve a mixed problem where there is one of the unknown functions which is defined in the interior of the domain and the other defined on the boundary. The two are coupled. My plan was to use mixed elements and I started to implement the following simplified problem:

from dolfin import *

mesh = UnitSquare(32,32)
bcmesh=BoundaryMesh(mesh)

# Choose finite element vector space
U = FunctionSpace(mesh, "Lagrange", 1)
P = FunctionSpace(bcmesh, "Lagrange", 1)

W=U*P

(u, p) = TrialFunctions(W)
(v, q) = TestFunctions(W)

# Construct bilinear and linear form
(u,p) = TrialFunction(W)
(v,q) = TestFunction(W)

dt=0.1

a = u*v*dx+alpha*inner(grad(u), grad(v))*dx-p*vds+(1+dt)*p*q*ds

I get an error message when executing W=U*P

I wonder if Fenics is able to solve such problem. I believe that my question is actually the same as question 150806 sent 03/28/2011.

Thank you very much for your help!

Xavier Raynaud.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Garth Wells
Solved:
Last query:
Last reply:
Revision history for this message
Xavier Raynaud (xav-raynaud) said :
#1

It seems that the answer given to question #136409 could really be useful. In the code which is refered to there ( http://arxiv.org/abs/1010.1873), one can find the definition of the function space

 V_cg = FunctionSpace(mesh, "CG", order, "facet")

which is restricted to facets. Where could I have found documentation on the option "facet"?

Thanks.

Xavier.

Revision history for this message
Xavier Raynaud (xav-raynaud) said :
#2

I actually found a way to deal with this question but it does not seem natural: I apply zero dirichlet boundary condition on the interior (!) of the domain. Is there any more natural way in Fenics of defining spaces of functions defined on the boundary?

You can find here a description of the problem
http://dl.dropbox.com/u/4003624/testcase.pdf

Here is the code:

from dolfin import *

mesh = UnitSquare(32,32)

movie=False

# Time step, Time interval
dt=0.1
T=80

# Choose finite element vector space
U = FunctionSpace(mesh, "Lagrange", 1)
P = FunctionSpace(mesh, "Lagrange", 1)

W=U*P

(u, p) = TrialFunctions(W)
(v, q) = TestFunctions(W)

def boundary(x):
   if x[0]<0.0001 or x[0]>1-0.0001 or x[1]<0.0001 or x[1]>1-0.0001:
      return False
   else:
      return True

bc = DirichletBC(W.sub(1), Constant(1.0), boundary)

#dissipation coefficient
alpha=0.001

uprev=interpolate(Constant(0.0),U)
pprev=interpolate(Constant(0.0),P)

# visualization parameters
h=plot(uprev)
# h.rescale=True
h.rescale=False
h.set_min_max(0,100)
h.init_writer(".tmp")

# Construct bilinear and linear form
(u,p) = TrialFunction(W)
(v,q) = TestFunction(W)

# k1=0
k2=1
gamma=1

# a = u*v*dx+dt*alpha*inner(grad(u), grad(v))*dx-(-k1*gamma*u*p*v+k2*gamma*(1-p))*ds+(p-dt*(-k1*gamma*u*p*v+k2*gamma*(1-p)))*w*ds

a = u*v*dx+dt*alpha*inner(grad(u),grad(v))*dx+k2*gamma*p*v*ds+(1+dt*k2)*p*q*ds
L = uprev*v*dx+k2*gamma*v*ds+(pprev+dt*k2)*q*ds

A=assemble(a)

w=Function(W)

# debug_here()

# Time integration
t=0
i=1
while t<=T:

   b=assemble(L)
   bc.apply(A,b)
   solve(A,w.vector(),b)

   (u,p)=w.split()
   h.update(data=u)
   if movie:
      h.write_png()

   i+=1
   t+=dt
   uprev.assign(u)
   pprev.assign(p)

if movie:
   h.movie("movie2.avi", fps=10, cleanup=True)

Revision history for this message
Best Garth Wells (garth-wells) said :
#3

What you describe is the way to do it for now. There is a Blueprint for defining equations on sub-domains only:

    https://blueprints.launchpad.net/dolfin/+spec/fespace-subdomain

Revision history for this message
Xavier Raynaud (xav-raynaud) said :
#4

This answers my question. Thank you very much!

Revision history for this message
Xavier Raynaud (xav-raynaud) said :
#5

Thanks Garth Wells, that solved my question.