On Aug 22, 2008, at 3:09 AM, Anders Logg wrote: > On Fri, Aug 22, 2008 at 09:58:17AM +0200, Kent-Andre Mardal wrote: >> On to., 2008-08-21 at 14:14 -0500, Catherine Micek wrote: >>> 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? >> >> Can someone comment on this, I have only copied the code from the >> other >> stokes demos. >> >> Kent > > I was hoping you would comment so I wouldn't have to. :-) > > In the standard Stokes demo in DOLFIN, the system is solved as one > big system (with three components and two subsystems). Then we need to > specify which subsystem a bc should be applied to. > > In your Stokes demo, you have already split the system in two, so then > you just need to apply the velocity bc to the velocity system and the > pressure bc to the pressure system (and make sure to zero out the > offdiagonals correctly). Then solve it as a block system. >
This helps -- thanks! > -- > Anders > _______________________________________________ > DOLFIN-dev mailing list > [email protected] > http://www.fenics.org/mailman/listinfo/dolfin-dev _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
