diff --git a/applications/solvers/combustion/dieselEngineFoam/Make/options b/applications/solvers/combustion/dieselEngineFoam/Make/options index d0a572b86f..9a45247819 100644 --- a/applications/solvers/combustion/dieselEngineFoam/Make/options +++ b/applications/solvers/combustion/dieselEngineFoam/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I../engineFoam \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ @@ -24,6 +25,7 @@ EXE_LIBS = \ -lreactionThermophysicalModels \ -lfiniteVolume \ -llagrangian \ + -lmeshTools \ -ldieselSpray \ -lliquids \ -lliquidMixture \ diff --git a/applications/solvers/combustion/dieselFoam/Make/options b/applications/solvers/combustion/dieselFoam/Make/options index 9096934c2d..3b1786aa08 100644 --- a/applications/solvers/combustion/dieselFoam/Make/options +++ b/applications/solvers/combustion/dieselFoam/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ @@ -21,6 +22,7 @@ EXE_LIBS = \ -lcompressibleLESModels \ -lreactionThermophysicalModels \ -llagrangian \ + -lmeshTools \ -ldieselSpray \ -lliquids \ -lliquidMixture \ diff --git a/applications/solvers/discreteMethods/dsmc/dsmcFoam/Make/options b/applications/solvers/discreteMethods/dsmc/dsmcFoam/Make/options index bc99834af6..62520c19b0 100644 --- a/applications/solvers/discreteMethods/dsmc/dsmcFoam/Make/options +++ b/applications/solvers/discreteMethods/dsmc/dsmcFoam/Make/options @@ -9,4 +9,3 @@ EXE_LIBS = \ -lfiniteVolume \ -llagrangian \ -ldsmc - diff --git a/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/Make/files b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/Make/files new file mode 100644 index 0000000000..e233a549b8 --- /dev/null +++ b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/Make/files @@ -0,0 +1,3 @@ +incompressibleUncoupledKinematicParcelDyMFoam.C + +EXE = $(FOAM_APPBIN)/incompressibleUncoupledKinematicParcelDyMFoam diff --git a/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/Make/options b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/Make/options new file mode 100644 index 0000000000..3c4206dc24 --- /dev/null +++ b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/Make/options @@ -0,0 +1,33 @@ +EXE_INC = \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude + + +EXE_LIBS = \ + -llagrangian \ + -llagrangianIntermediate \ + -lthermophysicalFunctions \ + -lbasicThermophysicalModels \ + -lspecie \ + -lradiation \ + -lincompressibleRASModels \ + -lincompressibleLESModels \ + -lincompressibleTransportModels \ + -lfiniteVolume \ + -lmeshTools \ + -lsurfaceFilmModels \ + -ldynamicMesh \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh diff --git a/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/createFields.H b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/createFields.H new file mode 100644 index 0000000000..0ad057e229 --- /dev/null +++ b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/createFields.H @@ -0,0 +1,147 @@ + Info<< "\nReading transportProperties\n" << endl; + + IOdictionary transportProperties + ( + IOobject + ( + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); + + dimensionedScalar rhoInfValue + ( + transportProperties.lookup("rhoInf") + ); + + volScalarField rhoInf + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + rhoInfValue + ); + + Info<< "Reading field U\n" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + #include "createPhi.H" + + Info<< "Creating turbulence model\n" << endl; + + singlePhaseTransportModel laminarTransport(U, phi); + + const volScalarField nu = laminarTransport.nu(); + + autoPtr turbulence + ( + incompressible::turbulenceModel::New(U, phi, laminarTransport) + ); + + volScalarField mu + ( + IOobject + ( + "mu", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + nu*rhoInfValue + ); + + word kinematicCloudName("kinematicCloud"); + args.optionReadIfPresent("cloudName", kinematicCloudName); + + Info<< "Constructing kinematicCloud " << kinematicCloudName << endl; + basicKinematicCloud kinematicCloud + ( + kinematicCloudName, + rhoInf, + U, + mu, + g + ); + + IOobject Hheader + ( + "H", + runTime.timeName(), + mesh, + IOobject::NO_READ + ); + + autoPtr HPtr_; + + if (Hheader.headerOk()) + { + Info<< "\nReading field H\n" << endl; + + HPtr_.reset + ( + new volVectorField + ( + IOobject + ( + "H", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) + ); + } + + IOobject HdotGradHheader + ( + "HdotGradH", + runTime.timeName(), + mesh, + IOobject::NO_READ + ); + + autoPtr HdotGradHPtr_; + + if (HdotGradHheader.headerOk()) + { + Info<< "Reading field HdotGradH" << endl; + + HdotGradHPtr_.reset + ( + new volVectorField + ( + IOobject + ( + "HdotGradH", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) + ); + } diff --git a/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/incompressibleUncoupledKinematicParcelDyMFoam.C b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/incompressibleUncoupledKinematicParcelDyMFoam.C new file mode 100644 index 0000000000..f5fba006e0 --- /dev/null +++ b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/incompressibleUncoupledKinematicParcelDyMFoam.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2010 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 . + +Application + uncoupledKinematicParcelFoam + +Description + Transient solver for the passive transport of a single kinematic + particle could. + + Uses a pre-calculated velocity field to evolve the cloud. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "singlePhaseTransportModel.H" +#include "turbulenceModel.H" +#include "basicKinematicCloud.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::addOption + ( + "cloudName", + "name", + "specify alternative cloud name. default is 'kinematicCloud'" + ); + + #include "setRootCase.H" + #include "createTime.H" + # include "createDynamicFvMesh.H" + + #include "readGravitationalAcceleration.H" + #include "createFields.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.loop()) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + + mesh.update(); + + U.correctBoundaryConditions(); + + Info<< "Evolving " << kinematicCloud.name() << endl; + + laminarTransport.correct(); + + mu = nu*rhoInfValue; + + kinematicCloud.evolve(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/findCell-octree/findCell-octree.C b/applications/test/findCell-octree/findCell-octree.C index 2fbb9c0703..df8797eeb0 100644 --- a/applications/test/findCell-octree/findCell-octree.C +++ b/applications/test/findCell-octree/findCell-octree.C @@ -29,6 +29,8 @@ License #include "IStringStream.H" #include "octree.H" #include "octreeDataCell.H" +#include "indexedOctree.H" +#include "treeDataCell.H" #include "OFstream.H" using namespace Foam; @@ -44,11 +46,13 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + label nReps = 100000; + const point sample = args.argRead(1); - treeBoundBox meshBb(mesh.points()); + treeBoundBox meshBb(mesh.bounds()); - // Calculate typical cell releated size to shift bb by. + // Calculate typical cell related size to shift bb by. scalar typDim = meshBb.avgDim()/(2.0*Foam::cbrt(scalar(mesh.nCells()))); treeBoundBox shiftedBb @@ -57,16 +61,13 @@ int main(int argc, char *argv[]) meshBb.max() + vector(typDim, typDim, typDim) ); - Info<< "Mesh" << endl; Info<< " bounding box : " << meshBb << endl; Info<< " bounding box (shifted) : " << shiftedBb << endl; Info<< " typical dimension : " << shiftedBb.typDim() << endl; - - /* - * Now we have allBb and shiftedBb - */ + Info<< "Initialised mesh in " + << runTime.cpuTimeIncrement() << " s" << endl; // Wrap indices and mesh information into helper object octreeDataCell shapes(mesh); @@ -80,14 +81,52 @@ int main(int argc, char *argv[]) 10.0 // maximum ratio of cubes v.s. cells ); - Info<< "Point:" << sample << " is in shape " - << oc.find(sample) << nl - << "Point:" << sample << " is in cell " - << mesh.findCell(sample) << endl; + for (label i = 0; i < nReps - 1 ; i++) + { + oc.find(sample); + } + Info<< "Point:" << sample << " is in shape " + << oc.find(sample) << endl; oc.printStats(Info); + Info<< "Found in octree " << nReps << " times in " + << runTime.cpuTimeIncrement() << " s" << endl; + + indexedOctree ioc + ( + treeDataCell(true, mesh), + shiftedBb, + 8, // maxLevel + 10, // leafsize + 3.0 // duplicity + ); + + for (label i = 0; i < nReps - 1 ; i++) + { + ioc.findInside(sample); + } + + Info<< "Point:" << sample << " is in shape " + << ioc.findInside(sample) + << ", where the possible cells were:" << nl + << ioc.findIndices(sample) + << endl; + + Info<< "Found in indexedOctree " << nReps << " times in " + << runTime.cpuTimeIncrement() << " s" << endl; + + for (label i = 0; i < nReps - 1 ; i++) + { + mesh.findCell(sample); + } + + Info<< "Point:" << sample << " is in cell " + << mesh.findCell(sample) << endl; + + Info<< "Found in mesh.findCell " << nReps << " times in " + << runTime.cpuTimeIncrement() << " s" << endl; Info<< "End\n" << endl; diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 476dbe1afb..a15aa483c4 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -341,11 +341,14 @@ meshQualityControls // Set to very negative number (e.g. -1E30) to disable. minVol 1e-13; - //- Minimum tet volume. Is absolute volume of the tet formed by the - // face-centre decomposition triangle and the cell centre. - // Set to a sensible fraction of the smallest cell volume expected. - // Set to very negative number (e.g. -1E30) to disable. - minTetVol 1e-20; + //- Minimum quality of the tet formed by the face-centre + // and variable base point minimum decomposition triangles and + // the cell centre. Set to very negative number (e.g. -1E30) to + // disable. + // <0 = inside out tet, + // 0 = flat tet + // 1 = regular tet + minTetQuality 1e-9; //- Minimum face area. Set to <0 to disable. minArea -1; diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 57f892b8e4..82e0dedd82 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -6,6 +6,7 @@ #include "EdgeMap.H" #include "wedgePolyPatch.H" #include "unitConversion.H" +#include "polyMeshTetDecomposition.H" // Find wedge with opposite orientation. Note: does not actually check that @@ -83,7 +84,7 @@ bool Foam::checkWedges { Info<< " Wedge " << pp.name() << " with angle " << radToDeg(wedgeAngle) << " degrees" - << endl; + << endl; } // Find opposite @@ -413,7 +414,6 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) } } - { faceSet faces(mesh, "wrongOrientedFaces", mesh.nFaces()/100 + 1); if (mesh.checkFacePyramids(true, -SMALL, &faces)) @@ -433,25 +433,6 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) } } - { - faceSet faces(mesh, "wrongOrientedTriangleFaces", mesh.nFaces()/100+1); - if (mesh.checkFaceTets(true, 0, &faces)) - { - noFailedChecks++; - - label nFaces = returnReduce(faces.size(), sumOp