CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Matrix Algebra

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 21, 2005, 08:20
Default Hi all, Have you got any sug
  #1
Tommaso Lucchini (Lucchini)
Guest
 
Posts: n/a
Hi all,
Have you got any suggestios about how to calculate the eigenvalues of a scalar matrix with OpenFoam?
Thanks. Regards
tommaso
  Reply With Quote

Old   January 21, 2005, 08:23
Default How big is the matrix? If it
  #2
Henry Weller (Henry)
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   July 10, 2006, 09:19
Default Can anyone tell me somthing ab
  #3
Member
 
Ralph
Join Date: Mar 2009
Posts: 40
Rep Power: 8
ralph is on a distinguished road
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
ralph is offline   Reply With Quote

Old   July 10, 2006, 09:46
Default You need to be more careful: w
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,761
Rep Power: 21
hjasak will become famous soon enough
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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 10, 2006, 10:07
Default Hi Hrvoje, Iīm using fvMatrix
  #5
Member
 
Ralph
Join Date: Mar 2009
Posts: 40
Rep Power: 8
ralph is on a distinguished road
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
ralph is offline   Reply With Quote

Old   July 10, 2006, 10:12
Default No, it's all fine. The matrix
  #6
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,761
Rep Power: 21
hjasak will become famous soon enough
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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 10, 2006, 10:21
Default Itīs doing good to hear thatīs
  #7
Member
 
Ralph
Join Date: Mar 2009
Posts: 40
Rep Power: 8
ralph is on a distinguished road
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?
ralph is offline   Reply With Quote

Old   July 10, 2006, 12:57
Default Let's think about it: in terms
  #8
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,761
Rep Power: 21
hjasak will become famous soon enough
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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 10, 2006, 13:48
Default Thanks a lot Hrvoje, I got it
  #9
Member
 
Ralph
Join Date: Mar 2009
Posts: 40
Rep Power: 8
ralph is on a distinguished road
Thanks a lot Hrvoje,
I got it.
ralph is offline   Reply With Quote

Old   July 17, 2007, 08:38
Default Hi, I need to know the diffe
  #10
New Member
 
Rachid bannari
Join Date: Mar 2009
Location: Quebec, Canada
Posts: 12
Rep Power: 8
bannari is on a distinguished road
Hi,
I need to know the difference between BICCG and Bi-CGSTAB. and if it's possible the article of Vorst.
best regards
bannari is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Addressing matrix element and reuse of system matrix marziolettich OpenFOAM Running, Solving & CFD 2 February 19, 2008 06:04
Matrix Algebra Tommaso Lucchini (Lucchini) OpenFOAM Running, Solving & CFD 0 January 21, 2005 10:33
Roe matrix srinath Main CFD Forum 2 March 26, 2003 11:39
Elemtary matrix to CSR global matrix xueying Main CFD Forum 2 September 24, 2002 09:44
FEM/Linear algebra question clifford bradford Main CFD Forum 7 May 4, 2001 23:47


All times are GMT -4. The time now is 06:00.