diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C index d1ce68a075..fbf1e10ce3 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C @@ -62,8 +62,6 @@ Foam::threePhaseMixture::threePhaseMixture ) ), - transportModel(U, phi), - phase1Name_("phase1"), phase2Name_("phase2"), phase3Name_("phase3"), diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Allwclean b/applications/solvers/multiphase/interPhaseChangeFoam/Allwclean new file mode 100755 index 0000000000..99c52e59f9 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/Allwclean @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wclean libso phaseChangeTwoPhaseMixtures +wclean +wclean interPhaseChangeDyMFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Allwmake b/applications/solvers/multiphase/interPhaseChangeFoam/Allwmake new file mode 100755 index 0000000000..414ed904a0 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/Allwmake @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake libso phaseChangeTwoPhaseMixtures +wmake +wmake interPhaseChangeDyMFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Make/files b/applications/solvers/multiphase/interPhaseChangeFoam/Make/files index 5f65a3a4c2..4358afef8b 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/Make/files +++ b/applications/solvers/multiphase/interPhaseChangeFoam/Make/files @@ -1,8 +1,3 @@ interPhaseChangeFoam.C -phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C -phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C -phaseChangeTwoPhaseMixtures/Kunz/Kunz.C -phaseChangeTwoPhaseMixtures/Merkle/Merkle.C -phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C EXE = $(FOAM_APPBIN)/interPhaseChangeFoam diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options index d4ead14721..4721c88961 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options +++ b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options @@ -4,13 +4,14 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ - -IphaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture \ + -IphaseChangeTwoPhaseMixtures/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude\ -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ + -lphaseChangeTwoPhaseMixtures \ -ltwoPhaseMixture \ -linterfaceProperties \ -ltwoPhaseProperties \ diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/Make/files b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/Make/files new file mode 100644 index 0000000000..2d4521425f --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/Make/files @@ -0,0 +1,3 @@ +interPhaseChangeDyMFoam.C + +EXE = $(FOAM_APPBIN)/interPhaseChangeDyMFoam diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/Make/options b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/Make/options new file mode 100644 index 0000000000..3bf8a5dfb6 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/Make/options @@ -0,0 +1,31 @@ +EXE_INC = \ + -I.. \ + -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ + -I../phaseChangeTwoPhaseMixtures/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fvOptions/lnInclude\ + -I$(LIB_SRC)/sampling/lnInclude + +EXE_LIBS = \ + -lphaseChangeTwoPhaseMixtures \ + -ltwoPhaseMixture \ + -linterfaceProperties \ + -ltwoPhaseProperties \ + -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ + -lincompressibleRASModels \ + -lincompressibleLESModels \ + -lfiniteVolume \ + -ldynamicMesh \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -lmeshTools \ + -lfvOptions \ + -lsampling diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C new file mode 100644 index 0000000000..da11697426 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ 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 . + +Application + interPhaseChangeDyMFoam + +Description + Solver for 2 incompressible, isothermal immiscible fluids with phase-change + (e.g. cavitation). Uses a VOF (volume of fluid) phase-fraction based + interface capturing approach, with optional mesh motion and mesh topology + changes including adaptive re-meshing. + + The momentum and other fluid properties are of the "mixture" and a + single momentum equation is solved. + + The set of phase-change models provided are designed to simulate cavitation + but other mechanisms of phase-change are supported within this solver + framework. + + Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "MULES.H" +#include "subCycle.H" +#include "interfaceProperties.H" +#include "phaseChangeTwoPhaseMixture.H" +#include "turbulenceModel.H" +#include "pimpleControl.H" +#include "fvIOoptionList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + #include "readGravitationalAcceleration.H" + #include "initContinuityErrs.H" + #include "createFields.H" + #include "readTimeControls.H" + + pimpleControl pimple(mesh); + + surfaceScalarField phiAbs("phiAbs", phi); + fvc::makeAbsolute(phiAbs, U); + + #include "../interFoam/interDyMFoam/correctPhi.H" + #include "CourantNo.H" + #include "setInitialDeltaT.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "../interFoam/interDyMFoam/readControls.H" + #include "CourantNo.H" + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); + + { + // Ensure old-time U exists for mapping + U.oldTime(); + + // Calculate the relative velocity used to map the relative flux phi + volVectorField Urel("Urel", U); + + if (mesh.moving()) + { + Urel -= fvc::reconstruct(fvc::meshPhi(U)); + } + + // Do any mesh changes + mesh.update(); + } + + if (mesh.changing()) + { + Info<< "Execution time for mesh.update() = " + << runTime.elapsedCpuTime() - timeBeforeMeshUpdate + << " s" << endl; + + gh = g & mesh.C(); + ghf = g & mesh.Cf(); + } + + if (mesh.changing() && correctPhi) + { + #include "../interFoam/interDyMFoam/correctPhi.H" + } + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + + twoPhaseProperties->correct(); + + #include "alphaEqnSubCycle.H" + interface.correct(); + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "UEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H new file mode 100644 index 0000000000..afb6478b9d --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H @@ -0,0 +1,77 @@ +{ + volScalarField rAU("rAU", 1.0/UEqn.A()); + surfaceScalarField rAUf("Dp", fvc::interpolate(rAU)); + + volVectorField HbyA("HbyA", U); + HbyA = rAU*UEqn.H(); + + surfaceScalarField phiHbyA + ( + "phiHbyA", + (fvc::interpolate(HbyA) & mesh.Sf()) + + fvc::ddtPhiCorr(rAU, rho, U, phiAbs) + ); + + if (p_rgh.needReference()) + { + fvc::makeRelative(phiHbyA, U); + adjustPhi(phiHbyA, U, p_rgh); + fvc::makeAbsolute(phiHbyA, U); + } + + phiAbs = phiHbyA; + + surfaceScalarField phig + ( + ( + fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) + - ghf*fvc::snGrad(rho) + )*rAUf*mesh.magSf() + ); + + phiHbyA += phig; + + Pair > vDotP = twoPhaseProperties->vDotP(); + const volScalarField& vDotcP = vDotP[0](); + const volScalarField& vDotvP = vDotP[1](); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix p_rghEqn + ( + fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh) + - (vDotvP - vDotcP)*(pSat - rho*gh) + fvm::Sp(vDotvP - vDotcP, p_rgh) + ); + + p_rghEqn.setReference(pRefCell, pRefValue); + + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA + p_rghEqn.flux(); + + U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf); + U.correctBoundaryConditions(); + fvOptions.correct(U); + } + } + + phiAbs = phi; + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phi, U); + + p == p_rgh + rho*gh; + + if (p_rgh.needReference()) + { + p += dimensionedScalar + ( + "p", + p.dimensions(), + pRefValue - getRefCellValue(p, pRefCell) + ); + p_rgh = p - rho*gh; + } +} diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/files b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/files new file mode 100644 index 0000000000..ac0e4f4787 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/files @@ -0,0 +1,7 @@ +phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C +phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C +Kunz/Kunz.C +Merkle/Merkle.C +SchnerrSauer/SchnerrSauer.C + +LIB = $(FOAM_LIBBIN)/libphaseChangeTwoPhaseMixtures diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/options b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/options new file mode 100644 index 0000000000..2e61e4ba77 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/options @@ -0,0 +1,11 @@ +EXE_INC = \ + -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -ltwoPhaseMixture \ + -ltwoPhaseProperties \ + -lincompressibleTransportModels \ + -lfiniteVolume diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index 73f8fddd72..2a472a943f 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -383,8 +383,6 @@ Foam::multiphaseSystem::multiphaseSystem ) ), - transportModel(U, phi), - phases_(lookup("phases"), phaseModel::iNew(U.mesh())), mesh_(U.mesh()), diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 7aa8c80d02..cd3c2e4318 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -77,7 +77,6 @@ Foam::multiphaseMixture::multiphaseMixture ) ), - transportModel(U, phi), phases_(lookup("phases"), phase::iNew(U, phi)), mesh_(U.mesh()), diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 857ad99254..707c1f5aeb 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -1150,11 +1150,12 @@ int main(int argc, char *argv[]) globalToMasterPatch.setSize(surfaces.nRegions(), -1); globalToSlavePatch.setSize(surfaces.nRegions(), -1); - Info<< setw(8) << "Patch" - << setw(30) << "Type" + Info<< setf(ios_base::left) + << setw(6) << "Patch" + << setw(20) << "Type" << setw(30) << "Region" << nl - << setw(8) << "-----" - << setw(30) << "----" + << setw(6) << "-----" + << setw(20) << "----" << setw(30) << "------" << endl; const labelList& surfaceGeometry = surfaces.surfaces(); @@ -1197,8 +1198,9 @@ int main(int argc, char *argv[]) ); } - Info<< setw(8) << patchI - << setw(30) << mesh.boundaryMesh()[patchI].type() + Info<< setf(ios_base::left) + << setw(6) << patchI + << setw(20) << mesh.boundaryMesh()[patchI].type() << setw(30) << regNames[i] << nl; globalToMasterPatch[globalRegionI] = patchI; @@ -1236,8 +1238,9 @@ int main(int argc, char *argv[]) ); } - Info<< setw(8) << patchI - << setw(30) << mesh.boundaryMesh()[patchI].type() + Info<< setf(ios_base::left) + << setw(6) << patchI + << setw(20) << mesh.boundaryMesh()[patchI].type() << setw(30) << regNames[i] << nl; globalToMasterPatch[globalRegionI] = patchI; @@ -1267,8 +1270,9 @@ int main(int argc, char *argv[]) ); } - Info<< setw(8) << patchI - << setw(30) << mesh.boundaryMesh()[patchI].type() + Info<< setf(ios_base::left) + << setw(6) << patchI + << setw(20) << mesh.boundaryMesh()[patchI].type() << setw(30) << slaveName << nl; globalToSlavePatch[globalRegionI] = patchI; diff --git a/bin/foamEndJob b/bin/foamEndJob index 09f701d1bf..06e695795a 100755 --- a/bin/foamEndJob +++ b/bin/foamEndJob @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -363,10 +363,12 @@ trap restoreDict QUIT TERM INT if [ "$stopOpt" = now ] then setRawEntry $controlDict stopAt nextWrite + setRawEntry $controlDict writeControl timeStep setRawEntry $controlDict writeInterval 1 echo "$Script : Changed in controlDict:" echo " `getLine $controlDict stopAt`" + echo " `getLine $controlDict writeControl`" echo " `getLine $controlDict writeInterval`" else setRawEntry $controlDict stopAt nextWrite diff --git a/bin/mpirunDebug b/bin/mpirunDebug index 7911e06e98..5fa926ba2c 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -196,7 +196,7 @@ do echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema ;; 5) - echo "$sourceFoam; cd $PWD; valgrind $exec $args; read dummy" >> $procCmdFile + echo "$sourceFoam; cd $PWD; valgrind --leak-check=full --show-reachable=yes $exec $args 2>&1 | tee $procLog; read dummy" >> $procCmdFile echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema ;; 6) diff --git a/src/OpenFOAM/algorithms/indexedOctree/labelBits.H b/src/OpenFOAM/algorithms/indexedOctree/labelBits.H index e8037a3bd3..757fd73621 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/labelBits.H +++ b/src/OpenFOAM/algorithms/indexedOctree/labelBits.H @@ -35,7 +35,7 @@ SourceFiles #define labelBits_H #include "label.H" -#include "uLabel.H" +//#include "uLabel.H" #include "direction.H" #include "error.H" @@ -55,15 +55,17 @@ class labelBits label data_; - inline static label pack(const uLabel val, const direction bits) + inline static label pack(const label val, const direction bits) { # ifdef FULLDEBUG if (bits > 7 || (((val<<3)>>3) != val)) { FatalErrorIn ( - "labelBits::pack(const uLabel, const direction)" + "labelBits::pack(const label, const direction)" ) << "Direction " << bits << " outside range 0..7" + << " or value " << val << " negative or larger than " + << label(8*sizeof(label)-3) << " bit representation" << abort(FatalError); } # endif diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index a603a76dd9..74844aea82 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -243,6 +243,21 @@ const Foam::fileName& Foam::IOobject::caseName() const } +Foam::word Foam::IOobject::group() const +{ + word::size_type i = name_.find_last_of('.'); + + if (i == word::npos || i == 0) + { + return word::null; + } + else + { + return name_.substr(i+1, word::npos); + } +} + + const Foam::fileName& Foam::IOobject::rootPath() const { return time().rootPath(); diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index 7b9d73ee28..098819d5ca 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -154,6 +154,7 @@ private: //- IOobject state objectState objState_; + protected: // Protected Member Functions @@ -187,6 +188,9 @@ public: word& name ); + template + static inline word groupName(Name name, const word& group); + // Constructors @@ -313,6 +317,9 @@ public: // Path components + //- Return group (extension part of name) + word group() const; + const fileName& rootPath() const; const fileName& caseName() const; diff --git a/src/OpenFOAM/db/IOobject/IOobjectI.H b/src/OpenFOAM/db/IOobject/IOobjectI.H index ea0d65508e..ed831092aa 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectI.H +++ b/src/OpenFOAM/db/IOobject/IOobjectI.H @@ -27,6 +27,20 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +inline Foam::word Foam::IOobject::groupName(Name name, const word& group) +{ + if (group != word::null) + { + return name + ('.' + group); + } + else + { + return name; + } +} + + template inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint) { diff --git a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H index 05f1c28b42..e83c2c0d58 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H @@ -38,6 +38,7 @@ Description #define geometricOneField_H #include "oneFieldField.H" +#include "dimensionSet.H" #include "scalar.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,6 +66,8 @@ public: // Member Operators + inline const dimensionSet& dimensions() const; + inline scalar operator[](const label) const; inline oneField field() const; diff --git a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H index 2b8a3989bc..eafebe4b01 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H @@ -27,6 +27,11 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +inline const Foam::dimensionSet& Foam::geometricOneField::dimensions() const +{ + return dimless; +} + inline Foam::scalar Foam::geometricOneField::operator[](const label) const { return scalar(1); diff --git a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H index 60c4bac849..7e5aa91024 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,6 +38,7 @@ Description #define geometricZeroField_H #include "zeroFieldField.H" +#include "dimensionSet.H" #include "scalar.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,6 +66,8 @@ public: // Member Operators + inline const dimensionSet& dimensions() const; + inline scalar operator[](const label) const; inline zeroField field() const; diff --git a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H index cea8c52bbb..d6188702d5 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H @@ -27,6 +27,11 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +inline const Foam::dimensionSet& Foam::geometricZeroField::dimensions() const +{ + return dimless; +} + inline Foam::scalar Foam::geometricZeroField::operator[](const label) const { return scalar(0); diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H index 5b48463bef..04de193220 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H @@ -83,6 +83,10 @@ public: //- Return the accumulated constraint transformation tensor inline tensor constraintTransformation() const; + + //- Return the accumulated unconstrained directions. Directions + // coded as first n rows of tensor. + inline void unconstrainedDirections(label& n, tensor& vecs) const; }; diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H index 0915a301d4..82c1957c3b 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H @@ -136,6 +136,49 @@ Foam::tensor Foam::pointConstraint::constraintTransformation() const } +void Foam::pointConstraint::unconstrainedDirections(label& n, tensor& tt) +const +{ + n = 3-first(); + + FixedList vecs; + + if (first() == 0) + { + vecs[0] = vector(1, 0, 0); + vecs[1] = vector(0, 1, 0); + vecs[2] = vector(0, 0, 1); + } + else if (first() == 1) + { + const vector& planeDir = second(); + + vecs[0] = vector(1, 0, 0) - planeDir.x()*planeDir; + + if (mag(vecs[0].x()) < 1e-3) + { + vecs[0] = vector(0, 1, 0) - planeDir.y()*planeDir; + } + + vecs[0] /= mag(vecs[0]); + vecs[1] = vecs[0] ^ planeDir; + vecs[1] /= mag(vecs[1]); + } + else if (first() == 2) + { + vecs[0] = second(); + } + + // Knock out remaining vectors + for (direction dir = n; dir < vecs.size(); dir++) + { + vecs[dir] = vector::zero; + } + + tt = tensor(vecs[0], vecs[1], vecs[2]); +} + + void Foam::combineConstraintsEqOp::operator() ( pointConstraint& x, diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C index db596157c8..282377f4f3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "lduAddressing.H" #include "demandDrivenData.H" +#include "scalarField.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -248,4 +249,28 @@ Foam::label Foam::lduAddressing::triIndex(const label a, const label b) const } +Foam::Tuple2 Foam::lduAddressing::band() const +{ + const labelUList& owner = lowerAddr(); + const labelUList& neighbour = upperAddr(); + + labelList cellBandwidth(size(), 0); + + forAll(neighbour, faceI) + { + label own = owner[faceI]; + label nei = neighbour[faceI]; + + // Note: mag not necessary for correct (upper-triangular) ordering. + label diff = nei-own; + cellBandwidth[nei] = max(cellBandwidth[nei], diff); + } + + label bandwidth = max(cellBandwidth); + scalar profile = sum(1.0*cellBandwidth); + + return Tuple2(bandwidth, profile); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H index 6266737285..3c9d1b2fcb 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H @@ -98,6 +98,7 @@ SourceFiles #include "labelList.H" #include "lduSchedule.H" +#include "Tuple2.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -196,6 +197,9 @@ public: //- Return off-diagonal index given owner and neighbour label label triIndex(const label a, const label b) const; + + //- Calculate bandwidth and profile of addressing + Tuple2 band() const; }; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C index 66a495f6b2..cc2dc1a415 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C @@ -69,111 +69,132 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels) procAgglomeratorPtr_().agglomerate(); - if (debug) - { + } - Info<< "GAMGAgglomeration:" << nl - << " local agglomerator : " << type() << nl - << " processor agglomerator : " + // Print a bit + if (processorAgglomerate() && debug) + { + Info<< "GAMGAgglomeration:" << nl + << " local agglomerator : " << type() << nl; + if (processorAgglomerate()) + { + Info<< " processor agglomerator : " << procAgglomeratorPtr_().type() << nl << nl; - - Info<< setw(40) << "nCells" - << setw(24) << "nFaces/nCells" - << setw(24) << "nInterfaces" - << setw(24) << "nIntFaces/nCells" << nl - << setw(8) << "Level" - << setw(8) << "nProcs" - << " " - << setw(8) << "avg" - << setw(8) << "max" - << " " - << setw(8) << "avg" - << setw(8) << "max" - << " " - << setw(8) << "avg" - << setw(8) << "max" - << " " << setw(4) << "avg" - << " " << setw(4) << "max" - << nl - << setw(8) << "-----" - << setw(8) << "------" - << " " - << setw(8) << "---" - << setw(8) << "---" - << " " - << setw(8) << "---" - << setw(8) << "---" - << " " << setw(4) << "---" - << " " << setw(4) << "---" - << nl; - - for (label levelI = 0; levelI <= size(); levelI++) - { - label nProcs = 0; - label nCells = 0; - scalar faceCellRatio = 0; - label nInterfaces = 0; - label nIntFaces = 0; - scalar ratio = 0.0; - - if (hasMeshLevel(levelI)) - { - nProcs = 1; - - const lduMesh& fineMesh = meshLevel(levelI); - nCells = fineMesh.lduAddr().size(); - faceCellRatio = - scalar(fineMesh.lduAddr().lowerAddr().size())/nCells; - - const lduInterfacePtrsList interfaces = - fineMesh.interfaces(); - forAll(interfaces, i) - { - if (interfaces.set(i)) - { - nInterfaces++; - nIntFaces += interfaces[i].faceCells().size(); - } - } - ratio = scalar(nIntFaces)/nCells; - } - - label totNprocs = returnReduce(nProcs, sumOp