CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Matrix Algebra (http://www.cfd-online.com/Forums/openfoam-solving/59565-matrix-algebra.html)

Tommaso Lucchini (Lucchini) January 21, 2005 08:20

Hi all, Have you got any sug
 
Hi all,
Have you got any suggestios about how to calculate the eigenvalues of a scalar matrix with OpenFoam?
Thanks. Regards
tommaso

Henry Weller (Henry) January 21, 2005 08:23

How big is the matrix? If it
 
How big is the matrix? If it's a 3x3 tensor then the functionality is already provided but for larger matrices it is not currently available. However there are algorithms in Numerical Recipies (and other books) to do this and the latest C++ edition of the book is pretty good and the code is quite easy to integrate with OpenFOAM.

ralph July 10, 2006 09:19

Can anyone tell me somthing ab
 
Can anyone tell me somthing about manipulating the coefficients in a linear system in OpenFOAM.
1) Can the central coefficients of a system be manipulated by using lduMatrix::diag()?
2) Can the rhs coefficients be manipulated by using lduMatrix::source()?
3) If yes, the manipulated system
xyEqn.diag() *= factor;
xyEqn.source() *= factor;

should be equal to the initial system (left + right side multiplicated with a diagonal matrix).
If that is the case, Iīm doing something wrong, because the solutions of the two systems show a big difference.

Thanks in advance
Ralph

hjasak July 10, 2006 09:46

You need to be more careful: w
 
You need to be more careful: what class are you using and what exactly happens.

Class lduMatrix has got the membr functions for

const scalarField& lower() const;
const scalarField& diag() const;
const scalarField& upper() const;

but it does not hold the source. That means you are using a derived class (which?) and this may do additional things.

Hrv

ralph July 10, 2006 10:07

Hi Hrvoje, Iīm using fvMatrix
 
Hi Hrvoje,
Iīm using fvMatrix class (with scalar type).
Iīm actually doing:
1) Creating a linear system of type fvMatrix (e.g. xyEqn)
2) Applying:
xyEqn.diag() *= factor;
xyEqn.source() *= factor;

3) Solving: xyEqn.solve()
(The residuum is lowered about 5 orders of magnitudes during the solution procedure)
4) Again creating the system (with the unknowns of the former solution as "start values").
5) Solving (without any manipulations).

The problem is, that the start residuum for (5) is about that of (3). But if Manipulation in (2) works well, the start residuum should be lower, as (3) should produce similar results to (5) and therefore a good starting solution should be available.

Am I doing somthing fundamental wrong?

Ralph

hjasak July 10, 2006 10:12

No, it's all fine. The matrix
 
No, it's all fine. The matrix normalisation is based on the diagonal and source and it's different in the two cases. You could safely ignore this and carry on.


Hrv

ralph July 10, 2006 10:21

Itīs doing good to hear thatīs
 
Itīs doing good to hear thatīs all fine.
But if itīs fine I would expect the first result similiar to the second one and therefore the start residuum of the second one to be much lower (as the result should already nearly be reached).
Donīt you agree?

hjasak July 10, 2006 12:57

Let's think about it: in terms
 
Let's think about it: in terms of absolute residuals, you are quite right: boosting the diagonal and the source will mean that you are closer to the solution. However, the reported residuals are normalised (i.e. divided by something) and the normalisation factor is calculated from the matrix itself. Quoting from the code:

// --- Calculate reference value of psi
scalar psiRef = gAverage(psi_);

// --- Calculate A.psi and A.psiRef
matrix_.Amul(wA, psi_, coupleBouCoeffs_, interfaces_, cmpt_);
matrix_.Amul
(
pA,
scalarField(psi_.size(), psiRef),
coupleBouCoeffs_,
interfaces_,
cmpt_
);

// --- Calculate normalisation factor
scalar normFactor = gSum(mag(wA - pA) + mag(source_ - pA)) + matrix_.small_;


You can see the normalisation factor in the last line above. The wa and pa bit is multiplied by the diagona and source_ is source :-)If you increase the diagonal and source, the normalisation factor changes - which explains what you see.

Clear?

Hrv

ralph July 10, 2006 13:48

Thanks a lot Hrvoje, I got it
 
Thanks a lot Hrvoje,
I got it.

bannari July 17, 2007 08:38

Hi, I need to know the diffe
 
Hi,
I need to know the difference between BICCG and Bi-CGSTAB. and if it's possible the article of Vorst.
best regards


All times are GMT -4. The time now is 19:59.