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), ParcelType::constantProperties(parentDict),
pMin_(this->dict_, "pMin", 1000.0), pMin_(this->dict_, "pMin", 1000.0),
constantVolume_(this->dict_, "constantVolume", false), constantVolume_(this->dict_, "constantVolume", false),
volUpdateType_ volUpdateType_(this->dict_, "volumeUpdateMethod")
(
this->dict_,
"volumeUpdateMethod",
volumeUpdateType::mConstRho
)
{ {
// If constantVolume found use it // If constantVolume found use it
if (this->dict_.found("constantVolume")) if (this->dict_.found("constantVolume"))
{ {
volUpdateType_.setValue(mUndefined); 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 const word volumeUpdateMethod
( (
this->dict_.getWord("volumeUpdateMethod") this->dict_.getWord("volumeUpdateMethod")

View File

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

View File

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

View File

@ -60,44 +60,8 @@ serialRun() {
runApplication WatersKing 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 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; relTol 0;
} }
Phi
{
$p_rgh;
}
"(Yi|O2|N2|H2O)" "(Yi|O2|N2|H2O)"
{ {
solver PBiCGStab; solver PBiCGStab;

View File

@ -21,6 +21,6 @@ runParallel renumberMesh -overwrite
runParallel $(getApplication) 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;
}
);
// ************************************************************************* //