Post-Processing: Visualization, Sampling, and Plotting: Eric Paterson Egp@vt - Edu
Post-Processing: Visualization, Sampling, and Plotting: Eric Paterson Egp@vt - Edu
Eric Paterson
egp@vt.edu
ESOP Workshop
5-8 June 2017
Outline
1 Visualization
3 Post-processing functionality
CourantNo Calculates the Courant Number field from the flux field.
Lambda2 Calculates and writes the second largest eigenvalue of the sum of the
square of the symmetrical and anti-symmetrical parts of the velocity
gradient tensor.
MachNo Calculates the Mach Number field from the velocity field.
PecletNo Calculates the Peclet Number field from the flux field.
Q Calculates the second invariant of the velocity gradient tensor.
R Calculates the Reynolds stress tensor field and stores it on the database.
components Writes the component scalar fields (e.g. Ux, Uy, Uz) of a field (e.g. U).
div Calculates the divergence of a field.
enstrophy Calculates the enstrophy of the velocity field.
flowType Calculates and writes the flowType of velocity field where: -1 = rotational
flow; 0 = simple shear flow; +1 = planar extensional flow.
Eric Paterson (Virginia Tech AOE) postProcessing 5-8 June 2017 5 / 27
Field calculation [2]
flowRatePatch Calculates the flow rate through a specified patch by summing the flux
on patch faces. For solvers where the flux is volumetric, the flow rate is
volumetric; where flux is mass flux, the flow rate is mass flow rate.
fvolFlowRateSurface Calculates volumetric flow rate through a specified triangulated
surface by interpolating velocity onto the triangles and integrating over
the surface area. Triangles need to be small for an accurate result.
singleGraph Writes graph data for specified fields along a line, specified by start and
end points.
cellMax Writes out the maximum cell value for one or more fields.
ccellMin Writes out the minimum cell value for one or more fields.
cfaceMax Writes out the maximum face value for one or more fields.
cfaceMin Writes out the minimum face value for one or more fields.
cminMaxComponents Writes out the minimum and maximum values, by component for
non-scalar fields, and the locations where they occur.
cminMaxMagnitude Writes out the minimum and maximum values, by magnitude for
non-scalar fields, and the locations where they occur.
residuals For specified fields, writes out the initial residuals for the first solution of
each time step; for non-scalar fields (e.g. vectors), writes the largest of
the residuals for each component (e.g. x, y, z).
streamlines Writes out files of streamlines with interpolated field data in VTK format.
surfaces Writes out surface files with interpolated field data in VTK format, e.g.
cutting planes, iso-surfaces and patch boundary surfaces.ld.
When a user wishes to process data during a simulation, they need to configure
the case accordingly.
The configuration process is as follows, using an example of monitoring flow rate
at an outlet patch named outlet.
Firstly, the user should include the flowRatePatch function in functions
sub-dictionary in the case controlDict file, using the #includeFunc directive.
functions
{
#i n c l u d e F u n c flowRatePatch
}
That will include the functionality in the flowRatePatch configuration file,
located in the directory hierarchy beginning with
$FOAM_ETC/caseDicts/postProcessing .
Eric Paterson (Virginia Tech AOE) postProcessing 5-8 June 2017 16 / 27
Run–time data processing [2]
Option 2 for specifying the patch name is to provide the name as an argument to
the flowRatePatch in the #includeFunc directive, using the syntax
keyword=entry.
functions
{
#i n c l u d e F u n c f l o w R a t e P a t c h ( name=o u t l e t )
}
I personally like Option 1. It requires the code to be copied into the system
directory and is more explicit and aids my memory in what was done if I come
back to the case after some length of time.
Also, some functions require the setting of many parameters, e.g.
forces , forceCoeffs , surfaces , etc. For those functions, it is more reliable
and convenient to copy and configure the function using Option 1 rather than
through arguments.
Eric Paterson (Virginia Tech AOE) postProcessing 5-8 June 2017 18 / 27
The postProcess utility[1]
The user can execute post-processing functions after the simulation is complete
using the postProcess utility.
Let us illustrate the use of postProcess using the pitzDaily case from the
tutorials directory.
The case can be copied, e.g. into the user’s run directory; the user can then go
into the case directory, generate the mesh with blockMesh and then run
simpleFoam
% run
% cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily
% cd pitzDaily
% blockMesh
% simpleFoam
% postProcess -func "mag(U)"
% postProcess -func "flowRatePatch(name=outlet)"
There are a set of general post-processing functions for sampling data across the
domain for graphs and visualization.
Several functions also provide data in a single file, in the form of time versus
values, that can be plotted onto graphs.
This time-value data can be monitored during a simulation with the
foamMonitor script.
The functions for probing data are boundaryCloud , internalCloud and probes
All functions work on the basis that the user provides some point locations and a list of fields,
and the function writes out values of the fields at those locations
This time-value data can be monitored during a simulation with the foamMonitor script.
probes identifies the nearest cells to the probe locations and writes out the cell values;
data is written into a single file in time-value format, suitable for plotting a graph.
boundaryCloud and internalCloud interpolate field data to the probe locations, with the
locations being snapped onto boundaries for boundaryCloud ; data sets are
written to separate files at scheduled write times
Generally probes is more suitable for monitoring values at smaller numbers of locations, whereas
the cloud functions are typically for sampling at large numbers of locations.
The singleGraph function samples data for graph plotting. To use it, the
singleGraph file should be copied into the system directory to be configured.
% cp -r $FOAM_ETC/caseDicts/postProcessing/graphs/singleGraph system
The start and end points of the line, along which data is sampled, should be edited
The configuration is completed by adding the #includeFunc directive to
functions in the the controlDict file.
The surfaces and streamlines functions can be used to generate files for
visualization. The use of streamlines is already configured in the pitzDaily
case.
The surfaces function is configured by copying the surfaces file to the
system directory.
% cp -r $FOAM_ETC/caseDicts/postProcessing/visualization/surfaces system
The file is configured with a set of example surfaces that includes cutting planes,
isosurfaces and patch surfaces. We can edit the file to produce a cutting plane
along the pitzDaily geometry, normal to the z-direction.
The function can be included as normal from the by adding the includeFunc
directive to functions in the the controlDict file.
Functions like probes produce a singe file of time-value data, suitable for graph
plotting.
When the function is executed during a simulation, the user may wish to monitor
the data live on screen.
The foamMonitor script enables this; to discover its functionality, the user run it
with the -help option. The help option includes an example of monitoring residuals
that we can demonstrate in this section.
To use the foamMonitor , you will need gnuplot on the server, and the ability
to push the X-window to the client.
foamMonitor -l postProcessing/residuals/0/residuals.dat