Hi, actually John clarify what I exactly want. Thank you John,
For PetSc, MatZeroRows set 1 for all diagonal entities
of all Dirichlet boundary rows (other entities will be zero) as I =20
mentioned last time.
In fact you can find examples using this approach from PetSc since I =20
this from PetSc.
What you have to do is modify RHS as John's example shows.
I have used this method for my other codes using PetSc (but not for =20
This approach gives same results as reduced matrix method.
On Sep 29, 2006, at 5:45 AM, John Peterson wrote:
> Just as an addendum to Tim's note, you can maintain any
> symmetry originally present in the problem by "subtracting"
> the column entries multiplied by the Dirichlet value from
> the right hand side vector.
> If Au=3Db, where
> [a_11 a_12 a_13] [u1] =3D [b1]
> [a_21 a_22 a_23] [u2] =3D [b2]
> [a_31 a_32 a_33] [u3] =3D [b3]
> and u1 =3D g1, a non-homogeneous BC val, we can modify Au=3Db as:
> [ 1 0 0 ] [u1] =3D [g1]
> [ 0 a_22 a_23] [u2] =3D [b2 - g1*a21]
> [ 0 a_32 a_33] [u3] =3D [b3 - g1*a31]
> This imposes u1=3Dg1, and maintains any original symmetry of A.
> Tim Kr=F6ger writes:
>> Dear all,
>> On Fri, 29 Sep 2006, li pan wrote:
>>> I'm also thinking about this. Are you sure that you
>>> only need to zero all the enties of rows? I read
>>> somewhere that columes should also be zeroed. Could
>>> somebody confirm this?
>> If you zero only the row entries, the matrix will no longer be
>> symmetric. This is often considered as a drawback (provided that the
>> matrix was symmetric before) because certain solvers (e.g. CG) cannot
>> be used then any more.
>> On the other hand, if the column entries are also zeroed, the =20
>> of the system will be wrong -- except for the case of *homogeneous*
>> Dirichlet conditions. For this reason, some people transform their
>> problems to homogeneous boundary conditions, i.e. they do in practice
>> the same thing that is usually done theoretically anyway, i.e. they
>> subtract a function that fulfills all Dirichlet boundary conditions
>> but not the PDE. Note that in the discrete case, such a function is
>> trivial to find.
>> Because I find this all quite unsatisfactory, I was glad to see that
>> libMesh uses the penalty method (which I did not know before) because
>> it is easy to implement, works in all cases, and does not destroy
>> symmetry or positivity of the matrix.
>> Best Regards,
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to =20
> share your
> opinions on IT & business topics through brief surveys -- and earn =20
> Libmesh-users mailing list