Subject: [Ufl] [Question #215444]: how does FEniCS apply the Dirichlet boundary conditions on unitcircle

From: Huadong GAO <[email-masked]>
Date: Wed, 28 Nov 2012 02:16:00 -0000

New question #215444 on UFL:
https://answers.launchpad.net/ufl/+question/215444

Hi, I do not know the details of applying Dirichlet boundary conditions on unit circle, in particular for quadratic and
cubic element methods, as some triangles have curved boundary. 

Thanks!

-- 
You received this question notification because you are a member of UFL
Team, which is an answer contact for UFL.

---

From: Johan Hake <[email-masked]>
Date: Wed, 28 Nov 2012 09:55:55 -0000

Question #215444 on UFL changed:
https://answers.launchpad.net/ufl/+question/215444

    Status: Open => Answered

Johan Hake proposed the following answer:
On Nov 28, 2012 3:16 AM, "Huadong GAO" <[email-masked]>
wrote:
> Hi, I do not know the details of applying Dirichlet boundary conditions
on unit circle, in particular for quadratic and
> cubic element methods, as some triangles have curved boundary.

Dolfin does not use higher order geometries so no curved boundaries.

It would help if you provided a mininal example showing what you are trying
to do.

Johan

> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp

---

From: Johan Hake <[email-masked]>
Date: Thu, 29 Nov 2012 07:31:11 -0000

Status: Open => Answered

Johan Hake proposed the following answer:
You can read more in detail about this in the FEniCS book. Search for
DirichletBC. You can also get some usefull information by

>>> help(DirichletBC)

in a Python session.

As far as I can see there is nothing wrong with your script.

Johan

On 11/29/2012 03:55 AM, Huadong GAO wrote:
>     Status: Answered => Open
> Huadong GAO is still having a problem:
> First thanks Johan's help.   A simple python code is attached below. I use quadratic element
> solving Poisson Equation on the UnitCircle domain, I do not know how FEniCS apply the Dirichlet boundary conditions. I mean the how to determine the value at the midpoint of the boundary edge ?
> 
> ######################################
> from dolfin import *
> 
> mesh = UnitCircle(5)
> V = FunctionSpace(mesh, "Lagrange", degree=2)
> 
> u = TrialFunction(V)
> v = TestFunction(V)
> 
> #--------------------------------------------
> f = Expression("1.0")
> u_e = Expression("exp(x[0]+x[1]-t)",t=0)
> #--------------------------------------------
> 
> a = inner(nabla_grad(u),nabla_grad(v))*dx
> v = f*v*dx
> 
> def boundary(x,on_boundary):
>     return on_boundary
> 
> bc = DirichletBC(V,u_e,boundary)
> 
> A = assemble(a)
> b = assemble(v)
> bc.apply(A,b)
> u = Function(V)
> solver = KrylovSolver("gmres", "ilu")            
> solver.solve(A, u.vector(), b)
> 
> plot(mesh)
> plot(u)
> interactive()
> ######################################
>

---

From: Huadong GAO <[email-masked]>
Date: Thu, 29 Nov 2012 07:51:04 -0000

Huadong GAO posted a new comment:
1         2              3
o--------o-----------o
 \                       /
   \                   /
    o  4           o 5
       \           /
         \       /   
           \   /
             o  6

---

From: Johan Hake <[email-masked]>
Date: Thu, 29 Nov 2012 09:41:10 -0000

Status: Open => Answered

Johan Hake proposed the following answer:
Have you read the docstring of DirichletBC?

Johan

On 11/29/2012 08:51 AM, Huadong GAO wrote:
> Thanks Johan again.
> I just want to know how does FEniCS define the value of the node at
> boundary edge, say,
> 
> for the UnitCircle partition the following element is near the boudary,
> we can assume edge 1-2-3 is the boundary, and when applying Dirichlet boundary conditions,  we have to know the values of the equation at  nodes 1, 2 and 3,
>  
> node 1 and node 3 lay on the boundary so we can directly use these values, but the value of node2 is difficult to get, as node 2 is not on the boundary exactly, 
> 
> my question is how FEniCS treat this.
>  
> 
> 1         2              3
> o--------o-----------o
>  \                       /
>    \                   /
>     o  4           o 5
>        \           /
>          \       /   
>            \   /
>              o  6
>

---

From: Launchpad Janitor <[email-masked]>
Date: Fri, 14 Dec 2012 19:51:22 -0000

Status: Open => Expired

Launchpad Janitor expired the question:
This question was expired because it remained in the 'Open' state
without activity for the last 15 days.