From fa89905b7dfdd0ef71da2e3982765297abd855d7 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 22 May 2009 13:14:22 +0100 Subject: [PATCH] adding particle tracking functionality --- .../ParticleTrackingData.C | 72 ++++++ .../ParticleTrackingData.H | 166 +++++++++++++ .../ParticleTrackingDataI.H | 49 ++++ .../ParticleTrackingDataIO.C | 233 ++++++++++++++++++ .../trackedReactingCloud.C | 77 ++++++ .../trackedReactingCloud.H | 103 ++++++++ .../TrackedReactingParcel.C | 47 ++++ .../TrackedReactingParcel.H | 160 ++++++++++++ .../TrackedReactingParcelI.H | 59 +++++ .../TrackedReactingParcelIO.C | 105 ++++++++ .../defineTrackedReactingParcel.C | 57 +++++ ...keTrackedReactingParcelCompositionModels.C | 48 ++++ ...akeTrackedReactingParcelDispersionModels.C | 68 +++++ .../makeTrackedReactingParcelDragModels.C | 45 ++++ ...eTrackedReactingParcelHeatTransferModels.C | 55 +++++ ...makeTrackedReactingParcelInjectionModels.C | 69 ++++++ ...keTrackedReactingParcelPhaseChangeModels.C | 55 +++++ ...rackedReactingParcelPostProcessingModels.C | 55 +++++ .../makeTrackedReactingParcelTrackingModels.C | 55 +++++ ...ackedReactingParcelWallInteractionModels.C | 55 +++++ .../trackedReactingParcel.C | 95 +++++++ .../trackedReactingParcel.H | 119 +++++++++ 22 files changed, 1847 insertions(+) create mode 100644 src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.C create mode 100644 src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.H create mode 100644 src/lagrangian/basic/ParticleTrackingData/ParticleTrackingDataI.H create mode 100644 src/lagrangian/basic/ParticleTrackingData/ParticleTrackingDataIO.C create mode 100644 src/lagrangian/intermediate/clouds/derived/trackedReactingCloud/trackedReactingCloud.C create mode 100644 src/lagrangian/intermediate/clouds/derived/trackedReactingCloud/trackedReactingCloud.H create mode 100644 src/lagrangian/intermediate/parcels/Templates/TrackedReactingParcel/TrackedReactingParcel.C create mode 100644 src/lagrangian/intermediate/parcels/Templates/TrackedReactingParcel/TrackedReactingParcel.H create mode 100644 src/lagrangian/intermediate/parcels/Templates/TrackedReactingParcel/TrackedReactingParcelI.H create mode 100644 src/lagrangian/intermediate/parcels/Templates/TrackedReactingParcel/TrackedReactingParcelIO.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/defineTrackedReactingParcel.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelCompositionModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelDispersionModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelDragModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelHeatTransferModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelInjectionModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelPhaseChangeModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelPostProcessingModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelTrackingModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/submodels/makeTrackedReactingParcelWallInteractionModels.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/trackedReactingParcel.C create mode 100644 src/lagrangian/intermediate/parcels/derived/trackedReactingParcel/trackedReactingParcel.H diff --git a/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.C b/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.C new file mode 100644 index 0000000000..80f1dcaaf7 --- /dev/null +++ b/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "ParticleTrackingData.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +Foam::label Foam::ParticleTrackingData::PARTICLE_COUNT = 0; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ParticleTrackingData::ParticleTrackingData +( + const Cloud& cloud +) +: + cloud_(cloud), + origProc_(Pstream::myProcNo()), + id_(PARTICLE_COUNT++) +{} + + +template +Foam::ParticleTrackingData::ParticleTrackingData +( + const ParticleTrackingData& ptd +) +: + cloud_(ptd.cloud_), + origProc_(ptd.origProc_), + id_(ptd.id_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ParticleTrackingData::~ParticleTrackingData() +{} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +#include "ParticleTrackingDataIO.C" + +// ************************************************************************* // diff --git a/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.H b/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.H new file mode 100644 index 0000000000..c752c2ec36 --- /dev/null +++ b/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.H @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::ParticleTrackingData + +Description + Class to provide additional properties to allow construction of + particle tracks + +SourceFiles + ParticleTrackingData.C + ParticleTrackingDataIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ParticleTrackingData_H +#define ParticleTrackingData_H + +#include "Cloud.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes and friend functions +template +class ParticleTrackingData; + + +template +Ostream& operator<< +( + Ostream&, + const ParticleTrackingData& +); + + +/*---------------------------------------------------------------------------*\ + Class ParticleTrackingData Declaration +\*---------------------------------------------------------------------------*/ + +template +class ParticleTrackingData +{ + // Private data + + //- Reference to the cloud + const Cloud& cloud_; + + //- Originating processor id + label origProc_; + + //- Local particle id + label id_; + + //- Cumulative particle count used for particle id + static label PARTICLE_COUNT; + + + // Private member functions + + //- Write properties - particle count + static void writeProperties(const Cloud& cloud); + + //- Read properties - particle count + static void readProperties(const Cloud& cloud); + + +public: + + // Constructors + + //- Construct from cloud + ParticleTrackingData(const Cloud& cloud); + + //- Construct copy + ParticleTrackingData(const ParticleTrackingData& ptd); + + //- Construct from Istream and mesh + ParticleTrackingData + ( + const Cloud& cloud, + Istream& is, + bool readFields + ); + + + //- Destructor + ~ParticleTrackingData(); + + + // Member functions + + // Access + + //- Return const access to the cloud + inline const Cloud& cloud() const; + + //- Return const access to the originating processor id + inline label origProc() const; + + //- Return const access to the local particle id + inline label id() const; + + + // I-O + + //- Read fields + static void readFields(Cloud& c); + + //- Write fields + static void writeFields(const Cloud& c); + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const ParticleTrackingData& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ParticleTrackingDataI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ParticleTrackingData.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingDataI.H b/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingDataI.H new file mode 100644 index 0000000000..da195d5627 --- /dev/null +++ b/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingDataI.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +template +inline const Foam::Cloud& +Foam::ParticleTrackingData::cloud() const +{ + return cloud_; +} + + +template +inline Foam::label Foam::ParticleTrackingData::origProc() const +{ + return origProc_; +} + + +template +inline Foam::label Foam::ParticleTrackingData::id() const +{ + return id_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingDataIO.C b/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingDataIO.C new file mode 100644 index 0000000000..e575426eea --- /dev/null +++ b/src/lagrangian/basic/ParticleTrackingData/ParticleTrackingDataIO.C @@ -0,0 +1,233 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "ParticleTrackingData.H" + +// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // + +template +void Foam::ParticleTrackingData::readProperties +( + const Cloud& cloud +) +{ + IOobject propsDictHeader + ( + "particleTrackingProperties", + cloud.db().time().timeName(), + "uniform/Lagrangian"/cloud.name(), + cloud.db(), + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + if (propsDictHeader.headerOk()) + { + const IOdictionary propsDict(propsDictHeader); + + word procName("processor" + name(Pstream::myProcNo())); + if (propsDict.found(procName)) + { + propsDict.subDict(procName).lookup("particleCount") >> + PARTICLE_COUNT; + } + } +} + + +template +void Foam::ParticleTrackingData::writeProperties +( + const Cloud& cloud +) +{ + if (cloud.db().time().outputTime()) + { + IOdictionary propsDict + ( + IOobject + ( + "particleTrackingProperties", + cloud.db().time().timeName(), + "uniform/Lagrangian"/cloud.name(), + cloud.db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ) + ); + + word procName("processor" + name(Pstream::myProcNo())); + propsDict.add(procName, dictionary()); + propsDict.subDict(procName).add("particleCount", PARTICLE_COUNT); + + propsDict.regIOobject::write(); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ParticleTrackingData::ParticleTrackingData +( + const Cloud& cloud, + Istream& is, + bool readFields +) +: + cloud_(cloud), + origProc_(-1), + id_(-1) +{ + if (readFields) + { + if (is.format() == IOstream::ASCII) + { + is >> origProc_ >> id_; + } + else + { + is.read + ( + reinterpret_cast(&origProc_), + sizeof(origProc_) + sizeof(id_) + ); + } + } + + // Check state of Istream + is.check + ( + "ParticleTrackingData::ParticleTrackingData" + "(" + "Istream&, " + "bool" + ")" + ); +} + + +template +void Foam::ParticleTrackingData::readFields +( + Cloud& c +) +{ + if (!c.size()) + { + return; + } + + readProperties(c); + + IOField