ENH: improve file reader support for runTimePostProcessing (#1091)

- support .vtp format for geometry, surface, line, cloud.

- use native reader for handling vtk, vtp, obj, stl surface files.
  For other formats, use the MeshedSurface (the surfMesh lib) to
  handle reading and Foam::vtk::Tools::Patch to handle the
  conversion to vtkPolyData. This combination is more memory efficient.

- update tutorial case to include vtp surface geometry
This commit is contained in:
Mark Olesen
2018-12-16 19:14:22 +01:00
parent b6983e6af5
commit c3507f74f2
33 changed files with 681 additions and 441 deletions

View File

@ -4,4 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
cleanCase0
rm -f ppGeometry.vtp 2>/dev/null
#------------------------------------------------------------------------------

View File

@ -19,6 +19,9 @@ runApplication topoSet
runApplication createPatch -overwrite
runApplication surfaceMeshTriangulate \
-patches hole ppGeometry.vtp -constant -time ''
echo "End"
#------------------------------------------------------------------------------

View File

@ -15,6 +15,8 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
libs ("libOpenFOAM.so" "libfieldFunctionObjects.so");
application pimpleFoam;
startFrom latestTime;
@ -49,10 +51,10 @@ adjustTimeStep yes;
maxCo 0.2;
functions
{
#include "sampling"
#include "streamLines"
#include "runTimePostProcessing"
}

View File

@ -29,12 +29,12 @@ postPro1
// Parallel projection flag
parallelProjection yes;
clipBox (-0.2 -0.2 0)(1.65 0.2 1.25); // optional
// clipBox is optional
position (-2.28 1.28 2.24);
focalPoint (0.003 0.008 0.024);
focalPoint (0 0.008 0.024);
up (0.26 0.930 -0.266);
zoom 1.25;
zoom 1.75;
}
// Default colours
@ -44,7 +44,7 @@ postPro1
{
background (0.317647 0.341176 0.431373);
background2 ${background};
text (0 0 0);
text (0.75 0.75 0.75);
edge (1 0 0);
surface (0.5 0.5 0.5);
line (1 0 0);
@ -52,9 +52,24 @@ postPro1
lines
{
streamline
{
type functionObjectLine;
functionObject streamLines;
representation tube;
visible yes;
tubeRadius 0.0025;
colourBy field;
field U;
range (0 10);
opacity 0.6;
scalarBar
{
visible no;
}
}
}
_plane
{
type functionObjectSurface;
@ -77,6 +92,17 @@ postPro1
surfaces
{
geom
{
type geometry;
files ("<case>/ppGeometry.vtp");
renderMode phong;
representation surface;
edgeColour (0.5 0.5 0.5);
visible yes;
featureEdges no;
opacity 0.8;
}
plane0
{
${_plane};
@ -104,11 +130,11 @@ postPro1
{
text1
{
string "elipsekkLOmega";
position (0.1 0.05);
size 24;
bold no;
visible yes;
string "ellipse kkLOmega";
position (0.6 0.05);
size 18;
bold yes;
visible yes;
}
}
}

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
streamLines
{
type streamLine;
writeControl writeTime;
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.70 -0.25 0.025);
end (-0.70 0.25 0.025);
nPoints 20;
}
}
// ************************************************************************* //