laplacian(rAU, p) == fvc::div(phiHbyA)?
Posted May 28, 2022 at 18:13 by Mars409
Quote:
The argument of fvc::div(phiHbyA) is declared as a surfaceScalarField:
Code:
const surfaceScalarField& phiHbyA,
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)
)
);
}
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();
}
Total Comments 0




