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/)
-   -   Calculate flowrate of a scalarField (https://www.cfd-online.com/Forums/openfoam-post-processing/233876-calculate-flowrate-scalarfield.html)

Andrea23 February 15, 2021 13:19

Calculate flowrate of a scalarField
 
Hi,

with "flowRatePatch" postprocess function you can calculate the volumetric or mass flow rate through a patch, reading the phi scalarfield. I want to calculate the flowrate of a concentration (scalarfield T).

There is a postprocess function to calcolate the flowrate of phi*T?

or there is a way to multiply these 2 fields? the problem is that T has 1 value per cell, phi has 1 value per face so it has to be a openfoam function that associate cell T value with phi value of cell faces

Thanks

HPE February 15, 2021 14:43

Maybe helps?

- surfaceInterpolate function object to obtain (somewhat) equivalent surface field values from volumetric field values (using T).
- Multiply the two fields (surfaceInterpolated T and phi) by using `multiply` function object.

Andrea23 February 15, 2021 16:24

Quote:

Originally Posted by HPE (Post 796276)
Maybe helps?

- surfaceInterpolate function object to obtain (somewhat) equivalent surface field values from volumetric field values (using T).
- Multiply the two fields (surfaceInterpolated T and phi) by using `multiply` function object.

Thanks for the reply;

calcolate surfaceInterpolated and multiplying for phi is the same as multiply T cellcenter value for phi?
if yes, I have to write this in controlDict

Quote:

surfaceInterpolate1
{
// Mandatory entries (unmodifiable)
type surfaceInterpolate;
libs (fieldFunctionObjects);

// Mandatory entries (runtime modifiable)
fields (T phiT);

// Optional (inherited) entries
region region0;
enabled true;
log true;
timeStart 0;
timeEnd 1000;
executeControl timeStep;
executeInterval 100; //if i want the field every 100 time step
writeControl timeStep;
writeInterval 100;
}
but I haven't find documentation for "multiply", do you know how it works?

as last step after I have the new volScalarField I rename it as "phi" and use "flowRatePatch", right?

HPE February 15, 2021 16:58

For the first question: dont know.

For the second question: Please see incompressible/pisoFoam/RAS/cavity tutorial's controlDict.

Andrea23 February 16, 2021 04:47

Quote:

Originally Posted by HPE (Post 796288)
For the first question: dont know.

For the second question: Please see incompressible/pisoFoam/RAS/cavity tutorial's controlDict.

I have checked incompressible/pisoFoam/RAS/cavity but there isn't multiply in controlDict, I even tried using -help and foamInfo but it didn't find anything. I am using openFoam 8

I tried this too

Quote:

functions
{
functionObjectLibs("libutilityFunctionObject.so")
type coded;
name phiT;
writeControl runTime;
writeInterval 100;

codeWrite
{

surfaceScalarField phiT
(
IOobject
(
"phiT"
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),

mesh().lookupObject<surfaceScalarField>("phi") * mesh().lookupObject<volScalarField>("T")
);
phiT.write()
};
}
But I had an error "ill defined primitiveEntry startin at keyowrd surfaceScalarField

and probably I have to use

Quote:

mesh().lookupObject<volScalarField>("T")
mesh().lookupObject<surfaceScalarField>("phi")

phi*(fvc::interpolate(T) & mesh.Sf())
but I am not sure if it works, can I use fvc:: in controlDict?

Andrea23 February 16, 2021 09:40

the answer is in this post:

https://www.cfd-online.com/Forums/op...tml#post796329


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