ENH: extended runTimePostProcessing (#1206)

- Extended runTimePostProcessing to include access to "live"
  simulation objects such a geometry patches and sampled surfaces
  stored on the "functionObjectObjects" registry.

- Add 'live' runTimePostProcessing of cloud data.
  Extracts position and fields from the cloud via its objectRegistry writer

- For the "live" simulation objects, there are two new volume filters
  that work directly with the OpenFOAM volume fields:
      * iso-surface
      * cutting planes
  Both use the VTK algorithms directly and support multiple values.
  Eg, can make multiple iso-levels or multiple planes parallel to each
  other.

- When VTK has been compiled with MPI-support, parallel rendering will
  be used.

- Additional title text properties (shadow, italic etc)

- Simplified handling of scalar-bar and visibility switches

- Support multiple text positions. Eg, for adding watermark text.
This commit is contained in:
Mark Olesen
2019-02-13 11:22:46 +01:00
committed by Andrew Heather
parent 03e6aa1a6d
commit 42fbf6d38c
68 changed files with 7123 additions and 847 deletions

View File

@ -53,9 +53,8 @@ maxCo 0.2;
functions
{
#include "sampling"
#include "streamLines"
#include "runTimePostProcessing"
// Demonstrate runTimePostProcessing
#include "visualization"
}
// ************************************************************************* //

View File

@ -8,15 +8,21 @@
postPro1
{
type runTimePostProcessing;
libs ("librunTimePostProcessing.so");
writeControl writeTime;
#includeEtc "caseDicts/postProcessing/visualization/runTimePostPro.cfg"
// Time control etc
${_visualization};
// debug true;
// parallel true;
output
{
name image;
width 800;
height 600;
}
camera
{
// If camera is moving, optionally provide start and end times
@ -42,14 +48,10 @@ postPro1
// they are locally overridden
colours
{
background (0.317647 0.341176 0.431373);
background2 ${background};
text (0.75 0.75 0.75);
edge (1 0 0);
surface (0.5 0.5 0.5);
line (1 0 0);
${..colourScheme.paraview};
}
// Line data
lines
{
streamline
@ -70,11 +72,11 @@ postPro1
}
}
_plane
// Surface data
_surface
{
type functionObjectSurface;
functionObject cuttingPlane;
colourMap blueWhiteRed;
colourMap coolToWarm;
representation glyph;
maxGlyphLength 0.1;
visible yes;
@ -83,13 +85,8 @@ postPro1
field U;
range (0 10);
opacity 1;
scalarBar
{
visible no;
}
}
surfaces
{
geom
@ -102,26 +99,51 @@ postPro1
visible yes;
featureEdges no;
opacity 0.8;
visible false;
}
patches
{
type patches;
patches (hole);
renderMode phong;
representation surface;
colourMap coolToWarm;
colourBy field;
field U;
range (0 10);
nearCellValue true;
smooth true;
}
plane0
{
${_plane};
functionObject plane0;
${_surface};
functionObject planes.plane0;
}
plane1
{
${_plane};
functionObject plane1;
${_surface};
functionObject planes.plane1;
}
plane2
cutting
{
${_plane};
functionObject plane2;
}
plane3
{
${_plane};
functionObject plane3;
// Same colours and scaling as surface
${_surface};
type plane;
planeType pointAndNormal;
pointAndNormalDict
{
point (0 0 0);
normal (1 0 0);
}
offsets (0.1 0.2 0.3 0.4 0.5);
colourMap coolToWarm;
}
}

View File

@ -6,94 +6,58 @@
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
plane0
planes
{
type surfaces;
libs ("libsampling.so");
writeControl writeTime;
surfaceFormat vtk;
// Time control etc
${_visualization};
fields ( p U );
// surfaceFormat vtk;
surfaceFormat none;
store true;
interpolationScheme cellPoint;
_plane
{
type plane; //cuttingPlane;
planeType pointAndNormal;
interpolate false;
pointAndNormalDict
{
point (0 0 0);
normal (1 0 0);
}
}
surfaces
(
{
plane0
{
type cuttingPlane;
planeType pointAndNormal;
interpolate true;
${_plane}
pointAndNormalDict
{
point (0 0 0);
normal (1 0 0);
}
}
);
}
plane1
{
${plane0}
surfaces
(
plane1
{
type cuttingPlane;
planeType pointAndNormal;
interpolate true;
${_plane}
pointAndNormalDict
{
point (0.1 0 0);
normal (1 0 0);
point (-0.1 0 0);
}
}
);
}
}
plane2
{
${plane0}
surfaces
(
plane2
{
type cuttingPlane;
planeType pointAndNormal;
interpolate true;
pointAndNormalDict
{
point (0.2 0 0);
normal (1 0 0);
}
}
);
}
plane3
{
${plane0}
surfaces
(
plane3
{
type cuttingPlane;
planeType pointAndNormal;
interpolate true;
pointAndNormalDict
{
point (0.3 0 0);
normal (1 0 0);
}
}
);
#remove _plane
}

View File

@ -10,7 +10,8 @@ streamLines
{
type streamLine;
writeControl writeTime;
// Time control etc
${_visualization};
setFormat vtk;

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// Demonstrate runTimePostProcessing
// Timing
_visualization
{
writeControl writeTime;
// enabled true;
// Debug: writeControl timeStep;
// Debug: writeInterval 4;
}
#include "streamLines"
#include "sampling"
#include "runTimePostProcessing"
#remove _visualization
// ************************************************************************* //

View File

@ -49,10 +49,8 @@ runTimeModifiable true;
functions
{
// Demonstrate runtime postprocessing
#include "streamLines"
#include "cuttingPlane"
#include "runTimePostProcessing"
// Demonstrate runTimePostProcessing
#include "visualization"
// Do some other functionObjects
#include "forceCoeffs"

View File

@ -1,14 +1,34 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
postPro1
{
type runTimePostProcessing;
libs ("librunTimePostProcessing.so");
writeControl writeTime;
#includeEtc "caseDicts/postProcessing/visualization/runTimePostPro.cfg"
// Time control etc
${_visualization};
// debug true;
// parallel true;
output
{
name image;
width 2000;
height 1200;
}
// Default colours. Used for colourBy == colour unless locally overridden
colours
{
${..colourScheme.blueGradient};
}
camera
{
// If camera is moving, optionally provide start and end times
@ -19,27 +39,15 @@ postPro1
nFrameTotal 1;
// Parallel projection flag
parallelProjection no;
parallelProjection off;
clipBox (-0.2 -0.2 0)(1.65 0.2 1.25); // optional
focalPoint (1.2 1.1 0.2);
up (0 0 1);
position (3.6 5.1 -1.3);
up (0 0 1);
}
// Default colours
// - If select to colourBy colour, these values are used unless
// they are locally overridden
colours
{
background (1 1 1);
background2 (0 0 1);
text (0 0 0);
edge (1 0 0);
surface (0.5 0.5 0.5);
line (1 0 0);
}
// Line data
lines
{
@ -47,8 +55,9 @@ postPro1
{
type functionObjectLine;
functionObject streamLines;
colourMap rainbow;
representation tube;
visible yes;
visible true;
tubeRadius 0.01;
colourBy field;
field U;
@ -56,13 +65,17 @@ postPro1
opacity 1;
scalarBar
{
visible yes;
visible true;
position (0.8 0.1);
vertical yes;
fontSize 16;
title "velocity / [m/s]";
title "velocity [m/s]";
labelFormat "%6.2f";
numberOfLabels 5;
bold true;
italic true;
italic true;
colour (0.75 0.75 0.75);
}
}
}
@ -77,27 +90,40 @@ postPro1
renderMode phong;
representation surface;
edgeColour (0 0 0);
visible yes;
featureEdges yes;
opacity 1;
visible false;
}
cuttingPlane1
patches
{
type patches;
patches ("motorBike.*");
renderMode phong;
representation surface;
colourMap coolToWarm;
colourBy field;
field U;
range (0 30);
nearCellValue true;
smooth true;
featureEdges yes;
edgeColour (0 0 0);
}
plane1
{
type functionObjectSurface;
functionObject cuttingPlane;
colourMap blueWhiteRed;
functionObject samples.yNormal;
colourMap coolToWarm;
representation glyph;
maxGlyphLength 0.1;
visible yes;
visible true;
featureEdges no;
colourBy field;
field U;
range (0 30);
opacity 1;
scalarBar
{
visible no;
}
}
}
@ -106,11 +132,14 @@ postPro1
{
text1
{
string "Motorbike";
position (0.1 0.05);
size 72;
bold yes;
visible yes;
visible true;
string "Motorbike";
position (0.1 0.05);
size 72;
bold true;
italic true;
}
}
}
// ************************************************************************* //

View File

@ -6,31 +6,38 @@
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
cuttingPlane
samples
{
type surfaces;
libs ("libsampling.so");
writeControl writeTime;
surfaceFormat vtk;
// Time control etc
${_visualization};
fields (p U);
// surfaceFormat vtk;
surfaceFormat none;
verbose false;
interpolationScheme cellPoint;
surfaces
(
{
yNormal
{
type cuttingPlane;
planeType pointAndNormal;
interpolate true;
store true;
pointAndNormalDict
{
point (0 0 0);
normal (0 1 0);
}
interpolate true;
}
);
}
}

View File

@ -8,7 +8,7 @@
residuals
{
type residuals;
type solverInfo;
libs ("libutilityFunctionObjects.so");
writeFields true;
writeControl outputTime;

View File

@ -8,11 +8,10 @@
streamLines
{
type streamLine;
type streamLine;
// Output every
writeControl writeTime;
// writeInterval 10;
// Time control etc
${_visualization};
setFormat vtk; //gnuplot; //xmgr; //raw; //jplot; //csv; //ensight;

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// Demonstrate runTimePostProcessing
// Timing
_visualization
{
writeControl writeTime;
// enabled true;
// Debug: writeControl timeStep;
// Debug: writeInterval 10;
}
#include "streamLines"
#include "samples"
#include "runTimePostProcessing"
#remove _visualization
// ************************************************************************* //

View File

@ -52,6 +52,9 @@ functions
{
#include "ensightWrite"
#include "vtkWrite"
// Demonstrate runTimePostProcessing
#include "visualization"
}

View File

@ -0,0 +1,306 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
postPro1
{
#includeEtc "caseDicts/postProcessing/visualization/runTimePostPro.cfg"
// Time control etc
${_visualization};
// debug true;
// parallel true;
showIsoSurface false;
output
{
name image;
width 1280;
height 720;
}
camera
{
// If camera is moving, optionally provide start and end times
// startPosition 0.2;
// endPosition 0.75;
// Total number of frames to generate
nFrameTotal 1;
// Parallel projection flag
parallelProjection yes;
// clipBox is optional
position (385 -560 650);
focalPoint (160 90 60);
up (0.06 0.7 0.7);
position
(
-41.95
-247.55
426.87
);
focalPoint
(
146
76
40
);
up
(
0.3646
0.6194
0.6953
);
zoom 1.5;
// clipBox (-10 18 0)(280 160 76);
clipBox (-30 0 0)(300 200 80);
}
// Default colours
colours
{
${..colourScheme.paraview};
}
// Line data
lines
{
streamline
{
type functionObjectLine;
functionObject streamLines;
colourMap rainbow;
representation tube;
visible yes;
tubeRadius 0.5;
colourBy field;
field U;
range (0 20);
opacity 1;
}
}
_sampled
{
type functionObjectSurface;
colourMap coolToWarm;
representation glyph;
representation surface;
maxGlyphLength 0.1;
visible yes;
featureEdges no;
colourBy field;
field U;
range (0 20);
opacity 1;
}
_velocity_scalarBar
{
visible yes;
vertical false;
titleHack false;
position (0.8 0);
size (0.2 0.1);
fontSize 8;
titleSize 24;
title "velocity [m/s]";
labelFormat "%.0f";
numberOfLabels 5;
bold yes;
italic yes;
shadow yes;
}
surfaces
{
/*
geom
{
type geometry;
files ("<case>/buildings.vtp");
renderMode phong;
representation surface;
edgeColour (0.5 0.5 0.5);
visible yes;
featureEdges none;
opacity 1.0;
}
*/
ground1
{
type patches;
patches ( ground );
nearCellValue true;
colourMap coolToWarm;
representation glyph;
// maxGlyphLength 5;
maxGlyphLength 0;
colourBy field;
field U;
range (0 20);
}
ground2
{
type patches;
patches ( ground );
nearCellValue true;
smooth true;
colourMap coolToWarm;
representation wireframe;
// maxGlyphLength 5;
maxGlyphLength 0;
visible yes;
colourBy field;
field U;
range (0 20);
}
buildings
{
type patches;
patches ( buildings );
nearCellValue true;
smooth true;
colourMap coolToWarm;
representation surface;
renderMode phong;
colourBy field;
field U;
range (0 20);
scalarBar
{
${_velocity_scalarBar};
}
}
// A cutting plane from sampled surfaces:
stored1
{
${_sampled};
functionObject planes.plane2;
smooth true;
}
// VTK cutting planes:
cutting
{
type plane;
planeType pointAndNormal;
pointAndNormalDict
{
point (100 100 50);
normal (1 0 0);
}
offsets (0 200);
smooth true;
colourMap coolToWarm;
representation surface;
// representation glyph;
// maxGlyphLength 5;
maxGlyphLength 0;
visible yes;
featureEdges none;
colourBy field;
colourField U;
field U;
range (0 20);
}
// VTK iso surfaces of something
iso
{
visible ${showIsoSurface};
type isoSurface;
field U;
values (10);
smooth true;
colourMap coolToWarm;
representation surface;
// maxGlyphLength 5;
maxGlyphLength 0;
featureEdges none;
colourBy field;
colourField p;
range (-120 120);
}
}
// Text data
text
{
title
{
string "Wind around buildings";
position (0 0.95);
size 32;
bold yes;
italic yes;
shadow yes;
visible yes;
}
version
{
${title};
string "OpenFOAM ${FOAM_API}";
position (0 0);
size 24;
}
watermark
{
string "www.openfoam.com";
halign centre;
size 24;
opacity 0.3;
bold yes;
italic yes;
shadow yes;
positions
(
(0.50 0.05) (0.50 0.95)
(0.25 0.25) (0.75 0.25)
(0.25 0.50) (0.75 0.50)
(0.25 0.75) (0.75 0.75)
);
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
planes
{
type surfaces;
libs ("libsampling.so");
// Time control etc
${_visualization};
fields ( p U );
// surfaceFormat vtk;
surfaceFormat none;
store true;
interpolationScheme cellPoint;
_plane
{
type cuttingPlane;
planeType pointAndNormal;
interpolate false;
}
surfaces
{
plane0
{
${_plane}
pointAndNormalDict
{
point (100 100 50);
normal (1 -1 0);
}
enabled false;
}
plane1
{
${_plane}
pointAndNormalDict
{
point (100 100 50);
normal (1 1 0);
}
}
plane2
{
${_plane}
pointAndNormalDict
{
point (200 100 50);
normal (1 0 0);
}
}
};
#remove _plane
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
streamLines
{
type streamLine;
libs ("libfieldFunctionObjects.so");
// Time control etc
${_visualization};
setFormat vtk;
// Velocity field to use for tracking.
U U;
// Tracked forwards (+U) or backwards (-U)
trackForward true;
// Names of fields to sample. Should contain above velocity field!
fields (p U);
// Steps particles can travel before being removed
lifeTime 10000;
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
nSubCycle 5;
// Cloud name to use
cloud particleTracks;
// Seeding method.
seedSampleSet
{
type uniform;
axis x; //distance;
// Note: tracks slightly offset so as not to be on a face
start (0 -20 15);
end (0 150 15);
nPoints 40;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// Demonstrate runTimePostProcessing
// Timing
_visualization
{
writeControl writeTime;
// enabled true;
// Debug: writeControl timeStep;
// Debug: writeInterval 10;
}
#include "streamLines"
#include "sampling"
#include "runTimePostProcessing"
#remove _visualization
// ************************************************************************* //