diff --git a/Allwmake b/Allwmake index 3c0b73a6bc34c82dfa752a42353ab240dc115a29..4ae49dca1d4e4959a4cea21f25feafbbdd7b6e74 100755 --- a/Allwmake +++ b/Allwmake @@ -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 "========================================" + #------------------------------------------------------------------------------ diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/Lee/Lee.H b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/Lee/Lee.H index 5aee11db45d4cd544dcfdc28ea8ff9bbb1f5321c..427ad9fae50224dfa8fc380a0ab6c444d89c4d72 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/Lee/Lee.H +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/Lee/Lee.H @@ -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". diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/kineticGasEvaporation/kineticGasEvaporation.H b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/kineticGasEvaporation/kineticGasEvaporation.H index 4dee0ef2317c6495dc0911aeee74656bc27fb304..e94fff14a0e39b2d51501e46274c004c97614191 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/kineticGasEvaporation/kineticGasEvaporation.H +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/massTransferModels/kineticGasEvaporation/kineticGasEvaporation.H @@ -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. diff --git a/applications/test/etcFiles/Test-etcFiles.C b/applications/test/etcFiles/Test-etcFiles.C index 022c5295af0962181d5670ed866b2531621e5ddf..59d3a8b47f0b6c9cd2a903e80469f9e41c552cbb 100644 --- a/applications/test/etcFiles/Test-etcFiles.C +++ b/applications/test/etcFiles/Test-etcFiles.C @@ -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; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 652a9c21ed057a2345deef0ad3f393c961f96a57..26aa2582216eedad39e54a3a21987ec8a48ce1a6 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -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 diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H index cc5e02a793579e5142f897245b1e2fc675cca0db..75c7fb171e8fd35159124548faa83179201e6110 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H @@ -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), diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index ce456db48defc7e9930b55ab354285a715efc4ef..dd37ad5c1b5c5bfa76e9b034651b17387f17f88c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -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); diff --git a/applications/utilities/postProcessing/graphics/PVReaders/foamPv/Make/files b/applications/utilities/postProcessing/graphics/PVReaders/foamPv/Make/files index 6bace7560c49663bfdd86c1450dcfaef6f12b2ce..f3fb1b8d071fe03b82b3900fc9a4b6dbbadf8ef8 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/foamPv/Make/files +++ b/applications/utilities/postProcessing/graphics/PVReaders/foamPv/Make/files @@ -1,3 +1,3 @@ foamPvCore.C -LIB = $(FOAM_LIBBIN)/libfoamPv-pv${ParaView_MAJOR} +LIB = $(FOAM_LIBBIN)/libfoamPv-pv${PARAVIEW_API} diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/files b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/files index c159826919ea6fd22ad9e430bfdf49928b42979b..079991864adb448516f9e941e052bd81ed472402 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/files +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/files @@ -5,4 +5,4 @@ vtkPVFoamMeshLagrangian.C vtkPVFoamMeshVolume.C vtkPVFoamUpdateInfo.C -LIB = $(FOAM_LIBBIN)/libvtkPVFoam-pv${ParaView_MAJOR} +LIB = $(FOAM_LIBBIN)/libvtkPVFoam-pv${PARAVIEW_API} diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options index 69d9b12aa0967ff4fed92af9bb28c884429ee6b6..db95069c804b973d19e3dba75ea96f9e72b62ee9 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options @@ -18,5 +18,5 @@ LIB_LIBS = \ -lconversion \ -lgenericPatchFields \ -llagrangian \ - -L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_API) \ + -L$(FOAM_LIBBIN) -lfoamPv-pv${PARAVIEW_API} \ $(GLIBS) diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVblockMesh/Make/files b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVblockMesh/Make/files index 35930f249c8e09d349b9532850847b2d4b650d90..12405a2ef230b7bca2c043a9aa0553446c82426b 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVblockMesh/Make/files +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVblockMesh/Make/files @@ -1,4 +1,4 @@ vtkPVblockMesh.C vtkPVblockMeshConvert.C -LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh-pv${ParaView_MAJOR} +LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh-pv${PARAVIEW_API} diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVblockMesh/Make/options b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVblockMesh/Make/options index 9ecf4c42764e84a708546d341feeba6cb8318e43..40f9fce989ba82558ede84d82ee2b0e775d44fa8 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVblockMesh/Make/options +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVblockMesh/Make/options @@ -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) diff --git a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C index 1018f0ea80da7fa6d2c96c8e2b07eb4b2e515c8e..5f934dc020ccca57b8c4afc796c9f8e623e8e70d 100644 --- a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C +++ b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C @@ -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()) { diff --git a/applications/utilities/preProcessing/createBoxTurb/Make/files b/applications/utilities/preProcessing/createBoxTurb/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..718509c7567b380827d092dd62c30b87be9fc227 --- /dev/null +++ b/applications/utilities/preProcessing/createBoxTurb/Make/files @@ -0,0 +1,3 @@ +createBoxTurb.C + +EXE = $(FOAM_APPBIN)/createBoxTurb diff --git a/applications/utilities/preProcessing/createBoxTurb/Make/options b/applications/utilities/preProcessing/createBoxTurb/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..8e62b99f630123b8f5b810a8b31c34bfbe83f7c9 --- /dev/null +++ b/applications/utilities/preProcessing/createBoxTurb/Make/options @@ -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 diff --git a/applications/utilities/preProcessing/createBoxTurb/createBlockMesh.H b/applications/utilities/preProcessing/createBoxTurb/createBlockMesh.H new file mode 100644 index 0000000000000000000000000000000000000000..a4c482a954351c6f907827671e29f5a73bd5812b --- /dev/null +++ b/applications/utilities/preProcessing/createBoxTurb/createBlockMesh.H @@ -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(); diff --git a/applications/utilities/preProcessing/createBoxTurb/createBoxTurb.C b/applications/utilities/preProcessing/createBoxTurb/createBoxTurb.C new file mode 100644 index 0000000000000000000000000000000000000000..9da5d767952ad2cb49a3b5eba690b441730e6a91 --- /dev/null +++ b/applications/utilities/preProcessing/createBoxTurb/createBoxTurb.C @@ -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; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createBoxTurb/createFields.H b/applications/utilities/preProcessing/createBoxTurb/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..a0f6c4ca0fa038ceb5ddb5b2e7fa949d1dabb037 --- /dev/null +++ b/applications/utilities/preProcessing/createBoxTurb/createFields.H @@ -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); + diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C index 29d582178ce94e05f12e8884a55ca6b93a4799aa..c459d15e2abad54790ce0acd850f595f796a6417 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C @@ -288,8 +288,8 @@ int main(int argc, char *argv[]) Info<< "Subtracting mapped source field from target" << endl; } - wordRes selectedFields; - args.readListIfPresent<wordRe>("fields", selectedFields); + // Non-mandatory + const wordRes selectedFields(args.getList<wordRe>("fields", false)); const bool noLagrangian = args.found("noLagrangian"); diff --git a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C index 44001f4dd8e87853e5d403565aa87a1969ca4378..6647f088ac0c762494ad724256857a532e4342b2 100644 --- a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C +++ b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C @@ -177,6 +177,11 @@ int main(int argc, char *argv[]) isoCutCell icc(mesh, f); icc.volumeOfFluid(alpha1, f0); + if (dict.lookupOrDefault("invertAlpha", false)) + { + alpha1 = 1 - alpha1; + } + // Writing volScalarField alpha1 ISstream::defaultPrecision(18); alpha1.write(); diff --git a/bin/mpirunDebug b/bin/mpirunDebug index 249dfbf60bef484e2b3abf84b2e334199575cb3d..61d2f212d850f8ff162aaf1b0ca764042de23cbb 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -29,6 +29,7 @@ # Driver script to run mpi jobs with the processes in a separate XTerm # or to separate log files. # Requires bash on all processors. +# #------------------------------------------------------------------------------ . $WM_PROJECT_DIR/bin/tools/RunFunctions # Run functions @@ -193,15 +194,17 @@ fi 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 <installedProject>/etc/ if [ -n "$WM_PROJECT" ] then for i in \ - $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \ - $HOME/.$WM_PROJECT \ - $WM_PROJECT_DIR/etc \ + "$HOME/.$WM_PROJECT/$WM_PROJECT_API" \ + "$HOME/.$WM_PROJECT" \ + "$WM_PROJECT_DIR/etc" \ ; do if [ -f "$i/bashrc" ] diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index 6890d35ed0d48220537f68515a5706d4d23dcfe1..2d5a4cf6e7fa53fcaa5c8f8b721607ce67ef8a3d 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -123,7 +123,7 @@ _matches() local result for regexp do - result=$(echo "$input" | sed -n -e "/^$regexp"'$/p') + result=$(echo "$input" | sed -ne "/^$regexp"'$/p') test -n "$result" && return 0 # successful match done return 1 @@ -243,7 +243,7 @@ removeBashMagic() # ---- # set projectName="$WM_PROJECT" # set projectDir=`lsof +p $$ |& \ -# sed -n -e 's@^[^/]*@@; s@\(/'"$projectName"'[^/]*\)/etc/cshrc[^/]*@\1@p'` +# sed -ne 'something /etc/cshrc something'` # ---- removeCshMagic() { @@ -586,8 +586,8 @@ do _matches "$optionValue" "$expected" || \ die "'$1' has bad value: '$optionValue'" - replace etc/config.sh/paraview ParaView_VERSION "$optionValue" - replaceCsh etc/config.csh/paraview ParaView_VERSION "$optionValue" + replace etc/config.sh/paraview ParaView_VERSION "$optionValue" + replace etc/config.csh/paraview ParaView_VERSION "$optionValue" adjusted=true shift ;; diff --git a/etc/caseDicts/postProcessing/fields/AMIWeights b/etc/caseDicts/postProcessing/fields/AMIWeights new file mode 100644 index 0000000000000000000000000000000000000000..3bbda0fcc5d6c88934d1236305d59e13cd7399c1 --- /dev/null +++ b/etc/caseDicts/postProcessing/fields/AMIWeights @@ -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; + +// ************************************************************************* // diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview index e8acdadc637a4914355c0e85e7b777c648f8d1c5..a0fb0c6351e686e8e0ac038cc7dafed035947570 100644 --- a/etc/config.csh/paraview +++ b/etc/config.csh/paraview @@ -77,15 +77,14 @@ endif while ( $#argv > 0 ) switch ($argv[1]) case ParaView*=*: - # name=value -> setenv name value - eval "setenv $argv[1]:s/=/ /" + # name=value -> set name=value + eval "set $argv[1]" breaksw endsw shift end -if (! $?ParaView_VERSION ) set ParaView_VERSION='' - +if ($?ParaView_VERSION) then switch ("$ParaView_VERSION") case "": # empty - do nothing @@ -209,8 +208,8 @@ default: setenv ParaView_DIR # Defined but empty (used by foamPV alias) endif breaksw - endsw +endif unset cleaned archDir unset cmake cmake_version diff --git a/etc/config.csh/setup b/etc/config.csh/setup index 7f02c0dcb6ecbefa8d08e162d9f9791e3d26a35d..a1152d8a74da3d6822e31d211882560e467056f0 100644 --- a/etc/config.csh/setup +++ b/etc/config.csh/setup @@ -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" # 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 set foundDir='' + _foamEcho "Locating ThirdParty directory" -foreach WM_THIRD_PARTY_DIR (\ + +foreach foamDir (\ "$WM_PROJECT_DIR/ThirdParty" \ "$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \ "$prefixDir/ThirdParty-v$WM_PROJECT_API" \ "$prefixDir/ThirdParty-$WM_PROJECT_API" \ "$prefixDir/ThirdParty-common" \ ) - _foamEcho "... $WM_THIRD_PARTY_DIR" - if ( -d "$WM_THIRD_PARTY_DIR" ) then - if ( -f "$WM_THIRD_PARTY_DIR/Allwmake" || -d "$WM_THIRD_PARTY_DIR/platforms" ) then + _foamEcho "... $foamDir" + if ( -d "$foamDir" ) then + if ( -f "$foamDir/Allwmake" || -d "$foamDir/platforms" ) then + setenv WM_THIRD_PARTY_DIR "$foamDir" set foundDir=true break endif @@ -182,6 +186,6 @@ unalias _foamAddLib unalias _foamAddLibAuto # Variables (done as final statement for a clean exit code) -unset cleaned foamOldDirs foundDir prefixDir +unset cleaned foamOldDirs foundDir foamDir prefixDir #------------------------------------------------------------------------------ diff --git a/etc/config.csh/unset b/etc/config.csh/unset index b35cef97ef9c0e0f865f7af1d1c9ddf39b2742b3..3041f8931a973ced95b85f6e66432900d2c04263 100644 --- a/etc/config.csh/unset +++ b/etc/config.csh/unset @@ -43,6 +43,7 @@ unsetenv WM_ARCH_OPTION unsetenv WM_CC unsetenv WM_CFLAGS unsetenv WM_COMPILER +unsetenv WM_COMPILER_ARCH unsetenv WM_COMPILER_TYPE unsetenv WM_COMPILER_LIB_ARCH unsetenv WM_COMPILE_OPTION diff --git a/etc/config.sh/ADIOS b/etc/config.sh/ADIOS index df1fec50e2367ec4f9c2446e81a95730eb269bd3..ed5dda9a18bb9d9967f971c25cca5608b29806dc 100644 --- a/etc/config.sh/ADIOS +++ b/etc/config.sh/ADIOS @@ -49,7 +49,7 @@ then # outside of ThirdParty and should be added to the path. ending="${ADIOS_ARCH_PATH##*-}" - if [ "$ending" != none -a "$ending" != system ] + if [ "$ending" != none ] && [ "$ending" != system ] then # PATH was already cleaned by etc/bashrc caller _foamAddPath $ADIOS_ARCH_PATH/bin diff --git a/etc/config.sh/completion_cache b/etc/config.sh/completion_cache index 3d0553007e24845a05edf2705bd6949ce7bb20cb..09d59664c352b7cbe41b87ae5c40e4f3c367683e 100644 --- a/etc/config.sh/completion_cache +++ b/etc/config.sh/completion_cache @@ -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_[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_[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_[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" diff --git a/etc/config.sh/functions b/etc/config.sh/functions index ead80710543d74d14c261a31fd4318aa5fb73e99..42aa068873e315e09782eb96b83f58fc1fcbff2a 100644 --- a/etc/config.sh/functions +++ b/etc/config.sh/functions @@ -105,7 +105,7 @@ then foamVar_end="${1##*-}" # 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 unset foamVar_prefix foamVar_end return 1 diff --git a/etc/config.sh/gperftools b/etc/config.sh/gperftools index e1d2a01a1cdf28c82abbb0a6b1b8b4743f2fdf73..61649a7c32515f61700f8ad1bb94e273e836cd8d 100644 --- a/etc/config.sh/gperftools +++ b/etc/config.sh/gperftools @@ -53,7 +53,7 @@ then # outside of ThirdParty and must be added to the lib-path. ending="${GPERFTOOLS_ARCH_PATH##*-}" - if [ "$ending" != none -a "$ending" != system ] + if [ "$ending" != none ] && [ "$ending" != system ] then _foamAddLib $GPERFTOOLS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH _foamAddPath $GPERFTOOLS_ARCH_PATH/bin diff --git a/etc/config.sh/paraview b/etc/config.sh/paraview index b909281d98576990189474aab7ec2752889810ba..87ba79beb9e69f15d25b841cde5ed5cebcfe5cd2 100644 --- a/etc/config.sh/paraview +++ b/etc/config.sh/paraview @@ -204,7 +204,7 @@ case "$ParaView_VERSION" in echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" 1>&2 fi else - if [ "$FOAM_VERBOSE" -a "$PS1" ] + if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] then echo "No paraview found" 1>&2 echo " ParaView_DIR : $ParaView_DIR" 1>&2 diff --git a/etc/config.sh/settings b/etc/config.sh/settings index 23aec009a36c376deab3a9b929303ef559ca5981..c0ea5654aa78c8252c6006e5fdbbfb42ece2c09f 100644 --- a/etc/config.sh/settings +++ b/etc/config.sh/settings @@ -146,7 +146,7 @@ export FOAM_LIBBIN="$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib" siteDir="$WM_PROJECT_DIR/site" # User override -if [ -d "$WM_PROJECT_SITE" -a "$WM_PROJECT_SITE" != "$siteDir" ] +if [ -d "$WM_PROJECT_SITE" ] && [ "$WM_PROJECT_SITE" != "$siteDir" ] then siteDir="$WM_PROJECT_SITE" export WM_PROJECT_SITE @@ -287,7 +287,7 @@ GCC_NOT_FOUND # Add gmp/mpfr/mpc libraries to run-time environment. # Require that they exist, automatically find lib64/ or lib/. - _foamAddLibAuto $gmpDir && \ + _foamAddLibAuto $gmpDir && \ export GMP_ARCH_PATH=$gmpDir # For non-system CGAL _foamAddLibAuto $mpfrDir && \ diff --git a/etc/config.sh/setup b/etc/config.sh/setup index 423605ce920c9863926b1bf7d344e74c98aef18a..40ab0012f72129d64fbcd3b46d491f62869ae529 100644 --- a/etc/config.sh/setup +++ b/etc/config.sh/setup @@ -41,7 +41,9 @@ unset WM_SHELL_FUNCTIONS # It may also not be required at all, in which case a dummy "ThirdParty" # 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 unset foundDir diff --git a/etc/cshrc b/etc/cshrc index 971041cfa836c8f29ee5fafd805a3c5dc29a1fb3..8da66078bf356a5a01346a2a2039c2cfc08e7849 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -54,7 +54,7 @@ setenv WM_PROJECT_VERSION plus # If the directory naming does not match WM_PROJECT, need to change here set projectName="$WM_PROJECT" 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="/opt/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION" diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 84ece4c4b6c8ca00c248b1ea7b7b559dc70511ca..cc3c87011dedd00b9f79f57371b56fc7550baabb 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -70,6 +70,10 @@ primitives/Tensor/lists/symmTensorList.C primitives/Tensor/lists/tensorList.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) primitives/Vector/floatVector/floatVector.C primitives/Tensor/floatTensor/floatTensor.C diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C index 20de92e33efecd055ae87ca335f1728328c2ff26..4a932cf84258a2e94a34ad1e672bdf7ce22d629f 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C +++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C @@ -212,13 +212,14 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault const Type& defaultValue ) { - return - dimensioned<Type> - ( - name, - dims, - dict.lookupOrDefault<Type>(name, defaultValue) - ); + if (dict.found(name)) + { + return dimensioned<Type>(name, dims, dict); + } + else + { + return dimensioned<Type>(name, dims, defaultValue); + } } diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index d5d1cd32f052cf530aef54a9a29a94b183902ba7..e74e2eca524847b8c42c888de86dcdaa50005f5c 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -871,8 +871,14 @@ void Foam::argList::parse if (Pstream::master() && bannerEnabled()) { IOobject::writeBanner(Info, true) - << "Build : " << foamVersion::build.c_str() - << " (OPENFOAM=" << OPENFOAM; + << "Build : "; + + if (foamVersion::build.size()) + { + Info<< foamVersion::build.c_str() << ' '; + } + + Info<< "OPENFOAM=" << foamVersion::api; if (foamVersion::patched()) { @@ -880,7 +886,7 @@ void Foam::argList::parse Info<< " patch=" << foamVersion::patch.c_str(); } - Info<< ')' << nl + Info<< nl << "Arch : " << foamVersion::buildArch << nl << "Exec : " << commandLine_.c_str() << nl << "Date : " << dateString.c_str() << nl diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index af2dd2779dffef73e6d3d919fc04c4524d0bcde8..18cc39417a4d598dc18a4254237cb63347606b58 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -371,12 +371,15 @@ public: const T& deflt ) 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. + // \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> - 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. // \return true if the named option was found. template<class T> diff --git a/src/OpenFOAM/global/argList/argListI.H b/src/OpenFOAM/global/argList/argListI.H index 81e8a6443c3e94ed76a7a56fc1e9f72e377581a6..9d7dca7639de50cf8c0bde2fb029398594012f43 100644 --- a/src/OpenFOAM/global/argList/argListI.H +++ b/src/OpenFOAM/global/argList/argListI.H @@ -322,14 +322,22 @@ inline Foam::List<T> Foam::argList::getList(const label index) const 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 { - ITstream is(optName, options_[optName]); - List<T> list; - readList(is, list); - checkITstream(is, optName); + if (mandatory || found(optName)) + { + ITstream is(optName, options_[optName]); + + readList(is, list); + + checkITstream(is, optName); + } return list; } @@ -345,6 +353,7 @@ inline bool Foam::argList::readListIfPresent if (found(optName)) { ITstream is(optName, options_[optName]); + readList(is, list); checkITstream(is, optName); diff --git a/src/OpenFOAM/global/etcFiles/etcFiles.C b/src/OpenFOAM/global/etcFiles/etcFiles.C index c192baab4c251f7605d5bfc655504a7577003c7d..fc9997b4bf956263421c65a97eafc47a924ec414 100644 --- a/src/OpenFOAM/global/etcFiles/etcFiles.C +++ b/src/OpenFOAM/global/etcFiles/etcFiles.C @@ -95,6 +95,7 @@ static inline bool groupResourceDir(Foam::fileName& queried) is undefined (was this intentional?) #endif + queried.clear(); return false; } @@ -108,7 +109,13 @@ static inline bool groupResourceDir(Foam::fileName& queried) static inline bool projectResourceDir(Foam::fileName& queried) { 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&) ) { - // Could use foamVersion::api, but this more direct. - const Foam::fileName version(std::to_string(OPENFOAM)); + // 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; 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 ( const fileName& name, diff --git a/src/OpenFOAM/global/etcFiles/etcFiles.H b/src/OpenFOAM/global/etcFiles/etcFiles.H index bbe52918768061dcee5d97e3eb0507fcbd5e1350..9fdcc696c330cdbee8fa666287f5d8e79f46cf8f 100644 --- a/src/OpenFOAM/global/etcFiles/etcFiles.H +++ b/src/OpenFOAM/global/etcFiles/etcFiles.H @@ -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. // Uses search hierarchy as per findEtcFiles(). // @@ -51,8 +59,8 @@ namespace Foam // an empty list if the name cannot be found. fileNameList findEtcDirs ( - const fileName& name=fileName::null, //!< the file to search for - const bool findFirst=false //!< stop when the first file has been found + const fileName& name, //!< The directory to search for + 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. fileNameList findEtcFiles ( - const fileName& name, //!< the file to search for - const bool mandatory=false, //!< abort if the file cannot be found - const bool findFirst=false //!< stop when the first file has been found + const fileName& name, //!< The file to search for + const bool mandatory=false, //!< Abort if the file cannot be 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. fileName findEtcFile ( - const fileName& name, //!< the file to search for - const bool mandatory=false //!< abort if the file cannot be found + const fileName& name, //!< The file to search for + const bool mandatory=false //!< Abort if the file cannot be found ); diff --git a/src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.C b/src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.C new file mode 100644 index 0000000000000000000000000000000000000000..a4227f457a82bfbc5aeec1109dc8057f7e696b47 --- /dev/null +++ b/src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.C @@ -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 +); + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.H b/src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.H new file mode 100644 index 0000000000000000000000000000000000000000..5276c32974c9590176214da2dbb6480bf0e3f031 --- /dev/null +++ b/src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.H @@ -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 + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Tensor/floatTensor/floatTensor.H b/src/OpenFOAM/primitives/Tensor/floatTensor/floatTensor.H index 53f25ca22e7b8b7da963fc48e389e3a74f784c22..0145c1167ebca847c2472d8e3320d2d0d9425568 100644 --- a/src/OpenFOAM/primitives/Tensor/floatTensor/floatTensor.H +++ b/src/OpenFOAM/primitives/Tensor/floatTensor/floatTensor.H @@ -25,7 +25,7 @@ Typedef Foam::floatTensor Description - FloatTensor of scalars. + A Tensor of values with float precision SourceFiles floatTensor.C @@ -48,9 +48,10 @@ namespace Foam typedef Tensor<float> floatTensor; //- Data associated with floatTensor type are contiguous +#if !defined(WM_SP) template<> inline bool contiguous<floatTensor>() {return true;} - +#endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.H b/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.H index 99aa35fb5b669c7035b7d5db82d0d14bc8ab8d80..7ef335db0cd8f8783f312f838ab6b0895a48fd53 100644 --- a/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.H +++ b/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.H @@ -25,7 +25,7 @@ Typedef Foam::labelTensor Description - 3D labelTensor obtained from generic Tensor + A Tensor of values using label (integer) representation. SourceFiles labelTensor.C diff --git a/src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.C b/src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.C new file mode 100644 index 0000000000000000000000000000000000000000..9b4f7d0785b106d40cdc033f8dc28e9eb7c72bb5 --- /dev/null +++ b/src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.C @@ -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) +); + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.H b/src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.H new file mode 100644 index 0000000000000000000000000000000000000000..e50e1f60923f9d4d14e3faddb41dd1d958da0f6d --- /dev/null +++ b/src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.H @@ -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 + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector/floatVector/floatVector.C b/src/OpenFOAM/primitives/Vector/floatVector/floatVector.C index 13ab567ba41708cd4f7edfa4034e6e6c4524bb28..ba29858f448866448ee76e93b4a23608d2842e70 100644 --- a/src/OpenFOAM/primitives/Vector/floatVector/floatVector.C +++ b/src/OpenFOAM/primitives/Vector/floatVector/floatVector.C @@ -21,9 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Vector of floats. - \*---------------------------------------------------------------------------*/ #include "floatVector.H" diff --git a/src/OpenFOAM/primitives/Vector/floatVector/floatVector.H b/src/OpenFOAM/primitives/Vector/floatVector/floatVector.H index 9d8eee773d2d59f685d95627120e89316dcc6bf8..e49afbdf888e3b1aad445ea83807117b56d3442a 100644 --- a/src/OpenFOAM/primitives/Vector/floatVector/floatVector.H +++ b/src/OpenFOAM/primitives/Vector/floatVector/floatVector.H @@ -25,7 +25,7 @@ Typedef Foam::floatVector Description - A float version of vector + A Vector of values with float precision. SourceFiles floatVector.C diff --git a/src/Pstream/mpi/UPstream.C b/src/Pstream/mpi/UPstream.C index 4e68dc8bf717259789bcd6e654c04da89687d4ec..62d04495f5a5af3277f3ce8525e51e4d28c00222 100644 --- a/src/Pstream/mpi/UPstream.C +++ b/src/Pstream/mpi/UPstream.C @@ -187,6 +187,9 @@ bool Foam::UPstream::init(int& argc, char**& argv, const bool needsThread) 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); } #endif @@ -225,10 +228,19 @@ void Foam::UPstream::exit(int errnum) #ifndef SGIMPI { - int size; - char* buff; - MPI_Buffer_detach(&buff, &size); - delete[] buff; + // Some MPI notes suggest that the return code is MPI_SUCCESS when + // no buffer is attached. + // Be extra careful and require a non-zero size as well. + + int bufSize = 0; + char* buf = nullptr; + + flag = MPI_Buffer_detach(&buf, &bufSize); + + if (MPI_SUCCESS == flag && bufSize) + { + delete[] buf; + } } #endif diff --git a/src/functionObjects/field/AMIWeights/AMIWeights.C b/src/functionObjects/field/AMIWeights/AMIWeights.C new file mode 100644 index 0000000000000000000000000000000000000000..8f85c1944e70218d4e4da062b217ca34fc8b91ea --- /dev/null +++ b/src/functionObjects/field/AMIWeights/AMIWeights.C @@ -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; +} + + +// ************************************************************************* // diff --git a/src/functionObjects/field/AMIWeights/AMIWeights.H b/src/functionObjects/field/AMIWeights/AMIWeights.H new file mode 100644 index 0000000000000000000000000000000000000000..bebbd0dcc785c0d57a179f69d864cc19b3446101 --- /dev/null +++ b/src/functionObjects/field/AMIWeights/AMIWeights.H @@ -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 + +// ************************************************************************* // diff --git a/src/functionObjects/field/Make/files b/src/functionObjects/field/Make/files index d5aa38ee3dddab5e461818f15f825f0874bd423d..fbbac57cb6d50bdfe3f8fad5a66f05fa2e0d866b 100644 --- a/src/functionObjects/field/Make/files +++ b/src/functionObjects/field/Make/files @@ -1,3 +1,5 @@ +AMIWeights/AMIWeights.C + fieldAverage/fieldAverage.C fieldAverage/fieldAverageItem/fieldAverageItem.C fieldAverage/fieldAverageItem/fieldAverageItemIO.C diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.H b/src/functionObjects/utilities/ensightWrite/ensightWrite.H index 5ce6fe8dddc4cba9d1adcca2269ffb4fddac9ebd..d2c695ff3f09917c0423b3ec76d841bde28d7062 100644 --- a/src/functionObjects/utilities/ensightWrite/ensightWrite.H +++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.H @@ -49,7 +49,7 @@ Description { box { - action add; + action use; source box; box (-0.1 -0.01 -0.1) (0.1 0.30 0.1); } @@ -110,7 +110,7 @@ Description Note 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 conversion of all cells (in the selected regions). Omitting the patches entry is the same as specifying the conversion of all diff --git a/src/functionObjects/utilities/ensightWrite/ensightWriteUpdate.C b/src/functionObjects/utilities/ensightWrite/ensightWriteUpdate.C index cf2e0b01bda438e09af6007bc7f3493656428b9d..e1de8f6446187ef6d9ebe74febab8b1f2c46ddd3 100644 --- a/src/functionObjects/utilities/ensightWrite/ensightWriteUpdate.C +++ b/src/functionObjects/utilities/ensightWrite/ensightWriteUpdate.C @@ -35,6 +35,7 @@ namespace Foam // A limited selection of actions const Enum<topoSetSource::setAction> actionNames ({ + { topoSetSource::NEW, "use" }, // Reuse NEW for "use" action name { topoSetSource::ADD, "add" }, { topoSetSource::SUBTRACT, "subtract" }, { topoSetSource::SUBSET, "subset" }, @@ -92,8 +93,15 @@ bool Foam::functionObjects::ensightWrite::updateSubset switch (action) { + case topoSetSource::NEW: // "use" case topoSetSource::ADD: 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); 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() { if (meshState_ == polyMesh::UNCHANGED) diff --git a/src/functionObjects/utilities/residuals/residualsTemplates.C b/src/functionObjects/utilities/residuals/residualsTemplates.C index 43c26a7f032f1583abd1e54896e5c113d79b753e..bfba247840c1a6f881293b4aa48d00cd030db6ee 100644 --- a/src/functionObjects/utilities/residuals/residualsTemplates.C +++ b/src/functionObjects/utilities/residuals/residualsTemplates.C @@ -41,6 +41,8 @@ void Foam::functionObjects::residuals::writeFileHeader if (foundObject<fieldType>(fieldName)) { + writeTabbed(os, fieldName + "_solver"); + typename pTraits<Type>::labelType validComponents ( mesh_.validComponents<Type>() @@ -50,13 +52,16 @@ void Foam::functionObjects::residuals::writeFileHeader { if (component(validComponents, cmpt) != -1) { - writeTabbed - ( - os, - fieldName + word(pTraits<Type>::componentNames[cmpt]) - ); + const word cmptName(pTraits<Type>::componentNames[cmpt]); + const word fieldBase(fieldName + cmptName); + + 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) { - const word resultName = - fieldName + word(pTraits<Type>::componentNames[cmpt]); + const word resultName + ( + fieldName + word(pTraits<Type>::componentNames[cmpt]) + ); createField(resultName); } @@ -96,6 +103,7 @@ template<class Type> void Foam::functionObjects::residuals::writeResidual(const word& fieldName) { typedef GeometricField<Type, fvPatchField, volMesh> volFieldType; + typedef typename pTraits<Type>::labelType labelType; if (foundObject<volFieldType>(fieldName)) { @@ -108,28 +116,41 @@ void Foam::functionObjects::residuals::writeResidual(const word& 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 - ( - mesh_.validComponents<Type>() - ); + const labelType validComponents(mesh_.validComponents<Type>()); + + file() << token::TAB << solverName; for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt) { 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 = - fieldName + word(pTraits<Type>::componentNames[cmpt]); - setResult(resultName, r); + const word cmptName(pTraits<Type>::componentNames[cmpt]); + const word resultName(fieldName + cmptName); + setResult(resultName + "_initial", ri); + setResult(resultName + "_final", rf); + setResult(resultName + "_iters", n); writeField(resultName); } } + + file() << token::TAB << converged; } } } diff --git a/src/functionObjects/utilities/vtkWrite/vtkWrite.H b/src/functionObjects/utilities/vtkWrite/vtkWrite.H index ff9990a0b25790fd8f56e07bd4f520747384964b..77110505d15d1565f93d9069f216f7084cd74d6d 100644 --- a/src/functionObjects/utilities/vtkWrite/vtkWrite.H +++ b/src/functionObjects/utilities/vtkWrite/vtkWrite.H @@ -49,7 +49,7 @@ Description { box { - action add; + action use; source box; box (-0.1 -0.01 -0.1) (0.1 0.30 0.1); } @@ -112,7 +112,7 @@ Description Note 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 conversion of all cells (in the selected regions). Omitting the patches entry is the same as specifying the conversion of all diff --git a/src/functionObjects/utilities/vtkWrite/vtkWriteUpdate.C b/src/functionObjects/utilities/vtkWrite/vtkWriteUpdate.C index 9df872a05e880f74f150685b9581bf712189a832..87fe8a3d3a7b27089a9e45be63efe2691db14432 100644 --- a/src/functionObjects/utilities/vtkWrite/vtkWriteUpdate.C +++ b/src/functionObjects/utilities/vtkWrite/vtkWriteUpdate.C @@ -34,6 +34,7 @@ namespace Foam // A limited selection of actions const Enum<topoSetSource::setAction> actionNames ({ + { topoSetSource::NEW, "use" }, // Reuse NEW for "use" action name { topoSetSource::ADD, "add" }, { topoSetSource::SUBTRACT, "subtract" }, { topoSetSource::SUBSET, "subset" }, @@ -90,8 +91,15 @@ bool Foam::functionObjects::vtkWrite::updateSubset switch (action) { + case topoSetSource::NEW: // "use" case topoSetSource::ADD: 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); break; diff --git a/src/meshTools/sets/cellSources/regionToCell/regionToCell.H b/src/meshTools/sets/cellSources/regionToCell/regionToCell.H index dd699df550ac1ef0c9aaa003bba45a181f495ef2..93ae8e6df67b7c935bf2d804bef008298b581b76 100644 --- a/src/meshTools/sets/cellSources/regionToCell/regionToCell.H +++ b/src/meshTools/sets/cellSources/regionToCell/regionToCell.H @@ -28,6 +28,7 @@ Description A topoSetCellSource to select cells belonging to a topological connected region (that contains given points) +Usage In dictionary input: \verbatim // optional name of cellSet delimiting search @@ -41,7 +42,7 @@ Description insidePoints ((1 2 3)); \endverbatim - \heading Dictionary parameters + Dictionary parameters: \table Property | Description | Required | Default insidePoints | Points inside regions | yes | @@ -68,7 +69,7 @@ namespace Foam class regionSplit; /*---------------------------------------------------------------------------*\ - Class regionToCell Declaration + Class regionToCell Declaration \*---------------------------------------------------------------------------*/ class regionToCell @@ -151,7 +152,6 @@ public: const topoSetSource::setAction action, topoSet& set ) const; - }; diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.H b/src/meshTools/sets/topoSetSource/topoSetSource.H index 4c37698fc36f5b42b3ab01178855e733f6f74f05..1ce6ef99a6669b3cec26a5a1f37152352fcbb002 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.H +++ b/src/meshTools/sets/topoSetSource/topoSetSource.H @@ -82,7 +82,7 @@ public: enum setAction { 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 INVERT, //!< Invert the elements in the set CLEAR, //!< Clear the set, possibly creating it diff --git a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.H b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.H index b1b01e76a14d93d48ee26a19330248e7bcd67009..d155cd00480699429d81c258818407017a0fba3c 100644 --- a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriter.H @@ -70,14 +70,14 @@ Description The \c rootdir normally corresponds to something like \c postProcessing/\<name\> - \subheading Geometry + where the geometry is written as: \verbatim rootdir `-- surfaceName `-- "points" \endverbatim - \subheading Fields + and field data: \verbatim rootdir `-- surfaceName diff --git a/tutorials/Alltest b/tutorials/Alltest index f4d6b9dfa59ab714b2dfbd0f60657a367b573c71..78fb64e6ecec37f0ca0d7a29ae8f2a8a8901a213 100755 --- a/tutorials/Alltest +++ b/tutorials/Alltest @@ -16,6 +16,9 @@ # Description # 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 @@ -128,24 +131,18 @@ EOF # -# Location of the main controlDict +# Location of the user or project controlDict # -unset MAIN_CONTROL_DICT - -for i in \ - $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \ - $HOME/.$WM_PROJECT \ - $WM_PROJECT_DIR/etc \ - ; -do - if [ -f "$i/controlDict" ] +if MAIN_CONTROL_DICT="$($WM_PROJECT_DIR/bin/foamEtcFile -mode=uo controlDict)" +then + if [ -e "${MAIN_CONTROL_DICT}.orig" ] then - MAIN_CONTROL_DICT="$i/controlDict" - break + die "File ${MAIN_CONTROL_DICT}.orig already exists" \ + "Did Alltest fail in some way and then run again?" fi -done - -[ -f "$MAIN_CONTROL_DICT" ] || usage "Main controlDict not found" +else + die "No main (user or project) controlDict found" +fi TUTORIALS_DIR=$ROOT @@ -182,13 +179,6 @@ then rm -rf $buildDir 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 if [ -n "$useGit" ] diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/0.orig/nut b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/0.orig/nut new file mode 100644 index 0000000000000000000000000000000000000000..dd331473ffa8bcab46fb0330bb76774d1ab7212c --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/0.orig/nut @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/0.orig/p b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/0.orig/p new file mode 100644 index 0000000000000000000000000000000000000000..3eb2549010fab5e59562711c9c96409caec9d5fb --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/0.orig/p @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allclean b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..f302b7891a417508af9b4804b1e06258bac31f7d --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allclean @@ -0,0 +1,5 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions + +cleanCase0 diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allrun b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..fa83764ff90ebb5b229c5e6afa79cc2144b5ae97 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/Allrun @@ -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 diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/README b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/README new file mode 100644 index 0000000000000000000000000000000000000000..81fcc2d22d68a3286e13f50e0154f8c8554d1a0e --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/README @@ -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). diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/createBoxTurbDict b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/createBoxTurbDict new file mode 100644 index 0000000000000000000000000000000000000000..0457469e9e5fc58008e863b832e52940c9b1b344 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/createBoxTurbDict @@ -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) +); + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/include/turbulenceModels b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/include/turbulenceModels new file mode 100644 index 0000000000000000000000000000000000000000..264a45358b9bcc05dfcfe8483f87a88d2f03eaeb --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/include/turbulenceModels @@ -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; + } +} diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/transportProperties b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..1a283199e0ae854061dba46babf98721bc2001c4 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/transportProperties @@ -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; + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/turbulenceProperties b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..ce83a8191fb36b79819d8acb874c7d805a119b0a --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/constant/turbulenceProperties @@ -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} +} + + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/blockMeshDict b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..9c0fa82f46bf231671b63e1987021cdcd2b84a88 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/blockMeshDict @@ -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 +( +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/controlDict b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..bfb898fe6af1b3d02ef1ae7ff5e811e0dd633ddd --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/controlDict @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/decomposeParDict b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..d4e6e0822a38cf10e0d53dbf76026991f825abaa --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/decomposeParDict @@ -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); +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/fvSchemes b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..fa0b24fc414a15d68811b9bc4219c32ddf81ebee --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/fvSchemes @@ -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; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/fvSolution b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..cd4d4f956c36915478a18c2c641390277757f670 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/LES/decayIsoTurb/system/fvSolution @@ -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; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/propeller/system/AMIWeights b/tutorials/incompressible/pimpleFoam/RAS/propeller/system/AMIWeights new file mode 100644 index 0000000000000000000000000000000000000000..dc9e5ec1282e626febd9e5685512129a4a7f9910 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/propeller/system/AMIWeights @@ -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; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/propeller/system/controlDict b/tutorials/incompressible/pimpleFoam/RAS/propeller/system/controlDict index 92a90406da27ddbe07af9f70ef097b9661cebcb7..507be631bb13c137067ca7e1ed3f039ba12d284c 100644 --- a/tutorials/incompressible/pimpleFoam/RAS/propeller/system/controlDict +++ b/tutorials/incompressible/pimpleFoam/RAS/propeller/system/controlDict @@ -57,6 +57,7 @@ functions #includeFunc Q #include "surfaces" #include "forces" + #include "AMIWeights" } // ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/windAroundBuildings/system/vtkWrite b/tutorials/incompressible/simpleFoam/windAroundBuildings/system/vtkWrite index f7e4a56f6d966e5fc8c7fcd474168061aabbd140..146bae43abbff685c6dd28fa934679dcf0f99eca 100644 --- a/tutorials/incompressible/simpleFoam/windAroundBuildings/system/vtkWrite +++ b/tutorials/incompressible/simpleFoam/windAroundBuildings/system/vtkWrite @@ -51,7 +51,7 @@ subset { dome { - action add; + action use; source sphere; origin (125 100 0); radius 100; diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/system/vtkWrite b/tutorials/lagrangian/reactingParcelFoam/filter/system/vtkWrite index 6e71e5f89efef72052fa29ed102c16f0018ddcbe..6b1a04ff276c1f86e6f80246419f72b3ed08b25b 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/system/vtkWrite +++ b/tutorials/lagrangian/reactingParcelFoam/filter/system/vtkWrite @@ -22,7 +22,7 @@ vtkWrite { inletRegion { - action add; + action use; source zone; zones (leftFluid); } diff --git a/tutorials/multiphase/interIsoFoam/iobasin/0.orig/U b/tutorials/multiphase/interIsoFoam/iobasin/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..fcc166b1155cfec6a46dd51e1270a2a53db8be0d --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/0.orig/U @@ -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); + } + +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/0.orig/alpha.water b/tutorials/multiphase/interIsoFoam/iobasin/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..7c8c91473292175b98c98f5a2453b5c210f39e06 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/0.orig/alpha.water @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/0.orig/p_rgh b/tutorials/multiphase/interIsoFoam/iobasin/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..3867a5548344b4d26ebda557ee7093587e7945a7 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/0.orig/p_rgh @@ -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; + } + +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/Allclean b/tutorials/multiphase/interIsoFoam/iobasin/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..e2f275d9fd6e6ba843f14fec57e2987e4c8607b3 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/Allclean @@ -0,0 +1,7 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions + +cleanCase0 + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interIsoFoam/iobasin/Allrun b/tutorials/multiphase/interIsoFoam/iobasin/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..90ac4929521659a246995e14b41521f49729d13f --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/Allrun @@ -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) + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interIsoFoam/iobasin/constant/g b/tutorials/multiphase/interIsoFoam/iobasin/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..bded3688c0600a4e15e99a23892da0fb60d689e2 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/constant/g @@ -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); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/constant/transportProperties b/tutorials/multiphase/interIsoFoam/iobasin/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..c4ebbfe29dd3d8e34d8fb6a8e32cf1a887c4d03c --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/constant/transportProperties @@ -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; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/constant/turbulenceProperties b/tutorials/multiphase/interIsoFoam/iobasin/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..0077473d45b3cd3f56918e169988a7137ce53d87 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/constant/turbulenceProperties @@ -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; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/system/blockMeshDict b/tutorials/multiphase/interIsoFoam/iobasin/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..56fcf4bc8618fe48e173a4976ea0c9e00fa75f93 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/system/blockMeshDict @@ -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) +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/system/controlDict b/tutorials/multiphase/interIsoFoam/iobasin/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..4b7fd592554c4d40dfd47dcca90338f3b6c23ca2 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/system/controlDict @@ -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 ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/system/createPatchDict b/tutorials/multiphase/interIsoFoam/iobasin/system/createPatchDict new file mode 100644 index 0000000000000000000000000000000000000000..f039ada7f52b3d71b9b46145fcf68d82b6bd10f1 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/system/createPatchDict @@ -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; + } +*/ +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/system/decomposeParDict b/tutorials/multiphase/interIsoFoam/iobasin/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..56c7dca5aa46fcac79f99c4044b2e6378be7c495 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/system/decomposeParDict @@ -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; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/system/fvSchemes b/tutorials/multiphase/interIsoFoam/iobasin/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..e503f16cd74f4dccdab61f7bc5188ea7a3020d5a --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/system/fvSchemes @@ -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; +} +*/ + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/system/fvSolution b/tutorials/multiphase/interIsoFoam/iobasin/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..2280dbc593e1ab16aefbf7a4798252e319d92164 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/system/fvSolution @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/iobasin/system/setFieldsDict b/tutorials/multiphase/interIsoFoam/iobasin/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..4424ae1279a1a21d352e1fed6d91600f3444bbe8 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/iobasin/system/setFieldsDict @@ -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 + ); + } + +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/U b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..020c0cd55c52841759705c679e54d556b638f505 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/U @@ -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); + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/alpha.water b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..436879eb36706174517ccdcb3849cb6b506d41ba --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/alpha.water @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/p_rgh b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..5fe1bb4ade9ede8985c60b0ac325165805d6b884 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/0.orig/p_rgh @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/Allclean b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..e2f275d9fd6e6ba843f14fec57e2987e4c8607b3 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/Allclean @@ -0,0 +1,7 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions + +cleanCase0 + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/Allrun b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..28bf991e627511713c3b915ac0d9998f068ce030 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/Allrun @@ -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) + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/g b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..492b5693e947caf937121bd5e6977ef9dcf59896 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/g @@ -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 uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/transportProperties b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..70f3aebb062ac5bca95ae0908d0ec48ca1de4f8c --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/transportProperties @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / 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; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/turbulenceProperties b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..feea4803ea50860c13e81ee1b30d0af0aebcf956 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/turbulenceProperties @@ -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; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/waveProperties b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/waveProperties new file mode 100644 index 0000000000000000000000000000000000000000..b18ad6d4d2ab6e1e719997a45db91b1271a5289a --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/constant/waveProperties @@ -0,0 +1,80 @@ +/*--------------------------------*- 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 waveProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inlet +{ + alpha alpha.water; + + waveModel streamFunction; + + nPaddle 1; + + waveHeight 0.1517; + + waveAngle 0.0; + + rampTime 3.017;//6.034; + + activeAbsorption yes; + + wavePeriod 3.017; + + uMean 2.0825; + + waveLength 6.2832; + + Bjs + ( + 8.6669014e-002 + 2.4849799e-002 + 7.7446850e-003 + 2.3355420e-003 + 6.4497731e-004 + 1.5205114e-004 + 2.5433769e-005 + -2.2045436e-007 + -2.8711504e-006 + -1.2287334e-006 + ); + + Ejs + ( + 5.6009609e-002 + 3.1638171e-002 + 1.5375952e-002 + 7.1743178e-003 + 3.3737077e-003 + 1.6324880e-003 + 8.2331980e-004 + 4.4403497e-004 + 2.7580059e-004 + 2.2810557e-004 + ); + +} + +outlet +{ + alpha alpha.water; + + waveModel shallowWaterAbsorption; + + nPaddle 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/blockMeshDict b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..7e2390b70576a7b4af0b710acc71f461e1e95bc6 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/blockMeshDict @@ -0,0 +1,91 @@ +/*--------------------------------*- 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.0 0.0) + ( 40.0 0.0 0.0) + ( 40.0 0.01 0.0) + ( 0.0 0.01 0.0) + ( 0.0 0.0 0.8) + ( 40.0 0.0 0.8) + ( 40.0 0.01 0.8) + ( 0.0 0.01 0.8) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (2000 1 80) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + outlet + { + type patch; + faces + ( + (1 5 6 2) + ); + } + ground + { + type wall; + faces + ( + (0 1 2 3) + ); + } + top + { + type patch; + faces + ( + (4 5 6 7) + ); + } + sides + { + type empty; + faces + ( + (0 1 5 4) + (3 2 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // + + diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/controlDict b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..c0cf911c720335e0f12c5a4336dfc552897c229a --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/controlDict @@ -0,0 +1,162 @@ +/*--------------------------------*- 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 interIsoFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 30.0; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 0.15085; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.5; +maxAlphaCo 0.5; + +maxDeltaT 0.5; + + +functions +{ + line + { + type sets; + libs ("libsampling.so"); + enabled true; + writeControl writeTime; + writeInterval 1; + + interpolationScheme cellPoint; + setFormat raw; + sets + ( + line1 + { + type uniform; + axis distance; + start ( 1.0 0.005 0.0 ); + end ( 1.0 0.005 1.0 ); + nPoints 1001; + } + line2 + { + type uniform; + axis distance; + start ( 2.0 0.005 0.0 ); + end ( 2.0 0.005 1.0 ); + nPoints 1001; + } + line3 + { + type uniform; + axis distance; + start ( 3.0 0.005 0.0 ); + end ( 3.0 0.005 1.0 ); + nPoints 1001; + } + line4 + { + type uniform; + axis distance; + start ( 5.0 0.005 0.0 ); + end ( 5.0 0.005 1.0 ); + nPoints 1001; + } + line5 + { + type uniform; + axis distance; + start ( 7.5 0.005 0.0 ); + end ( 7.5 0.005 1.0 ); + nPoints 1001; + } + + line6 + { + type uniform; + axis distance; + start ( 10.0 0.005 0.0 ); + end ( 10.0 0.005 1.0 ); + nPoints 1001; + } + line7 + { + type uniform; + axis distance; + start ( 12.0 0.005 0.0 ); + end ( 12.0 0.005 1.0 ); + nPoints 1001; + } + line8 + { + type uniform; + axis distance; + start ( 15.0 0.005 0.0 ); + end ( 15.0 0.005 1.0 ); + nPoints 1001; + } + line9 + { + type uniform; + axis distance; + start ( 20.0 0.005 0.0 ); + end ( 20.0 0.005 1.0 ); + nPoints 1001; + } + line10 + { + type uniform; + axis distance; + start ( 28.0 0.005 0.0 ); + end ( 28.0 0.005 1.0 ); + nPoints 1001; + } + ); + + fixedLocations false; + fields + ( + U alpha.water + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/decomposeParDict b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..d17ee03e3d140ed6365240ae578a9571b03f25b9 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/decomposeParDict @@ -0,0 +1,29 @@ +/*--------------------------------*- 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 decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/fvSchemes b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..1962d3a4a4c428c507a2c1abc4829eda87a7ab3e --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/fvSchemes @@ -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 "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss linearUpwind grad(U); + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default orthogonal; +} + + +// ************************************************************************* // + diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/fvSolution b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..46b73f7e0c00bae63f435b4bebd71f8c40c86767 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/fvSolution @@ -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.*" + { + isoFaceTol 1e-10; + surfCellTol 1e-2; + nAlphaBounds 3; + snapTol 1e-12; + clip true; + + nAlphaCorr 1; + nAlphaSubCycles 1; + cAlpha 1; + + MULESCorr yes; + nLimiterIter 5; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + } + + "pcorr.*" + { + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0; + } + + p_rgh + { + solver PCG; + preconditioner DIC; + tolerance 1e-08; + relTol 0.05; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + U + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-06; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nOuterCorrectors 1; + nCorrectors 3; + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + equations + { + ".*" 1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/setFieldsDict b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..bbf3c8d43fc1769aa3461f2c9dfb6f2c26d43523 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/waveExampleStreamFunction/system/setFieldsDict @@ -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 "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (0 0 0) (40.0 1.0 0.4046); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/U b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..615644c61b1ad1f0eadeba1bceb00e72827b151a --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/U @@ -0,0 +1,55 @@ +/*--------------------------------*- 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; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type variableHeightFlowRateInletVelocity; + flowRate $inletFlowRate; + alpha alpha.water; + value uniform (0 0 0); + } + + outlet + { + type zeroGradient; + } + + lowerWall + { + type noSlip; + } + + atmosphere + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/alpha.water.orig b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/alpha.water.orig new file mode 100644 index 0000000000000000000000000000000000000000..7562548261e83ddce3406ae902c4fca9dc6b1a5f --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/alpha.water.orig @@ -0,0 +1,56 @@ +/*--------------------------------*- 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; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type variableHeightFlowRate; + lowerBound 0; + upperBound 1; + value uniform 0; + } + + outlet + { + type zeroGradient; + } + + lowerWall + { + type zeroGradient; + } + + atmosphere + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/epsilon b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..e4501081b331459a602d3651758f86a931840ad8 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/epsilon @@ -0,0 +1,59 @@ +/*--------------------------------*- 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; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform $turbulentEpsilon; + +boundaryField +{ + inlet + { + type fixedValue; + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + lowerWall + { + type epsilonWallFunction; + value $internalField; + } + + atmosphere + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/include/initialConditions b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/include/initialConditions new file mode 100644 index 0000000000000000000000000000000000000000..2331b854d28b7f57489fe2be1830c3c47874e8d3 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/include/initialConditions @@ -0,0 +1,14 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +inletFlowRate 75; +pressure 0; +turbulentKE 4.14e-03; +turbulentEpsilon 4.39e-05; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/k b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/k new file mode 100644 index 0000000000000000000000000000000000000000..1b0b46e5dcaef99f1081fbf546e61188d378e695 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/k @@ -0,0 +1,59 @@ +/*--------------------------------*- 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; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform $turbulentKE; + +boundaryField +{ + inlet + { + type fixedValue; + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + lowerWall + { + type kqRWallFunction; + value $internalField; + } + + atmosphere + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/nut b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/nut new file mode 100644 index 0000000000000000000000000000000000000000..7af6950d8bb11a89b8e1d78517e84a0d7a59c2db --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/nut @@ -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; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } + lowerWall + { + type nutkWallFunction; + value uniform 0; + } + atmosphere + { + type calculated; + value uniform 0; + } + + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/p_rgh b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..e692f6e849060bc15026c5b807b25dfe3d26fdbc --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/0.orig/p_rgh @@ -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 p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "include/initialConditions" + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform $pressure; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet + { + type zeroGradient; + } + + lowerWall + { + type fixedFluxPressure; + } + + atmosphere + { + type totalPressure; + p0 uniform 0; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/Allclean b/tutorials/multiphase/interIsoFoam/weirOverflow/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..e2f275d9fd6e6ba843f14fec57e2987e4c8607b3 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/Allclean @@ -0,0 +1,7 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions + +cleanCase0 + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/Allrun b/tutorials/multiphase/interIsoFoam/weirOverflow/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..c7107259267d9ec3d57107003fcfe6a9e1483ad5 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/Allrun @@ -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 blockMesh +\cp 0/alpha.water.orig 0/alpha.water + +runApplication setFields +runApplication $(getApplication) + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/constant/g b/tutorials/multiphase/interIsoFoam/weirOverflow/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..037697dd981e91821b2f945f442f842357790ef0 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/constant/g @@ -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 uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 -9.81 0); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/constant/transportProperties b/tutorials/multiphase/interIsoFoam/weirOverflow/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..c4ebbfe29dd3d8e34d8fb6a8e32cf1a887c4d03c --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/constant/transportProperties @@ -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; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/constant/turbulenceProperties b/tutorials/multiphase/interIsoFoam/weirOverflow/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..0e5f55ae375d8a8f5549782d89481e69caeb1861 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/constant/turbulenceProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- 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 RAS; + +RAS +{ + RASModel kEpsilon; + + turbulence on; + + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/system/blockMeshDict b/tutorials/multiphase/interIsoFoam/weirOverflow/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..c8309631490290d3683ac35899511f556db603f2 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/system/blockMeshDict @@ -0,0 +1,93 @@ +/*--------------------------------*- 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 +( + (-18 0 -0.5) + ( 0 0 -0.5) + ( 30 0 -0.5) + ( 90 0 -0.5) + (-18 30 -0.5) + ( 0 30 -0.5) + ( 15 30 -0.5) + ( 90 30 -0.5) + (-18 54 -0.5) + ( 0 54 -0.5) + ( 15 54 -0.5) + ( 90 54 -0.5) + + (-18 0 0.5) + ( 0 0 0.5) + ( 30 0 0.5) + ( 90 0 0.5) + (-18 30 0.5) + ( 0 30 0.5) + ( 15 30 0.5) + ( 90 30 0.5) + (-18 54 0.5) + ( 0 54 0.5) + ( 15 54 0.5) + ( 90 54 0.5) +); + +blocks +( + hex (0 1 5 4 12 13 17 16) (20 20 1) simpleGrading (1 0.5 1) + hex (2 3 7 6 14 15 19 18) (60 40 1) simpleGrading (1 2 1) + hex (4 5 9 8 16 17 21 20) (20 24 1) simpleGrading (1 1 1) + hex (5 6 10 9 17 18 22 21) (15 24 1) simpleGrading (1 1 1) + hex (6 7 11 10 18 19 23 22) (60 24 1) simpleGrading (1 1 1) +); + +edges +( +); + +patches +( + patch inlet + ( + (0 12 16 4) + (4 16 20 8) + ) + patch outlet + ( + (7 19 15 3) + (11 23 19 7) + ) + wall lowerWall + ( + (0 1 13 12) + (1 5 17 13) + (5 6 18 17) + (2 14 18 6) + (2 3 15 14) + ) + patch atmosphere + ( + (8 20 21 9) + (9 21 22 10) + (10 22 23 11) + ) +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/system/controlDict b/tutorials/multiphase/interIsoFoam/weirOverflow/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..1b57380eefa56a1b689ead25bfa07e5554573c98 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/system/controlDict @@ -0,0 +1,55 @@ +/*--------------------------------*- 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 interIsoFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 30; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 2; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep on; + +maxCo 0.9; +maxAlphaCo 0.9; + +maxDeltaT 1; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/system/fvSchemes b/tutorials/multiphase/interIsoFoam/weirOverflow/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..7b9531750a95c9a937f24b03ff552b3ea7740e7f --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/system/fvSchemes @@ -0,0 +1,56 @@ +/*--------------------------------*- 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 +{ + div(rhoPhi,U) Gauss linear; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,R) Gauss upwind; + div(R) Gauss linear; + div(phi,nuTilda) Gauss upwind; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/system/fvSolution b/tutorials/multiphase/interIsoFoam/weirOverflow/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..6ff4f3463f969a9a54133f251a2d810896142401 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/system/fvSolution @@ -0,0 +1,79 @@ +/*--------------------------------*- 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 fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + alpha.water + { + + isoFaceTol 1e-6; + surfCellTol 1e-6; + nAlphaBounds 3; + snapTol 1e-12; + clip true; + + nAlphaSubCycles 1; + cAlpha 1; // Note: cAlpha is not used by isoAdvector but must + // be specified because interfacePropertes object + // reads it during construction. + } + + "pcorr.*" + { + solver PCG; + preconditioner DIC; + tolerance 1e-10; + relTol 0; + } + + p_rgh + { + solver PCG; + preconditioner DIC; + tolerance 1e-08; + relTol 0.05; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "(U|k|epsilon)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0.1; + } + + "(U|k|epsilon)Final" + { + $U; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nCorrectors 3; + nNonOrthogonalCorrectors 0; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interIsoFoam/weirOverflow/system/setFieldsDict b/tutorials/multiphase/interIsoFoam/weirOverflow/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..1020eb07ee169c77f4a6dee85cd1971a3bf854e0 --- /dev/null +++ b/tutorials/multiphase/interIsoFoam/weirOverflow/system/setFieldsDict @@ -0,0 +1,35 @@ +/*--------------------------------*- 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 setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (-100 0 -100) (0 20 100); + + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + +// ************************************************************************* // diff --git a/wmake/wmakeBuildInfo b/wmake/wmakeBuildInfo index b05b1cf1f167e76e55c8c5a25841c1661023acc2..5914b310735c874160cd6280e4c6478523ddb90c 100755 --- a/wmake/wmakeBuildInfo +++ b/wmake/wmakeBuildInfo @@ -30,6 +30,7 @@ # # Environment # - WM_PROJECT_DIR +# - WM_PROJECT_VERSION # - WM_DIR (unset defaults to WM_PROJECT_DIR/wmake) # # Note @@ -179,6 +180,13 @@ declare -A metaInfo # getMakeInfo() { + if [ "${#makeInfo[*]}" -eq 4 ] + then + ##echo "use cached value for make info" 1>&2 + return 0 + fi + ##echo "get make info" 1>&2 + local api patch build branch makeInfo=() @@ -193,8 +201,9 @@ getMakeInfo() patch="$(sed -ne 's@^patch *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/build-info 2>/dev/null)" fi - # Build info from git - build="$(git --git-dir=$WM_PROJECT_DIR/.git log -1 --date='format:%y%m%d' --format='%h-%ad' 2>/dev/null)" + # Build info from git. Use short date format (YYYY-MM-DD) and sed instead + # of the newer --date='format:%y%m%d' + build="$(git --git-dir=$WM_PROJECT_DIR/.git log -1 --date=short --format='%h=%ad' 2>/dev/null|sed 's/-//g;s/=/-/')" # Branch info from git if [ -n "$build" ] @@ -206,7 +215,6 @@ getMakeInfo() makeInfo[patch]="${patch:-0}" # default is 0 makeInfo[branch]="$branch" makeInfo[build]="$build" - makeInfo[cached]=true } @@ -224,6 +232,13 @@ getMakeInfo() # getMetaInfo() { + if [ "${#metaInfo[*]}" -eq 4 ] + then + ##echo "use cached value for meta info" 1>&2 + return 0 + fi + ##echo "get meta info" 1>&2 + local api patch build branch metaInfo=() @@ -242,7 +257,6 @@ getMetaInfo() metaInfo[patch]="${patch:-0}" # default is 0 metaInfo[branch]="$branch" metaInfo[build]="$build" - metaInfo[cached]=true } @@ -257,14 +271,14 @@ getMetaInfo() # getApi() { - [ -n "${makeInfo[cached]}" ] || getMakeInfo + getMakeInfo # Local copy local api="${makeInfo[api]}" if [ -z "$api" ] then - [ -n "${metaInfo[cached]}" ] || getMetaInfo + getMetaInfo api="${metaInfo[api]}" fi @@ -284,7 +298,7 @@ getApi() # getPatchLevel() { - [ -n "${metaInfo[cached]}" ] || getMetaInfo + getMetaInfo # Local copy local value="${metaInfo[patch]}" @@ -301,10 +315,8 @@ getPatchLevel() # Report make info reportMakeInfo() { - local key - - [ -n "${makeInfo[cached]}" ] || getMakeInfo - [ -n "${metaInfo[cached]}" ] || getMetaInfo + getMakeInfo + getMetaInfo local patch="${metaInfo[patch]}" # <- From meta-info only makeInfo[patch]="${patch:=0}" # Extra safety @@ -320,9 +332,7 @@ reportMakeInfo() # Report meta info reportMetaInfo() { - local key - - [ -n "${metaInfo[cached]}" ] || getMetaInfo + getMetaInfo local patch="${metaInfo[patch]}" # <- From meta-info only metaInfo[patch]="${patch:=0}" # Extra safety @@ -343,14 +353,26 @@ checkDiff() local verbose="$1" local key diff - [ -n "${makeInfo[cached]}" ] || getMakeInfo - [ -n "${metaInfo[cached]}" ] || getMetaInfo + getMakeInfo + getMetaInfo for key in api patch branch build do if [ "${makeInfo[$key]}" != "${metaInfo[$key]}" ] then - diff="$diff $key" + case "$key" in + (branch | build) + # Only trigger when make info (branch, build) are non-empty + if [ -n "${makeInfo[$key]}" ] + then + diff="$diff $key" + fi + + ;; + (*) + diff="$diff $key" + ;; + esac fi done @@ -365,7 +387,8 @@ checkDiff() done fi - test -z "$diff" + # No diffs, but never permit entirely empty values for build. + test -z "$diff" || test -z "${makeInfo[build]}${metaInfo[build]}" } @@ -374,8 +397,8 @@ checkDiff() # performUpdate() { - [ -n "${makeInfo[cached]}" ] || getMakeInfo - [ -n "${metaInfo[cached]}" ] || getMetaInfo + getMakeInfo + getMetaInfo # Local copies of the make info local api="${makeInfo[api]}" @@ -389,6 +412,9 @@ performUpdate() [ -n "$branch" ] || branch="${metaInfo[branch]}" [ -n "$build" ] || build="${metaInfo[build]}" + # Fallback to WM_PROJECT_VERSION alone + [ -n "$build" ] || build="${WM_PROJECT_VERSION:-unknown}" + local outputFile # build-info @@ -447,8 +473,8 @@ performFiltering() exit 2 } - [ -n "${makeInfo[cached]}" ] || getMakeInfo - [ -n "${metaInfo[cached]}" ] || getMetaInfo + getMakeInfo + getMetaInfo # Local copies of the make info local api="${makeInfo[api]}" @@ -479,7 +505,8 @@ performFiltering() if [ -z "$build" ] then build="${metaInfo[build]}" - build="nogit${build:+-$build}" + # Fallback to WM_PROJECT_VERSION + build="${build:-${WM_PROJECT_VERSION:-unknown}}" fi sed \ diff --git a/wmake/wmakeScheduler b/wmake/wmakeScheduler index ff07cb488917b97129542adeea2f6232619e1f41..08b05d5d5269a9069210b3a2c65e15f0ef0cf2a2 100755 --- a/wmake/wmakeScheduler +++ b/wmake/wmakeScheduler @@ -43,8 +43,10 @@ # # Sources the relevant cshrc/bashrc if not set. # -# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set -# before calling this routine. +# Environment +# - WM_PROJECT_DIR +# - WM_PROJECT +# - WM_PROJECT_API # #------------------------------------------------------------------------------- Script=${0##*/} @@ -52,7 +54,7 @@ Script=${0##*/} # csh sets HOST, bash sets HOSTNAME : ${HOST:=$HOSTNAME} -lockDir=$HOME/.$WM_PROJECT/.wmake +lockDir="$HOME/.$WM_PROJECT/.wmake" # Fallback - 1 core on current host : ${WM_HOSTS:=$HOST:1} @@ -86,15 +88,17 @@ case $SHELL in ;; esac -# Check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ +# Same as foamEtcFile -mode=uo bashrc +# +# Check ~/.$WM_PROJECT/$WM_PROJECT_API/ # Check ~/.$WM_PROJECT/ -# Check <installedProject>/etc/ +# Check projectDir/etc/ if [ -n "$WM_PROJECT" ] then for i in \ - $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \ - $HOME/.$WM_PROJECT \ - $WM_PROJECT_DIR/etc \ + "$HOME/.$WM_PROJECT/$WM_PROJECT_API" \ + "$HOME/.$WM_PROJECT" \ + "$WM_PROJECT_DIR/etc" \ ; do if [ -f "$i/$shellRc" ] @@ -144,7 +148,6 @@ set -o pipefail #------------------------------------------------------------------------------ colourPipe() { - if tty -s <&1 # [ "$1" ] then ( diff --git a/wmake/wmakeSchedulerUptime b/wmake/wmakeSchedulerUptime index 569470fb56e727ed75708f00b7aa8bb04cc72a88..ec8d2e72484027f660641c93fc520ee101b8ef1f 100755 --- a/wmake/wmakeSchedulerUptime +++ b/wmake/wmakeSchedulerUptime @@ -43,8 +43,10 @@ # # Sources the relevant cshrc/bashrc if not set. # -# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set -# before calling this routine. +# Environment +# - WM_PROJECT_DIR +# - WM_PROJECT +# - WM_PROJECT_API # #------------------------------------------------------------------------------- Script=${0##*/} @@ -52,7 +54,8 @@ Script=${0##*/} # csh sets HOST, bash sets HOSTNAME : ${HOST:=$HOSTNAME} -lockDir=$HOME/.$WM_PROJECT/.wmake +lockDir="$HOME/.$WM_PROJECT/.wmake" + # Fallback - 1 core on current host : ${WM_HOSTS:=$HOST:1} @@ -85,15 +88,17 @@ case $SHELL in ;; esac -# Check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ +# Same as foamEtcFile -mode=uo bashrc +# +# Check ~/.$WM_PROJECT/$WM_PROJECT_API/ # Check ~/.$WM_PROJECT/ -# Check <installedProject>/etc/ +# Check projectDir/etc/ if [ -n "$WM_PROJECT" ] then for i in \ - $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \ - $HOME/.$WM_PROJECT \ - $WM_PROJECT_DIR/etc \ + "$HOME/.$WM_PROJECT/$WM_PROJECT_API" \ + "$HOME/.$WM_PROJECT" \ + "$WM_PROJECT_DIR/etc" \ ; do if [ -f "$i/$shellRc" ] @@ -138,9 +143,9 @@ done set -o pipefail -# +#------------------------------------------------------------------------------ # Colour output by argument 1 -# +#------------------------------------------------------------------------------ colourPipe() { if [ -n "$1" ] @@ -166,8 +171,7 @@ while [ "$#" -gt 0 ] do case "$1" in -np) - shift - nprocs=$1 + nprocs="$2" shift ;; -*) @@ -177,6 +181,7 @@ do break ;; esac + shift done