sampledSets, streamlines: Various improvements

Sampled sets and streamlines now write all their fields to the same
file. This prevents excessive duplication of the geometry and makes
post-processing tasks more convenient.

"axis" entries are now optional in sampled sets and streamlines. When
omitted, a default entry will be used, which is chosen appropriately for
the coordinate set and the write format. Some combinations are not
supported. For example, a scalar ("x", "y", "z" or "distance") axis
cannot be used to write in the vtk format, as vtk requires 3D locations
with which to associate data. Similarly, a point ("xyz") axis cannot be
used with the gnuplot format, as gnuplot needs a single scalar to
associate with the x-axis.

Streamlines can now write out fields of any type, not just scalars and
vectors, and there is no longer a strict requirement for velocity to be
one of the fields.

Streamlines now output to postProcessing/<functionName>/time/<file> in
the same way as other functions. The additional "sets" subdirectory has
been removed.

The raw set writer now aligns columns correctly.

The handling of segments in coordSet and sampledSet has been
fixed/completed. Segments mean that a coordinate set can represent a
number of contiguous lines, disconnected points, or some combination
thereof. This works in parallel; segments remain contiguous across
processor boundaries. Set writers now only need one write method, as the
previous "writeTracks" functionality is now handled by streamlines
providing the writer with the appropriate segment structure.

Coordinate sets and set writers now have a convenient programmatic
interface. To write a graph of A and B against some coordinate X, in
gnuplot format, we can call the following:

    setWriter::New("gnuplot")->write
    (
        directoryName,
        graphName,
        coordSet(true, "X", X), // <-- "true" indicates a contiguous
        "A",                    //     line, "false" would mean
        A,                      //     disconnected points
        "B",
        B
    );

This write function is variadic. It supports any number of
field-name-field pairs, and they can be of any primitive type.

Support for Jplot and Xmgrace formats has been removed. Raw, CSV,
Gnuplot, VTK and Ensight formats are all still available.

The old "graph" functionality has been removed from the code, with the
exception of the randomProcesses library and associated applications
(noise, DNSFoam and boxTurb). The intention is that these should also
eventually be converted to use the setWriters. For now, so that it is
clear that the "graph" functionality is not to be used elsewhere, it has
been moved into a subdirectory of the randomProcesses library.
This commit is contained in:
Will Bainbridge
2021-11-25 09:42:19 +00:00
parent 50fb2477bd
commit 25a6d068f0
185 changed files with 4727 additions and 6308 deletions

View File

@ -1,9 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
rm -r constant/polyMesh
rm log.*
#------------------------------------------------------------------------------

View File

