From 4dd02834c2860a60082312120c287c0dba4211fa Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 16 Feb 2011 12:57:13 +0000 Subject: [PATCH 01/53] STYLE: minor code formatting --- src/lagrangian/basic/Particle/Particle.H | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lagrangian/basic/Particle/Particle.H b/src/lagrangian/basic/Particle/Particle.H index 484ca7ded0..743925525a 100644 --- a/src/lagrangian/basic/Particle/Particle.H +++ b/src/lagrangian/basic/Particle/Particle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -120,7 +120,7 @@ public: protected: - // Private data + // Protected data //- Reference to the particle cloud const Cloud& cloud_; @@ -179,18 +179,18 @@ protected: const label tetPtI ) const; - //- Find the lambda value for a moving tri face - inline scalar movingTetLambda - ( - const vector& from, - const vector& to, - const label triI, - const vector& tetArea, - const label tetPlaneBasePtI, - const label cellI, - const label tetFaceI, - const label tetPtI - ) const; + //- Find the lambda value for a moving tri face + inline scalar movingTetLambda + ( + const vector& from, + const vector& to, + const label triI, + const vector& tetArea, + const label tetPlaneBasePtI, + const label cellI, + const label tetFaceI, + const label tetPtI + ) const; //- Modify the tet owner data by crossing triI inline void tetNeighbour(label triI); From a701c9a6971ec59298561ea1d089fcaa5873f263 Mon Sep 17 00:00:00 2001 From: sergio Date: Thu, 24 Feb 2011 09:38:51 +0000 Subject: [PATCH 02/53] ENH: Change fatal Error to warning for absorption coeffs --- .../fvDOM/absorptionCoeffs/absorptionCoeffs.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thermophysicalModels/radiationModels/radiationModel/fvDOM/absorptionCoeffs/absorptionCoeffs.C b/src/thermophysicalModels/radiationModels/radiationModel/fvDOM/absorptionCoeffs/absorptionCoeffs.C index 76361fa861..9827cda5d7 100644 --- a/src/thermophysicalModels/radiationModels/radiationModel/fvDOM/absorptionCoeffs/absorptionCoeffs.C +++ b/src/thermophysicalModels/radiationModels/radiationModel/fvDOM/absorptionCoeffs/absorptionCoeffs.C @@ -59,12 +59,12 @@ void Foam::radiation::absorptionCoeffs::checkT(const scalar T) const { if (T < Tlow_ || T > Thigh_) { - FatalErrorIn + WarningIn ( "absorptionCoeffs::checkT(const scalar T) const" - ) << "attempt to use absCoeff out of temperature range:" << nl + ) << "usinf absCoeff out of temperature range:" << nl << " " << Tlow_ << " -> " << Thigh_ << "; T = " << T - << nl << abort(FatalError); + << nl << endl; } } From f2b04ab9a7b765f6f7ba4dbebdb8b4d3345aee17 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Feb 2011 15:37:38 +0000 Subject: [PATCH 03/53] COMP: promoted finiteVolume in build order --- src/Allwmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Allwmake b/src/Allwmake index 128d4a9845..9f90c0f641 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -38,9 +38,9 @@ parallel/decompose/AllwmakeLnInclude # dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools dummyThirdParty/Allwmake $* +wmake $makeOption finiteVolume wmake $makeOption lagrangian/basic wmake $makeOption lagrangian/distributionModels -wmake $makeOption finiteVolume wmake $makeOption genericPatchFields # Build the proper scotchDecomp, metisDecomp etc. From 0bbd3e55e61793cfa972aa7a12243b99f748c1ca Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Feb 2011 15:41:47 +0000 Subject: [PATCH 04/53] ENH: moved pointInTet() to inside() method in tetrahedron --- .../primitiveShapes/tetrahedron/tetrahedron.H | 10 +++--- .../tetrahedron/tetrahedronI.H | 34 ++++++++++++++++++- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H index 7e55cd872c..53e92c7f66 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H +++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -174,10 +174,10 @@ public: ) const; //- Return nearest point to p on tetrahedron - inline pointHit nearestPoint - ( - const point& p - ) const; + inline pointHit nearestPoint(const point& p) const; + + //- Return true if point is inside tetrahedron + inline bool inside(const point& pt) const; //- Return (min)containment sphere, i.e. the smallest sphere with // all points inside. Returns pointHit with: diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H index 38c9eae41c..309f16ddea 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -380,6 +380,38 @@ inline Foam::pointHit Foam::tetrahedron::nearestPoint } +template +bool Foam::tetrahedron::inside(const point& pt) const +{ + // For robustness, assuming that the point is in the tet unless + // "definitively" shown otherwise by obtaining a positive dot + // product greater than a tolerance of SMALL. + + // The tet is defined: tet(Cc, tetBasePt, pA, pB) where the normal + // vectors and base points for the half-space planes are: + // area[0] = Sa(); + // area[1] = Sb(); + // area[2] = Sc(); + // area[3] = Sd(); + // planeBase[0] = tetBasePt = tet.b() + // planeBase[1] = ptA = tet.c() + // planeBase[2] = tetBasePt = tet.b() + // planeBase[3] = tetBasePt = tet.b() + + vector n = Sa(); + n /= (Foam::mag(n) + VSMALL); + + if (((pt - b_) & n) > SMALL) + { + return false; + } + else + { + return true; + } +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template From d79c91e689a83fb8c1ed3de61996a5f7843c242e Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Feb 2011 15:44:22 +0000 Subject: [PATCH 05/53] ENH: added cloud autoMap bas method (was pure abstract) --- src/OpenFOAM/fields/cloud/cloud.C | 12 ++++++++++-- src/OpenFOAM/fields/cloud/cloud.H | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/fields/cloud/cloud.C b/src/OpenFOAM/fields/cloud/cloud.C index c4260f02ee..40eb070bcd 100644 --- a/src/OpenFOAM/fields/cloud/cloud.C +++ b/src/OpenFOAM/fields/cloud/cloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,7 @@ Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName) ( IOobject ( - ( cloudName.size() ? cloudName : defaultName ), + (cloudName.size() ? cloudName : defaultName), obr.time().timeName(), prefix, obr, @@ -58,4 +58,12 @@ Foam::cloud::~cloud() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::cloud::autoMap(const mapPolyMesh&) +{ + notImplemented("cloud::autoMap(const mapPolyMesh&)"); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/fields/cloud/cloud.H b/src/OpenFOAM/fields/cloud/cloud.H index a4c4eae51e..0755c6dd61 100644 --- a/src/OpenFOAM/fields/cloud/cloud.H +++ b/src/OpenFOAM/fields/cloud/cloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -91,7 +91,7 @@ public: //- Remap the cells of particles corresponding to the // mesh topology change - virtual void autoMap(const mapPolyMesh&) = 0; + virtual void autoMap(const mapPolyMesh&); }; From 06024cf98882324584ad4b067b352dc89e5dd6cc Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Feb 2011 16:02:28 +0000 Subject: [PATCH 06/53] ENH: Updated lagrangian basic particle - removed templating - updated track data --- src/lagrangian/basic/particle/particle.C | 147 +++++ .../Particle.H => particle/particle.H} | 313 ++++------ .../ParticleI.H => particle/particleI.H} | 488 ++++----------- .../ParticleIO.C => particle/particleIO.C} | 96 +-- .../particleTemplates.C} | 562 ++++++++++-------- 5 files changed, 713 insertions(+), 893 deletions(-) create mode 100644 src/lagrangian/basic/particle/particle.C rename src/lagrangian/basic/{Particle/Particle.H => particle/particle.H} (75%) rename src/lagrangian/basic/{Particle/ParticleI.H => particle/particleI.H} (55%) rename src/lagrangian/basic/{Particle/ParticleIO.C => particle/particleIO.C} (66%) rename src/lagrangian/basic/{Particle/Particle.C => particle/particleTemplates.C} (62%) diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C new file mode 100644 index 0000000000..c2ae9af0d2 --- /dev/null +++ b/src/lagrangian/basic/particle/particle.C @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "particle.H" +#include "transform.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +Foam::label Foam::particle::particleCount_ = 0; + +const Foam::scalar Foam::particle::trackingCorrectionTol = 1e-5; + +namespace Foam +{ + defineTypeNameAndDebug(particle, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::particle::particle +( + const polyMesh& mesh, + const vector& position, + const label cellI, + const label tetFaceI, + const label tetPtI +) +: + mesh_(mesh), + position_(position), + cellI_(cellI), + faceI_(-1), + stepFraction_(0.0), + tetFaceI_(tetFaceI), + tetPtI_(tetPtI), + origProc_(Pstream::myProcNo()), + origId_(getNewParticleID()) +{} + + +Foam::particle::particle +( + const polyMesh& mesh, + const vector& position, + const label cellI, + bool doCellFacePt +) +: + mesh_(mesh), + position_(position), + cellI_(cellI), + faceI_(-1), + stepFraction_(0.0), + tetFaceI_(-1), + tetPtI_(-1), + origProc_(Pstream::myProcNo()), + origId_(getNewParticleID()) +{ + if (doCellFacePt) + { + initCellFacePt(); + } +} + + +Foam::particle::particle(const particle& p) +: + mesh_(p.mesh_), + position_(p.position_), + cellI_(p.cellI_), + faceI_(p.faceI_), + stepFraction_(p.stepFraction_), + tetFaceI_(p.tetFaceI_), + tetPtI_(p.tetPtI_), + origProc_(p.origProc_), + origId_(p.origId_) +{} + + +Foam::particle::particle(const particle& p, const polyMesh& mesh) +: + mesh_(mesh), + position_(p.position_), + cellI_(p.cellI_), + faceI_(p.faceI_), + stepFraction_(p.stepFraction_), + tetFaceI_(p.tetFaceI_), + tetPtI_(p.tetPtI_), + origProc_(p.origProc_), + origId_(p.origId_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::particle::transformPosition(const tensor& T) +{ + position_ = transform(T, position_); +} + + +void Foam::particle::transformProperties(const tensor&) +{} + + +void Foam::particle::transformProperties(const vector&) +{} + + +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // + +bool Foam::operator==(const particle& pA, const particle& pB) +{ + return (pA.origProc() == pB.origProc() && pA.origId() == pB.origId()); +} + + +bool Foam::operator!=(const particle& pA, const particle& pB) +{ + return !(pA == pB); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/basic/Particle/Particle.H b/src/lagrangian/basic/particle/particle.H similarity index 75% rename from src/lagrangian/basic/Particle/Particle.H rename to src/lagrangian/basic/particle/particle.H index 743925525a..f9b832348f 100644 --- a/src/lagrangian/basic/Particle/Particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -22,99 +22,102 @@ License along with OpenFOAM. If not, see . Class - Foam::Particle + Foam::particle Description + Base particle class \*---------------------------------------------------------------------------*/ -#ifndef Particle_H -#define Particle_H +#ifndef particle_H +#define particle_H #include "vector.H" +#include "Cloud.H" #include "IDLList.H" #include "labelList.H" #include "pointField.H" #include "faceList.H" -#include "typeInfo.H" +//#include "typeInfo.H" #include "OFstream.H" #include "tetPointRef.H" #include "FixedList.H" #include "polyMeshTetDecomposition.H" -#include "wallPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -template -class Cloud; +// Forward declaration of classes +class particle; + +class polyPatch; -class wedgePolyPatch; -class symmetryPolyPatch; class cyclicPolyPatch; class processorPolyPatch; +class symmetryPolyPatch; class wallPolyPatch; -class polyPatch; +class wedgePolyPatch; // Forward declaration of friend functions and operators -template -class Particle; - -// Friend Operators - -template Ostream& operator<< ( Ostream&, - const Particle& + const particle& ); -template -bool operator==(const Particle&, const Particle&); +bool operator==(const particle&, const particle&); -template -bool operator!=(const Particle&, const Particle&); +bool operator!=(const particle&, const particle&); /*---------------------------------------------------------------------------*\ - Class Particle Declaration + Class Particle Declaration \*---------------------------------------------------------------------------*/ -template -class Particle +class particle : - public IDLList::link + public IDLList::link { - public: - //- Class used to pass tracking data to the trackToFace function - class trackData + template + class TrackingData { - // Private data - //- Reference to the cloud containing this particle - Cloud& cloud_; + //- Reference to the cloud containing (this) particle + CloudType& cloud_; public: - bool switchProcessor; - bool keepParticle; + // Public data + + typedef CloudType cloudType; + + //- Flag to switch processor + bool switchProcessor; + + //- Flag to indicate whether to keep particle (false = delete) + bool keepParticle; - // Constructors - - inline trackData(Cloud& cloud); + // Constructor + TrackingData(CloudType& cloud) + : + cloud_(cloud) + {} // Member functions //- Return a reference to the cloud - inline Cloud& cloud(); + CloudType& cloud() + { + return cloud_; + } }; @@ -122,8 +125,8 @@ protected: // Protected data - //- Reference to the particle cloud - const Cloud& cloud_; + //- Reference to the polyMesh database + const polyMesh& mesh_; //- Position of particle vector position_; @@ -156,7 +159,7 @@ protected: // Private Member Functions //- Find the tet tri faces between position and tet centre - inline void findTris + void findTris ( const vector& position, DynamicList