Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
sergio
2018-12-10 12:04:31 -08:00
130 changed files with 4605 additions and 235 deletions

View File

@ -60,6 +60,13 @@ then
(cd $WM_PROJECT_DIR/modules 2>/dev/null && wmake -all) (cd $WM_PROJECT_DIR/modules 2>/dev/null && wmake -all)
fi fi
# Count files in given directory. Ignore "Test-*" binaries.
_foamCountDirEntries()
{
(cd "$1" 2>/dev/null && find -mindepth 1 -maxdepth 1 -type f 2>/dev/null) |\
sed -e '\@/Test-@d' | wc -l
}
# Some summary information # Some summary information
echo echo
date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown" date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
@ -68,4 +75,11 @@ echo " ${WM_PROJECT_DIR##*/}"
echo " $WM_COMPILER $WM_COMPILER_TYPE compiler" echo " $WM_COMPILER $WM_COMPILER_TYPE compiler"
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}" echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
echo echo
echo " api = $(wmakeBuildInfo -show-api 2>/dev/null)"
echo " patch = $(wmakeBuildInfo -show-patch 2>/dev/null)"
echo " bin = $(_foamCountDirEntries $FOAM_APPBIN) entries"
echo " lib = $(_foamCountDirEntries $FOAM_LIBBIN) entries"
echo
echo "========================================"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -28,14 +28,14 @@ Description
Mass tranfer Lee model. Simple model driven by field value difference as: Mass tranfer Lee model. Simple model driven by field value difference as:
\f[ \f[
mDot = C \rho \alpha (\T - T_{activate})/T_{activate} \dot{m} = C \rho \alpha (T - T_{activate})/T_{activate}
\f] \f]
where C is a model constant. where C is a model constant.
if C > 0: if C > 0:
\f[ \f[
mDot = C \rho \alpha*(\T - T_{activate})/T_{activate} \dot{m} = C \rho \alpha (T - T_{activate})/T_{activate}
\f] \f]
for \f[ T > T_{activate} \f] for \f[ T > T_{activate} \f]
@ -46,12 +46,12 @@ Description
if C < 0: if C < 0:
\f[ \f[
mDot = -C \rho \alpha (T_{activate} - \T)/T_{activate} \dot{m} = -C \rho \alpha (T_{activate} - T)/T_{activate}
\f] \f]
for \f[ T < T_{activate} \f] for \f[ T < T_{activate} \f]
and and
\f[ mDot = 0.0 \f] for \f[ T > T_{activate} \f] \f[ \dot{m} = 0.0 \f] for \f[ T > T_{activate} \f]
Based on the reference: Based on the reference:
-# W. H. Lee. "A Pressure Iteration Scheme for Two-Phase Modeling". -# W. H. Lee. "A Pressure Iteration Scheme for Two-Phase Modeling".

View File

@ -25,38 +25,37 @@ Class
Foam::meltingEvaporationModels::kineticGasEvaporation Foam::meltingEvaporationModels::kineticGasEvaporation
Description Description
Considering the Hertz Knudsen formula, which gives the Considering the Hertz Knudsen formula, which gives the
evaporation-condensation flux based on the kinetic theory for flat evaporation-condensation flux based on the kinetic theory for flat
interface: interface:
\f[ \f[
Flux = C sqrt(M/(2 \pi \R T_{activate}))(\p - pSat) Flux = C \sqrt{\frac{M}{2 \pi R T_{activate}}}(p - p_{sat})
\f] \f]
where: where:
\vartable \vartable
Flux | mass flux rate [Kg/s/m2] Flux | mass flux rate [kg/s/m2]
M | molecular weight M | molecular weight
T_{activate} | saturation temperature T_{activate} | saturation temperature
C | accomodation coefficient C | accomodation coefficient
R | universal gas constant R | universal gas constant
pSat | saturation pressure p_{sat} | saturation pressure
\p | vapor partial pressure p | vapor partial pressure
\endvartable \endvartable
The Clapeyron-Clausius equation relates the pressure to the temperature The Clapeyron-Clausius equation relates the pressure to the temperature
for the saturation condition: for the saturation condition:
\f[ \f[
dp/dT = - L / (T*(nuv - nul)) \frac{dp}{dT} = - \frac{L}{T (\nu_v - \nu_l)}
\f] \f]
where: where:
\vartable \vartable
L | latent heat L | latent heat
nuv | inverse of the vapor density \nu_v | inverse of the vapor density
nul | inverse of the liquid density \nu_l | inverse of the liquid density
\endvartable \endvartable
@ -64,10 +63,10 @@ Description
\f[ \f[
Flux = Flux =
2 C/(2 - C) 2 \frac{C}{2 - C}
sqrt(M/(2 \pi \R T_{activate})) \sqrt{\frac{M}{2 \pi R T_{activate}}}
L (\rho_{v}*\rho_{l}/(\rho_{l} - \rho_{v})) L (\rho_{v}*\rho_{l}/(\rho_{l} - \rho_{v}))
(\T - T_{activate})/T_{activate} (T - T_{activate})/T_{activate}
\f] \f]
This assumes liquid and vapour are in equilibrium, then the accomodation This assumes liquid and vapour are in equilibrium, then the accomodation
@ -75,7 +74,7 @@ Description
Hertz-Knudsen-Schrage. Hertz-Knudsen-Schrage.
Based on the reference: Based on the reference:
- Van P. Carey, Liquid-Vapor Phase Change Phenomena, ISBN 0-89116836, - Van P. Carey, Liquid-Vapor Phase Change Phenomena, ISBN 0-89116836,
1992, pp. 112-121. 1992, pp. 112-121.

View File

