CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   using a function object to calculate the wall heat flux at a certain location (https://www.cfd-online.com/Forums/openfoam-post-processing/222075-using-function-object-calculate-wall-heat-flux-certain-location.html)

AbdulazizAlkandari November 10, 2019 21:35

using a function object to calculate the wall heat flux at a certain location
 
Hi,

I have written a function object which allows me to calculate the average wall heat flux for a whole patch. How can I modify that function object to calculate the average wall heat flux for a specific strip of the same patch , say between x=-0.1 to x=0.1?

Below is the code i used to calculate my heat flux at the patch:

const fvBoundaryMesh& bMesh = mesh().boundary();
const label WallPatchIDB = bMesh.findPatchID("bottomWall");
const fvPatch& WallPatchB = bMesh[WallPatchIDB];

const volScalarField& h = mesh().lookupObject<volScalarField>("h");
const volScalarField& alphaSgs = mesh().lookupObject<volScalarField>("alphat");
const volScalarField& alpha = mesh().lookupObject<volScalarField>("thermo:alpha" );
const surfaceScalarField alphaEff= fvc::interpolate( alpha + alphaSgs );

const surfaceScalarField qMahdi = alphaEff * fvc::snGrad(h);
const scalar qWallBMahdi = gSum( qMahdi.boundaryField()[WallPatchIDB]*WallPatchB.magSf() );
const scalar AfB = gSum( WallPatchB.magSf() );

const scalar WallFluxBMahdi = qWallBMahdi / AfB;


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