On Thu, 20060323 at 08:27 0600, Roy Stogner wrote:
> On Thu, 23 Mar 2006, li pan wrote:
>
> > The penalty method was used to set boundary condition
> > in ex13. Can I use DenseMatrix::condense() in stead of
> > penalty method?
>
> In general, not easily. Even if you know the nodal values implied by
> your boundary conditions (which may not be easy for nonLagrange
> elements), what happens when you have boundary nodes that are on
> nonboundary elements? (picture a triangulated domain, for example,
> or an interior corner on a mesh of quads). You'd need to use
> condense() on every element matrix that included your boundary node,
> which means you'd have to store a pernode "I'm on the boundary" flag
> somewhere; libMesh only keeps track of boundary element sides.
>
Agreed. You can use the condense method, but you have to avoid the
pitfall Roy describes. However, the BoundaryInfo class does keep track
of boundary nodes for the boundary sides it tracks. The only possible
problem is when you have, for example, a corner node which lives on two
sides with two separate BC ids. This does give you the option of using
the condense method for Lagrange elements, but as Roy points out you can
no longer restrict your boundary condition applications to elements with
a side on the boundary. See
http://libmesh.sourceforge.net/doxygen/classBoundaryInfo.html#a6
Now, since only level0 elements have their side BCs stored then only
their nodes will get added in this automatic way. But, as a
preprocessing step, you could loop through all active elements on the
boundary and add their nodes to the BoundaryInfo class.
> > Another simple question, how to calculate invert matrix in libmesh?
>
> There is no inverse, I'm afraid; nobody has needed anything more than
> linear system solves with DenseMatrix. It's rare that you really need
> a matrix inverse, but if you do you can call lu_solve() or
> cholesky_solve() with each of N unit vectors to build one.
Roy's right here too ;) To quote one of my professors, "we only invert
matrices under the penalty of death." Also, multiple subsequent
lu_solve()'s will only perform the O(n^3) factorization once and then
just do a series of O(n^2) back substitutions. See
http://libmesh.sourceforge.net/doxygen/classDenseMatrix.html#a19
Ben
