On 5/10/11 3:04 PM, John Peterson wrote:
> On Tue, May 10, 2011 at 1:00 PM, Boyce Griffith<griffith@...> wrote:
>> On 5/10/11 11:33 AM, Omar Al-Abbasi wrote:
>>> Hi everyone,
>>> I am trying to define the boundary conditions in a way which I am more
>>> familiar with. I have only one type of BC which is Drichilet and I am doing
>>> that simply by making indices that are on the outer surface of the domain to
>>> be zero in the stiffness (k) and mass (m) matrix and 1 for the mass matrix
>>> if index i==j.
>>> Ok I am trying to do that, but I am facing a problem for the mass matrix
>>> when the index i==j, since I am using:
>>> matrix_B.add_matrix (Me, dof_indices);
>>> which will add several 1 to the diagonal terms in the matrix.
>> I think that the easiest way to do this is to make two sweeps through
>> the mesh. In the first sweep, set the matrix elements without worrying
>> about boundary conditions. Once you have finished this initial
>> assembly, call SparseMatrix::close() to "flush" the matrix coefficients.
>> Then make a second sweep through the mesh and reset the appropriate
>> entries by calling SparseMatrix::set().
> I think DenseMatrix::condense() is the appropriate way to handle this.
> We don't have an example which does this, but the interface is
> relatively straightforward, and is defined in
I think DenseMatrix::condense() will work to zero out values, but if you
want to put some nonzero value in, e.g., the diagonal of the assembled
matrix, it seems like you need to do that after an initial assembly,