Click here to load reader
POLITECNICO DI MILANO CHALMERS
OpenFOAM postprocessing and advancedrunning options
Gianluca Montenegro
Department of EnergyPolitecnico di Milano
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThe post processing tool: paraFoam
The main post-processing tool provided with OpenFOAM is the reader module to runwith ParaView, an open-source, visualization application
The module is compiled into 2 libraries, PVFoamReader and vtkFoam, using version2.4.4 of ParaView supplied with the OpenFOAM release
ParaView uses the Visualization Toolkit (VTK) as its data processing and renderingengine and can therefore read any data in VTK format
OpenFOAM includes the foamToVTK utility to convert data from its native format toVTK format, which means that any VTK-based graphics tools can be used topost-process OpenFOAM cases. This provides an alternative means for usingParaView with OpenFOAM
paraFoam is strictly a script that launches ParaView using the reader module suppliedwith OpenFOAM
It is executed like any of the OpenFOAM utilities with the root directory path and thecase directory name as arguments:
paraFoam <root> <case>
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSBefore starting
Before starting with the user should copy two tutorials in his own run folder:
cp -r $FOAM_TUTORIALS/simpleFoam/pitzDaily/ $FOAM_RUN/cp -r $FOAM_TUTORIALS/dieselFoam/aachenBomb $FOAM_RUN/
SimpleFoam is an incompressible steady-state flow solver, while dieselFoam isdedicated to combustion process with spray injection
The two cases should also be executed
runblockMesh . pitzDailysimpleFoam . pitzDailyblockMesh . aachenBombdieselFoam . aachenBomb
The user should care about reducing the endTime and the writeInterval to haveimmediately some calculations to post process for the pitzDaily case
For the aachenBomb case the user should switch off the chemistry to reduce thecomputational time
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing the mesh
The mesh can be viewed only in paraFoam since there is no pre-processing tool toview the mesh
We shall start with the pitzDaily case of the simpleFoam tutorial:
paraFoam $FOAM RUN/ pitzDaily
Click the Accept button which will bring up an image of the case geometry in the imagedisplay window.
In the parameters panel it is possible to choose what you can visualize:
the time step
the region
the vol field
the point field if exists
To visualize the mesh make sure that all the regions are toggled on
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThe post processing tool: paraFoam
When paraView is launched the case is controlled from the left panel, which containsthe following:
Selection Window lists the modules opened in ParaView, where the selectedmodules are highlighted in yellow and the graphics for the given module can beenabled/disabled by clicking the eye button alongside
Parameters panel contains the input selections for the case, such as times,regions and fields
Display panel controls the visual representation of the selected module, e.g.colors
Information panel gives case statistics such as mesh geometry and size
ParaView operates a tree-based structure in which data can be filtered from the top-level case module to create sets of sub-modules
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing the mesh
Select property and wireframe of surface to visualize the mesh. Play wit theactor color menu to select the color you prefer
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing the mesh
To improve the quality of the mesh Visualization it is possible to overlap the surface ofyour mesh
Select the extract parts from the filter menu and then select surfacevisualization of the mesh. Play with the color option to create the desired contrast
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: display panel
The Display panel contains the settings for visualizing the data/fields for a given casemodule. The following points are particularly important:
the data range is not automatically updated to the max/min limits of a field, so theuser should take care to select Edit Color Map and Reset range at appropriateintervals, in particular after loading the initial case module
the style of legend, e.g. font, for the color bar is controlled by in the Scalar Barpanel of the Edit Color Map window
the underlying mesh can be represented by selecting Wireframe in theRepresentation menu
the geometry, e.g. a mesh (if Wireframe is selected), can be visualized as a singlecolor by selecting Property from the Color by menu and specifying the Actor color
the image can be made translucent by editing the value in Opacity (1 = solid, 0 =invisible)
the activated field can be translated, scaled, rotated with respect the other ones
In the color windows it is possible to select the field that the user wants to plot
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: vectorFields (U)
Selecting the velocity field from the color window in the display panel, two options areavailable:
point volPointInterpolate , the velocity field is defined on the grid vertex andinterpolated from the cell centers
cell U the velocity field is displayed in the cell center
It is possible to visualize only the magnitude of velocity, without any information aboutthe direction of the velocity vector:
magU . pitzDaily
Time = 50Reading UCalculating magU
mag(U): max: 10.619 min: 0.12244
Then select the magU filed in the color window
If you run the magU utility after having launched paraFoam you will need to change thetime step or to update the GUI to visualize the new field
Alternatively the user may use the calculator filter. Keep in mind that it works only forthe selected time step
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: vectorFields (U)
To visualize the velocity filed as a field of vectors you must act on filters once again:
The user must first create a filter to select the quantities in the cell centers
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: vectorFields (U)
Starting from the cell center filtered field, the user must select the Glyphs filter andthen accept
The vector field will be displayed in the window on the right
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: glyphs (U)
The filter reads an Input and offers a range of Glyphs for which the Arrow0 provides aclear vector plot images
In the Orient/Scale window, the most common options for Scale Mode are: VectorMagnitude, where the glyph length is proportional to the vector magnitude, whereasselecting Data Scaling Off each glyph is the same length
An additional Scale Factor parameter controls the base length of the glyphs
It is possible to select the maximum number of Glyphs to be displayed. Putting anumber lower than the cell number can speed up the visualization
Other option rather than arrows are available: cones, cubes, lines, spheres andarrow2d
It is possible to select the glyphs filter directly from the ParaView toolbar:
Glyphs button
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: contour plots
A contour plot is created by selecting Contour from the Filter menu at the top menu bar
Iso−surface button
The filter acts on a given module so that, if the module is the 3D case module itself, thecontours will be a set of 2D surfaces that represent a constant value, i.e. isosurfaces
The Parameters panel for contours contains the list of constant values, that the usercan edit, most conveniently by the Generate range of values window. The Input andScalars menus present the module and fields, respectively, that are read by the filter
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: streamlines
Streamlines are created by first creating an append attributes filter
Streamlines are created selecting the tracer lines using the Stream Tracer filter
The tracer Seed window specifies a distribution of tracer points over a Line or PointCloud
The distance the tracer travels and the length of steps the tracer takes are specified inthe text boxes below
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: probes
To plot a graph in ParaView, the users must first extract the internal mesh using theExtract Parts filter
The user can then plot a graph by selecting Probe from the Filter menu
In the Probe Object window, the user should select Line and position the line verticallyup the center of the domain with a resolution of 50
The fields that are plotted are selected in the Point scalars window of the Probe panel
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: probes
The user can select the probe filter directly by clicking onto the probes button on thetoolbar
Sample button
It is possible to write the selected sampled fields onto a csv file. The output will be acomma separated file as follows:
volPointInterpolate(p),0.200097,5.12835,8.24178,10.3533,...volPointInterpolate(magU),8.63369,8.13691,7.70859,7.37819,....volPointInterpolate(epsilon),48.1914,52.6348,59.0361,67.6491,7,...volPointInterpolate(k),1.08187,1.13229,1.19894,1.28333,1.3918,...
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: Data analysis
To plot field values in a certain point (cell, vertex, line) as a function of time (plottedtime steps) the user can select the filter Data analysis form the filter menu or byclicking onto the Data Analysis button on the toolbar:
Data analysis
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing fields: probes
Pick the cell you want to select by positioning the pointer onto it and pressing the p key(pick)
The user can pick the cell by means of different query methods: cell, point(interpolated), line, cell ID, point ID
Plotted fields can be activated or deactivated
The time period can be selected by acting on the slide bar in thetemporal parameters window
Once again the plotted fields can be written onto a csv file by clicking thesave as CSV button
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSCut planes
To create a contour plot across a plane rather than producing isosurfaces, the usermust first use the Cut filter to create the cutting plane, on which the contours can beplotted
The Cut filter allows the user to specify acutting Plane or Sphere in the Cut Func-tion menu by a center and normal/radiusrespectively
The user can then run the Contour fil-ter on the cut plane to generate contourlines
Multiple cut planes can be generatedusing the Add value or the Generaterange of values sub panel
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSClip filter
The Clip filter works similarly to the Cut one, but keeps the mesh and fieldinformation on one side of the cutting plane
The Clip filter allows the user to specifya cutting Plane, Sphere, Box or on thebasis of a value for a scalar field
The clip selection can be inverted byactivating the Inside out option
The visibility option allows the user toactivate or deactivate the visibility of thecutting plane, sphere or box
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThreshold
The Threshold filter allows to visualize only the cells having the values of theselected field within a specified range
The range can be specified by means of moving the Upper threshold and lowerthreshold bars
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSVisualizing Lagrangian
To visualize the Lagrangian particle tracking the case must be converted into paraviewformat
The user should run the application foamToVTK on the case containing the Lagrangianparticle tracking (in our case the aachenBomb tutorial for the dieselFoam application)
foamToVTK . aachenBomb
This command will generate an additional folder named VTK inside the case directory
The user must start paraview typing the following command:
paraview
The case can be opened clicking on the file menu, open, and selecting the VTKdirectory. By clicking on the *.vtk file the case will be opened
The user may load all the time steps by clicking on the timesteps button and selectingthe Add all choice on the new window
The use must then open the files contained in the lagrangian directory inside the VTKfolder
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSVisualizing Lagrangian
To display the particles the user must filter the lagrangian field with the Glyphs filter
Then the scalar option must be selected in the scale mode window along with thespheres as glyphs
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThe 3D view button
There are settings controlling the 3D view Properties, selected from the View menu, oralternatively by clicking the small 3D View toggle button at the top left of the imagedisplay window
The General panel includes the following items which are often worth setting at startup
the background color, where white is often a preferred choice for printed material
Use parallel projection which is the usual choice for CFD, especially for 2D cases
the level of detail (LOD) which controls the rendering of the image while it is beingmanipulated, e.g. translated, resized, rotated; lowering the levels set by thesliders, allows cases with large numbers of cells to be re-rendered quickly duringmanipulation
The Annotate panel includes options for including annotations in the image
The Display Orientation Axes feature is particularly useful.
The Camera panel includes buttons of Standard Views, settings for Camera Controlsand the options for detailed Camera Orientation
The user can store up to 6 camera positions by clicking on a given button using theright mouse button, for subsequent retrieval using the left mouse button
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing sets with paraview
The user may create sets (pintSet, faceSet and cellSet) to perform certain additionaloperation over the fields, i.e. moving certain points or applying a source term only in acertain area
A set, i.e. a cellSet, can be created in OpenFOAM using the command cellSet
$FOAM_APP/utilities/mesh/manipulation/cellSet
This application creates a list of cells on the base of data read from the cellSetDictfile
The user shall try to create a new cellSet in the pitzDaily tutorial case
runcp -r $FOAM_TUTORIAL/simpleFoam/pitzDailycd pitzDaily/systemcp $FOAM_UTILITIES/mesh/manipulation/cellSet/cellSetDict .
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing sets with paraview
The user must modify the cellSetDict file in the following way:
// Name of set to operate onname myCellSet;
// One of clear/new/invert/add/delete|subset/listaction new;
topoSetSources(
// Cells with cell centre within boxboxToCell{
box (-0.05 -0.25 -0.001) (0.1 0.25 0.001);}
);
To create the cell set the user must run the cellSet application
cellSet . pitzDaily
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSViewing sets with paraview
Once the cellSet has been created run the foamToVTK command on the pitzDailycase using the cellSet option:
foamToVTK . pitzDaily -cellSet myCellSet
To know all the available option of the foamToVTK application type foamToVTK andpress enter. It will be displayed the usage of that application
Usage: foamToVTK <root> <case> [-surfaceFields] [-ascii][-faceSet faceSet name] [-mesh mesh name] [-nearCellValue][-pointSet pointSet name] [-excludePatches patches to exclude][-allPatches] [-cellSet cellSet name] [-parallel] [-fields fields][-constant] [-noPointValues] [-latestTime] [-noInternal] [-time time]
To visualize the cellSet the user must open the VTK folder (it works also form a alreadyopened paraFoam windows) in the pitzDaily directory and select the file with the nameof the cellSet: myCellSet_*.*
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSData manipulation
It possible to rely on data manipulation utilities which OpanFOAM provides inside itsutilities folder
OpenFOAM utilities can also be copied and customized to create user defined utilities
An example could be the ptot utilities which calculates the total pressure starting fromthe velocity and pressure field
$FOAM_UTILITIES/postProcessing/miscellaneous/ptot
It is also possible to export data to be visualized with other post-processing tools
>cd $FOAM_UTILITIES/postProcessing/dataConversion>lsfoamDataToFluent foamToFieldview9 foamToVTKfoamToEnsight foamToGMV smapToFoam
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel
The method of parallel computing used by OpenFOAM is known as domaindecomposition, in which the geometry and associated fields are broken into pieces andallocated to separate processors for solution
The first step is to decompose the domain using the decomposePar utility
The user must edit the dictionary associated with decomposePar nameddecomposeParDict which is located in the system directory of the case
The first entry is numberOfSubdomains which specifies the number of sub-domainsinto which the case will be decomposed, usually corresponding to the number ofprocessors available for the case
The parallel running uses the public domain openMPI implementation of the standardmessage passing interface (MPI)
The process of parallel computation involves: decomposition of mesh and fields;running the application in parallel; and, post-processing the decomposed case
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel
We shall use the pitzDaily case for the simpleFoam application tutorial
tutcd simpleFoamcd pitzDaily
We can copy the pitzDaily case to the pitzDailyParallel
cp -r pitzDaily pitzDailyParallel
And copy into the system directory the directory the decomposeParDict file available inthe pitzdailtExptInlet case
cp pitzDailyExptInlet/system/decomposeParDict pitzDailyParallel/system/
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: domain decomposition
The mesh and fields are decomposed using the decomposePar utility
The underlying aim is to break up the domain with minimal effort but in such a way toguarantee a fairly economic solution
The geometry and fields are broken up according to a set of parameters specified in adictionary named decomposeParDict that must be located in the system directoryof the case of interest
In the decomposeParDict file the user must set the number of domains which thecase should be decomposed into: usually it corresponds to the number of coresavailable for the calculation
numberOfSubdomains 2;
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: domain decomposition
The user has a choice of four methods of decomposition, specified by the methodkeyword
For each method there are a set of coefficients specified in a sub-dictionary ofdecompositionDict, named <method>Coeffs, used to instruct the decompositionprocess
method simple/hierarchical/metis/manual;
simple : simple geometric decomposition in which the domain is split into piecesby direction, e.g. 2 pieces in the x direction, 1 in y etc.
hierarchical : Hierarchical geometric decomposition which is the same as simpleexcept the user specifies the order in which the directional split is done, e.g. first inthe y-direction, then the x-direction etc
metis : METIS decomposition which requires no geometric input from the user andattempts to minimize the number of processor boundaries. The user can specify aweighting for the decomposition between processors which can be useful onmachines with differing performance between processors
manual : Manual decomposition, where the user directly specifies the allocation ofeach cell to a particular processor
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: domain decomposition
The coefficients sub-dictionary for the simple method are set as follows:
simpleCoeffs{
n (2 1 1);delta 0.001;
}
Where n is the number of sub-domains in the x, y, z directions (nx ny nz) and delta isthe cell skew factor, typically 10−3
The coefficients sub-dictionary for the hierarchical method are set as follows:
hierarchicalCoeffs{
n (2 2 1);delta 0.001;order xyz;
}
Where n is the number of sub-domains in the x, y, z directions, delta is the cell skewfactor and order is the order of decomposition xyz/xzy/yxz...
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: domain decomposition
The coefficients sub-dictionary for the metis method are set as follows:
metisCoeffs{
processorWeights(
1...1
);}
It is the list of weighting factors for allocation of cells to processors: <wt1> is theweighting factor for processor 1, etc.
The coefficients sub-dictionary for the manual method contains the reference to a file
manualCoeffs{
dataFile "<fileName>";}
It is the name of file containing data of allocation of cells to processors
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: domain decomposition
Data files may need to be distributed if only local disks are used in order to improveperformance
The root path to the case directory may differ between machines. The paths must thenbe specified in the decomposeParDict dictionary using distributed and rootskeywords
The distributed entry should read
distributed yes;
and the roots entry is a list of root paths, <root0>, <root1>, . . . , for each node
roots<nRoots>("<root0>""<root1>"...);
where <nRoots> is the number of roots
Each of the processorN directories should be placed in the case directory at each ofthe root paths specified in the decomposeParDict dictionary
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: domain decomposition
The decomposePar utility is executed in the normal manner by typing
decomposePar <root> <case>
The output will look like:
Calculating distribution of cellsSelecting decompositionMethod metis...Processor 0
Number of cells = 6199Number of faces shared with processor 1 = 71Number of processor patches = 1Number of processor faces = 71Number of boundary faces = 12667
Processor 1Number of cells = 6026Number of faces shared with processor 0 = 71Number of processor patches = 1Number of processor faces = 71Number of boundary faces = 12343
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: domain decomposition
On completion, a set of subdirectories will have been created, one for each processor,in the case directory
The directories are named processorN where N = 0, 1, ... represents a processornumber and contains a time directory, containing the decomposed field descriptions,and a constant/polyMesh directory containing the decomposed mesh description.
pitzDailyParallel|------> 0|------> constant|------> processor0|------> processor1|------> system
openMPI can be run on a local multiprocessor machine very simply but when runningon machines across a network, a file must be created that contains the host names ofthe machines. The file can be given any name and located at any path
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: execution
An application is run in parallel using the mpirun command:
mpirun --hostfile <machines> -np <nProcs> <foamExec><root> <case> <otherArgs> -parallel > log
where: <nProcs> is the number of processors; <foamExec> is the executable, e.g.simpleFoam; and, the output is redirected to a file named log.
The <machines> file contains the names of the machines listed, one machine per line
The names must correspond to a fully resolved hostname in the /etc/hosts file of themachine on which the openMPI is run. The <machines> file would contain:
hostname1hostname2 cpu=2hostname3
In our case it becomes:
mpirun -np 2 simpleFoam . pitzDailyParallel -parallel > log &
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: post-processing
When post-processing cases that have been run in parallel the user has two options:
reconstruction of the mesh and field data to recreate the complete domain andfields, which can be post-processed as normal;
post-processing each segment of decomposed domain individually
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSRunning in parallel: post-processing
After a case has been run in parallel, it can be reconstructed for post-processing bymerging the sets of time directories from each processorN directory into a single set oftime directories
The reconstructPar utility performs such a reconstruction by executing the command:
reconstructPar <root> <case>
In our case it will become:
reconstructPar . pitzDailyParallelTime = 0Reconstructing FV fields
Reconstructing volScalarFieldsp
.....Reconstructing volVectorFields
UReconstructing volTensorFields
RNo point fieldsNo lagrangian fields
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThe sample utility
OpenFOAM provides the sample utility to sample field data for plotting on graphs
The sampling locations are specified for a case through a sampleDict dictionarylocated in the case system directory
The data can be written in a range of formats including well-known graphing packagessuch as Grace/xmgr, gnuplot and jPlot
The sampling can be executed by running the utility application sample according tothe application syntax
sample . pitzDaily
The sampleDict dictionary can be generated with the standard set of keyword entriesusing FoamX, or by copying a detailed sampleDict from a the sample utility folder:
$FOAM_UTILITIES/postProcessing/miscellaneous/sample
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThe sampleDict file
The sampleDict contains entries to be set according to the user needs
interpolationScheme cellPoint;
The choice for the interpolationScheme can be one of the following:
cell : use cell-centre value only, constant over cells, no interpolation at all
cellPoint : use cell-centre and vertex values
cellPointFace : use cell-centre, vertex and face values
Vertex values are determined from neighboring cell-centre values whereas face valuesdetermined using the current face interpolation scheme for the field (linear, gamma,etc.)
writeFormat raw;
The choice for the write format depends on the application used to plot the series. Theuser can choose one of the following:
xmgr
jplot
gnuplot
raw
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThe sampleDict file
The sampleDict file contains a sampleSet subdictionary which defines where thefields should be sampled
sampleSets(
uniform{
name data;axis x;start (-0.0206 0 0);end (0.29 0 0);nPoints 1000;
})
In this subdictionary the user can specify the type of sampling method, the name ofsamples and how to write point coordinate plus other parameters depending on themethod chosen
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThe sampleDict file
The user may choose one of the following sampling methods:uniform : evenly distributed points on lineface : one point per face intersectionmidPoint : one point per cell, in between two face intersectionsmidPointAndFace : combination of face and midPointcurve : specified points, not necessary on line, uses trackingcloud : specified points, uses findCell
name lineX1;
The name entry is typically a filename. After running the sample application the userwill find a new folder in the case directory named sample
Each data file is given a name containing the field name, the sample set name, and anextension relating to the output format, including .xy for raw data, .agr for Grace/xmgrand .dat for jPlot
axis distance;
Specifies how to write point coordinates, options are:x/y/z: x/y/z coordinate onlyxyz: three columnsdistance: distance from start of sampling line (if uses line) or distance from firstspecified sampling point
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSThe sampleDict file
There are also some type specific options:
start and end coordinate for uniform, face, midPoint and midPointAndFace
nPoints number of sampling points for uniform
list of coordinates for curve and cloud
The fields list contains the fields that the user wishes to sample
fields(
pmag(U)U.component(1)R.component(0)
);
The sample utility can parse the following restricted set of functions to enable the userto manipulate vector and tensor fields
U.component(n) writes the nth component of the vector/tensor
mag(U) writes the magnitude of the vector/tensor
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSProbes
To plot values of fields as functions of the time the user can rely on the newfunctionObject class
This is a modular plugin that evaluates at every time step the specified field at thespecified location
Function objects are created adding them to a function subdict in the controlDict file
The user may find an example of how to modify the controlDict file in$FOAM_TUTORIAL/oodles/pitzDaily/ case
This function cannot parse the set of functions as the sample utility does, however inthe case of the Ux component extraction the user can easily do that for the U probedfield
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSProbes
functions(
probes1{
type probes; // Type of functionObject// Where to load it from (if not already in solver)functionObjectLibs ("libsampling.so");probeLocations // Locations to be probed. runTime modifiable!(
(0.1778 0.0253 0.0));// Fields to be probed. runTime modifiable!fields(
p);
});
During the job run it will be created, inside the case directory, a folder named probescontaining the probed values
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSfoamLog
There are limitations to monitoring a job by reading the log file, in particular it is difficultto extract trends over a long period of time
The foamLog script is therefore provided to extract data of residuals, iterations, Courantnumber etc. from a log file and present it in a set of files that can be plotted graphically
The user must run the application in the following manner:
simpleFoam . pitzDaily > log
Where the log file can be named arbitrarilyThe script is executed by
foamLog <root> <case> <logFile>
The files are stored in a subdirectory of the case directory named logs
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options
POLITECNICO DI MILANO CHALMERSfoamLog
Once the log file has been created the foamLog must be executed to generate therequired statistics
foamLog <root> <case> <logFile>
The files are stored in a subdirectory of the case directory named logs
Each file has the name <var> <subIter> where <var> is the name of the variablespecified in the log file and <subIter> is the iteration number within the time step
Those variables that are solved for, the initial residual takes the variable name <var>and final residual takes ¡var¿FinalRes. By default, the files are presented intwo-column format of time and the extracted values
>cd pitzDaily>ls
contCumulative_0 epsilonIters_0 kIters_0 Time_0 UyFinalRes_0contGlobal_0 executionTime_0 p_0 Ux_0 UyIters_0contLocal_0 foamLog.awk pFinalRes_0 UxFinalRes_0epsilon_0 k_0 pIters_0 UxIters_0epsilonFinalRes_0 kFinalRes_0 Separator_0 Uy_0
Gianluca Montenegro/ OpenFOAM postprocessing and advanced running options