CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   The meanings of diag( ), source( ), psi( ) (http://www.cfd-online.com/Forums/openfoam-programming-development/86170-meanings-diag-source-psi.html)

cfd_explorer March 16, 2011 07:25

The meanings of diag( ), source( ), psi( )
 
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

sleepdeprivation March 16, 2011 10:46

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

santiagomarquezd March 16, 2011 13:08

Hi,

Quote:

Originally Posted by cfd_explorer (Post 299640)
================================================== ==========
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.

cfd_explorer March 17, 2011 05:56

Quote:

Originally Posted by santiagomarquezd (Post 299717)
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 Ψ ?


luckycfd September 19, 2013 13:53

Quote:

Originally Posted by cfd_explorer (Post 299807)
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


All times are GMT -4. The time now is 14:55.