CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   calc of mass flux (http://www.cfd-online.com/Forums/openfoam-programming-development/68208-calc-mass-flux.html)

mabinty September 10, 2009 06:01

calc of mass flux
 
dear all!!

I added the in http://www.cfd-online.com/Forums/ope...-values-2.html posted codes into chtMultiRegionFoam to get the net mass flux in the fluid region(s) (see code-sniped below).

************************************************** ******************************
// --- PIMPLE loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
forAll(fluidRegions, i)
{
Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl;
#include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
#include "solveFluid.H"
wordList globalBoundaryList;
globalBoundaryList = buildGlobalBoundaryList(fluidRegions[i]);
#include "calculateMassFlux.H"
}

........

}

************************************************** ********************************

it compiles but gives me the following warnings:

************************************************** *******************************
fluid/setRegionFluidFields.H: In function ‘int main(int, char**)’:
fluid/setRegionFluidFields.H:1: warning: unused variable ‘mesh’
fluid/setRegionFluidFields.H:5: warning: unused variable ‘K’
fluid/setRegionFluidFields.H:6: warning: unused variable ‘U’
fluid/setRegionFluidFields.H:7: warning: unused variable ‘phi’
fluid/setRegionFluidFields.H:8: warning: unused variable ‘g’
fluid/setRegionFluidFields.H:10: warning: unused variable ‘turb’
fluid/setRegionFluidFields.H:11: warning: unused variable ‘DpDt’
fluid/setRegionFluidFields.H:14: warning: unused variable ‘psi’
fluid/setRegionFluidFields.H:15: warning: unused variable ‘h
************************************************** *******************************

but the code is apparently running. should I still care about the warnings, or did I oversee something??

greatly appreciate your comments!

aram

santiagomarquezd October 27, 2009 15:43

Hello Aram... This kind of warning has the aim of remember you that there are some defined variables that you aren't using. For example:

Code:

int a=2;
int b=4;
int g;

printf("2 by 4 is %d: \n",a*b);

if you put this in a main, etc. and compile it you'll receive a warning because the non-utilization of g. These messages warns you about defining variables and then forget the code associate to them, erasing by error or simply for leave code without use. These warnings don't impede your code to be compiled and ran, but it's a good practice to avoid warnings.

Try it and share your conclusions, it's important to close the question appropriately.

Regards.

mabinty October 28, 2009 05:43

Hi Santiago,

thank you very much for your comments!!! Thats what I assumed, that the variables mesh, K, U etc. are "not used". That again made me to be sceptical as these variables (defined in "setRegionFluidFields.H") are then used in "readFluidMultiRegionPIMPLEControls.H" and "solveFluid.H" to solve U-Equation, h-Equation etc; and indeed when I comment the reportedly "unnused" variables in "setRegionFluidFields.H" I get an error ("not declared in this scope"). BTW, this is also the case when I remove the modifications for the calculation of the mass-flux ....

Appreciate your comments,
Aram

niklas October 29, 2009 03:54

Has anyone any experience with calculating the mass flow/volume flow in paraview?

I've used the 'Surface Flow' filter, but the accuracy is really bad.

I've come up with a way which seems abit more accurate.
You calculate the Normals of the Slice.
You dot it with U to calculate flux, i.e flux=U.Normals, and
then you use the filter 'integrate variables'
It's still a bit sensitive to where I create the slice, but far less than the 'Surface Flow' filter.

Anyone know a better approach I would be happy to hear it.


All times are GMT -4. The time now is 22:05.