Commit 27a705bb authored by sergio's avatar sergio
Browse files

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

parents 51fae75b 199c857d
......@@ -60,6 +60,13 @@ then
(cd $WM_PROJECT_DIR/modules 2>/dev/null && wmake -all)
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
echo
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_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
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 "========================================"
#------------------------------------------------------------------------------
......@@ -28,14 +28,14 @@ Description
Mass tranfer Lee model. Simple model driven by field value difference as:
\f[
mDot = C \rho \alpha (\T - T_{activate})/T_{activate}
\dot{m} = C \rho \alpha (T - T_{activate})/T_{activate}
\f]
where C is a model constant.
if C > 0:
\f[
mDot = C \rho \alpha*(\T - T_{activate})/T_{activate}
\dot{m} = C \rho \alpha (T - T_{activate})/T_{activate}
\f]
for \f[ T > T_{activate} \f]
......@@ -46,12 +46,12 @@ Description
if C < 0:
\f[
mDot = -C \rho \alpha (T_{activate} - \T)/T_{activate}
\dot{m} = -C \rho \alpha (T_{activate} - T)/T_{activate}
\f]
for \f[ T < T_{activate} \f]
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:
-# W. H. Lee. "A Pressure Iteration Scheme for Two-Phase Modeling".
......
......@@ -25,38 +25,37 @@ Class
Foam::meltingEvaporationModels::kineticGasEvaporation
Description
Considering the Hertz Knudsen formula, which gives the
evaporation-condensation flux based on the kinetic theory for flat
interface:
\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]
where:
\vartable
Flux | mass flux rate [Kg/s/m2]
Flux | mass flux rate [kg/s/m2]
M | molecular weight
T_{activate} | saturation temperature
C | accomodation coefficient
R | universal gas constant
pSat | saturation pressure
\p | vapor partial pressure
p_{sat} | saturation pressure
p | vapor partial pressure
\endvartable
The Clapeyron-Clausius equation relates the pressure to the temperature
for the saturation condition:
\f[
dp/dT = - L / (T*(nuv - nul))
\frac{dp}{dT} = - \frac{L}{T (\nu_v - \nu_l)}
\f]
where:
\vartable
L | latent heat
nuv | inverse of the vapor density
nul | inverse of the liquid density
\nu_v | inverse of the vapor density
\nu_l | inverse of the liquid density
\endvartable
......@@ -64,10 +63,10 @@ Description
\f[
Flux =
2 C/(2 - C)
sqrt(M/(2 \pi \R T_{activate}))
2 \frac{C}{2 - C}
\sqrt{\frac{M}{2 \pi R T_{activate}}}
L (\rho_{v}*\rho_{l}/(\rho_{l} - \rho_{v}))
(\T - T_{activate})/T_{activate}
(T - T_{activate})/T_{activate}
\f]
This assumes liquid and vapour are in equilibrium, then the accomodation
......@@ -75,7 +74,7 @@ Description
Hertz-Knudsen-Schrage.
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.
......
......@@ -64,6 +64,11 @@ int main(int argc, char *argv[])
"list",
"List directories or files to be checked"
);
argList::addBoolOption
(
"list-all",
"List all directories (including non-existence ones)"
);
argList::addArgument("file...");
argList::addNote
......@@ -77,9 +82,15 @@ int main(int argc, char *argv[])
// First handle no parameters
if (args.size() == 1)
{
if (args.found("list"))
if (args.found("list-all"))
{
fileNameList results = etcDirs(false);
printList(results);
return 0;
}
else if (args.found("list"))
{
fileNameList results = findEtcDirs();
fileNameList results = etcDirs();
printList(results);
return 0;
}
......
......@@ -61,7 +61,7 @@ Usage
- \par -patches patch or patch list
Specify particular patches to write.
- \par -faceZones patch or zone list
- \par -faceZones zone or zone list
Specify faceZones to write, with wildcards
- \par -cellZone zoneName
......
......@@ -149,7 +149,7 @@ Description
// Write faceZones (POLYDATA file, one for each zone)
if (doFaceZones && !mesh.faceZones().empty())
if (!selectedFaceZones.empty() && !mesh.faceZones().empty())
{
if (nSurfaceScalarField == -1)
{
......@@ -187,6 +187,11 @@ Description
for (const faceZone& fz : mesh.faceZones())
{
if (!selectedFaceZones.match(fz.name()))
{
continue;
}
indirectPrimitivePatch pp
(
IndirectList<face>(mesh.faces(), fz),
......
......@@ -70,6 +70,10 @@ Usage
- \par -pointSet \<name\>
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
Output cell value on patches instead of patch value itself
......@@ -85,9 +89,6 @@ Usage
- \par -no-point-data
Suppress conversion of pointFields. No interpolated PointData.
- \par -noFaceZones
Suppress conversion of surface fields on faceZones
- \par -poly-decomp
Decompose polyhedral cells into tets/pyramids
......@@ -308,6 +309,13 @@ int main(int argc, char *argv[])
"Convert specified pointSet only",
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
(
......@@ -397,12 +405,10 @@ int main(int argc, char *argv[])
" Eg, 'outlet' or '( inlet \".*Wall\" )'",
true // mark as an advanced option
);
argList::addBoolOption
argList::ignoreOptionCompat
(
"noFaceZones",
"Suppress conversion of surface fields on faceZones",
true // mark as an advanced option
{"noFaceZones", 1806}, // faceZones are only enabled on demand
false // bool option, no argument
);
argList::ignoreOptionCompat
(
......@@ -435,7 +441,6 @@ int main(int argc, char *argv[])
const bool doFiniteArea = args.found("finiteAreaFields");
const bool doSurfaceFields = args.found("surfaceFields");
const bool doFaceZones = !args.found("noFaceZones") && doInternal;
const bool oneBoundary = args.found("one-boundary") && doBoundary;
const bool nearCellValue = args.found("nearCellValue") && doBoundary;
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;
const bool useFieldFilter =
args.readListIfPresent<wordRe>("fields", selectedFields);
// Non-mandatory
const wordRes selectedFaceZones(args.getList<wordRe>("faceZones", false));
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
......
foamPvCore.C
LIB = $(FOAM_LIBBIN)/libfoamPv-pv${ParaView_MAJOR}
LIB = $(FOAM_LIBBIN)/libfoamPv-pv${PARAVIEW_API}
......@@ -5,4 +5,4 @@ vtkPVFoamMeshLagrangian.C
vtkPVFoamMeshVolume.C
vtkPVFoamUpdateInfo.C
LIB = $(FOAM_LIBBIN)/libvtkPVFoam-pv${ParaView_MAJOR}
LIB = $(FOAM_LIBBIN)/libvtkPVFoam-pv${PARAVIEW_API}
......@@ -18,5 +18,5 @@ LIB_LIBS = \
-lconversion \
-lgenericPatchFields \
-llagrangian \
-L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_API) \
-L$(FOAM_LIBBIN) -lfoamPv-pv${PARAVIEW_API} \
$(GLIBS)
vtkPVblockMesh.C
vtkPVblockMeshConvert.C
LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh-pv${ParaView_MAJOR}
LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh-pv${PARAVIEW_API}
......@@ -12,5 +12,5 @@ EXE_INC = \
LIB_LIBS = \
-lmeshTools \
-lblockMesh \
-L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_API) \
-L$(FOAM_LIBBIN) -lfoamPv-pv${PARAVIEW_API} \
$(GLIBS)
......@@ -215,8 +215,8 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
wordRes selectedFields;
args.readListIfPresent<wordRe>("fields", selectedFields);
// Non-mandatory
const wordRes selectedFields(args.getList<wordRe>("fields", false));
if (selectedFields.empty())
{
......
createBoxTurb.C
EXE = $(FOAM_APPBIN)/createBoxTurb
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
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();
/*---------------------------------------------------------------------------*\
========= |
\\ / 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();