test: Refactored transposing of plot data into function bin/tools/RunFunctions::transposeFile()

which simplifies the reactingEulerFoam populationBalance test cases.

Patch contributed by Institute of Fluid Dynamics, Helmholtz-Zentrum
Dresden - Rossendorf (HZDR)
This commit is contained in:
Henry Weller
2018-03-23 14:24:50 +00:00
parent ef885b407c
commit a59351c64f
19 changed files with 149 additions and 190 deletions

View File

@ -168,4 +168,31 @@ cloneCase()
fi fi
} }
transposeFile()
{
awk '
{
for (i = 1; i <= NF; i++)
{
a[NR, i] = $i
}
}
NF > p {p = NF}
END {
for (j = 1; j <= p; j++)
{
str = a[1,j]
for(i = 2; i <= NR; i++)
{
str = str" "a[i,j];
}
print str
}
}' $1
}
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,27 +11,9 @@ runApplication blockMesh
runApplication $application runApplication $application
# Get and transpose results # Get and transpose results
cp postProcessing/box.all.numberDensity.volume.bubbles/0/box.all.numberDensity.volume.bubbles.dat . cp postProcessing/numberDensity/0/numberDensity.dat .
sed -i -e '1d' -e 's/# /#/g' numberDensity.dat
sed -i -e 1d box.all.numberDensity.volume.bubbles.dat transposeFile numberDensity.dat > numberDensity.transposed.dat
sed -i -e 's/# /#/g' box.all.numberDensity.volume.bubbles.dat
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' box.all.numberDensity.volume.bubbles.dat > box.all.numberDensity.volume.bubbles.transposed.dat
# Create plot # Create plot
./plot ./plot

View File

@ -13,7 +13,7 @@ set ylabel 'n(m^{-3}m^{-3})'
set logscale xy set logscale xy
set xrange [1e-5:1.5] set xrange [1e-5:1.5]
set yrange [1e-5:10] set yrange [1e-5:10]
set key center set key at graph 0.8,0.5
N0 = 0.05 N0 = 0.05
v0 = 1.0 v0 = 1.0
@ -21,7 +21,7 @@ v0 = 1.0
n(x,t) = N0*exp(-t*x**2.0)*2.0*t*v0 n(x,t) = N0*exp(-t*x**2.0)*2.0*t*v0
plot "<printf '1 0.05\n1 0\n'" w l t "Init. Cond.",\ plot "<printf '1 0.05\n1 0\n'" w l t "Init. Cond.",\
n(x,10.0) ls 2 lc rgb "black" t "Ziff and McGrady (1985)",\ n(x,10.0) ls 2 lc rgb "black" t "[Ziff and McGrady, J. Phys. A: Math. Gen., 18: 3027-3037, 1985]",\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::0::19 u 1:2 w p pt 1 t 'air1',\ 'numberDensity.transposed.dat' every ::0::19 u 1:2 w p pt 1 t 'air1',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::20::24 u 1:2 w p pt 5 t 'air2',\ 'numberDensity.transposed.dat' every ::20::24 u 1:2 w p pt 5 t 'air2',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::25::28 u 1:2 w p pt 9 t 'air3' 'numberDensity.transposed.dat' every ::25::28 u 1:2 w p pt 9 t 'air3'

View File

