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/)
-   -   How to get conditional minima and maxima? (https://www.cfd-online.com/Forums/openfoam-programming-development/149097-how-get-conditional-minima-maxima.html)

raunakbardia February 25, 2015 16:58

How to get conditional minima and maxima?
 
Hi everyone,

I am a beginner in OpenFoam and I am having troubles with a simple problem of droplet collision.

I am trying to find the minimum x coordinate where phase 1 exists and maximum x coordinate where phase 1 exists in the entire domain for my two phase interfoam simulation.

Here is that code:

volVectorField centres = alpha1.mesh().C();
volScalarField xcomp = centres.component(0);

xl = 100;
xr = -100;

forAll (alpha1.internalField(), nCells)
{
if(alpha1.internalField()[nCells] > 0.5)
{
if(xcomp[nCells] < xl.value())
xl.value() = xcomp[nCells];
if(xcomp[nCells] > xr.value())
xr.value() = xcomp[nCells];
}
}

I am logging it separately in a file but I am not getting the correct results. Moreover, for 4000 time steps I am getting 4195 values which is weird because I am logging Kinetic Energy for the entire domain as well and I am getting exactly 4000 values for 4000 time steps.

I am running the simulation on 12 processors. I am not sure if that is the issue because Kinetic Energy seems to be in order.

Any help is appreciated.

Thanks!


All times are GMT -4. The time now is 03:50.