CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

The meanings of diag( ), source( ), psi( )

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By cfd_explorer
  • 1 Post By sleepdeprivation
  • 1 Post By santiagomarquezd
  • 1 Post By sharonyue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 16, 2011, 06:25
Default The meanings of diag( ), source( ), psi( )
  #1
New Member
 
Xuan Cai
Join Date: Mar 2011
Location: Karlsruhe, Germany
Posts: 9
Rep Power: 15
cfd_explorer is on a distinguished road
I am using the solver"porousSimpleFoam" to run simulations on a domain including porous media.
In the UEqn.H, the momentum equation is implemented as follows:
// Construct the Momentum equation

tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence->divDevReff(U)
);

Then in the file: /src/finiteVolume/cfdTools/general/porousMedia/porousZone.C

we have the following code:
================================================== ==========
scalarField& Udiag = UEqn.diag();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
================================================== ==========

Does anyone know the exact meanings of UEqn.diag(), UEqn.source(), UEqn.psi() in details, e.g. what do these functions return? Or could anyone give some hints about that?
Thank you very much
gooya_kabir likes this.
cfd_explorer is offline   Reply With Quote

Old   March 16, 2011, 09:46
Default
  #2
New Member
 
Alton Luder III
Join Date: Oct 2009
Location: Michigan
Posts: 22
Rep Power: 16
sleepdeprivation is on a distinguished road
See the source code documentation.
Here is the list of all members of fvMatrix since diag() is inheirited
http://foam.sourceforge.net/docs/cpp...ix-members.php
acs likes this.
sleepdeprivation is offline   Reply With Quote

Old   March 16, 2011, 12:08
Default
  #3
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 23
santiagomarquezd will become famous soon enough
Hi,

Quote:
Originally Posted by cfd_explorer View Post
================================================== ==========
scalarField& Udiag = UEqn.diag();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
================================================== ==========
UEqn.diag(); gives you the diagonal of system matrix, UEqn.source(); the source term (both without applying BC's) and UEqn.psi(); a reference to the unknown field. Remember that UEqn is the whole linear system not only the matrix.

Regards.
luiscardona likes this.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Research Scientist
Research Center for Computational Methods (CIMEC) - CONICET/UNL
Tel: 54-342-4511594 Int. 7032
Colectora Ruta Nac. 168 / Paraje El Pozo
(3000) Santa Fe - Argentina.
http://www.cimec.org.ar
santiagomarquezd is offline   Reply With Quote

Old   March 17, 2011, 04:56
Default
  #4
New Member
 
Xuan Cai
Join Date: Mar 2011
Location: Karlsruhe, Germany
Posts: 9
Rep Power: 15
cfd_explorer is on a distinguished road
Quote:
Originally Posted by santiagomarquezd View Post
Hi,



UEqn.diag(); gives you the diagonal of system matrix, UEqn.source(); the source term (both without applying BC's) and UEqn.psi(); a reference to the unknown field. Remember that UEqn is the whole linear system not only the matrix.

Regards.

Hi Santiago.

Thanks for your reply.
In the openfoamwiki, I learn that disretization of PDE leads to an algebraic equation in the following form:
AΨ = B

So does
UEqn.diag() mean the diagonal of A, UEqn.source() mean B and UEqn.psi() mean Ψ ?

cfd_explorer is offline   Reply With Quote

Old   September 19, 2013, 13:53
Default
  #5
Member
 
Hassan
Join Date: Oct 2012
Location: Iran
Posts: 63
Rep Power: 13
luckycfd is on a distinguished road
Quote:
Originally Posted by cfd_explorer View Post
Hi Santiago.

Thanks for your reply.
In the openfoamwiki, I learn that disretization of PDE leads to an algebraic equation in the following form:
AΨ = B

So does
UEqn.diag() mean the diagonal of A, UEqn.source() mean B and UEqn.psi() mean Ψ ?

Hi,
Please attention to this post. ?

Regards,
Hassan
luckycfd is offline   Reply With Quote

Old   June 17, 2015, 14:13
Default
  #6
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
Quote:
Originally Posted by cfd_explorer View Post

So does [/B]UEqn.diag() mean the diagonal of A, UEqn.source() mean B and UEqn.psi() mean Ψ ?

Not really, this is what Im thinking:

For example, if you are discritizing velocity, u will have an symmetry matrix. After discritization, u will have Ax = B, A will be symmetric, Then OpenFOAM will do:

[A.diag()+A.offdiag()] x = B;

A.diag() x = B - A.offdiag() x;

For symmetric matrix, A.diag() will be the diagonal of A, A.offdiag() x will be the source of A. That means if your matrix equation is like this:

A x = 0;

U also have an source() term.


acs likes this.
__________________
My OpenFOAM algorithm website: http://dyfluid.com
By far the largest Chinese CFD-based forum: http://www.cfd-china.com/category/6/openfoam
We provide lots of clusters to Chinese customers, and we are considering to do business overseas: http://dyfluid.com/DMCmodel.html
sharonyue is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 17:18
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


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