CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Verifying Mass Flux at Outlet Boundary (https://www.cfd-online.com/Forums/openfoam-programming-development/191104-verifying-mass-flux-outlet-boundary.html)

victorious_BIG July 31, 2017 18:34

Verifying Mass Flux at Outlet Boundary
 
Hi,

I am verifying the calculation of several key quantities in openfoam.

Specifically, I want to make sure that I understood how "phi" is calculated at the boundary faces.

In the code below I expect phi = dot product of face normal vector with velocity * area (phi = A n_i U_i). I have verified this on inlet boundaries, but I am finding that at outlet boundaries phi ~= A n_i U_i. The numbers are very close, but not exact. Does anyone know why?

Thanks for the help!

Code:

const fvBoundaryMesh& boundaryMesh = mesh.boundary();
forAll(boundaryMesh, patchI)
{
const fvPatch& patch = boundaryMesh[patchI];
const fvsPatchField<scalar> &phiCheck =
patch.lookupPatchField<surfaceScalarField, scalar>("phi");
const fvPatchField<vector> &U2 =
patch.lookupPatchField<volVectorField, vector>("U");


forAll(patch, faceI)
{
vector faceNormal = patch.Sf()[faceI];
scalar phiOut = phiCheck[faceI];
vector vel2 = U2[faceI];

Info << "Face Area vector (A n_i): " << faceNormal << endl;
Info << "Velocity (v_i): " << vel2 << endl;
Info << "Phi: " << phiOut << endl;
Info << "Calculated Phi: A n_i & v_i: " << (faceNormal & vel2) << endl;
Info << endl;

}

}

victorious_BIG August 1, 2017 16:45

Update:

I am using the icoFoam solver. I find that if I comment out the "U.correctBoundaryConditions();" line at the bottom of the solver, then my code above does lead to exact agreement between phi and A n_i * U_i.

So, a new question, what exactly is "correctBoundaryConditions()" changing and why doesn't the change seem to propagate out to the patch field values?


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