Merge branch 'tut-alltest-corrections' into 'develop'

TUT: Alltest: Corrections

See merge request Development/openfoam!412
This commit is contained in:
Andrew Heather
2020-12-11 14:33:26 +00:00
13 changed files with 118 additions and 253 deletions

View File

@ -61,20 +61,27 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
ParcelType::constantProperties(parentDict),
pMin_(this->dict_, "pMin", 1000.0),
constantVolume_(this->dict_, "constantVolume", false),
volUpdateType_
(
this->dict_,
"volumeUpdateMethod",
volumeUpdateType::mConstRho
)
volUpdateType_(this->dict_, "volumeUpdateMethod")
{
// If constantVolume found use it
if (this->dict_.found("constantVolume"))
{
volUpdateType_.setValue(mUndefined);
}
else if (this->dict_.found("volumeUpdateMethod"))
else
{
if (!this->dict_.found("volumeUpdateMethod"))
{
FatalErrorInFunction
<< "Either 'constantVolume' or 'volumeUpdateMethod' " << nl
<< " must be provided. " << nl
<< " The new keyword is 'volumeUpdateMethod'. " << nl
<< " Available methods are : " << nl
<< " constantRho, constantVolume or updateRhoAndVol. " << nl
<< " 'constantVolume' is either true/false " << nl
<< nl << exit(FatalError);
}
const word volumeUpdateMethod
(
this->dict_.getWord("volumeUpdateMethod")

View File

@ -23,8 +23,8 @@ boundaryField
{
inlet
{
type uniformFixedValue;
uniformValue 0.000141;
type fixedValue;
value uniform 0.000141;
}
outlet

View File

@ -54,7 +54,7 @@ functions
AMI1
{
type surfaceFieldValue;
functionObjectLibs ("libfieldFunctionObjects.so");
libs (fieldFunctionObjects);
log true;
executeControl timeStep;
executeInterval 1;
@ -65,10 +65,11 @@ functions
surfaceFormat none;
fields (phi);
}
AMI2
{
type surfaceFieldValue;
functionObjectLibs ("libfieldFunctionObjects.so");
libs (fieldFunctionObjects);
log true;
executeControl timeStep;
executeInterval 1;
@ -83,26 +84,20 @@ functions
forces
{
type forces;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
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
#------------------------------------------------------------------------------

View File

@ -21,4 +21,10 @@ solution
}
constantProperties
{
volumeUpdateMethod constantRho;
}
// ************************************************************************* //

View File

@ -62,6 +62,11 @@ solvers
relTol 0;
}
Phi
{
$p_rgh;
}
"(Yi|O2|N2|H2O)"
{
solver PBiCGStab;

View File

@ -21,6 +21,6 @@ runParallel renumberMesh -overwrite
runParallel $(getApplication)
runParallel redistributePar -reconstruct -latestTime
runApplication reconstructPar -latestTime
#------------------------------------------------------------------------------

View File

@ -65,8 +65,6 @@ functions
}
);
}
#includeFunc "samples"
}

View File

@ -1,158 +0,0 @@
// -*- C++ -*-
type sets;
libs (sampling);
interpolationScheme cellPoint;
setFormat raw;
writeControl writeTime;
fields
(
T
p_rgh
U
k
nut
);
sets
(
lineZM_C20
{
type uniform;
axis distance;
start (0.0 0.0 21.0);
end (0.0 0.0 500.0);
nPoints 500;
}
lineFlowDirM_C20
{
type uniform;
axis distance;
start (-9000 0.0 40.0);
end (9000 0.0 40.0);
nPoints 500;
}
lineFlowDirM_C100
{
type uniform;
axis distance;
start (-9000 0.0 120.0);
end (9000 0.0 120.0);
nPoints 500;
}
lineFlowDirM_C200
{
type uniform;
axis distance;
start (-9000 0.0 220.0);
end (9000 0.0 220.0);
nPoints 500;
}
lineFlowDirM_C1000
{
type uniform;
axis distance;
start (-9000 0.0 1020.0);
end (9000 0.0 1020.0);
nPoints 500;
}
lineZM_I20
{
type uniform;
axis distance;
start (-9000.0 0.0 21.0);
end (-9000.0 0.0 500.0);
nPoints 500;
}
lineFlowDirM_I20
{
type uniform;
axis distance;
start (-9000 0.0 40.0);
end (9000 0.0 40.0);
nPoints 500;
}
lineFlowDirM_I100
{
type uniform;
axis distance;
start (-9000 0.0 120.0);
end (9000 0.0 120.0);
nPoints 500;
}
lineFlowDirM_I200
{
type uniform;
axis distance;
start (-9000 0.0 220.0);
end (9000 0.0 220.0);
nPoints 500;
}
lineFlowDirM_I1000
{
type uniform;
axis distance;
start (-9000 0.0 1020.0);
end (9000 0.0 1020.0);
nPoints 500;
}
lineZM_O20
{
type uniform;
axis distance;
start (9000.0 0.0 21.0);
end (9000.0 0.0 500.0);
nPoints 500;
}
lineFlowDirM_O20
{
type uniform;
axis distance;
start (-9000 0.0 40.0);
end (9000.0 0.0 40.0);
nPoints 500;
}
lineFlowDirM_O100
{
type uniform;
axis distance;
start (-9000 0.0 120.0);
end (9000.0 0.0 120.0);
nPoints 500;
}
lineFlowDirM_O200
{
type uniform;
axis distance;
start (-9000 0.0 220.0);
end (9000.0 0.0 220.0);
nPoints 500;
}
lineFlowDirM_O1000
{
type uniform;
axis distance;
start (-9000 0.0 1020.0);
end (9000.0 0.0 1020.0);
nPoints 500;
}
);
// ************************************************************************* //