From 7f9e4755cd732165d713f167c8904f0e4bcc8005 Mon Sep 17 00:00:00 2001
From: graham <graham.macpherson@strath.ac.uk>
Date: Mon, 23 Feb 2009 18:55:24 +0000
Subject: [PATCH] Adding initial dsmc cloud and solver.

---
 applications/solvers/dsmc/dsmcFoam/Make/files |   3 +
 .../solvers/dsmc/dsmcFoam/Make/options        |  10 +
 .../solvers/dsmc/dsmcFoam/createFields.H      |   4 +
 applications/solvers/dsmc/dsmcFoam/dsmcFoam.C |  72 +++++
 .../clouds/Templates/DsmcCloud/DsmcCloud.C    | 187 ++++++++++++
 .../clouds/Templates/DsmcCloud/DsmcCloud.H    | 265 +++++++++++++++++
 .../clouds/Templates/DsmcCloud/DsmcCloudI.H   | 278 ++++++++++++++++++
 .../baseClasses/DsmcBaseCloud/DsmcBaseCloud.C |  49 +++
 .../baseClasses/DsmcBaseCloud/DsmcBaseCloud.H |  89 ++++++
 9 files changed, 957 insertions(+)
 create mode 100755 applications/solvers/dsmc/dsmcFoam/Make/files
 create mode 100755 applications/solvers/dsmc/dsmcFoam/Make/options
 create mode 100644 applications/solvers/dsmc/dsmcFoam/createFields.H
 create mode 100644 applications/solvers/dsmc/dsmcFoam/dsmcFoam.C
 create mode 100644 src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C
 create mode 100644 src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H
 create mode 100644 src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H
 create mode 100644 src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
 create mode 100644 src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.H

