← Back to team overview

dolfin team mailing list archive

Re: trilinos demo: applying bc's

 


On Aug 20, 2008, at 2:18 AM, Kent-Andre Mardal wrote:

On ti., 2008-08-19 at 14:59 -0500, Catherine Micek wrote:
Hi,

I have been looking at demo3.py in the dolfin demos in "sandbox/la/
trilinos/", which solves the Stokes system using preconditioners and
an iterative solver.  I can follow the code until it gets to applying
the boundary conditions:

# apply bc
for bc in bcs:
     bc.apply(A00, b0, a00)
     bc.zero(A01, a00)

Why do you apply the second command as "bc.zero(A01, a00)?"  I would
have guessed something more like "bc.zero(A01, a01)."  Perhaps the
better question is more general: how do the bc.apply and bc.zero
commands work?

Thanks!
Katy

bc.apply(A00, b0, a00)
will set the Dirichlet boundary conditions by seting
the part of A00 on the boundary to the identity and put
the boundary conditions in b0.

bc.zero(A01, a00) will zero out the part on the boundary.

Together these to commands create an identity matrix for
the part on the boundary for the block matrix.

I have some follow-up questions on applying boundary conditions in the Trilinos demo.

1.  To enforce boundary conditions, the code

# No-slip boundary condition for velocity
bc0 = DirichletBC(noslip, sub_domains, 0)

# Inflow boundary condition for velocity
bc1 = DirichletBC(inflow, sub_domains, 1)

# Collect boundary conditions
bcs = [bc0, bc1]

is used. I don't understand why we don't tell Dolfin where to apply the boundary conditions with something like

bc0 = DirichletBC(noslip, sub_domains, 0, velocity)
bc1 = DirichletBC(inflow, sub_domains, 1, velocity)

Why isn't it necessary to specify the velocity?

2. As a continuation of the earlier question: what if, for the Stokes system demo, we wanted to specify one boundary condition for the velocity and another for the pressure? In this case, doesn't Dolfin need to know what boundary condition applies to what part of the system? How would you handle this?

Any help would be appreciated -- thanks!

Katy



Kent






Follow ups

References