@ -14,9 +14,9 @@ streamlines
// Output every
writeControl writeTime;
// writeInterval 10;
setFormat vtk; // gnuplot; // xmgr; //raw; //jplot; //csv; //ensight;
// Write format
setFormat vtk;
// Track forward (+U) or backward (-U) or both
direction forward;
@ -37,9 +37,6 @@ streamlines
seedSampleSet
{
type lineUniform;
axis x; // distance;
// Note: tracks slightly offset so as not to be on a face
start (-1.001 1e-7 0.0011);
end (-1.001 1e-7 1.0011);
nPoints 20;

View File

@ -6,6 +6,8 @@ then
exit 1
fi
time=$(foamListTimes -case .. -latestTime)
gnuplot<<EOF
set term post enhanced color solid linewidth 2.0 20
set out "graphs.eps"
@ -15,13 +17,12 @@ gnuplot<<EOF
set style line 1 lt 1 linecolor rgb "blue" linewidth 1.5
set style line 11 lt 2 linecolor rgb "black" linewidth 1.5
time = system("foamListTimes -case .. | tail -1")
set xlabel "x"
set ylabel "u'"
set title "T3A - Flat Plate - turbulent intensity"
plot [:1.5][:0.05] \
"../postProcessing/kGraph/".time."/line_k.xy" \
"../postProcessing/kGraph/$time/line.xy" \
u (\$1-0.04):(1./5.4*sqrt(2./3.*\$2))title "kOmegaSSTLM" w l ls 1, \
"exptData/T3A.dat" u (\$1/1000):(\$3/100) title "Exp T3A" w p ls 11
@ -29,7 +30,7 @@ gnuplot<<EOF
set ylabel "c_f"
set title "T3A - Flat Plate - C_f"
plot [:6e+5][0:0.01] \
"../postProcessing/wallShearStressGraph/".time."/line_wallShearStress.xy" \
"../postProcessing/wallShearStressGraph/$time/line.xy" \
u ((\$1-0.04)*5.4/1.5e-05):(-\$2/0.5/5.4**2) title "kOmegaSSTLM" w l, \
"exptData/T3A.dat" u (\$1/1000*5.4/1.51e-05):2 title "Exp" w p ls 11
EOF

View File

@ -8,16 +8,15 @@
streamlines
{
// Where to load it from
libs ("libfieldFunctionObjects.so");
type streamlines;
libs ("libfieldFunctionObjects.so");
// Output every
writeControl writeTime;
// writeInterval 10;
setFormat vtk; // gnuplot; // xmgr; //raw; //jplot; //csv; //ensight;
// Write format
setFormat vtk;
// Track forward (+U) or backward (-U) or both
direction forward;
@ -28,15 +27,8 @@ streamlines
// Steps particles can travel before being removed
lifeTime 10000;
//- Specify either absolute length of steps (trackLength) or a number
// of subcycling steps per cell (nSubCycle)
// Size of single track segment [m]
// trackLength 1e-3;
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
nSubCycle 5;
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
nSubCycle 5;
// Cloud name to use
cloudName particleTracks;
@ -45,9 +37,6 @@ streamlines
seedSampleSet
{
type lineUniform;
axis x; // distance;
// Note: tracks slightly offset so as not to be on a face
start (-1.001 -0.05 0.0011);
end (-1.001 -0.05 1.0011);
nPoints 20;

View File

@ -50,14 +50,13 @@ functions
{
type streamlines;
// Where to load it from (if not already in solver)
libs ("libfieldFunctionObjects.so");
// Output every
writeControl writeTime;
// writeInterval 10;
setFormat vtk; // gnuplot;//xmgr;//raw;//jplot;//csv;//ensight;
// Write format
setFormat vtk;
// Track forward (+U) or backward (-U) or both
direction forward;
@ -78,8 +77,6 @@ functions
seedSampleSet
{
type lineUniform;
axis x; // distance;
start (-0.0205 0.001 0.00001);
end (-0.0205 0.0251 0.00001);
nPoints 10;

View File

@ -81,6 +81,8 @@ functions
writeControl outputTime;
writeInterval 1;
setFormat raw;
populationBalance bubbles;
regionType cellZone;
name injection;
@ -98,6 +100,8 @@ functions
writeControl outputTime;
writeInterval 1;
setFormat raw;
populationBalance bubbles;
regionType cellZone;
name outlet;

View File

@ -6,42 +6,45 @@ then
exit 1
fi
time=$(foamListTimes -case .. -latestTime)
graphFile=../postProcessing/graph/$time/line.xy
gnuplot<<EOF
set terminal postscript eps color enhanced font "Helvetica,20"
set output '../void_fraction.eps'
set xlabel 'r (mm)'
set ylabel '{/Symbol a} (-)'
alpha = system("ls ../postProcessing/graph/$(foamListTimes -case .. -latestTime)/line_alpha*.xy")
forces = system("ls ../postProcessing/graph/$(foamListTimes -case .. -latestTime)/line_lift*.xy")
plot alpha u (\$1*1000):4 w l lw 3 lc rgb 'black' t 'total',\
alpha u (\$1*1000):2 w l lw 2 lc rgb 'green' t 'd < 5.5mm',\
alpha u (\$1*1000):3 w l lw 2 lc rgb 'red' t 'd > 5.5mm'
plot "$graphFile" u (\$1*1000):4 w l lw 3 lc rgb 'black' t 'total',\
"$graphFile" u (\$1*1000):2 w l lw 2 lc rgb 'green' t 'd < 5.5mm',\
"$graphFile" u (\$1*1000):3 w l lw 2 lc rgb 'red' t 'd > 5.5mm'
set output '../nonDragForces.eps'
set ylabel 'F_{r} (N/m^3)'
plot forces u (\$1*1000):(-\$2) w l lw 2 t 'Lift',\
forces u (\$1*1000):(-\$5) w l lw 2 t 'Wall lubrication',\
forces u (\$1*1000):(-\$8) w l lw 2 t 'Turbulent dispersion'
plot "$graphFile" u (\$1*1000):(-\$5) w l lw 2 t 'Lift',\
"$graphFile" u (\$1*1000):(-\$8) w l lw 2 t 'Wall lubrication',\
"$graphFile" u (\$1*1000):(-\$11) w l lw 2 t 'Turbulent dispersion'
EOF
injectionFile=../postProcessing/probabilityDensity.injection/$time/probabilityDensity.injection.xy
outletFile=../postProcessing/probabilityDensity.outlet/$time/probabilityDensity.outlet.xy
gnuplot<<EOF
set terminal postscript eps color enhanced font "Helvetica,20"
set output '../volumeDensity.eps'
set xlabel 'd (mm)'
set ylabel '({/Symbol a}/{/Symbol a}_{tot})/{/Symbol D}d (mm^{-1})'
set xtics 1
injection = system("ls ../postProcessing/probabilityDensity.injection/$(foamListTimes -case .. | tail -1)/*.dat")
outlet = system("ls ../postProcessing/probabilityDensity.outlet/$(foamListTimes -case .. | tail -1)/*.dat")
plot injection u (\$3/1e-3):(\$4/1e3) w histeps lw 3 lc rgb 'green' t 'injection',\
outlet u (\$3/1e-3):(\$4/1e3) w histeps lw 3 lc rgb 'red' t 'outlet'
plot "$injectionFile" u (\$3/1e-3):(\$4/1e3) w histeps lw 3 lc rgb 'green' t 'injection',\
"$outletFile" u (\$3/1e-3):(\$4/1e3) w histeps lw 3 lc rgb 'red' t 'outlet'
EOF
#------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@ then
exit 1
fi
graphFile=$(foamListTimes -latestTime)/line_alpha.gas_T.liquid_T.gas.xy
graphFile=$(foamListTimes -latestTime)/line.xy
surfaceFile=$(cd postProcessing/inflow && ls -1tr */* | tail -n 1)
gnuplot<<EOF

View File

@ -6,7 +6,7 @@ then
exit 1
fi
graphFile=$(foamListTimes -latestTime)/line_alpha.gas_T.liquid_T.gas_d.gas.xy
graphFile=$(foamListTimes -latestTime)/line.xy
surfaceFile=$(cd postProcessing/inflow && ls -1tr */* | tail -n 1)
gnuplot<<EOF

View File

@ -58,6 +58,7 @@ functions
functionObjectLibs ( "libmultiphaseEulerFoamFunctionObjects.so" );
writeControl runTime;
writeInterval 0.5;
setFormat raw;
log yes;
functionType volume;
coordinateType diameter;
@ -71,6 +72,7 @@ functions
functionObjectLibs ( "libmultiphaseEulerFoamFunctionObjects.so" );
writeControl runTime;
writeInterval 0.5;
setFormat raw;
log yes;
functionType volume;
coordinateType diameter;
@ -84,6 +86,7 @@ functions
functionObjectLibs ( "libmultiphaseEulerFoamFunctionObjects.so" );
writeControl runTime;
writeInterval 0.5;
setFormat raw;
log yes;
functionType volume;
coordinateType diameter;

View File

@ -6,7 +6,7 @@ then
exit 1
fi
graphFile=$(foamListTimes -latestTime)/line_alpha.gas_T.liquid_T.gas_d.gas.xy
graphFile=$(foamListTimes -latestTime)/line.xy
surfaceFile=$(cd postProcessing/inflow && ls -1tr */* | tail -n 1)
gnuplot<<EOF

View File

@ -58,6 +58,7 @@ functions
functionObjectLibs ( "libmultiphaseEulerFoamFunctionObjects.so" );
writeControl runTime;
writeInterval 0.5;
setFormat raw;
log yes;
functionType volume;
coordinateType diameter;
@ -71,6 +72,7 @@ functions
functionObjectLibs ( "libmultiphaseEulerFoamFunctionObjects.so" );
writeControl runTime;
writeInterval 0.5;
setFormat raw;
log yes;
functionType volume;
coordinateType diameter;
@ -84,6 +86,7 @@ functions
functionObjectLibs ( "libmultiphaseEulerFoamFunctionObjects.so" );
writeControl runTime;
writeInterval 0.5;
setFormat raw;
log yes;
functionType volume;
coordinateType diameter;

View File

@ -6,7 +6,7 @@ then
exit 1
fi
graphFile=$(foamListTimes -latestTime)/line_alpha.gas_alpha.gas2_alpha.liquid_T.liquid_T.gas_d.bubbles.xy
graphFile=$(foamListTimes -latestTime)/line.xy
surfaceFile=$(cd postProcessing/inflow && ls -1tr */* | tail -n 1)
gnuplot<<EOF

View File

@ -67,6 +67,7 @@ functions
writeControl outputTime;
writeInterval 1;
setFormat raw;
log yes;
regionType cellZone;

View File

@ -6,6 +6,10 @@ then
exit 1
fi
time=$(foamListTimes -case .. -latestTime)
graphFile=../postProcessing/graph/$time/line.xy
gnuplot<<EOF
set terminal postscript eps color enhanced font "Helvetica,20"
set output '../species.eps'
@ -17,14 +21,14 @@ gnuplot<<EOF
set y2tics nomirror
set key center
file = system("ls ../postProcessing/graph/$(foamListTimes -case .. | tail -1)/*.xy")
plot file u 1:2 w l t 'TiCl4',\
file u 1:3 w l t 'O2',\
file u 1:4 w l t 'Cl2',\
file u 1:5 axis x1y2 w l t '{/Symbol a}_{particles}'
plot "$graphFile" u 1:2 w l t 'TiCl4',\
"$graphFile" u 1:3 w l t 'O2',\
"$graphFile" u 1:4 w l t 'Cl2',\
"$graphFile" u 1:5 axis x1y2 w l t '{/Symbol a}_{particles}'
EOF
resultFile=../postProcessing/numberConcentration/$time/numberConcentration.xy
gnuplot<<EOF
set terminal postscript eps color enhanced font "Helvetica,20"
set output '../sizeDistribution.eps'
@ -39,11 +43,9 @@ gnuplot<<EOF
set xrange [1e-3:1]
set yrange [1e-3:3]
result = system("ls ../postProcessing/numberConcentration/$(foamListTimes -case .. | tail -1)/numberConcentration.dat")
plot result u (\$3/1e-6):4 w lp t 'Size distribution',\
result u (\$3/1e-6):(\$2/\$1) axis x1y2 w l t '{/Symbol k}',\
result u (\$3/1e-6):(6./((6./pi*\$1)**(1./3.))) axis x1y2 w l t '{/Symbol k} lower bound'
plot "$resultFile" u (\$3/1e-6):4 w lp t 'Size distribution',\
"$resultFile" u (\$3/1e-6):(\$2/\$1) axis x1y2 w l t '{/Symbol k}',\
"$resultFile" u (\$3/1e-6):(6./((6./pi*\$1)**(1./3.))) axis x1y2 w l t '{/Symbol k} lower bound'
EOF
#------------------------------------------------------------------------------

View File

@ -67,6 +67,7 @@ functions
writeControl outputTime;
writeInterval 1;
setFormat raw;
log yes;
regionType cellZone;

View File

@ -6,6 +6,10 @@ then
exit 1
fi
time=$(foamListTimes -case .. -latestTime)
graphFile=../postProcessing/graph/$time/line.xy
gnuplot<<EOF
set terminal postscript eps color enhanced font "Helvetica,20"
set output '../species.eps'
@ -17,14 +21,14 @@ gnuplot<<EOF
set y2tics nomirror
set key center
file = system("ls ../postProcessing/graph/$(foamListTimes -case .. | tail -1)/*.xy")
plot file u 1:2 w l t 'TiCl4',\
file u 1:3 w l t 'O2',\
file u 1:4 w l t 'Cl2',\
file u 1:5 axis x1y2 w l t '{/Symbol a}_{particles}'
plot "$graphFile" u 1:2 w l t 'TiCl4',\
"$graphFile" u 1:3 w l t 'O2',\
"$graphFile" u 1:4 w l t 'Cl2',\
"$graphFile" u 1:5 axis x1y2 w l t '{/Symbol a}_{particles}'
EOF
resultFile=../postProcessing/numberConcentration/$time/numberConcentration.xy
gnuplot<<EOF
set terminal postscript eps color enhanced font "Helvetica,20"
set output '../sizeDistribution.eps'
@ -39,11 +43,9 @@ gnuplot<<EOF
set xrange [1e-3:1]
set yrange [1e-3:3]
result = system("ls ../postProcessing/numberConcentration/$(foamListTimes -case .. | tail -1)/numberConcentration.dat")
plot result u (\$3/1e-6):4 w lp t 'Size distribution',\
result u (\$3/1e-6):(\$2/\$1) axis x1y2 w l t '{/Symbol k}',\
result u (\$3/1e-6):(6./((6./pi*\$1)**(1./3.))) axis x1y2 w l t '{/Symbol k} lower bound'
plot "$resultFile" u (\$3/1e-6):4 w lp t 'Size distribution',\
"$resultFile" u (\$3/1e-6):(\$2/\$1) axis x1y2 w l t '{/Symbol k}',\
"$resultFile" u (\$3/1e-6):(6./((6./pi*\$1)**(1./3.))) axis x1y2 w l t '{/Symbol k} lower bound'
EOF
#------------------------------------------------------------------------------