@ -64,6 +64,11 @@ int main(int argc, char *argv[])
"list", "list",
"List directories or files to be checked" "List directories or files to be checked"
); );
argList::addBoolOption
(
"list-all",
"List all directories (including non-existence ones)"
);
argList::addArgument("file..."); argList::addArgument("file...");
argList::addNote argList::addNote
@ -77,9 +82,15 @@ int main(int argc, char *argv[])
// First handle no parameters // First handle no parameters
if (args.size() == 1) if (args.size() == 1)
{ {
if (args.found("list")) if (args.found("list-all"))
{ {
fileNameList results = findEtcDirs(); fileNameList results = etcDirs(false);
printList(results);
return 0;
}
else if (args.found("list"))
{
fileNameList results = etcDirs();
printList(results); printList(results);
return 0; return 0;
} }

View File

@ -61,7 +61,7 @@ Usage
- \par -patches patch or patch list - \par -patches patch or patch list
Specify particular patches to write. Specify particular patches to write.
- \par -faceZones patch or zone list - \par -faceZones zone or zone list
Specify faceZones to write, with wildcards Specify faceZones to write, with wildcards
- \par -cellZone zoneName - \par -cellZone zoneName

View File

@ -149,7 +149,7 @@ Description
// Write faceZones (POLYDATA file, one for each zone) // Write faceZones (POLYDATA file, one for each zone)
if (doFaceZones && !mesh.faceZones().empty()) if (!selectedFaceZones.empty() && !mesh.faceZones().empty())
{ {
if (nSurfaceScalarField == -1) if (nSurfaceScalarField == -1)
{ {
@ -187,6 +187,11 @@ Description
for (const faceZone& fz : mesh.faceZones()) for (const faceZone& fz : mesh.faceZones())
{ {
if (!selectedFaceZones.match(fz.name()))
{
continue;
}
indirectPrimitivePatch pp indirectPrimitivePatch pp
( (
IndirectList<face>(mesh.faces(), fz), IndirectList<face>(mesh.faces(), fz),

View File

@ -70,6 +70,10 @@ Usage
- \par -pointSet \<name\> - \par -pointSet \<name\>
Restrict conversion to the faceSet or pointSet. Restrict conversion to the faceSet or pointSet.
- \par -faceZones zone or zone list
Specify single faceZone or or multiple faceZones (name or regex)
to write
- \par -nearCellValue - \par -nearCellValue
Output cell value on patches instead of patch value itself Output cell value on patches instead of patch value itself
@ -85,9 +89,6 @@ Usage
- \par -no-point-data - \par -no-point-data
Suppress conversion of pointFields. No interpolated PointData. Suppress conversion of pointFields. No interpolated PointData.
- \par -noFaceZones
Suppress conversion of surface fields on faceZones
- \par -poly-decomp - \par -poly-decomp
Decompose polyhedral cells into tets/pyramids Decompose polyhedral cells into tets/pyramids
@ -308,6 +309,13 @@ int main(int argc, char *argv[])
"Convert specified pointSet only", "Convert specified pointSet only",
true // mark as an advanced option true // mark as an advanced option
); );
argList::addOption
(
"faceZones",
"wordRes",
"Specify single or multiple faceZones to write\n"
"Eg, 'cells' or '( slice \"mfp-.*\" )'."
);
argList::addOption argList::addOption
( (
@ -397,12 +405,10 @@ int main(int argc, char *argv[])
" Eg, 'outlet' or '( inlet \".*Wall\" )'", " Eg, 'outlet' or '( inlet \".*Wall\" )'",
true // mark as an advanced option true // mark as an advanced option
); );
argList::ignoreOptionCompat
argList::addBoolOption
( (
"noFaceZones", {"noFaceZones", 1806}, // faceZones are only enabled on demand
"Suppress conversion of surface fields on faceZones", false // bool option, no argument
true // mark as an advanced option
); );
argList::ignoreOptionCompat argList::ignoreOptionCompat
( (
@ -435,7 +441,6 @@ int main(int argc, char *argv[])
const bool doFiniteArea = args.found("finiteAreaFields"); const bool doFiniteArea = args.found("finiteAreaFields");
const bool doSurfaceFields = args.found("surfaceFields"); const bool doSurfaceFields = args.found("surfaceFields");
const bool doFaceZones = !args.found("noFaceZones") && doInternal;
const bool oneBoundary = args.found("one-boundary") && doBoundary; const bool oneBoundary = args.found("one-boundary") && doBoundary;
const bool nearCellValue = args.found("nearCellValue") && doBoundary; const bool nearCellValue = args.found("nearCellValue") && doBoundary;
const bool allRegions = args.found("allRegions"); const bool allRegions = args.found("allRegions");
@ -471,10 +476,14 @@ int main(int argc, char *argv[])
} }
} }
// Can be specified as empty (ie, no fields)
wordRes selectedFields; wordRes selectedFields;
const bool useFieldFilter = const bool useFieldFilter =
args.readListIfPresent<wordRe>("fields", selectedFields); args.readListIfPresent<wordRe>("fields", selectedFields);
// Non-mandatory
const wordRes selectedFaceZones(args.getList<wordRe>("faceZones", false));
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);

View File

@ -1,3 +1,3 @@
foamPvCore.C foamPvCore.C
LIB = $(FOAM_LIBBIN)/libfoamPv-pv${ParaView_MAJOR} LIB = $(FOAM_LIBBIN)/libfoamPv-pv${PARAVIEW_API}

View File

@ -5,4 +5,4 @@ vtkPVFoamMeshLagrangian.C
vtkPVFoamMeshVolume.C vtkPVFoamMeshVolume.C
vtkPVFoamUpdateInfo.C vtkPVFoamUpdateInfo.C
LIB = $(FOAM_LIBBIN)/libvtkPVFoam-pv${ParaView_MAJOR} LIB = $(FOAM_LIBBIN)/libvtkPVFoam-pv${PARAVIEW_API}

View File

@ -18,5 +18,5 @@ LIB_LIBS = \
-lconversion \ -lconversion \
-lgenericPatchFields \ -lgenericPatchFields \
-llagrangian \ -llagrangian \
-L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_API) \ -L$(FOAM_LIBBIN) -lfoamPv-pv${PARAVIEW_API} \
$(GLIBS) $(GLIBS)

View File

@ -1,4 +1,4 @@
vtkPVblockMesh.C vtkPVblockMesh.C
vtkPVblockMeshConvert.C vtkPVblockMeshConvert.C
LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh-pv${ParaView_MAJOR} LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh-pv${PARAVIEW_API}

View File

@ -12,5 +12,5 @@ EXE_INC = \
LIB_LIBS = \ LIB_LIBS = \
-lmeshTools \ -lmeshTools \
-lblockMesh \ -lblockMesh \
-L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_API) \ -L$(FOAM_LIBBIN) -lfoamPv-pv${PARAVIEW_API} \
$(GLIBS) $(GLIBS)

View File

@ -215,8 +215,8 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
wordRes selectedFields; // Non-mandatory
args.readListIfPresent<wordRe>("fields", selectedFields); const wordRes selectedFields(args.getList<wordRe>("fields", false));
if (selectedFields.empty()) if (selectedFields.empty())
{ {

View File

@ -0,0 +1,3 @@
createBoxTurb.C
EXE = $(FOAM_APPBIN)/createBoxTurb

View File

@ -0,0 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lblockMesh \
-lfileFormats

View File

@ -0,0 +1,104 @@
const cellModel& hex = cellModel::ref(cellModel::HEX);
cellShapeList cellShapes;
faceListList boundary;
pointField points;
{
Info<< "Creating block" << endl;
block b
(
cellShape(hex, identity(8), false),
pointField
(
{
point(0, 0, 0),
point(L.x(), 0, 0),
point(L.x(), L.y(), 0),
point(0, L.y(), 0),
point(0, 0, L.z()),
point(L.x(), 0, L.z()),
point(L.x(), L.y(), L.z()),
point(0, L.y(), L.z())
}
),
blockEdgeList(),
blockFaceList(),
N,
List<gradingDescriptors>(12)
);
Info<< "Creating cells" << endl;
List<FixedList<label, 8>> bCells(b.cells());
cellShapes.setSize(bCells.size());
forAll(cellShapes, celli)
{
cellShapes[celli] =
cellShape(hex, labelList(bCells[celli]), false);
}
Info<< "Creating boundary faces" << endl;
boundary.setSize(b.boundaryPatches().size());
forAll(boundary, patchi)
{
faceList faces(b.boundaryPatches()[patchi].size());
forAll(faces, facei)
{
faces[facei] = face(b.boundaryPatches()[patchi][facei]);
}
boundary[patchi].transfer(faces);
}
points.transfer(const_cast<pointField&>(b.points()));
}
Info<< "Creating patch dictionaries" << endl;
wordList patchNames(boundary.size());
forAll(patchNames, patchi)
{
patchNames[patchi] = "patch" + Foam::name(patchi);
}
PtrList<dictionary> boundaryDicts(boundary.size());
forAll(boundaryDicts, patchi)
{
boundaryDicts.set(patchi, new dictionary());
dictionary& patchDict = boundaryDicts[patchi];
word nbrPatchName;
if (patchi % 2 == 0)
{
nbrPatchName = "patch" + Foam::name(patchi + 1);
}
else
{
nbrPatchName = "patch" + Foam::name(patchi - 1);
}
patchDict.add("type", cyclicPolyPatch::typeName);
patchDict.add("neighbourPatch", nbrPatchName);
}
Info<< "Creating polyMesh" << endl;
polyMesh mesh
(
IOobject
(
polyMesh::defaultRegion,
runTime.constant(),
runTime,
IOobject::NO_READ
),
std::move(points),
cellShapes,
boundary,
patchNames,
boundaryDicts,
"defaultFaces",
cyclicPolyPatch::typeName,
false
);
Info<< "Writing polyMesh" << endl;
mesh.write();

View File

@ -0,0 +1,184 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
createBoxTurb
Description
Creates a box of isotropic turbulence based on a user-specified
energy spectrum.
Based on the reference
\verbatim
Saad, T., Cline, D., Stoll, R., Sutherland, J.C.
"Scalable Tools for Generating Synthetic Isotropic Turbulence with
Arbitrary Spectra"
AIAA Journal, Vol. 55, No. 1 (2017), pp. 327-331.
\endverbatim
The \c -createBlockMesh option creates a block mesh and exits, which
can then be decomposed and the utility run in parallel.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "block.H"
#include "mathematicalConstants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::vector randomUnitVector(Random& rndGen)
{
// Sample point on a sphere
scalar t = rndGen.globalPosition<scalar>(-1, 1);
scalar phim = rndGen.globalSample01<scalar>()*mathematical::twoPi;
scalar thetam = Foam::acos(t);
return vector
(
Foam::sin(thetam*Foam::cos(phim)),
Foam::sin(thetam*Foam::sin(phim)),
Foam::cos(thetam)
);
}
int main(int argc, char *argv[])
{
argList::addBoolOption
(
"createBlockMesh",
"create the block mesh and exit"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createFields.H"
if (args.found("createBlockMesh"))
{
// Create a box block mesh with cyclic patches
#include "createBlockMesh.H"
return 0;
}
#include "createMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Minimum wave number
scalar kappa0 = mathematical::twoPi/cmptMin(L);
// Maximum wave number
scalar kappaMax = mathematical::pi/cmptMin(delta);
Info<< "Wave number min/max = " << kappa0 << ", " << kappaMax << endl;
Info<< "Generating velocity field" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedVector(dimVelocity, Zero)
);
vectorField& Uc = U.primitiveFieldRef();
const scalar deltaKappa = (kappaMax - kappa0)/scalar(nModes - 1);
const vectorField& C(mesh.C());
for (label modei = 1; modei <= nModes; ++modei)
{
// Equidistant wave mode
scalar kappaM = kappa0 + deltaKappa*(modei-1);
Info<< "Processing mode:" << modei << " kappaM:" << kappaM << endl;
// Energy
scalar E = Ek->value(kappaM);
// Wave amplitude
scalar qm = Foam::sqrt(E*deltaKappa);
// Wave number unit vector
const vector kappaHatm(randomUnitVector(rndGen));
vector kappaTildem(0.5*kappaM*cmptMultiply(kappaHatm, delta));
for (direction i = 0; i < 3; ++i)
{
kappaTildem[i] = 2/delta[i]*Foam::sin(kappaTildem[i]);
}
// Intermediate unit vector zeta
const vector zetaHatm(randomUnitVector(rndGen));
// Unit vector sigma
vector sigmaHatm(zetaHatm^kappaTildem);
sigmaHatm /= mag(kappaTildem);
// Phase angle
scalar psim = 0.5*rndGen.position(-mathematical::pi, mathematical::pi);
// Add the velocity contribution per mode
Uc += 2*qm*cos(kappaM*(kappaHatm & C) + psim)*sigmaHatm;
}
U.write();
{
Info<< "Generating kinetic energy field" << endl;
volScalarField k("k", 0.5*magSqr(U));
k.write();
Info<< "min/max/average k = "
<< gMin(k) << ", " << gMax(k) << ", " << gAverage(k)
<< endl;
}
{
Info<< "Generating div(U) field" << endl;
volScalarField divU(fvc::div(U));
divU.write();
Info<< "min/max/average div(U) = "
<< gMin(divU) << ", " << gMax(divU) << ", " << gAverage(divU)
<< endl;
}
Info<< nl;
runTime.printExecutionTime(Info);
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
IOdictionary dict
(
IOobject
(
"createBoxTurbDict",
runTime.constant(),
runTime,
IOobject::MUST_READ
)
);
// Extents in x, y, z directions
const vector L(dict.get<vector>("L"));
// Number of cells in x, y, z directions
const Vector<label> N(dict.get<Vector<label>>("N"));
// Wave number vs energy profile
autoPtr<Function1<scalar>> Ek(Function1<scalar>::New("Ek", dict));
// Number of modes
const label nModes = dict.get<label>("nModes");
// Mesh spacing in x, y and z directions
const vector delta
(
L.x()/scalar(N.x()),
L.y()/scalar(N.y()),
L.z()/scalar(N.z())
);
Random rndGen(1234);

View File

@ -288,8 +288,8 @@ int main(int argc, char *argv[])
Info<< "Subtracting mapped source field from target" << endl; Info<< "Subtracting mapped source field from target" << endl;
} }
wordRes selectedFields; // Non-mandatory
args.readListIfPresent<wordRe>("fields", selectedFields); const wordRes selectedFields(args.getList<wordRe>("fields", false));
const bool noLagrangian = args.found("noLagrangian"); const bool noLagrangian = args.found("noLagrangian");

View File

@ -177,6 +177,11 @@ int main(int argc, char *argv[])
isoCutCell icc(mesh, f); isoCutCell icc(mesh, f);
icc.volumeOfFluid(alpha1, f0); icc.volumeOfFluid(alpha1, f0);
if (dict.lookupOrDefault("invertAlpha", false))
{
alpha1 = 1 - alpha1;
}
// Writing volScalarField alpha1 // Writing volScalarField alpha1
ISstream::defaultPrecision(18); ISstream::defaultPrecision(18);
alpha1.write(); alpha1.write();

View File

@ -29,6 +29,7 @@
# Driver script to run mpi jobs with the processes in a separate XTerm # Driver script to run mpi jobs with the processes in a separate XTerm
# or to separate log files. # or to separate log files.
# Requires bash on all processors. # Requires bash on all processors.
#
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions # Run functions
@ -193,15 +194,17 @@ fi
sourceFoam=false # Fallback command sourceFoam=false # Fallback command
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ # Same as foamEtcFile -mode=uo bashrc
#
# check ~/.$WM_PROJECT/$WM_PROJECT_API/
# check ~/.$WM_PROJECT/ # check ~/.$WM_PROJECT/
# check <installedProject>/etc/ # check <installedProject>/etc/
if [ -n "$WM_PROJECT" ] if [ -n "$WM_PROJECT" ]
then then
for i in \ for i in \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \ "$HOME/.$WM_PROJECT/$WM_PROJECT_API" \
$HOME/.$WM_PROJECT \ "$HOME/.$WM_PROJECT" \
$WM_PROJECT_DIR/etc \ "$WM_PROJECT_DIR/etc" \
; ;
do do
if [ -f "$i/bashrc" ] if [ -f "$i/bashrc" ]

View File

@ -123,7 +123,7 @@ _matches()
local result local result
for regexp for regexp
do do
result=$(echo "$input" | sed -n -e "/^$regexp"'$/p') result=$(echo "$input" | sed -ne "/^$regexp"'$/p')
test -n "$result" && return 0 # successful match test -n "$result" && return 0 # successful match
done done
return 1 return 1
@ -243,7 +243,7 @@ removeBashMagic()
# ---- # ----
# set projectName="$WM_PROJECT" # set projectName="$WM_PROJECT"
# set projectDir=`lsof +p $$ |& \ # set projectDir=`lsof +p $$ |& \
# sed -n -e 's@^[^/]*@@; s@\(/'"$projectName"'[^/]*\)/etc/cshrc[^/]*@\1@p'` # sed -ne 'something /etc/cshrc something'`
# ---- # ----
removeCshMagic() removeCshMagic()
{ {
@ -587,7 +587,7 @@ do
die "'$1' has bad value: '$optionValue'" die "'$1' has bad value: '$optionValue'"
replace etc/config.sh/paraview ParaView_VERSION "$optionValue" replace etc/config.sh/paraview ParaView_VERSION "$optionValue"
replaceCsh etc/config.csh/paraview ParaView_VERSION "$optionValue" replace etc/config.csh/paraview ParaView_VERSION "$optionValue"
adjusted=true adjusted=true
shift shift
;; ;;

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Version: v1806
\\ / A nd | Web: www.OpenFOAM.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Calculates and writes the second largest eigenvalue of the sum of the
square of the symmetrical and anti-symmetrical parts of the velocity
gradient tensor.
\*---------------------------------------------------------------------------*/
type AMIWeights;
libs ("libfieldFunctionObjects.so");
writeFields yes;
writeControl writeTime;
// ************************************************************************* //

View File

@ -77,15 +77,14 @@ endif
while ( $#argv > 0 ) while ( $#argv > 0 )
switch ($argv[1]) switch ($argv[1])
case ParaView*=*: case ParaView*=*:
# name=value -> setenv name value # name=value -> set name=value
eval "setenv $argv[1]:s/=/ /" eval "set $argv[1]"
breaksw breaksw
endsw endsw
shift shift
end end
if (! $?ParaView_VERSION ) set ParaView_VERSION='' if ($?ParaView_VERSION) then
switch ("$ParaView_VERSION") switch ("$ParaView_VERSION")
case "": case "":
# empty - do nothing # empty - do nothing
@ -209,8 +208,8 @@ default:
setenv ParaView_DIR # Defined but empty (used by foamPV alias) setenv ParaView_DIR # Defined but empty (used by foamPV alias)
endif endif
breaksw breaksw
endsw endsw
endif
unset cleaned archDir unset cleaned archDir
unset cmake cmake_version unset cmake cmake_version

View File

@ -40,21 +40,25 @@ source "$WM_PROJECT_DIR/etc/config.csh/functions"
# It may also not be required at all, in which case a dummy "ThirdParty" # It may also not be required at all, in which case a dummy "ThirdParty"
# directory inside of the OpenFOAM project directory. # directory inside of the OpenFOAM project directory.
# #
# Note: only accept if the directory exists and contains a "Allwmake" file # Note: only accept if the directory exists and contains either
# a "Allwmake" file (source) or a "platforms" directory (runtime-only)
setenv WM_THIRD_PARTY_DIR setenv WM_THIRD_PARTY_DIR
set foundDir='' set foundDir=''
_foamEcho "Locating ThirdParty directory" _foamEcho "Locating ThirdParty directory"
foreach WM_THIRD_PARTY_DIR (\
foreach foamDir (\
"$WM_PROJECT_DIR/ThirdParty" \ "$WM_PROJECT_DIR/ThirdParty" \
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \ "$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
"$prefixDir/ThirdParty-v$WM_PROJECT_API" \ "$prefixDir/ThirdParty-v$WM_PROJECT_API" \
"$prefixDir/ThirdParty-$WM_PROJECT_API" \ "$prefixDir/ThirdParty-$WM_PROJECT_API" \
"$prefixDir/ThirdParty-common" \ "$prefixDir/ThirdParty-common" \
) )
_foamEcho "... $WM_THIRD_PARTY_DIR" _foamEcho "... $foamDir"
if ( -d "$WM_THIRD_PARTY_DIR" ) then if ( -d "$foamDir" ) then
if ( -f "$WM_THIRD_PARTY_DIR/Allwmake" || -d "$WM_THIRD_PARTY_DIR/platforms" ) then if ( -f "$foamDir/Allwmake" || -d "$foamDir/platforms" ) then
setenv WM_THIRD_PARTY_DIR "$foamDir"
set foundDir=true set foundDir=true
break break
endif endif
@ -182,6 +186,6 @@ unalias _foamAddLib
unalias _foamAddLibAuto unalias _foamAddLibAuto
# Variables (done as final statement for a clean exit code) # Variables (done as final statement for a clean exit code)
unset cleaned foamOldDirs foundDir prefixDir unset cleaned foamOldDirs foundDir foamDir prefixDir
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -43,6 +43,7 @@ unsetenv WM_ARCH_OPTION
unsetenv WM_CC unsetenv WM_CC
unsetenv WM_CFLAGS unsetenv WM_CFLAGS
unsetenv WM_COMPILER unsetenv WM_COMPILER
unsetenv WM_COMPILER_ARCH
unsetenv WM_COMPILER_TYPE unsetenv WM_COMPILER_TYPE
unsetenv WM_COMPILER_LIB_ARCH unsetenv WM_COMPILER_LIB_ARCH
unsetenv WM_COMPILE_OPTION unsetenv WM_COMPILE_OPTION

View File

@ -49,7 +49,7 @@ then
# outside of ThirdParty and should be added to the path. # outside of ThirdParty and should be added to the path.
ending="${ADIOS_ARCH_PATH##*-}" ending="${ADIOS_ARCH_PATH##*-}"
if [ "$ending" != none -a "$ending" != system ] if [ "$ending" != none ] && [ "$ending" != system ]
then then
# PATH was already cleaned by etc/bashrc caller # PATH was already cleaned by etc/bashrc caller
_foamAddPath $ADIOS_ARCH_PATH/bin _foamAddPath $ADIOS_ARCH_PATH/bin

View File

@ -96,7 +96,7 @@ _of_complete_cache_[foamToGMV]="-case -decomposeParDict -fileHandler | -listFunc
_of_complete_cache_[foamToStarMesh]="-case -fileHandler -scale -time | -constant -latestTime -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noBnd -noFunctionObjects -noZero -doc -doc-source -help" _of_complete_cache_[foamToStarMesh]="-case -fileHandler -scale -time | -constant -latestTime -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noBnd -noFunctionObjects -noZero -doc -doc-source -help"
_of_complete_cache_[foamToSurface]="-case -fileHandler -scale -time | -constant -latestTime -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noFunctionObjects -noZero -tri -doc -doc-source -help" _of_complete_cache_[foamToSurface]="-case -fileHandler -scale -time | -constant -latestTime -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noFunctionObjects -noZero -tri -doc -doc-source -help"
_of_complete_cache_[foamToTetDualMesh]="-case -decomposeParDict -fileHandler -time | -constant -latestTime -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -noFunctionObjects -noZero -overwrite -parallel -doc -doc-source -help" _of_complete_cache_[foamToTetDualMesh]="-case -decomposeParDict -fileHandler -time | -constant -latestTime -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -noFunctionObjects -noZero -overwrite -parallel -doc -doc-source -help"
_of_complete_cache_[foamToVTK]="-case -cellSet -cellZone -decomposeParDict -excludePatches -faceSet -fields -fileHandler -name -patches -pointSet -region -regions -time | -allRegions -ascii -constant -finiteAreaFields -latestTime -legacy -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -nearCellValue -no-boundary -no-internal -no-lagrangian -no-point-data -noFaceZones -noFunctionObjects -noZero -one-boundary -overwrite -parallel -poly-decomp -surfaceFields -doc -doc-source -help" _of_complete_cache_[foamToVTK]="-case -cellSet -cellZone -decomposeParDict -excludePatches -faceSet -faceZones -fields -fileHandler -name -patches -pointSet -region -regions -time | -allRegions -ascii -constant -finiteAreaFields -latestTime -legacy -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -nearCellValue -no-boundary -no-internal -no-lagrangian -no-point-data -noFunctionObjects -noZero -one-boundary -overwrite -parallel -poly-decomp -surfaceFields -doc -doc-source -help"
_of_complete_cache_[foamUpgradeCyclics]="-case -decomposeParDict -fileHandler -region -time | -constant -dry-run -enableFunctionEntries -latestTime -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -noFunctionObjects -noZero -parallel -doc -doc-source -help" _of_complete_cache_[foamUpgradeCyclics]="-case -decomposeParDict -fileHandler -region -time | -constant -dry-run -enableFunctionEntries -latestTime -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -noFunctionObjects -noZero -parallel -doc -doc-source -help"
_of_complete_cache_[foamyHexMesh]="-case -decomposeParDict -fileHandler | -checkGeometry -conformationOnly -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -parallel -doc -doc-source -help" _of_complete_cache_[foamyHexMesh]="-case -decomposeParDict -fileHandler | -checkGeometry -conformationOnly -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -parallel -doc -doc-source -help"
_of_complete_cache_[foamyQuadMesh]="-case -fileHandler -pointsFile | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noFunctionObjects -overwrite -doc -doc-source -help" _of_complete_cache_[foamyQuadMesh]="-case -fileHandler -pointsFile | -listFunctionObjects -listRegisteredSwitches -listSwitches -listUnsetSwitches -noFunctionObjects -overwrite -doc -doc-source -help"

View File

@ -105,7 +105,7 @@ then
foamVar_end="${1##*-}" foamVar_end="${1##*-}"
# Do not add (none) or a system directory # Do not add (none) or a system directory
if [ -z "$foamVar_prefix" -o "$foamVar_end" = none -o "$foamVar_end" = system ] if [ -z "$foamVar_prefix" ] || [ "$foamVar_end" = none ] || [ "$foamVar_end" = system ]
then then
unset foamVar_prefix foamVar_end unset foamVar_prefix foamVar_end
return 1 return 1

View File

@ -53,7 +53,7 @@ then
# outside of ThirdParty and must be added to the lib-path. # outside of ThirdParty and must be added to the lib-path.
ending="${GPERFTOOLS_ARCH_PATH##*-}" ending="${GPERFTOOLS_ARCH_PATH##*-}"
if [ "$ending" != none -a "$ending" != system ] if [ "$ending" != none ] && [ "$ending" != system ]
then then
_foamAddLib $GPERFTOOLS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH _foamAddLib $GPERFTOOLS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddPath $GPERFTOOLS_ARCH_PATH/bin _foamAddPath $GPERFTOOLS_ARCH_PATH/bin

View File

@ -204,7 +204,7 @@ case "$ParaView_VERSION" in
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" 1>&2 echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" 1>&2
fi fi
else else
if [ "$FOAM_VERBOSE" -a "$PS1" ] if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then then
echo "No paraview found" 1>&2 echo "No paraview found" 1>&2
echo " ParaView_DIR : $ParaView_DIR" 1>&2 echo " ParaView_DIR : $ParaView_DIR" 1>&2

View File

@ -146,7 +146,7 @@ export FOAM_LIBBIN="$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib"
siteDir="$WM_PROJECT_DIR/site" siteDir="$WM_PROJECT_DIR/site"
# User override # User override
if [ -d "$WM_PROJECT_SITE" -a "$WM_PROJECT_SITE" != "$siteDir" ] if [ -d "$WM_PROJECT_SITE" ] && [ "$WM_PROJECT_SITE" != "$siteDir" ]
then then
siteDir="$WM_PROJECT_SITE" siteDir="$WM_PROJECT_SITE"
export WM_PROJECT_SITE export WM_PROJECT_SITE

View File

@ -41,7 +41,9 @@ unset WM_SHELL_FUNCTIONS
# It may also not be required at all, in which case a dummy "ThirdParty" # It may also not be required at all, in which case a dummy "ThirdParty"
# directory inside of the OpenFOAM project directory. # directory inside of the OpenFOAM project directory.
# #
# Note: only accept if the directory exists and contains a "Allwmake" file # Note: only accept if the directory exists and contains either
# a "Allwmake" file (source) or a "platforms" directory (runtime-only)
export WM_THIRD_PARTY_DIR export WM_THIRD_PARTY_DIR
unset foundDir unset foundDir

View File

@ -54,7 +54,7 @@ setenv WM_PROJECT_VERSION plus
# If the directory naming does not match WM_PROJECT, need to change here # If the directory naming does not match WM_PROJECT, need to change here
set projectName="$WM_PROJECT" set projectName="$WM_PROJECT"
set projectDir=`lsof +p $$ |& \ set projectDir=`lsof +p $$ |& \
sed -n -e 's@^[^/]*@@; s@\(/'"$projectName"'[^/]*\)/etc/cshrc[^/]*@\1@p'` sed -ne 's@^[^/]*@@;\@/'"$projectName"'[^/]*/etc/cshrc@{s@/etc/cshrc.*@@p; q}'`
# set projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION" # set projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# set projectDir="/opt/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION" # set projectDir="/opt/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"

View File

@ -70,6 +70,10 @@ primitives/Tensor/lists/symmTensorList.C
primitives/Tensor/lists/tensorList.C primitives/Tensor/lists/tensorList.C
primitives/Vector/complexVector/complexVector.C primitives/Vector/complexVector/complexVector.C
#if !defined(WM_DP)
primitives/Vector/doubleVector/doubleVector.C
primitives/Tensor/doubleTensor/doubleTensor.C
#endif
#if !defined(WM_SP) #if !defined(WM_SP)
primitives/Vector/floatVector/floatVector.C primitives/Vector/floatVector/floatVector.C
primitives/Tensor/floatTensor/floatTensor.C primitives/Tensor/floatTensor/floatTensor.C

View File

@ -212,13 +212,14 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
const Type& defaultValue const Type& defaultValue
) )
{ {
return if (dict.found(name))
dimensioned<Type> {
( return dimensioned<Type>(name, dims, dict);
name, }
dims, else
dict.lookupOrDefault<Type>(name, defaultValue) {
); return dimensioned<Type>(name, dims, defaultValue);
}
} }

View File

@ -871,8 +871,14 @@ void Foam::argList::parse
if (Pstream::master() && bannerEnabled()) if (Pstream::master() && bannerEnabled())
{ {
IOobject::writeBanner(Info, true) IOobject::writeBanner(Info, true)
<< "Build : " << foamVersion::build.c_str() << "Build : ";
<< " (OPENFOAM=" << OPENFOAM;
if (foamVersion::build.size())
{
Info<< foamVersion::build.c_str() << ' ';
}
Info<< "OPENFOAM=" << foamVersion::api;
if (foamVersion::patched()) if (foamVersion::patched())
{ {
@ -880,7 +886,7 @@ void Foam::argList::parse
Info<< " patch=" << foamVersion::patch.c_str(); Info<< " patch=" << foamVersion::patch.c_str();
} }
Info<< ')' << nl Info<< nl
<< "Arch : " << foamVersion::buildArch << nl << "Arch : " << foamVersion::buildArch << nl
<< "Exec : " << commandLine_.c_str() << nl << "Exec : " << commandLine_.c_str() << nl
<< "Date : " << dateString.c_str() << nl << "Date : " << dateString.c_str() << nl

View File

@ -371,12 +371,15 @@ public:
const T& deflt const T& deflt
) const; ) const;
//- Read a List of values from the named option, //- Get a List of values from the named option,
//- treating a single entry like a list of size 1. //- treating a single entry like a list of size 1.
// \param optName the option name to read from
// \param mandatory if the option is non-mandatory, the behaviour
// is similar to readListIfPresent().
template<class T> template<class T>
inline List<T> getList(const word& optName) const; inline List<T> getList(const word& optName, bool mandatory=true) const;
//- If named option is present, read a List of values //- If named option is present, get a List of values
//- treating a single entry like a list of size 1. //- treating a single entry like a list of size 1.
// \return true if the named option was found. // \return true if the named option was found.
template<class T> template<class T>

View File

@ -322,14 +322,22 @@ inline Foam::List<T> Foam::argList::getList(const label index) const
template<class T> template<class T>
inline Foam::List<T> Foam::argList::getList(const word& optName) const inline Foam::List<T> Foam::argList::getList
(
const word& optName,
bool mandatory
) const
{
List<T> list;
if (mandatory || found(optName))
{ {
ITstream is(optName, options_[optName]); ITstream is(optName, options_[optName]);
List<T> list;
readList(is, list); readList(is, list);
checkITstream(is, optName); checkITstream(is, optName);
}
return list; return list;
} }
@ -345,6 +353,7 @@ inline bool Foam::argList::readListIfPresent
if (found(optName)) if (found(optName))
{ {
ITstream is(optName, options_[optName]); ITstream is(optName, options_[optName]);
readList(is, list); readList(is, list);
checkITstream(is, optName); checkITstream(is, optName);

View File

@ -95,6 +95,7 @@ static inline bool groupResourceDir(Foam::fileName& queried)
is undefined (was this intentional?) is undefined (was this intentional?)
#endif #endif
queried.clear();
return false; return false;
} }
@ -108,7 +109,13 @@ static inline bool groupResourceDir(Foam::fileName& queried)
static inline bool projectResourceDir(Foam::fileName& queried) static inline bool projectResourceDir(Foam::fileName& queried)
{ {
queried = Foam::getEnv("WM_PROJECT_DIR")/"etc"; queried = Foam::getEnv("WM_PROJECT_DIR")/"etc";
return (queried.size() > 3 && Foam::isDir(queried)); if (queried.size() > 3)
{
return Foam::isDir(queried);
}
queried.clear();
return false;
} }
@ -119,8 +126,9 @@ Foam::fileNameList searchEtc
bool (*accept)(const Foam::fileName&) bool (*accept)(const Foam::fileName&)
) )
{ {
// Could use foamVersion::api, but this more direct. // Use foamVersion::api (instead of the OPENFOAM define) to ensure this
const Foam::fileName version(std::to_string(OPENFOAM)); // stays properly synchronized with the build information
const Foam::fileName version(std::to_string(Foam::foamVersion::api));
Foam::fileNameList list; Foam::fileNameList list;
Foam::fileName dir, candidate; Foam::fileName dir, candidate;
@ -192,6 +200,42 @@ Foam::fileNameList searchEtc
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::fileNameList Foam::etcDirs(bool test)
{
// Use foamVersion::api (instead of the OPENFOAM define) to ensure this
// stays properly synchronized with the build information
const Foam::fileName version(std::to_string(Foam::foamVersion::api));
Foam::fileNameList list(5);
Foam::fileName dir;
label nDirs = 0;
// User resource directories
if (userResourceDir(dir) || (!test && dir.size()))
{
list[nDirs++] = dir/version;
list[nDirs++] = dir;
}
// Group (site) resource directories
if (groupResourceDir(dir) || (!test && dir.size()))
{
list[nDirs++] = dir/version;
list[nDirs++] = dir;
}
// Other (project) resource directory
if (projectResourceDir(dir) || (!test && dir.size()))
{
list[nDirs++] = dir;
}
list.resize(nDirs);
return list;
}
Foam::fileNameList Foam::findEtcDirs Foam::fileNameList Foam::findEtcDirs
( (
const fileName& name, const fileName& name,

View File

@ -44,6 +44,14 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- The etc search directories in the normal search order.
//
// \param test false to disable the default test for directory existence.
//
// \return The list of directories
fileNameList etcDirs(bool test=true);
//- Search for directories from user/group/other directories. //- Search for directories from user/group/other directories.
// Uses search hierarchy as per findEtcFiles(). // Uses search hierarchy as per findEtcFiles().
// //
@ -51,8 +59,8 @@ namespace Foam
// an empty list if the name cannot be found. // an empty list if the name cannot be found.
fileNameList findEtcDirs fileNameList findEtcDirs
( (
const fileName& name=fileName::null, //!< the file to search for const fileName& name, //!< The directory to search for
const bool findFirst=false //!< stop when the first file has been found const bool findFirst=false //!< Stop after locating the first directory
); );
@ -76,9 +84,9 @@ fileNameList findEtcDirs
// an empty list if the name cannot be found. // an empty list if the name cannot be found.
fileNameList findEtcFiles fileNameList findEtcFiles
( (
const fileName& name, //!< the file to search for const fileName& name, //!< The file to search for
const bool mandatory=false, //!< abort if the file cannot be found const bool mandatory=false, //!< Abort if the file cannot be found
const bool findFirst=false //!< stop when the first file has been found const bool findFirst=false //!< Stop after locating the first directory
); );
@ -88,8 +96,8 @@ fileNameList findEtcFiles
// search hierarchy or an empty fileName if the name cannot be found. // search hierarchy or an empty fileName if the name cannot be found.
fileName findEtcFile fileName findEtcFile
( (
const fileName& name, //!< the file to search for const fileName& name, //!< The file to search for
const bool mandatory=false //!< abort if the file cannot be found const bool mandatory=false //!< Abort if the file cannot be found
); );

View File

@ -0,0 +1,86 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "doubleTensor.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const Foam::doubleTensor::vsType::typeName = "doubleTensor";
template<>
const char* const Foam::doubleTensor::vsType::componentNames[] =
{
"xx", "xy", "xz",
"yx", "yy", "yz",
"zx", "zy", "zz"
};
template<>
const Foam::doubleTensor Foam::doubleTensor::vsType::zero
(
doubleTensor::uniform(0)
);
template<>
const Foam::doubleTensor Foam::doubleTensor::vsType::one
(
doubleTensor::uniform(1)
);
template<>
const Foam::doubleTensor Foam::doubleTensor::vsType::max
(
doubleTensor::uniform(doubleScalarVGREAT)
);
template<>
const Foam::doubleTensor Foam::doubleTensor::vsType::min
(
doubleTensor::uniform(-doubleScalarVGREAT)
);
template<>
const Foam::doubleTensor Foam::doubleTensor::vsType::rootMax
(
doubleTensor::uniform(doubleScalarROOTVGREAT)
);
template<>
const Foam::doubleTensor Foam::doubleTensor::vsType::rootMin
(
doubleTensor::uniform(-doubleScalarROOTVGREAT)
);
template<>
const Foam::doubleTensor Foam::doubleTensor::I
(
1, 0, 0,
0, 1, 0,
0, 0, 1
);
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::doubleTensor
Description
A Tensor of values with double precision
SourceFiles
doubleTensor.C
\*---------------------------------------------------------------------------*/
#ifndef doubleTensor_H
#define doubleTensor_H
#include "Tensor.H"
#include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef Tensor<double> doubleTensor;
//- Data associated with doubleTensor type are contiguous
#if !defined(WM_DP)
template<>
inline bool contiguous<doubleTensor>() {return true;}
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,7 +25,7 @@ Typedef
Foam::floatTensor Foam::floatTensor
Description Description
FloatTensor of scalars. A Tensor of values with float precision
SourceFiles SourceFiles
floatTensor.C floatTensor.C
@ -48,9 +48,10 @@ namespace Foam
typedef Tensor<float> floatTensor; typedef Tensor<float> floatTensor;
//- Data associated with floatTensor type are contiguous //- Data associated with floatTensor type are contiguous
#if !defined(WM_SP)
template<> template<>
inline bool contiguous<floatTensor>() {return true;} inline bool contiguous<floatTensor>() {return true;}
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -25,7 +25,7 @@ Typedef
Foam::labelTensor Foam::labelTensor
Description Description
3D labelTensor obtained from generic Tensor A Tensor of values using label (integer) representation.
SourceFiles SourceFiles
labelTensor.C labelTensor.C

View File

@ -0,0 +1,76 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "doubleVector.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const Foam::doubleVector::vsType::typeName = "doubleVector";
template<>
const char* const Foam::doubleVector::vsType::componentNames[] =
{
"x", "y", "z"
};
template<>
const Foam::doubleVector Foam::doubleVector::vsType::zero
(
doubleVector::uniform(0)
);
template<>
const Foam::doubleVector Foam::doubleVector::vsType::one
(
doubleVector::uniform(1)
);
template<>
const Foam::doubleVector Foam::doubleVector::vsType::max
(
doubleVector::uniform(doubleScalarVGREAT)
);
template<>
const Foam::doubleVector Foam::doubleVector::vsType::min
(
doubleVector::uniform(-doubleScalarVGREAT)
);
template<>
const Foam::doubleVector Foam::doubleVector::vsType::rootMax
(
doubleVector::uniform(doubleScalarROOTVGREAT)
);
template<>
const Foam::doubleVector Foam::doubleVector::vsType::rootMin
(
doubleVector::uniform(-doubleScalarROOTVGREAT)
);
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::doubleVector
Description
A Vector of values with double precision.
SourceFiles
doubleVector.C
\*---------------------------------------------------------------------------*/
#ifndef doubleVector_H
#define doubleVector_H
#include "Vector.H"
#include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef Vector<double> doubleVector;
//- Data associated with doubleVector type are contiguous
#if !defined(WM_DP)
template<>
inline bool contiguous<doubleVector>() {return true;}
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -21,9 +21,6 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Vector of floats.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "floatVector.H" #include "floatVector.H"

View File

@ -25,7 +25,7 @@ Typedef
Foam::floatVector Foam::floatVector
Description Description
A float version of vector A Vector of values with float precision.
SourceFiles SourceFiles
floatVector.C floatVector.C

View File

@ -187,6 +187,9 @@ bool Foam::UPstream::init(int& argc, char**& argv, const bool needsThread)
Pout<< "UPstream::init : mpi-buffer-size " << bufSize << endl; Pout<< "UPstream::init : mpi-buffer-size " << bufSize << endl;
} }
// TBD: could add error handling here.
// Delete allocated and leave if we fail to attach the buffer?
MPI_Buffer_attach(new char[bufSize], bufSize); MPI_Buffer_attach(new char[bufSize], bufSize);
} }
#endif #endif
@ -225,10 +228,19 @@ void Foam::UPstream::exit(int errnum)
#ifndef SGIMPI #ifndef SGIMPI
{ {
int size; // Some MPI notes suggest that the return code is MPI_SUCCESS when
char* buff; // no buffer is attached.
MPI_Buffer_detach(&buff, &size); // Be extra careful and require a non-zero size as well.
delete[] buff;
int bufSize = 0;
char* buf = nullptr;
flag = MPI_Buffer_detach(&buf, &bufSize);
if (MPI_SUCCESS == flag && bufSize)
{
delete[] buf;
}
} }
#endif #endif

View File

@ -0,0 +1,396 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "AMIWeights.H"
#include "fvMesh.H"
#include "foamVtkSurfaceWriter.H"
#include "PatchTools.H"
#include "cyclicACMIPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(AMIWeights, 0);
addToRunTimeSelectionTable(functionObject, AMIWeights, dictionary);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::AMIWeights::writeFileHeader(Ostream& os)
{
writeHeader(os, "AMI");
writeCommented(os, "Time");
forAll(patchIDs_, patchi)
{
writeTabbed(os, "Patch");
writeTabbed(os, "nbr_patch");
if (Pstream::parRun())
{
writeTabbed(os, "distributed");
}
writeTabbed(os, "src_min_weight");
writeTabbed(os, "src_max_weight");
writeTabbed(os, "src_average_weight");
writeTabbed(os, "src_min_neighbours");
writeTabbed(os, "src_max_neighbours");
writeTabbed(os, "src_average_neighbours");
writeTabbed(os, "tgt_min_weight");
writeTabbed(os, "tgt_max_weight");
writeTabbed(os, "tgt_average_weight");
writeTabbed(os, "tgt_min_neighbours");
writeTabbed(os, "tgt_max_neighbours");
writeTabbed(os, "tgt_average_neighbours");
}
os << endl;
}
void Foam::functionObjects::AMIWeights::reportPatch
(
const cyclicAMIPolyPatch& pp
)
{
const word& nbrPatchName = pp.neighbPatchName();
const Switch distributed = pp.AMI().singlePatchProc() == -1;
const scalarField& srcWeightsSum = pp.AMI().srcWeightsSum();
const scalar srcMinWeight = gMin(srcWeightsSum);
const scalar srcMaxWeight = gMax(srcWeightsSum);
const scalar srcAveWeight = gAverage(srcWeightsSum);
const labelListList& srcAddress = pp.AMI().srcAddress();
label srcMinNbr = labelMax;
label srcMaxNbr = labelMin;
scalar srcAveNbr = 0;
for (const labelList& srcFace : srcAddress)
{
const label n = srcFace.size();
srcAveNbr += n;
srcMinNbr = min(srcMinNbr, n);
srcMaxNbr = max(srcMaxNbr, n);
}
reduce(srcMinNbr, minOp<label>());
reduce(srcMaxNbr, maxOp<label>());
srcAveNbr =
returnReduce(srcAveNbr, sumOp<scalar>())
/(returnReduce(srcAddress.size(), sumOp<scalar>()) + ROOTVSMALL);
const scalarField& tgtWeightsSum = pp.AMI().tgtWeightsSum();
const scalar tgtMinWeight = gMin(tgtWeightsSum);
const scalar tgtMaxWeight = gMax(tgtWeightsSum);
const scalar tgtAveWeight = gAverage(tgtWeightsSum);
const labelListList& tgtAddress = pp.AMI().tgtAddress();
label tgtMinNbr = labelMax;
label tgtMaxNbr = labelMin;
scalar tgtAveNbr = 0;
for (const labelList& tgtFace : tgtAddress)
{
const label n = tgtFace.size();
tgtAveNbr += n;
tgtMinNbr = min(tgtMinNbr, n);
tgtMaxNbr = max(tgtMaxNbr, n);
}
reduce(tgtMinNbr, minOp<label>());
reduce(tgtMaxNbr, maxOp<label>());
tgtAveNbr =
returnReduce(tgtAveNbr, sumOp<scalar>())
/(returnReduce(tgtAddress.size(), sumOp<scalar>()) + ROOTVSMALL);
file()
<< mesh_.time().timeName() << tab
<< pp.name() << tab
<< nbrPatchName << tab;
if (Pstream::parRun())
{
file() << distributed << tab;
}
file()
<< srcMinWeight << tab
<< srcMaxWeight << tab
<< srcAveWeight << tab
<< srcMinNbr << tab
<< srcMaxNbr << tab
<< srcAveNbr << tab
<< tgtMinWeight << tab
<< tgtMaxWeight << tab
<< tgtAveWeight << tab
<< tgtMinNbr << tab
<< tgtMaxNbr << tab
<< tgtAveNbr << tab
<< endl;
Log << " Patches: " << nl
<< " Source: " << pp.name() << nl
<< " Target: " << nbrPatchName << nl;
if (Pstream::parRun())
{
Log << " Parallel distributed: " << distributed << nl;
}
Log << nl;
const label w = IOstream::defaultPrecision() + 8;
Log << " | " << setw(w) << pp.name()
<< " | " << setw(w) << nbrPatchName << " | " << nl
<< " min(weight) | " << setw(w) << srcMinWeight
<< " | " << setw(w) << tgtMinWeight << " | " << nl
<< " max(weight) | " << setw(w) << srcMaxWeight
<< " | " << setw(w) << tgtMaxWeight << " | " << nl
<< " ave(weight) | " << setw(w) << srcAveWeight
<< " | " << setw(w) << tgtAveWeight << " | " << nl
<< " min(address) | " << setw(w) << srcMinNbr
<< " | " << setw(w) << tgtMinNbr << " | " << nl
<< " max(address) | " << setw(w) << srcMaxNbr
<< " | " << setw(w) << tgtMaxNbr << " | " << nl
<< " ave(address) | " << setw(w) << srcAveNbr
<< " | " << setw(w) << tgtAveNbr << " | " << nl
<< endl;
setResult(pp.name() + ":src", pp.name());
setResult(pp.name() + ":tgt", nbrPatchName);
setResult(pp.name() + ":src:min(weight)", srcMinWeight);
setResult(pp.name() + ":src:max(weight)", srcMaxWeight);
setResult(pp.name() + ":src:ave(weight)", srcAveWeight);
setResult(pp.name() + ":src:min(address)", srcMinNbr);
setResult(pp.name() + ":src:max(address)", srcMaxNbr);
setResult(pp.name() + ":src:ave(address)", srcAveNbr);
setResult(pp.name() + ":tgt:min(weight)", tgtMinWeight);
setResult(pp.name() + ":tgt:max(weight)", tgtMaxWeight);
setResult(pp.name() + ":tgt:ave(weight)", tgtAveWeight);
setResult(pp.name() + ":tgt:min(address)", tgtMinNbr);
setResult(pp.name() + ":tgt:max(address)", tgtMaxNbr);
setResult(pp.name() + ":tgt:ave(address)", tgtAveNbr);
}
void Foam::functionObjects::AMIWeights::writeWeightField
(
const cyclicAMIPolyPatch& cpp,
const scalarField& weightSum,
const word& side
) const
{
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
Foam::PatchTools::gatherAndMerge
(
mesh_,
cpp.localFaces(),
cpp.meshPoints(),
cpp.meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints
);
// Collect field
scalarField mergedWeights;
globalFaces().gather
(
UPstream::worldComm,
ListOps::create<label>
(
UPstream::procID(UPstream::worldComm),
labelOp<int>() // int -> label
),
weightSum,
mergedWeights
);
const bool isACMI = isA<cyclicACMIPolyPatch>(cpp);
scalarField mergedMask;
if (isACMI)
{
const cyclicACMIPolyPatch& pp = refCast<const cyclicACMIPolyPatch>(cpp);
globalFaces().gather
(
UPstream::worldComm,
ListOps::create<label>
(
UPstream::procID(UPstream::worldComm),
labelOp<int>() // int -> label
),
pp.mask(),
mergedMask
);
}
if (Pstream::master())
{
instant inst(mesh_.time().value(), mesh_.time().timeName());
vtk::surfaceWriter writer
(
mergedPoints,
mergedFaces,
(baseTimeDir()/cpp.name() + "_" + side),
false // serial: master-only
);
writer.setTime(inst);
writer.writeTimeValue();
writer.writeGeometry();
writer.beginCellData(1 + (isACMI ? 1 : 0));
writer.write("weightsSum", mergedWeights);
if (isACMI)
{
writer.write("mask", mergedMask);
}
}
}
void Foam::functionObjects::AMIWeights::writeWeightFields
(
const cyclicAMIPolyPatch& cpp
) const
{
if (cpp.owner())
{
writeWeightField(cpp, cpp.AMI().srcWeightsSum(), "src");
writeWeightField(cpp.neighbPatch(), cpp.AMI().tgtWeightsSum(), "tgt");
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::AMIWeights::AMIWeights
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(mesh_, name, typeName, dict),
writeFields_(false),
patchIDs_()
{
read(dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::AMIWeights::read(const dictionary& dict)
{
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
{
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
patchIDs_.clear();
labelHashSet ids;
forAll(pbm, patchi)
{
if (isA<cyclicAMIPolyPatch>(pbm[patchi]))
{
const auto& ami =
static_cast<const cyclicAMIPolyPatch&>(pbm[patchi]);
if (ami.owner())
{
ids.insert(patchi);
}
}
}
patchIDs_ = ids.sortedToc();
writeFileHeader(file());
writeFields_ = dict.get<bool>("writeFields");
return true;
}
return false;
}
bool Foam::functionObjects::AMIWeights::execute()
{
return true;
}
bool Foam::functionObjects::AMIWeights::write()
{
Log << type() << " " << name() << " write:" << nl;
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
for (const label patchi : patchIDs_)
{
const polyPatch& pp = pbm[patchi];
const auto& cpp = static_cast<const cyclicAMIPolyPatch&>(pp);
reportPatch(cpp);
if (writeFields_)
{
writeWeightFields(cpp);
}
}
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::AMIWeights
Group
grpFieldFunctionObjects
Description
Usage
Example of function object specification:
\verbatim
AMIWeights1
{
type AMIWeights;
libs ("libfieldFunctionObjects.so");
writeFields yes;
}
\endverbatim
Where the entries comprise:
\table
Property | Description | Required | Default value
type | type name: AMIWeights | yes |
writeFields | write weights as VTK fields | yes |
\endtable
Output data is written to the file \<timeDir\>/AMIWeights.dat
See also
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
SourceFiles
AMIWeights.C
AMIWeightsTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_AMIWeights_H
#define functionObjects_AMIWeights_H
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "cyclicAMIPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class AMIWeights Declaration
\*---------------------------------------------------------------------------*/
class AMIWeights
:
public fvMeshFunctionObject,
public writeFile
{
protected:
// Protected data
//- Flag to write AMI fields (as VTK files)
bool writeFields_;
//- List of AMI patch IDs
labelList patchIDs_;
// Protected Member Functions
//- Output file header information
virtual void writeFileHeader(Ostream& os);
//- Helper function to report patch information
virtual void reportPatch(const cyclicAMIPolyPatch& pp);
void writeWeightField
(
const cyclicAMIPolyPatch& cpp,
const scalarField& weightSum,
const word& side
) const;
void writeWeightFields(const cyclicAMIPolyPatch& cpp) const;
//- No copy construct
AMIWeights(const AMIWeights&) = delete;
//- No copy assignment
void operator=(const AMIWeights&) = delete;
public:
//- Runtime type information
TypeName("AMIWeights");
// Constructors
//- Construct from Time and dictionary
AMIWeights
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~AMIWeights() = default;
// Member Functions
//- Read the field min/max data
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual bool execute();
//- Write the AMIWeights
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,3 +1,5 @@
AMIWeights/AMIWeights.C
fieldAverage/fieldAverage.C fieldAverage/fieldAverage.C
fieldAverage/fieldAverageItem/fieldAverageItem.C fieldAverage/fieldAverageItem/fieldAverageItem.C
fieldAverage/fieldAverageItem/fieldAverageItemIO.C fieldAverage/fieldAverageItem/fieldAverageItemIO.C

View File

@ -49,7 +49,7 @@ Description
{ {
box box
{ {
action add; action use;
source box; source box;
box (-0.1 -0.01 -0.1) (0.1 0.30 0.1); box (-0.1 -0.01 -0.1) (0.1 0.30 0.1);
} }
@ -110,7 +110,7 @@ Description
Note Note
The region of interest is defined by the selection dictionary The region of interest is defined by the selection dictionary
as a set of actions (add,subtract,subset,invert). as a set of actions (use,add,subtract,subset,invert).
Omitting the selection dictionary is the same as specifying the Omitting the selection dictionary is the same as specifying the
conversion of all cells (in the selected regions). conversion of all cells (in the selected regions).
Omitting the patches entry is the same as specifying the conversion of all Omitting the patches entry is the same as specifying the conversion of all

View File

@ -35,6 +35,7 @@ namespace Foam
// A limited selection of actions // A limited selection of actions
const Enum<topoSetSource::setAction> actionNames const Enum<topoSetSource::setAction> actionNames
({ ({
{ topoSetSource::NEW, "use" }, // Reuse NEW for "use" action name
{ topoSetSource::ADD, "add" }, { topoSetSource::ADD, "add" },
{ topoSetSource::SUBTRACT, "subtract" }, { topoSetSource::SUBTRACT, "subtract" },
{ topoSetSource::SUBSET, "subset" }, { topoSetSource::SUBSET, "subset" },
@ -92,8 +93,15 @@ bool Foam::functionObjects::ensightWrite::updateSubset
switch (action) switch (action)
{ {
case topoSetSource::NEW: // "use"
case topoSetSource::ADD: case topoSetSource::ADD:
case topoSetSource::SUBTRACT: case topoSetSource::SUBTRACT:
if (topoSetSource::NEW == action)
{
// "use": only use this selection (clear + ADD)
// NEW is handled like ADD in applyToSet()
cellsToSelect.reset();
}
source->applyToSet(action, cellsToSelect); source->applyToSet(action, cellsToSelect);
break; break;
@ -121,41 +129,6 @@ bool Foam::functionObjects::ensightWrite::updateSubset
} }
#if 0
Foam::labelList Foam::functionObjects::ensightWrite::getSelectedPatches
(
const polyBoundaryMesh& patches
) const
{
DynamicList<label> patchIDs(patches.size());
for (const polyPatch& pp : patches)
{
if (isType<emptyPolyPatch>(pp))
{
continue;
}
else if (isType<processorPolyPatch>(pp))
{
break; // No processor patches
}
if
(
selectPatches_.size()
? selectPatches_.match(pp.name())
: true
)
{
patchIDs.append(pp.index());
}
}
return patchIDs.shrink();
}
#endif
bool Foam::functionObjects::ensightWrite::update() bool Foam::functionObjects::ensightWrite::update()
{ {
if (meshState_ == polyMesh::UNCHANGED) if (meshState_ == polyMesh::UNCHANGED)

View File

@ -41,6 +41,8 @@ void Foam::functionObjects::residuals::writeFileHeader
if (foundObject<fieldType>(fieldName)) if (foundObject<fieldType>(fieldName))
{ {
writeTabbed(os, fieldName + "_solver");
typename pTraits<Type>::labelType validComponents typename pTraits<Type>::labelType validComponents
( (
mesh_.validComponents<Type>() mesh_.validComponents<Type>()
@ -50,13 +52,16 @@ void Foam::functionObjects::residuals::writeFileHeader
{ {
if (component(validComponents, cmpt) != -1) if (component(validComponents, cmpt) != -1)
{ {
writeTabbed const word cmptName(pTraits<Type>::componentNames[cmpt]);
( const word fieldBase(fieldName + cmptName);
os,
fieldName + word(pTraits<Type>::componentNames[cmpt]) writeTabbed(os, fieldBase + "_initial");
); writeTabbed(os, fieldBase + "_final");
writeTabbed(os, fieldBase + "_iters");
} }
} }
writeTabbed(os, fieldName + "_converged");
} }
} }
@ -81,8 +86,10 @@ void Foam::functionObjects::residuals::initialiseField(const word& fieldName)
{ {
if (component(validComponents, cmpt) != -1) if (component(validComponents, cmpt) != -1)
{ {
const word resultName = const word resultName
fieldName + word(pTraits<Type>::componentNames[cmpt]); (
fieldName + word(pTraits<Type>::componentNames[cmpt])
);
createField(resultName); createField(resultName);
} }
@ -96,6 +103,7 @@ template<class Type>
void Foam::functionObjects::residuals::writeResidual(const word& fieldName) void Foam::functionObjects::residuals::writeResidual(const word& fieldName)
{ {
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType; typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef typename pTraits<Type>::labelType labelType;
if (foundObject<volFieldType>(fieldName)) if (foundObject<volFieldType>(fieldName))
{ {
@ -108,28 +116,41 @@ void Foam::functionObjects::residuals::writeResidual(const word& fieldName)
solverDict.lookup(fieldName) solverDict.lookup(fieldName)
); );
const Type& residual = sp.first().initialResidual(); const SolverPerformance<Type>& sp0 = sp.first();
const word& solverName = sp0.solverName();
const Type& initialResidual = sp0.initialResidual();
const Type& finalResidual = sp0.finalResidual();
const labelType nIterations = sp0.nIterations();
const bool converged = sp0.converged();
typename pTraits<Type>::labelType validComponents const labelType validComponents(mesh_.validComponents<Type>());
(
mesh_.validComponents<Type>() file() << token::TAB << solverName;
);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt) for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
{ {
if (component(validComponents, cmpt) != -1) if (component(validComponents, cmpt) != -1)
{ {
const scalar r = component(residual, cmpt); const scalar ri = component(initialResidual, cmpt);
const scalar rf = component(finalResidual, cmpt);
const label n = component(nIterations, cmpt);
file() << token::TAB << r; file()
<< token::TAB << ri
<< token::TAB << rf
<< token::TAB << n;
const word resultName = const word cmptName(pTraits<Type>::componentNames[cmpt]);
fieldName + word(pTraits<Type>::componentNames[cmpt]); const word resultName(fieldName + cmptName);
setResult(resultName, r); setResult(resultName + "_initial", ri);
setResult(resultName + "_final", rf);
setResult(resultName + "_iters", n);
writeField(resultName); writeField(resultName);
} }
} }
file() << token::TAB << converged;
} }
} }
} }

View File

@ -49,7 +49,7 @@ Description
{ {
box box
{ {
action add; action use;
source box; source box;
box (-0.1 -0.01 -0.1) (0.1 0.30 0.1); box (-0.1 -0.01 -0.1) (0.1 0.30 0.1);
} }
@ -112,7 +112,7 @@ Description
Note Note
The region of interest is defined by the selection dictionary The region of interest is defined by the selection dictionary
as a set of actions (add,subtract,subset,invert). as a set of actions (use,add,subtract,subset,invert).
Omitting the selection dictionary is the same as specifying the Omitting the selection dictionary is the same as specifying the
conversion of all cells (in the selected regions). conversion of all cells (in the selected regions).
Omitting the patches entry is the same as specifying the conversion of all Omitting the patches entry is the same as specifying the conversion of all

View File

@ -34,6 +34,7 @@ namespace Foam
// A limited selection of actions // A limited selection of actions
const Enum<topoSetSource::setAction> actionNames const Enum<topoSetSource::setAction> actionNames
({ ({
{ topoSetSource::NEW, "use" }, // Reuse NEW for "use" action name
{ topoSetSource::ADD, "add" }, { topoSetSource::ADD, "add" },
{ topoSetSource::SUBTRACT, "subtract" }, { topoSetSource::SUBTRACT, "subtract" },
{ topoSetSource::SUBSET, "subset" }, { topoSetSource::SUBSET, "subset" },
@ -90,8 +91,15 @@ bool Foam::functionObjects::vtkWrite::updateSubset
switch (action) switch (action)
{ {
case topoSetSource::NEW: // "use"
case topoSetSource::ADD: case topoSetSource::ADD:
case topoSetSource::SUBTRACT: case topoSetSource::SUBTRACT:
if (topoSetSource::NEW == action)
{
// "use": only use this selection (clear + ADD)
// NEW is handled like ADD in applyToSet()
cellsToSelect.reset();
}
source->applyToSet(action, cellsToSelect); source->applyToSet(action, cellsToSelect);
break; break;

View File

@ -28,6 +28,7 @@ Description
A topoSetCellSource to select cells belonging to a topological connected A topoSetCellSource to select cells belonging to a topological connected
region (that contains given points) region (that contains given points)
Usage
In dictionary input: In dictionary input:
\verbatim \verbatim
// optional name of cellSet delimiting search // optional name of cellSet delimiting search
@ -41,7 +42,7 @@ Description
insidePoints ((1 2 3)); insidePoints ((1 2 3));
\endverbatim \endverbatim
\heading Dictionary parameters Dictionary parameters:
\table \table
Property | Description | Required | Default Property | Description | Required | Default
insidePoints | Points inside regions | yes | insidePoints | Points inside regions | yes |
@ -151,7 +152,6 @@ public:
const topoSetSource::setAction action, const topoSetSource::setAction action,
topoSet& set topoSet& set
) const; ) const;
}; };

View File

@ -82,7 +82,7 @@ public:
enum setAction enum setAction
{ {
ADD, //!< Add elements to the set ADD, //!< Add elements to the set
SUBTRACT, //!< Remove elements from the set SUBTRACT, //!< Subtract elements from the set
SUBSET, //!< Subset with elements in the set SUBSET, //!< Subset with elements in the set
INVERT, //!< Invert the elements in the set INVERT, //!< Invert the elements in the set
CLEAR, //!< Clear the set, possibly creating it CLEAR, //!< Clear the set, possibly creating it

View File

@ -70,14 +70,14 @@ Description
The \c rootdir normally corresponds to something like The \c rootdir normally corresponds to something like
\c postProcessing/\<name\> \c postProcessing/\<name\>
\subheading Geometry where the geometry is written as:
\verbatim \verbatim
rootdir rootdir
`-- surfaceName `-- surfaceName
`-- "points" `-- "points"
\endverbatim \endverbatim
\subheading Fields and field data:
\verbatim \verbatim
rootdir rootdir
`-- surfaceName `-- surfaceName

View File

@ -16,6 +16,9 @@
# Description # Description
# Quickly test the tutorials and write out the scheme/solver information # Quickly test the tutorials and write out the scheme/solver information
# #
# Environment
# The entire OpenFOAM environment (WM_PROJECT_DIR, etc)
#
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
@ -128,24 +131,18 @@ EOF
# #
# Location of the main controlDict # Location of the user or project controlDict
# #
unset MAIN_CONTROL_DICT if MAIN_CONTROL_DICT="$($WM_PROJECT_DIR/bin/foamEtcFile -mode=uo controlDict)"
for i in \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \
;
do
if [ -f "$i/controlDict" ]
then then
MAIN_CONTROL_DICT="$i/controlDict" if [ -e "${MAIN_CONTROL_DICT}.orig" ]
break then
die "File ${MAIN_CONTROL_DICT}.orig already exists" \
"Did Alltest fail in some way and then run again?"
fi
else
die "No main (user or project) controlDict found"
fi fi
done
[ -f "$MAIN_CONTROL_DICT" ] || usage "Main controlDict not found"
TUTORIALS_DIR=$ROOT TUTORIALS_DIR=$ROOT
@ -182,13 +179,6 @@ then
rm -rf $buildDir rm -rf $buildDir
fi fi
if [ -e ${MAIN_CONTROL_DICT}.orig ]
then
die "File ${MAIN_CONTROL_DICT}.orig already exists" \
"Did Alltest fail in some way and then run again?"
fi
unset gitbase unset gitbase
if [ -n "$useGit" ] if [ -n "$useGit" ]

View File

@ -0,0 +1,31 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
".*"
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,31 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
".*"
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
restore0Dir
runApplication -s createBlockMesh createBoxTurb -createBlockMesh
runApplication decomposePar
runParallel createBoxTurb
runParallel pimpleFoam

View File

@ -0,0 +1,16 @@
Decay of homogenious incompressible isotropic turbulence
This case is based on the set-up of Comte-Bellot and S. Corrsin [1]
The mesh comprises a block-structured cube divided into 64x64x64 cells, with
a box length of 9*pi cm.
Turbulence is initialised using the target energy spectrum supplied in [1] (see
table 3).
For more information, see:
https://www.openfoam.com/documentation/cpp-guide/html/verification-validation-turbulent-decay-homogeneous-isotropic-turbulence.html
[1] G. Comte-Bellot and S. Corrsin, "The use of a contraction to improve the
isotropy of grid-generated turbulence," J. Fluid Mech. 25, 657 (1966).

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object createBoxTurbDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
N (64 64 64);
//N (128 128 128);
//N (256 256 256);
// Suggested box size of 9*2*pi [cm]
L (0.56548667765 0.56548667765 0.56548667765);
nModes 5000;
// Energy as a function of wave number
// Here using Comte-Bellot and Corrsin data at t.U_0/M = 42 (see Ref. table 3)
Ek table
(
(15 0)
(20 0.000129)
(25 0.00023)
(30 0.000322)
(40 0.000435)
(50 0.000457)
(70 0.00038)
(100 0.00027)
(150 0.000168)
(200 0.00012)
(250 8.9e-05)
(300 7.03e-05)
(400 4.7e-05)
(600 2.47e-05)
(800 1.26e-05)
(1000 7.42e-06)
(1250 3.96e-06)
(1500 2.33e-06)
(1750 1.34e-06)
(2000 8e-07)
);
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
WALE
{
delta cubeRootVol;
cubeRootVolCoeffs
{
deltaCoeff 1;
}
}
kEqn
{
delta cubeRootVol;
kEqnCoeffs
{
Ck 0.094;
Ce 1.048;
}
}
dynamicKEqn
{
delta cubeRootVol;
dynamicKEqnCoeffs
{
filter simple;
}
}
Smagorinsky
{
delta cubeRootVol;
SmagorinskyCoeffs
{
Ck 0.094;
Ce 1.048;
}
}

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 1e-05;
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/turbulenceModels"
simulationType LES;
LES
{
turbulence on;
printCoeffs on;
LESModel kEqn;
${:$LESModel}
}
// ************************************************************************* //

View File

@ -0,0 +1,115 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(0 0 0)
(4 0 0)
(0 1 0)
(4 1 0)
(0 2 0)
(4 2 0)
(0 0 2)
(4 0 2)
(0 1 2)
(4 1 2)
(0 2 2)
(4 2 2)
);
blocks
(
hex (0 1 3 2 6 7 9 8) (40 25 30) simpleGrading (1 10.7028 1)
hex (2 3 5 4 8 9 11 10) (40 25 30) simpleGrading (1 0.0934 1)
);
edges
(
);
boundary
(
bottomWall
{
type wall;
faces ((0 1 7 6));
}
topWall
{
type wall;
faces ((4 10 11 5));
}
sides1_half0
{
type cyclic;
neighbourPatch sides1_half1;
faces ((0 2 3 1));
}
sides1_half1
{
type cyclic;
neighbourPatch sides1_half0;
faces ((6 7 9 8));
}
sides2_half0
{
type cyclic;
neighbourPatch sides2_half1;
faces ((2 4 5 3));
}
sides2_half1
{
type cyclic;
neighbourPatch sides2_half0;
faces ((8 9 11 10));
}
inout1_half0
{
type cyclic;
neighbourPatch inout1_half1;
faces ((1 3 9 7));
}
inout1_half1
{
type cyclic;
neighbourPatch inout1_half0;
faces ((0 6 8 2));
}
inout2_half0
{
type cyclic;
neighbourPatch inout2_half1;
faces ((3 5 11 9));
}
inout2_half1
{
type cyclic;
neighbourPatch inout2_half0;
faces ((2 8 10 4));
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleFoam;
startFrom startTime;
startTime 0;
//startTime 0.28;
//startTime 0.66;
stopAt endTime;
endTime 1;
deltaT 0.001;
writeControl timeStep;
writeInterval 10;
purgeWrite 0;
writeFormat binary;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
energySpectrum1
{
type energySpectrum;
libs ("librandomProcessesFunctionObjects.so");
writeControl writeTime;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 8;
method simple;
simpleCoeffs
{
n (2 2 2);
}
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default backward;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
div(phi,k) Gauss limitedLinear 1;
div(phi,B) Gauss limitedLinear 1;
div(B) Gauss linear;
div(U) Gauss linear;
div(phi,nuTilda) Gauss limitedLinear 1;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
wallDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -0,0 +1,63 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
tolerance 0;
relTol 0.1;
smoother GaussSeidel;
}
pFinal
{
$p;
smoother DICGaussSeidel;
tolerance 1e-06;
relTol 0;
}
"(U|k|nuTilda)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0.1;
minIter 1;
}
"(U|k|nuTilda)Final"
{
$U;
tolerance 1e-05;
relTol 0;
}
}
PIMPLE
{
nOuterCorrectors 1;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,18 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
AMIWeights
{
type AMIWeights;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
writeFields no;
// writeFields yes;
}
// ************************************************************************* //

View File

@ -57,6 +57,7 @@ functions
#includeFunc Q #includeFunc Q
#include "surfaces" #include "surfaces"
#include "forces" #include "forces"
#include "AMIWeights"
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -51,7 +51,7 @@ subset
{ {
dome dome
{ {
action add; action use;
source sphere; source sphere;
origin (125 100 0); origin (125 100 0);
radius 100; radius 100;

View File

@ -22,7 +22,7 @@ vtkWrite
{ {
inletRegion inletRegion
{ {
action add; action use;
source zone; source zone;
zones (leftFluid); zones (leftFluid);
} }

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0.1 0 0);
boundaryField
{
inlet
{
type flowRateInletVelocity;
volumetricFlowRate constant 0.1;
}
walls
{
type slip;
}
outlet
{
type flowRateOutletVelocity;
volumetricFlowRate constant 0.1;
}
atmosphere
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type fixedValue;
value uniform 1;
}
walls
{
type zeroGradient;
}
outlet
{
type zeroGradient;
value uniform 0;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
walls
{
type fixedFluxPressure;
value uniform 0;
}
outlet
{
type zeroGradient;
}
atmosphere
{
type totalPressure;
p0 uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
restore0Dir
runApplication blockMesh
runApplication createPatch -overwrite
runApplication setFields
runApplication decomposePar
runParallel $(getApplication)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 0 -9.81);
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phases (water air);
water
{
transportModel Newtonian;
nu 1e-06;
rho 1000;
}
air
{
transportModel Newtonian;
nu 1.48e-05;
rho 1;
}
sigma 0.07;
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,179 @@
/*--------------------------------*- C++ -*----------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
// Basin
x0 0;
x1 1;
y0 0;
y1 1;
z0 0;
z1 1;
// Inlet
x2 -0.3;
x3 0;
y2 0.35;
y3 0.65;
z2 0.6;
z3 0.9;
// Outlet
x4 1;
x5 1.3;
y4 0.35;
y5 0.65;
z4 0.1;
z5 0.4;
vertices
(
// Basin
($x0 $y0 $z0)
($x1 $y0 $z0)
($x1 $y1 $z0)
($x0 $y1 $z0)
($x0 $y0 $z1)
($x1 $y0 $z1)
($x1 $y1 $z1)
($x0 $y1 $z1)
// Inlet
($x2 $y2 $z2)
($x3 $y2 $z2)
($x3 $y3 $z2)
($x2 $y3 $z2)
($x2 $y2 $z3)
($x3 $y2 $z3)
($x3 $y3 $z3)
($x2 $y3 $z3)
// Outlet
($x4 $y4 $z4)
($x5 $y4 $z4)
($x5 $y5 $z4)
($x4 $y5 $z4)
($x4 $y4 $z5)
($x5 $y4 $z5)
($x5 $y5 $z5)
($x4 $y5 $z5)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (40 40 40) simpleGrading (1 1 1)
hex (8 9 10 11 12 13 14 15) (12 12 12) simpleGrading (1 1 1)
hex (16 17 18 19 20 21 22 23) (12 12 12) simpleGrading (1 1 1)
);
boundary
(
inlet
{
type patch;
faces
(
(8 12 15 11)
);
}
outlet
{
type patch;
faces
(
(17 18 22 21)
);
}
walls
{
type patch;
faces
(
// Basin
(0 3 2 1)
(0 1 5 4)
(2 3 7 6)
// Inlet
(8 11 10 9)
(8 9 13 12)
(10 11 15 14)
(12 13 14 15)
// Outlet
(16 19 18 17)
(16 17 21 20)
(18 19 23 22)
(20 21 22 23)
);
}
atmosphere
{
type patch;
faces
(
(4 5 6 7)
);
}
inletRightPatch
{
type patch;
faces
(
(9 10 14 13)
);
}
basinLeftPatch
{
type patch;
faces
(
(0 4 7 3)
);
}
outletLeftPatch
{
type patch;
faces
(
(16 20 23 19)
);
}
basinRightPatch
{
type patch;
faces
(
(1 2 6 5)
);
}
);
edges
(
);
mergePatchPairs
(
(inletRightPatch basinLeftPatch)
(outletLeftPatch basinRightPatch)
);
// ************************************************************************* //

View File

@ -0,0 +1,100 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2;
format ascii;
class dictionary;
location "system";
object controlDict;
}
application interIsoFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 3;
deltaT 0.005;
//deltaT 0.001;
writeControl adjustableRunTime;
writeInterval 0.01;
purgeWrite 0;
writeFormat binary;
writePrecision 8;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.8;
maxAlphaCo 0.8;
maxDeltaT 1;
functions
{
inletFlux
{
type surfaceFieldValue;
libs ( "libfieldFunctionObjects.so" );
writeControl timeStep;
log true;
writeFields false;
regionType patch;
name inlet;
operation sum;
fields ( rhoPhi );
}
outletFlux
{
type surfaceFieldValue;
libs ( "libfieldFunctionObjects.so" );
writeControl timeStep;
log true;
writeFields false;
regionType patch;
name outlet;
operation sum;
fields ( rhoPhi );
}
atmosphereFlux
{
type surfaceFieldValue;
libs ( "libfieldFunctionObjects.so" );
writeControl timeStep;
log true;
writeFields false;
regionType patch;
name atmosphere;
operation sum;
fields ( rhoPhi );
}
}
// ************************************************************************* //

View File

@ -0,0 +1,84 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
pointSync false;
// Patches to create.
patches
(
{
// Name of new patch
name walls;
// Dictionary to construct new patch from
patchInfo
{
type patch;
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (walls basinLeftPatch basinRightPatch);
// If constructFrom = set : name of faceSet
set f0;
}
/*
{
// Name of new patch
name walls;
// Dictionary to construct new patch from
patchInfo
{
type wall;
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (originalPatch);
// If constructFrom = set : name of faceSet
set f0;
}
{
// Name of new patch
name frontAndBack;
// Dictionary to construct new patch from
patchInfo
{
type empty;
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (sides);
// If constructFrom = set : name of faceSet
set f0;
}
*/
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 8;
method simple;
simpleCoeffs
{
n (2 2 2);
delta 0.001;
}
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(rhoPhi,U) Gauss limitedLinearV 1;
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear;
"div\(phi,(k|omega)\)" Gauss upwind;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
div(phi,s) Gauss vanLeer;
div(phirb,s) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
/*
wallDist
{
method meshWave;
}
*/
// ************************************************************************* //

View File

@ -0,0 +1,89 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaSubCycles 1;
cAlpha 1;
}
"pcorr.*"
{
solver PCG;
preconditioner
{
preconditioner GAMG;
tolerance 1e-5;
relTol 0;
smoother GaussSeidel;
}
tolerance 1e-5;
relTol 0;
maxIter 50;
}
p_rgh
{
solver GAMG;
tolerance 5e-9;
relTol 0.01;
smoother GaussSeidel;
maxIter 50;
};
p_rghFinal
{
$p_rgh;
tolerance 5e-9;
relTol 0;
}
"(U|k|omega|s).*"
{
solver smoothSolver;
smoother symGaussSeidel;
nSweeps 1;
tolerance 1e-6;
relTol 0.1;
};
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (-1e10 -1e10 -1e10) (1e10 1e10 0.45);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
boxToCell
{
box (-1e10 -1e10 -1e10) (-.2 1e10 1e10);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type waveVelocity;
value uniform (0 0 0);
}
outlet
{
type waveVelocity;
value uniform (0 0 0);
}
sides
{
type empty;
}
ground
{
type fixedValue;
value uniform (0 0 0);
}
top
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type waveAlpha;
value uniform 0;
}
outlet
{
type zeroGradient;
}
ground
{
type zeroGradient;
}
sides
{
type empty;
}
top
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type fixedFluxPressure;
value uniform 0;
}
outlet
{
type fixedFluxPressure;
value uniform 0;
}
ground
{
type fixedFluxPressure;
value uniform 0;
}
sides
{
type empty;
}
top
{
type totalPressure;
p0 uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0
#------------------------------------------------------------------------------

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
restore0Dir
runApplication blockMesh
runApplication decomposePar
runParallel setFields
runParallel $(getApplication)
#------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More