TUT: Alltest: minor corrections (#1956)

This commit is contained in:
Kutalmis Bercin
2020-12-11 09:29:23 +00:00
committed by Andrew Heather
parent e646218af9
commit bcae4b7a4f
12 changed files with 104 additions and 246 deletions

View File

@ -54,55 +54,50 @@ functions
AMI1
{
type surfaceFieldValue;
functionObjectLibs ("libfieldFunctionObjects.so");
log true;
executeControl timeStep;
executeInterval 1;
writeFields true;
regionType patch;
name AMI1;
operation sum;
surfaceFormat none;
fields (phi);
libs (fieldFunctionObjects);
log true;
executeControl timeStep;
executeInterval 1;
writeFields true;
regionType patch;
name AMI1;
operation sum;
surfaceFormat none;
fields (phi);
}
AMI2
{
type surfaceFieldValue;
functionObjectLibs ("libfieldFunctionObjects.so");
log true;
executeControl timeStep;
executeInterval 1;
writeFields true;
regionType patch;
name AMI2;
operation sum;
surfaceFormat none;
fields (phi);
type surfaceFieldValue;
libs (fieldFunctionObjects);
log true;
executeControl timeStep;
executeInterval 1;
writeFields true;
regionType patch;
name AMI2;
operation sum;
surfaceFormat none;
fields (phi);
}
forces
{
type forces;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
timeInterval 1;
log yes;
patches ( "rotor" );
pName p;
UName U;
rho rhoInf; // Indicates incompressible
log true;
rhoInf 997; // Redundant for incompressible
CofR (0 0 0); // Rotation around centre line of propeller
pitchAxis (0 0 1);
forces
{
type forces;
libs (forces);
writeControl timeStep;
timeInterval 1;
log yes;
patches ( "rotor" );
pName p;
UName U;
rho rhoInf; // Indicates incompressible
log true;
rhoInf 997; // Redundant for incompressible
CofR (0 0 0); // Rotation around centre line of propeller
pitchAxis (0 0 1);
}
}
}
// ************************************************************************* //

View File

@ -25,11 +25,9 @@ actions
type faceSet;
action new;
source patchToFace;
sourceInfo
{
name "AMI.*";
}
patch "AMI.*";
}
);
// ************************************************************************* //

View File

@ -60,44 +60,8 @@ serialRun() {
runApplication WatersKing
}
# Plot streamwise flow speed at y=1.0 [m] as a function of time
#
# $* = models
# ----
plot() {
# Require gnuplot
command -v gnuplot >/dev/null || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
models=$*
endTime=$(foamDictionary -entry endTime -value system/controlDict)
gnuplot<<PLT
set terminal pngcairo font "helvetica,16" size 800,600
set output "planarPoiseuille.png"
set grid
set key right top
set xrange [0:"$endTime"]
set yrange [0:8]
set xlabel "t [s]"
set ylabel "U_x [m/s]" rotate by 0 offset 3,0,0
results=system("ls *.txt")
names="${models[*]}"
plot \
"WatersKing.dat" w lines t "Analytical" lt -1, \
for [i=1:words(results)] word(results, i) t word(names, i) \
w linespoints pointinterval 100 lt i pt 6 ps 1.5
PLT
}
#------------------------------------------------------------------------------
serialRun $endTime $models
plot $models
#------------------------------------------------------------------------------

View File

@ -0,0 +1,50 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
models="
Maxwell
Stokes
"
#------------------------------------------------------------------------------
# Plot streamwise flow speed at y=1.0 [m] as a function of time
#
# $* = models
# ----
plot() {
# Require gnuplot
command -v gnuplot >/dev/null || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
}
models=$*
endTime=$(foamDictionary -entry endTime -value system/controlDict)
gnuplot<<PLT
set terminal pngcairo font "helvetica,16" size 800,600
set output "planarPoiseuille.png"
set grid
set key right top
set xrange [0:"$endTime"]
set yrange [0:8]
set xlabel "t [s]"
set ylabel "U_x [m/s]" rotate by 0 offset 3,0,0
results=system("ls *.txt")
names="${models[*]}"
plot \
"WatersKing.dat" w lines t "Analytical" lt -1, \
for [i=1:words(results)] word(results, i) t word(names, i) \
w linespoints pointinterval 100 lt i pt 6 ps 1.5
PLT
}
#------------------------------------------------------------------------------
plot $models
#------------------------------------------------------------------------------