CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

laplacian(rAU, p) == fvc::div(phiHbyA)?

Register Blogs Community New Posts Updated Threads Search

Rate this Entry

laplacian(rAU, p) == fvc::div(phiHbyA)?

Posted May 28, 2022 at 18:13 by Mars409

Quote:
Originally Posted by sharonyue View Post
Hi,

In icoFoam's code, we have:
Code:
fvScalarMatrix pEqn
                (
                    fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
                );
Why its not div(HbyA) as of the equation in the image?

This equation is deduced by myself. If it was wrong just correct me.
Though 9 yrs old, this question is worth leaving a note for, bc I will forget.

The argument of fvc::div(phiHbyA) is declared as a surfaceScalarField:
Code:
const surfaceScalarField& phiHbyA,
in constrainPressure().

That gives a hint that the class function fvc::div() must have a constructor that takes a surfaceScalarField and return a volVectorField by summing the 6 surface fluxes of each cell and dividing by the cell's volume, to finish the job of computing the divergence of a volume vector field by way of the total surface flux of the cell divided by the cell volume.

The openFoam.com code browser indeed points to https://www.openfoam.com/documentati...ce.html#l00161
Code:
namespace fvc
 {
  
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  
 template<class Type>
 tmp<GeometricField<Type, fvPatchField, volMesh>>
 div
 (
     const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
 )
 {
     return tmp<GeometricField<Type, fvPatchField, volMesh>>
     (
         new GeometricField<Type, fvPatchField, volMesh>
         (
             "div("+ssf.name()+')',
             fvc::surfaceIntegrate(ssf)
         )
     );
 }
and from there points to https://www.openfoam.com/documentati...ce.html#l00046, where indeed it looks like that's done:

Code:
  namespace Foam
 {
  
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  
 namespace fvc
 {
  
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  
 template<class Type>
 void surfaceIntegrate
 (
     Field<Type>& ivf,
     const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
 )
 {
     const fvMesh& mesh = ssf.mesh();
  
     const labelUList& owner = mesh.owner();
     const labelUList& neighbour = mesh.neighbour();
  
     const Field<Type>& issf = ssf;
  
     forAll(owner, facei)
     {
         ivf[owner[facei]] += issf[facei];
         ivf[neighbour[facei]] -= issf[facei];
     }
  
     forAll(mesh.boundary(), patchi)
     {
         const labelUList& pFaceCells =
             mesh.boundary()[patchi].faceCells();
  
         const fvsPatchField<Type>& pssf = ssf.boundaryField()[patchi];
  
         forAll(mesh.boundary()[patchi], facei)
         {
             ivf[pFaceCells[facei]] += pssf[facei];
         }
     }
  
     ivf /= mesh.Vsc();
 }
Posted in Uncategorized
Views 562 Comments 0 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 0

Comments

 

All times are GMT -4. The time now is 04:18.