CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   Sample output at every time step (

gradylemoine October 14, 2013 14:08

Sample output at every time step
Hi all,

I'd like to get output along a line through my problem domain (specifically, I'd like to integrate alpha1 in interFoam along a vertical line to get fluid depth, in the style of waves2Foam), and it looks like the sampledSet approach is the way to do this. I want high resolution in time, though, to compare against experiment, so I was wondering -- is it possible to have OpenFOAM do this at every time step? I don't want to output the whole solution at every time step because it would take too much time and disk space, but output along just a line through the mesh at every step should be fine.


Grady Lemoine

ngj October 14, 2013 14:47

Hi Grady,

You, yourself, mention waves2Foam, and it does provide you with the instantaneous water level based on a vertical integration of the alpha1 field.

I suggest that you look into the waveFlume tutorial to see, how the output control is defined. You want to have it each time step, and it is possible also with the implementation in waves2Foam.

Kind regards


gradylemoine October 14, 2013 16:13

Ah, good to hear; thanks! I hadn't known the option to output at every timestep was available. I take it the waveFlume example is part of waves2Foam? I hadn't known about waves2Foam before this morning; I'll have to take a look and see how it's set up. I've had to do some modification to the interFoam source already to get it to do what I want, so I probably won't migrate to waves2Foam, but I might get some ideas about how to set things up.

gradylemoine October 14, 2013 17:08

I'm taking a look at the waveFlume tutorial, and I don't quite see where the output is specified. I see some references to wave gauges in the controlDict, but it's not clear to me where things go from there. Pardon my ignorance, but could somebody spell out what's going on in that tutorial, and how I could specify output at every time step in an essentially unmodified interFoam?

ngj October 16, 2013 16:16

Hi Grady,

If you open the file, which is pointed to in the controlDict in terms of a relative path, i.e. the file $TUTORIALS/waveFlume/waveGaugesNProbes/surfaceElevationAnyName_controlDict you can see the different options for the output control.

Essentially you merely need to change the option


outputInterval 20;


outputInterval 1;
and the surface elevation is sampled every single time step.

The location of the wave probes and the entire folder waveGaugesNProbes are created with the utility waveGaugesNProbes, which comes with the waves2Foam toolbox. This utility reads the file constant/probeDefinitions, where you can define different distribution patterns for the wave gauges.

If you want to run this in interFoam, i.e. with solvers, which are not compiled with the waves2Foam library/toolbox, then it should be sufficient to add the following line in your controlDict:


libs ( "" "" "" );
That is besides the functions-part, which the waveFlume tutorial gives an example on.

Kind regards


gradylemoine October 16, 2013 17:28

Thanks for the reply. I think I see (at least part of) the issue -- I can't find any directory named waveGaugesNProbes, except for one under the applications tree, which just contains source code. I haven't yet built waves2foam; is that necessary? Or did I download it from the wrong place? I followed the directions on the OpenFOAM wiki, , and checked it out from the svn repo specified.

I've also managed to get help from a more senior colleague, who's done some things a little like this in OpenFOAM in the past, so I should be able to tackle it.

Again, thanks for your time,


All times are GMT -4. The time now is 01:02.