ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #02112
Re: [Question #215444]: how does FEniCS apply the Dirichlet boundary conditions on unitcircle
Question #215444 on UFL changed:
https://answers.launchpad.net/ufl/+question/215444
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:
> Question #215444 on UFL changed:
> https://answers.launchpad.net/ufl/+question/215444
>
> 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()
> ######################################
>
--
You received this question notification because you are a member of UFL
Team, which is an answer contact for UFL.