CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to get conditional minima and maxima?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 25, 2015, 17:58
Default How to get conditional minima and maxima?
  #1
Member
 
Raunak Bardia
Join Date: Jan 2015
Posts: 32
Rep Power: 11
raunakbardia is on a distinguished road
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!
raunakbardia is offline   Reply With Quote

Reply

Tags
conditional if statement, coordinates, logfile, maximum, minimum


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TVD student Main CFD Forum 6 September 9, 2002 10:19
finite volume mehdi Main CFD Forum 12 June 2, 2000 21:32


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