diff --git a/applications/solvers/dsmc/dsmcFoam/Make/files b/applications/solvers/dsmc/dsmcFoam/Make/files
new file mode 100755
index 00000000000..a6860410e71
--- /dev/null
+++ b/applications/solvers/dsmc/dsmcFoam/Make/files
@@ -0,0 +1,3 @@
+dsmcFoam.C
+
+EXE = $(FOAM_APPBIN)/dsmcFoam
diff --git a/applications/solvers/dsmc/dsmcFoam/Make/options b/applications/solvers/dsmc/dsmcFoam/Make/options
new file mode 100755
index 00000000000..5ec7ea20fdd
--- /dev/null
+++ b/applications/solvers/dsmc/dsmcFoam/Make/options
@@ -0,0 +1,10 @@
+EXE_INC = \
+    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/lagrangian/basic/lnInclude \
+    -I$(LIB_SRC)/meshTools/lnInclude
+
+EXE_LIBS = \
+    -lmeshTools \
+    -lfiniteVolume \
+    -llagrangian
+
diff --git a/applications/solvers/dsmc/dsmcFoam/createFields.H b/applications/solvers/dsmc/dsmcFoam/createFields.H
new file mode 100644
index 00000000000..8663ea7c6c6
--- /dev/null
+++ b/applications/solvers/dsmc/dsmcFoam/createFields.H
@@ -0,0 +1,4 @@
+
+    Info<< "Constructing dsmcCloud " << endl;
+
+    dsmcCloud dsmc(mesh);
diff --git a/applications/solvers/dsmc/dsmcFoam/dsmcFoam.C b/applications/solvers/dsmc/dsmcFoam/dsmcFoam.C
new file mode 100644
index 00000000000..91b53b43a9f
--- /dev/null
+++ b/applications/solvers/dsmc/dsmcFoam/dsmcFoam.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
+
+Application
+    dsmcFoam
+
+Description
+    Direct Simulation Monte Carlo Solver for 3D, transient, multi-species flows
+
+\*---------------------------------------------------------------------------*/
+
+#include "fvCFD.H"
+#include "dsmcCloud.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+int main(int argc, char *argv[])
+{
+    #include "setRootCase.H"
+    #include "createTime.H"
+    #include "createMesh.H"
+    #include "createFields.H"
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+    Info<< "\nStarting time loop\n" << endl;
+
+    while (runTime.run())
+    {
+        runTime++;
+
+        Info<< "Time = " << runTime.timeName() << nl << endl;
+
+        dsmc.evolve();
+
+        dsmc.info();
+
+        runTime.write();
+
+        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
+            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
+            << nl << endl;
+    }
+
+    Info<< "End\n" << endl;
+
+    return(0);
+}
+
+
+// ************************************************************************* //
diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C
new file mode 100644
index 00000000000..152009efd5a
--- /dev/null
+++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C
@@ -0,0 +1,187 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  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 "DsmcCloud.H"
+#include "CollisionModel.H"
+#include "InjectionModel.H"
+#include "WallInteractionModel.H"
+#include "IntegrationScheme.H"
+
+// * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * * //
+
+template<class ParcelType>
+void Foam::DsmcCloud<ParcelType>::addNewParcel
+(
+    const vector& position,
+    const vector& U,
+    const label cellId,
+    const label speciesId
+)
+{
+    ParcelType* pPtr = new ParcelType
+    (
+        *this,
+        position,
+        U,
+        cellId,
+        speciesId,
+        constProps_(speciesId)
+    );
+
+    addParticle(pPtr);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<class ParcelType>
+Foam::DsmcCloud<ParcelType>::DsmcCloud
+(
+    const word& cloudType,
+    const fvMesh& mesh
+)
+:
+    Cloud<ParcelType>(mesh, cloudType, false),
+    DsmcBaseCloud(),
+    cloudType_(cloudType),
+    mesh_(mesh),
+    particleProperties_
+    (
+        IOobject
+        (
+            cloudType + "Properties",
+            rho.mesh().time().constant(),
+            rho.mesh(),
+            IOobject::MUST_READ,
+            IOobject::NO_WRITE
+        )
+    ),
+    constProps_(particleProperties_),
+    rndGen_(label(971501)),
+    interpolationSchemes_(particleProperties_.subDict("interpolationSchemes")),
+    collisionModel_
+    (
+        CollisionModel<DsmcCloud<ParcelType> >::New
+        (
+            particleProperties_,
+            *this
+        )
+    ),
+    injectionModel_
+    (
+        InjectionModel<DsmcCloud<ParcelType> >::New
+        (
+            particleProperties_,
+            *this
+        )
+    ),
+    wallInteractionModel_
+    (
+        WallInteractionModel<DsmcCloud<ParcelType> >::New
+        (
+            particleProperties_,
+            *this
+        )
+    ),
+    UIntegrator_
+    (
+        vectorIntegrationScheme::New
+        (
+            "U",
+            particleProperties_.subDict("integrationSchemes")
+        )
+    )
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+template<class ParcelType>
+Foam::DsmcCloud<ParcelType>::~DsmcCloud()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class ParcelType>
+void Foam::DsmcCloud<ParcelType>::evolve()
+{
+    typename ParcelType::trackData td
+    (
+        *this,
+        constProps_
+    );
+
+    this->injection().inject(td);
+
+    if (debug)
+    {
+        this->dumpParticlePositions();
+    }
+
+    Cloud<ParcelType>::move(td);
+
+    this->collision().collide();
+}
+
+
+template<class ParcelType>
+void Foam::DsmcCloud<ParcelType>::info() const
+{
+    Info<< "Cloud name: " << this->name() << nl
+        << "    Current number of parcels       = "
+        << returnReduce(this->size(), sumOp<label>()) << nl
+        << "    Current mass in system          = "
+        << returnReduce(massInSystem(), sumOp<scalar>()) << nl
+        << endl;
+}
+
+
+template<class ParcelType>
+void Foam::DsmcCloud<ParcelType>::dumpParticlePositions() const
+{
+    OFstream pObj
+    (
+        this->db().time().path()/"parcelPositions_"
+      + this->name() + "_"
+      + this->db().time().timeName() + ".obj"
+    );
+
+    forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
+    {
+        const ParcelType& p = iter();
+
+        pObj<< "v " << p.position().x()
+            << " "  << p.position().y()
+            << " "  << p.position().z()
+            << nl;
+    }
+
+    pObj.flush();
+}
+
+
+// ************************************************************************* //
diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H
new file mode 100644
index 00000000000..a8fddd1ba6e
--- /dev/null
+++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H
@@ -0,0 +1,265 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  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::DsmcCloud
+
+Description
+    Templated base class for dsmc cloud
+
+SourceFiles
+    DsmcCloudI.H
+    DsmcCloud.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef DsmcCloud_H
+#define DsmcCloud_H
+
+#include "Cloud.H"
+#include "DsmcBaseCloud.H"
+#include "IOdictionary.H"
+#include "autoPtr.H"
+#include "Random.H"
+#include "fvMesh.H"
+#include "volFields.H"
+
+#include "IntegrationSchemesFwd.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+
+template<class CloudType>
+class CollisionModel;
+
+template<class CloudType>
+class InjectionModel;
+
+template<class CloudType>
+class WallInteractionModel;
+
+/*---------------------------------------------------------------------------*\
+                       Class DsmcCloud Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class ParcelType>
+class DsmcCloud
+:
+    public Cloud<ParcelType>,
+    public DsmcBaseCloud
+{
+
+private:
+
+    // Private data
+
+        //- Cloud type - used to set the name of the parcel properties
+        //  dictionary by appending "Properties"
+        const word cloudType_;
+
+        //- References to the mesh and time databases
+        const fvMesh& mesh_;
+
+        //- Dictionary of particle properties
+        IOdictionary particleProperties_;
+
+        //- A data structure holding which particles are in which cell
+        List<DynamicList<ParcelType*> > cellOccupancy_;
+
+        //- Parcel constant properties - one for each species
+        List<typename ParcelType::constantProperties> constProps_;
+
+        //- Random number generator
+        Random rndGen_;
+
+        //- Interpolation schemes dictionary
+        dictionary interpolationSchemes_;
+
+
+        // References to the cloud sub-models
+
+            //- Injector model
+            autoPtr<CollisionModel<DsmcCloud<ParcelType> > >
+                collisionModel_;
+
+            //- Injector model
+            autoPtr<InjectionModel<DsmcCloud<ParcelType> > >
+                injectionModel_;
+
+            //- Wall interaction model
+            autoPtr<WallInteractionModel<DsmcCloud<ParcelType> > >
+                wallInteractionModel_;
+
+
+        // Reference to the particle integration schemes
+
+            //- Velocity integration
+            autoPtr<vectorIntegrationScheme> UIntegrator_;
+
+
+    // Private Member Functions
+
+        //- Record which particles are in which cell
+        void buildCellOccupancy()
+
+        //- Disallow default bitwise copy construct
+        DsmcCloud(const DsmcCloud&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const DsmcCloud&);
+
+
+public:
+
+    // Constructors
+
+        //- Construct given carrier gas fields
+        DsmcCloud
+        (
+            const word& cloudType,
+            const fvMesh& mesh
+        );
+
+
+    //- Destructor
+    virtual ~DsmcCloud();
+
+
+    // Member Functions
+
+        // Access
+
+            // References to the mesh and databases
+
+                //- Return the cloud type
+                inline const word& cloudType() const;
+
+                //- Return refernce to the mesh
+                inline const fvMesh& mesh() const;
+
+                //- Return particle properties dictionary
+                inline const IOdictionary& particleProperties() const;
+
+            //- Return refernce to the random object
+            inline Random& rndGen();
+
+
+
+            // Sub-models
+
+                //- Return reference to injection model
+                inline const CollisionModel<DsmcCloud<ParcelType> >&
+                    collision() const;
+
+                //- Return reference to injection model
+                inline const InjectionModel<DsmcCloud<ParcelType> >&
+                    injection() const;
+
+                inline InjectionModel<DsmcCloud<ParcelType> >&
+                    injection();
+
+                //- Return reference to wall interaction model
+                inline const WallInteractionModel<DsmcCloud<ParcelType> >&
+                    wallInteraction() const;
+
+
+            // Integration schemes
+
+                //-Return reference to velocity integration
+                inline const vectorIntegrationScheme& UIntegrator() const;
+
+
+
+        // Check
+
+            //- Total mass injected
+            inline scalar massInjected() const;
+
+            //- Total mass in system
+            inline scalar massInSystem() const;
+
+            //- Print cloud information
+            void info() const;
+
+            //- Dump particle positions to .obj file
+            void dumpParticlePositions() const;
+
+
+            // Fields
+
+                //- Return the real particle number density field
+                inline const tmp<volScalarField> rhoN() const;
+
+                //- Return the particle mass density field
+                inline const tmp<volScalarField> rhoM() const;
+
+                //- Return the field of number of DSMC particles
+                inline const tmp<volScalarField> rhoNP() const;
+
+                //- Return the velocity field
+                inline const tmp<volVectorField> U() const;
+
+                //- Return the temperature field
+                inline const tmp<volScalarField> T() const;
+
+
+        // Cloud evolution functions
+
+            //- Add new parcel
+            void addNewParcel
+            (
+                const vector& position,
+                const vector& U,
+                const label cellId,
+                const label speciesId,
+            );
+
+            //- Evolve the cloud (move, collide)
+            void evolve();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "DsmcCloudI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+#   include "DsmcCloud.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H
new file mode 100644
index 00000000000..4385907b75f
--- /dev/null
+++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H
@@ -0,0 +1,278 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  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
+
+\*---------------------------------------------------------------------------*/
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class ParcelType>
+inline const Foam::word& Foam::DsmcCloud<ParcelType>::cloudType() const
+{
+    return cloudType_;
+}
+
+
+template<class ParcelType>
+inline const Foam::fvMesh& Foam::DsmcCloud<ParcelType>::mesh() const
+{
+    return mesh_;
+}
+
+
+template<class ParcelType>
+inline const Foam::IOdictionary&
+Foam::DsmcCloud<ParcelType>::particleProperties() const
+{
+    return particleProperties_;
+}
+
+
+template<class ParcelType>
+inline const Foam::CollisionModel<Foam::DsmcCloud<ParcelType> >&
+Foam::DsmcCloud<ParcelType>::collision() const
+{
+    return collisionModel_;
+}
+
+
+template<class ParcelType>
+inline const Foam::InjectionModel<Foam::DsmcCloud<ParcelType> >&
+Foam::DsmcCloud<ParcelType>::injection() const
+{
+    return injectionModel_;
+}
+
+
+template<class ParcelType>
+inline Foam::InjectionModel<Foam::DsmcCloud<ParcelType> >&
+Foam::DsmcCloud<ParcelType>::injection()
+{
+    return injectionModel_();
+}
+
+
+template<class ParcelType>
+inline const Foam::WallInteractionModel<Foam::DsmcCloud<ParcelType> >&
+Foam::DsmcCloud<ParcelType>::wallInteraction() const
+{
+    return wallInteractionModel_;
+}
+
+
+template<class ParcelType>
+inline const Foam::vectorIntegrationScheme&
+Foam::DsmcCloud<ParcelType>::UIntegrator() const
+{
+    return UIntegrator_;
+}
+
+
+template<class ParcelType>
+inline Foam::scalar Foam::DsmcCloud<ParcelType>::massInSystem() const
+{
+    scalar sysMass = 0.0;
+
+    return sysMass;
+}
+
+
+template<class ParcelType>
+inline Foam::Random& Foam::DsmcCloud<ParcelType>::rndGen()
+{
+    return rndGen_;
+}
+
+
+template<class ParcelType>
+inline const Foam::tmp<Foam::volScalarField>
+Foam::DsmcCloud<ParcelType>::rhoN() const
+{
+    tmp<volScalarField> trhoN
+    (
+        new volScalarField
+        (
+            IOobject
+            (
+                this->name() + "rhoN",
+                this->db().time().timeName(),
+                this->db(),
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                false
+            ),
+            mesh_,
+            dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0)
+        )
+    );
+
+    return trhoN;
+}
+
+
+template<class ParcelType>
+inline const Foam::tmp<Foam::volScalarField>
+Foam::DsmcCloud<ParcelType>::rhoM() const
+{
+    tmp<volScalarField> trhoM
+    (
+        new volScalarField
+        (
+            IOobject
+            (
+                this->name() + "rhoM",
+                this->db().time().timeName(),
+                this->db(),
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                false
+            ),
+            mesh_,
+            dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), 0.0)
+        )
+    );
+
+    return trhoM;
+}
+
+
+template<class ParcelType>
+inline const Foam::tmp<Foam::volScalarField>
+Foam::DsmcCloud<ParcelType>::rhoNP() const
+{
+    tmp<volScalarField> trhoNP
+    (
+        new volScalarField
+        (
+            IOobject
+            (
+                this->name() + "rhoNP",
+                this->db().time().timeName(),
+                this->db(),
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                false
+            ),
+            mesh_,
+            dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0)
+        )
+    );
+
+    return trhoNP;
+}
+
+
+template<class ParcelType>
+inline const Foam::tmp<Foam::volVectorField>
+Foam::DsmcCloud<ParcelType>::U() const
+{
+    tmp<volScalarField> tU
+    (
+        new volScalarField
+        (
+            IOobject
+            (
+                this->name() + "U",
+                this->db().time().timeName(),
+                this->db(),
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                false
+            ),
+            mesh_,
+            dimensionedVector
+            (
+                "zero",
+                dimensionSet(0, 1, -1, 0, 0),
+                vector::zero
+            )
+        )
+    );
+
+    return tU;
+}
+
+
+template<class ParcelType>
+inline const Foam::tmp<Foam::volScalarField>
+Foam::DsmcCloud<ParcelType>::T() const
+{
+    tmp<volScalarField> tT
+    (
+        new volScalarField
+        (
+            IOobject
+            (
+                this->name() + "T",
+                this->db().time().timeName(),
+                this->db(),
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                false
+            ),
+            mesh_,
+            dimensionedScalar("zero", dimensionSet(0, 0, 0, 1, 0), 0.0)
+        )
+    );
+
+    return tT;
+}
+
+// template<class ParcelType>
+// inline const Foam::tmp<Foam::volScalarField>
+// Foam::DsmcCloud<ParcelType>::alpha() const
+// {
+//     tmp<volScalarField> talpha
+//     (
+//         new volScalarField
+//         (
+//             IOobject
+//             (
+//                 this->name() + "Alpha",
+//                 this->db().time().timeName(),
+//                 this->db(),
+//                 IOobject::NO_READ,
+//                 IOobject::NO_WRITE,
+//                 false
+//             ),
+//             mesh_,
+//             dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0), 0.0)
+//         )
+//     );
+
+//     scalarField& alpha = talpha().internalField();
+//     forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
+//     {
+//         const ParcelType& p = iter();
+//         const label cellI = p.cell();
+
+//         alpha[cellI] += p.nParticle()*p.mass();
+//     }
+
+//     alpha /= (mesh().cellVolumes()*rho_);
+
+//     return talpha;
+// }
+
+
+// ************************************************************************* //
diff --git a/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C b/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
new file mode 100644
index 00000000000..1e0c395ca19
--- /dev/null
+++ b/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
@@ -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
+
+\*---------------------------------------------------------------------------*/
+
+#include "DsmcBaseCloud.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(DsmcBaseCloud, 0);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::DsmcBaseCloud::DsmcBaseCloud()
+{}
+
+
+// * * * * * * * * * * * * * * * *  Destructors  * * * * * * * * * * * * * * //
+
+Foam::DsmcBaseCloud::~DsmcBaseCloud()
+{}
+
+
+// ************************************************************************* //
diff --git a/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.H b/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.H
new file mode 100644
index 00000000000..915becafaa0
--- /dev/null
+++ b/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.H
@@ -0,0 +1,89 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  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::DsmcBaseCloud
+
+Description
+    Virtual abstract base class for templated DsmcCloud
+
+SourceFiles
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef DsmcBaseCloud_H
+#define DsmcBaseCloud_H
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                       Class DsmcBaseCloud Declaration
+\*---------------------------------------------------------------------------*/
+
+class DsmcBaseCloud
+{
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        DsmcBaseCloud(const DsmcBaseCloud&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const DsmcBaseCloud&);
+
+
+public:
+
+    //- Runtime type information
+    TypeName("DsmcBaseCloud");
+
+    // Constructors
+
+        //- Null constructor
+        DsmcBaseCloud();
+
+
+    // Destructors
+
+        virtual ~DsmcBaseCloud();
+
+
+    // Member Functions
+
+        // Access
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
-- 
GitLab