@ -53,7 +53,7 @@ maxDeltaT 1;
functions functions
{ {
box.all.numberDensity.volume.bubbles numberDensity
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");

View File

@ -11,27 +11,9 @@ runApplication blockMesh
runApplication $application runApplication $application
# Get and transpose results # Get and transpose results
cp postProcessing/box.all.numberDensity.volume.bubbles/0/box.all.numberDensity.volume.bubbles.dat . cp postProcessing/numberDensity/0/numberDensity.dat .
sed -i -e '1d' -e 's/# /#/g' numberDensity.dat
sed -i -e 1d box.all.numberDensity.volume.bubbles.dat transposeFile numberDensity.dat > numberDensity.transposed.dat
sed -i -e 's/# /#/g' box.all.numberDensity.volume.bubbles.dat
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' box.all.numberDensity.volume.bubbles.dat > box.all.numberDensity.volume.bubbles.transposed.dat
# Create plot # Create plot
./plot ./plot

View File

@ -13,7 +13,7 @@ set ylabel 'n(m^{-3}m^{-3})'
set logscale xy set logscale xy
set xrange [1e-5:1.5] set xrange [1e-5:1.5]
set yrange [1e-5:10] set yrange [1e-5:10]
set key center set key at graph 0.8,0.5
N0 = 0.05 N0 = 0.05
v0 = 1.0 v0 = 1.0
@ -21,7 +21,7 @@ v0 = 1.0
n(x,t) = N0*exp(-t*x**2.0)*2.0*t*v0 n(x,t) = N0*exp(-t*x**2.0)*2.0*t*v0
plot "<printf '1 0.05\n1 0\n'" w l t "Init. Cond.",\ plot "<printf '1 0.05\n1 0\n'" w l t "Init. Cond.",\
n(x,10.0) ls 2 lc rgb "black" t "Ziff and McGrady (1985)",\ n(x,10.0) ls 2 lc rgb "black" t "[Ziff and McGrady, J. Phys. A: Math. Gen., 18: 3027-3037, 1985]",\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::0::19 u 1:2 w p pt 1 t 'air1',\ 'numberDensity.transposed.dat' every ::0::19 u 1:2 w p pt 1 t 'air1',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::20::24 u 1:2 w p pt 5 t 'air2',\ 'numberDensity.transposed.dat' every ::20::24 u 1:2 w p pt 5 t 'air2',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::25::28 u 1:2 w p pt 9 t 'air3' 'numberDensity.transposed.dat' every ::25::28 u 1:2 w p pt 9 t 'air3'

View File

@ -53,7 +53,7 @@ maxDeltaT 1;
functions functions
{ {
box.all.numberDensity.volume.bubbles numberDensity
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");

View File

@ -11,27 +11,9 @@ runApplication blockMesh
runApplication $application runApplication $application
# Get and transpose results # Get and transpose results
cp postProcessing/box.all.numberDensity.volume.bubbles/0/box.all.numberDensity.volume.bubbles.dat . cp postProcessing/numberDensity/0/numberDensity.dat .
sed -i -e '1d' -e 's/# /#/g' numberDensity.dat
sed -i -e 1d box.all.numberDensity.volume.bubbles.dat transposeFile numberDensity.dat > numberDensity.transposed.dat
sed -i -e 's/# /#/g' box.all.numberDensity.volume.bubbles.dat
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' box.all.numberDensity.volume.bubbles.dat > box.all.numberDensity.volume.bubbles.transposed.dat
# Create plot # Create plot
./plot ./plot

View File

@ -13,7 +13,7 @@ set ylabel 'n(m^{-3}m^{-3})'
set logscale xy set logscale xy
set xrange [1e-5:1e2] set xrange [1e-5:1e2]
set yrange [1e-15:100] set yrange [1e-15:100]
set key center left set key at graph 0.55,0.5
C = 1 C = 1
N0 = 2.5 N0 = 2.5
@ -41,7 +41,7 @@ phi(x,t) = (8*exp((y_s(t,x) - 1)*X(x)*2))/(((T(t) + 2)**2)*y_s(t,x)*(4*pi*(2 - 1
n(x,t) = (N0/v0)*phi(x,t) n(x,t) = (N0/v0)*phi(x,t)
plot n0(x) ls -1 t 'Initial Condition',\ plot n0(x) ls -1 t 'Initial Condition',\
n(x,10.0) ls 2 lc rgb 'black' t 'Scott (1968)',\ n(x,10.0) ls 2 lc rgb 'black' t '[Scott, J. Atmos. Sci., 25: 54-65, 1968]',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::0::46 u 1:2 w p pt 1 t 'air1',\ 'numberDensity.transposed.dat' every ::0::46 u 1:2 w p pt 1 t 'air1',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::47::55 u 1:2 w p pt 5 t 'air2',\ 'numberDensity.transposed.dat' every ::47::55 u 1:2 w p pt 5 t 'air2',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::56::70 u 1:2 w p pt 9 t 'air3' 'numberDensity.transposed.dat' every ::56::70 u 1:2 w p pt 9 t 'air3'

View File

@ -53,7 +53,7 @@ maxDeltaT 1;
functions functions
{ {
box.all.numberDensity.volume.bubbles numberDensity
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");

View File

@ -11,47 +11,13 @@ runApplication blockMesh
runApplication $application runApplication $application
# Get and transpose results # Get and transpose results
cp postProcessing/box.all.numberDensity.volume.bubbles/0/box.all.numberDensity.volume.bubbles.dat . cp postProcessing/numberDensity/0/numberDensity.dat .
cp postProcessing/box.all.volumeDensity.volume.bubbles/0/box.all.volumeDensity.volume.bubbles.dat . sed -i -e '1d' -e 's/# /#/g' numberDensity.dat
transposeFile numberDensity.dat > numberDensity.transposed.dat
sed -i -e 1d box.all.numberDensity.volume.bubbles.dat cp postProcessing/volumeDensity/0/volumeDensity.dat .
sed -i -e 's/# /#/g' box.all.numberDensity.volume.bubbles.dat sed -i -e '1d' -e 's/# /#/g' volumeDensity.dat
sed -i -e 1d box.all.volumeDensity.volume.bubbles.dat transposeFile volumeDensity.dat > volumeDensity.transposed.dat
sed -i -e 's/# /#/g' box.all.volumeDensity.volume.bubbles.dat
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' box.all.volumeDensity.volume.bubbles.dat > box.all.volumeDensity.volume.bubbles.transposed.dat
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' box.all.numberDensity.volume.bubbles.dat > box.all.numberDensity.volume.bubbles.transposed.dat
# Create plot # Create plot
./plot ./plot

View File

@ -13,13 +13,69 @@ set ylabel 'Probability density function (m^{-3})'
set xrange [1:10] set xrange [1:10]
set yrange [0:0.4] set yrange [0:0.4]
set key left set key below
plot 'rigorous.numberDensity.dat' w l t "Number density, Vanni (2000)",\ plot '-' w l t "Number density, [Vanni, J. Colloid Interface Sci., 221: 143-160, 2000]",\
'rigorous.volumeDensity.dat' w l t "Volume density, Vanni (2000)",\ '-' w l t "Volume density, [Vanni, J. Colloid Interface Sci., 221: 143-160, 2000]",\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::0::12 u 1:2 w p pt 1 t 'Number density, air1',\ 'numberDensity.transposed.dat' every ::0::12 u 1:2 w p pt 1 t 'Number density, air1',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::13::22 u 1:2 w p pt 5 t 'Number density, air2',\ 'numberDensity.transposed.dat' every ::13::22 u 1:2 w p pt 5 t 'Number density, air2',\
'box.all.numberDensity.volume.bubbles.transposed.dat' every ::23::30 u 1:2 w p pt 9 t 'Number density, air3',\ 'numberDensity.transposed.dat' every ::23::30 u 1:2 w p pt 9 t 'Number density, air3',\
'box.all.volumeDensity.volume.bubbles.transposed.dat' every ::0::12 u 1:2 w p pt 2 t 'Volume density, air1',\ 'volumeDensity.transposed.dat' every ::0::12 u 1:2 w p pt 2 t 'Volume density, air1',\
'box.all.volumeDensity.volume.bubbles.transposed.dat' every ::13::22 u 1:2 w p pt 6 t 'Volume density, air2',\ 'volumeDensity.transposed.dat' every ::13::22 u 1:2 w p pt 6 t 'Volume density, air2',\
'box.all.volumeDensity.volume.bubbles.transposed.dat' every ::23::30 u 1:2 w p pt 10 t 'Volume density, air3' 'volumeDensity.transposed.dat' every ::23::30 u 1:2 w p pt 10 t 'Volume density, air3'
1.000 0.042
1.460 0.062
1.950 0.083
2.403 0.100
2.775 0.116
3.109 0.127
3.562 0.141
4.015 0.151
4.475 0.162
4.876 0.172
5.270 0.179
5.700 0.188
6.035 0.190
6.436 0.188
6.777 0.178
7.163 0.157
7.416 0.137
7.705 0.109
7.980 0.078
8.285 0.047
8.589 0.026
8.953 0.010
9.228 0.003
9.495 0.002
EOF
0.993 0.000
0.985 0.002
1.475 0.003
1.965 0.005
2.485 0.010
2.975 0.020
3.488 0.032
3.985 0.055
4.468 0.084
4.995 0.123
5.507 0.176
6.087 0.240
6.532 0.289
6.755 0.309
7.007 0.326
7.260 0.324
7.535 0.305
7.683 0.284
7.839 0.252
8.017 0.215
8.196 0.172
8.351 0.137
8.574 0.090
8.723 0.065
8.946 0.037
9.161 0.021
9.339 0.013
9.517 0.006
9.770 0.004
9.993 0.002
EOF

View File

@ -53,7 +53,7 @@ maxDeltaT 1;
functions functions
{ {
box.all.numberDensity.volume.bubbles numberDensity
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");
@ -69,7 +69,7 @@ functions
normalize true; normalize true;
} }
box.all.volumeDensity.volume.bubbles volumeDensity
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");

View File

@ -11,27 +11,9 @@ runApplication blockMesh
runApplication $application runApplication $application
# Get and transpose results # Get and transpose results
cp postProcessing/box.all.numberDensity.volume.bubbles/0/box.all.numberDensity.volume.bubbles.dat . cp postProcessing/numberDensity/0/numberDensity.dat .
sed -i -e '1d' -e 's/# /#/g' numberDensity.dat
sed -i -e 1d box.all.numberDensity.volume.bubbles.dat transposeFile numberDensity.dat > numberDensity.transposed.dat
sed -i -e 's/# /#/g' box.all.numberDensity.volume.bubbles.dat
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' box.all.numberDensity.volume.bubbles.dat > box.all.numberDensity.volume.bubbles.transposed.dat
# Create plot # Create plot
./plot ./plot

View File

@ -15,8 +15,8 @@ set yrange [0:1.5e-2]
set key top right set key top right
plot "<printf '2 0\n2 0.01\n4 0.01\n4 0\n'" w l t 'Initial Condition',\ plot "<printf '2 0\n2 0.01\n4 0.01\n4 0\n'" w l t 'Initial Condition',\
"<printf '8 0\n8 0.01\n10 0.01\n10 0\n'" w l t 'Kumar (2002)',\ "<printf '8 0\n8 0.01\n10 0.01\n10 0\n'" w l t '[Kumar J., PhD thesis, Magdeburg, 2006]',\
'box.all.numberDensity.volume.bubbles.transposed.dat' u 1:2 w lp t 'air' 'numberDensity.transposed.dat' u 1:2 w lp t 'air'
set output "moments.eps" set output "moments.eps"
@ -29,7 +29,7 @@ set xrange [0:6]
set yrange [0.5:3.5] set yrange [0.5:3.5]
set key top left set key top left
plot 'postProcessing/box.all.moments.volume.bubbles/0/box.all.moments.volume.bubbles.dat' u 1:($2/0.024535) w p pt 5 t 'j=0 (Numbers), air',\ plot 'postProcessing/moments/0/moments.dat' u 1:($2/0.024535) w p pt 5 t 'j=0 (Numbers), air',\
"<printf '0 1\n6 1\n'" w l t 'j=0 (Numbers), Kumar (2002)',\ "<printf '0 1\n6 1\n'" w l t 'j=0 (Numbers), [Kumar J., PhD thesis, Magdeburg, 2006]',\
'postProcessing/box.all.moments.volume.bubbles/0/box.all.moments.volume.bubbles.dat' u 1:($3/0.0751237) w p pt 6 t 'j=1 (Volume), air',\ 'postProcessing/moments/0/moments.dat' u 1:($3/0.0751237) w p pt 6 t 'j=1 (Volume), air',\
"<printf '0 1\n6 3\n'" w l t 'j=1 (Volume), Kumar (2002)' "<printf '0 1\n6 3\n'" w l t 'j=1 (Volume), [Kumar J., PhD thesis, Magdeburg, 2006]'

View File

@ -53,7 +53,7 @@ maxDeltaT 1;
functions functions
{ {
box.all.numberDensity.volume.bubbles numberDensity
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");
@ -68,7 +68,7 @@ functions
populationBalance bubbles; populationBalance bubbles;
} }
box.all.moments.volume.bubbles moments
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");

View File

@ -11,27 +11,9 @@ runApplication blockMesh
runApplication $application runApplication $application
# Get and transpose results # Get and transpose results
cp postProcessing/box.all.numberDensity.volume.bubbles/0/box.all.numberDensity.volume.bubbles.dat . cp postProcessing/numberDensity/0/numberDensity.dat .
sed -i -e '1d' -e 's/# /#/g' numberDensity.dat
sed -i -e 1d box.all.numberDensity.volume.bubbles.dat transposeFile numberDensity.dat > numberDensity.transposed.dat
sed -i -e 's/# /#/g' box.all.numberDensity.volume.bubbles.dat
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' box.all.numberDensity.volume.bubbles.dat > box.all.numberDensity.volume.bubbles.transposed.dat
# Create plot # Create plot
./plot ./plot

View File

@ -14,9 +14,9 @@ set xrange [1:15]
set yrange [0:1.5e-2] set yrange [0:1.5e-2]
set key top right set key top right
plot "<printf '4 0\n4 0.01\n6 0.01\n6 0\n'" w l t 'Kumar (2002)',\ plot "<printf '4 0\n4 0.01\n6 0.01\n6 0\n'" w l t '[Kumar J., PhD thesis, Magdeburg, 2006]',\
"<printf '8 0\n8 0.01\n10 0.01\n10 0\n'" w l t 'Initial Condition',\ "<printf '8 0\n8 0.01\n10 0.01\n10 0\n'" w l t 'Initial Condition',\
'box.all.numberDensity.volume.bubbles.transposed.dat' u 1:2 w lp t 'air' 'numberDensity.transposed.dat' u 1:2 w lp t 'air'
set output "moments.eps" set output "moments.eps"
@ -29,7 +29,7 @@ set xrange [0:4]
set yrange [0:1.5] set yrange [0:1.5]
set key top right set key top right
plot 'postProcessing/box.all.moments.volume.bubbles/0/box.all.moments.volume.bubbles.dat' u 1:($2/0.0258575) w p pt 5 t 'j=0 (Numbers), air',\ plot 'postProcessing/moments/0/moments.dat' u 1:($2/0.0258575) w p pt 5 t 'j=0 (Numbers), air',\
"<printf '0 1\n6 1\n'" w l t 'j=0 (Numbers), Kumar (2002)',\ "<printf '0 1\n6 1\n'" w l t 'j=0 (Numbers), [Kumar J., PhD thesis, Magdeburg, 2006]',\
'postProcessing/box.all.moments.volume.bubbles/0/box.all.moments.volume.bubbles.dat' u 1:($3/0.2325241) w p pt 6 t 'j=1 (Volume), air',\ 'postProcessing/moments/0/moments.dat' u 1:($3/0.2325241) w p pt 6 t 'j=1 (Volume), air',\
"<printf '0 1\n6 0.33333\n'" w l t 'j=1 (Volume), Kumar (2002)' "<printf '0 1\n6 0.33333\n'" w l t 'j=1 (Volume), [Kumar J., PhD thesis, Magdeburg, 2006]'

View File

@ -53,7 +53,7 @@ maxDeltaT 1;
functions functions
{ {
box.all.numberDensity.volume.bubbles numberDensity
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");
@ -68,7 +68,7 @@ functions
populationBalance bubbles; populationBalance bubbles;
} }
box.all.moments.volume.bubbles moments
{ {
type sizeDistribution; type sizeDistribution;
functionObjectLibs ("libreactingEulerFoamFunctionObjects.so"); functionObjectLibs ("libreactingEulerFoamFunctionObjects.so");