diff --git a/applications/test/GAMGAgglomeration/Make/files b/applications/test/GAMGAgglomeration/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..e6ad2af5d22dd5ccc117a225a7e4d7f344fddb44 --- /dev/null +++ b/applications/test/GAMGAgglomeration/Make/files @@ -0,0 +1,3 @@ +Test-GAMGAgglomeration.C + +EXE = $(FOAM_USER_APPBIN)/Test-GAMGAgglomeration diff --git a/applications/test/GAMGAgglomeration/Make/options b/applications/test/GAMGAgglomeration/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..d27c95d033dd5d7b1995c8ff8dc406e35ca1f586 --- /dev/null +++ b/applications/test/GAMGAgglomeration/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/applications/test/GAMGAgglomeration/Test-GAMGAgglomeration.C b/applications/test/GAMGAgglomeration/Test-GAMGAgglomeration.C new file mode 100644 index 0000000000000000000000000000000000000000..82ccd8ce33605cb9e2dbbd91eb06de6780036199 --- /dev/null +++ b/applications/test/GAMGAgglomeration/Test-GAMGAgglomeration.C @@ -0,0 +1,201 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. + +Application + Test-GAMGAgglomeration + +Description + Test application for GAMG agglomeration. Hardcoded to expect GAMG on p. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "GAMGAgglomeration.H" +#include "OFstream.H" +#include "meshTools.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + argList::addBoolOption + ( + "writeObj", + "write obj files of agglomeration" + ); + argList::addBoolOption + ( + "normalise", + "normalise agglomeration (0..1)" + ); + + #include "setRootCase.H" + #include "createTime.H" + + bool writeObj = args.optionFound("writeObj"); + bool normalise = args.optionFound("normalise"); + + #include "createMesh.H" + + const fvSolution& sol = static_cast<const fvSolution&>(mesh); + const dictionary& pDict = sol.subDict("solvers").subDict("p"); + + const GAMGAgglomeration& agglom = GAMGAgglomeration::New + ( + mesh, + pDict + ); + + labelList cellToCoarse(identity(mesh.nCells())); + labelListList coarseToCell(invertOneToMany(mesh.nCells(), cellToCoarse)); + + runTime++; + + // Write initial agglomeration + { + volScalarField scalarAgglomeration + ( + IOobject + ( + "agglomeration", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("aggomeration", dimless, 0.0) + ); + scalarField& fld = scalarAgglomeration.internalField(); + forAll(fld, cellI) + { + fld[cellI] = cellToCoarse[cellI]; + } + fld /= max(fld); + scalarAgglomeration.correctBoundaryConditions(); + scalarAgglomeration.write(); + + Info<< "Writing initial cell distribution to " + << runTime.timeName() << endl; + } + + + for (label level = 0; level < agglom.size(); level++) + { + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + const labelList& addr = agglom.restrictAddressing(level); + label coarseSize = max(addr)+1; + + Info<< "Level : " << level << endl + << returnReduce(addr.size(), sumOp<label>()) << endl + << " current size : " + << returnReduce(addr.size(), sumOp<label>()) << endl + << " agglomerated size : " + << returnReduce(coarseSize, sumOp<label>()) << endl; + + forAll(addr, fineI) + { + const labelList& cellLabels = coarseToCell[fineI]; + forAll(cellLabels, i) + { + cellToCoarse[cellLabels[i]] = addr[fineI]; + } + } + coarseToCell = invertOneToMany(coarseSize, cellToCoarse); + + // Write agglomeration + { + volScalarField scalarAgglomeration + ( + IOobject + ( + "agglomeration", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("aggomeration", dimless, 0.0) + ); + scalarField& fld = scalarAgglomeration.internalField(); + forAll(fld, cellI) + { + fld[cellI] = cellToCoarse[cellI]; + } + if (normalise) + { + fld /= max(fld); + } + scalarAgglomeration.correctBoundaryConditions(); + scalarAgglomeration.write(); + } + + if (writeObj) + { + OFstream str(runTime.path()/runTime.timeName()/"aggomeration.obj"); + label vertI = 0; + + // Write all mesh cc + forAll(mesh.cellCentres(), cellI) + { + meshTools::writeOBJ(str, mesh.cellCentres()[cellI]); + vertI++; + } + + // Determine coarse cc + forAll(coarseToCell, coarseI) + { + const labelList& cellLabels = coarseToCell[coarseI]; + + point coarseCc = average + ( + pointField(mesh.cellCentres(), cellLabels) + ); + meshTools::writeOBJ(str, coarseCc); + vertI++; + + forAll(cellLabels, i) + { + label cellI = cellLabels[i]; + + str << "l " << cellI+1 << ' ' << vertI << nl; + } + } + } + + Info<< endl; + } + + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C index 7851be5e707e204db8c77baf2de47b5dcab9b7d3..4910faa51c44cd64e4d8c5e577de1c4791a7269c 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C @@ -179,7 +179,7 @@ void Foam::PairCollision<CloudType>::wallInteraction() const labelListList& dil = il_.dil(); - const labelListList directWallFaces = il_.dwfil(); + const labelListList& directWallFaces = il_.dwfil(); const labelList& patchID = mesh.boundaryMesh().patchID(); diff --git a/tutorials/incompressible/icoFoam/cavity/system/controlDict b/tutorials/incompressible/icoFoam/cavity/system/controlDict index 8016db385c2528d5d285b268fea33f6a968f984c..d2fa09cc526b96181407595f79c0968a81be7c44 100644 --- a/tutorials/incompressible/icoFoam/cavity/system/controlDict +++ b/tutorials/incompressible/icoFoam/cavity/system/controlDict @@ -31,10 +31,6 @@ writeControl timeStep; writeInterval 20; -//- Additional dump every hour of cpuTime for e.g. restarts -//secondaryWriteControl cpuTime; -//secondaryWriteInterval 3600; - purgeWrite 0; writeFormat ascii;