change symmetric lduMatrix into asymmetric
The fvm::laplacian(psi) returns a symmetric matrix M.
I am trying to modify single entries of this matrix by accessing M.upper() and M.lower(). Unfortunately every modification of M.upper() is treated as if M.lower() is modified as well, because a symmetric matrix holds only one shared pointer for both fields.
How can I change this matrix into an asymmetric matrix?
lduMatrix::upper() is implemented such that it duplicates (*lowerPtr_) into a new scalarField, if only *lowerPtr_ exists but not *upperPtr_.
Unfortunately, this is not implemented vice versa: fvm::laplacian(psi) is written such that it defines only *upperPtr_ but not *lowerPtr_. And lduMatrix::lower() does not duplicate (*upperPtr_) into a new scalarField if (*lowerPtr_) doesn't exist.
Can somebody help?
All you need to do is make a non-const access request for both the upper and lower. Just write:
If your M is not const, then your matrix is now asymmetric... Although at this point upper and lower are still the same.
Thank you, marupio, you are right.
I was confused by the lduMatrix source code, when I wrote about different implementations of lower() and upper(). Actually both are implemented equivalent.
|All times are GMT -4. The time now is 08:46.|