diff --git a/src/lagrangian/dsmc/Make/files b/src/lagrangian/dsmc/Make/files index 2359f74dec6e4df1a1612febdad8020a372a84bf..9f6d33d209edf23f3a65deb06139746c0bb873ae 100644 --- a/src/lagrangian/dsmc/Make/files +++ b/src/lagrangian/dsmc/Make/files @@ -11,5 +11,6 @@ clouds/derived/dsmcCloud/dsmcCloud.C parcels/derived/dsmcParcel/defineDsmcParcel.C parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C parcels/derived/dsmcParcel/makeDsmcParcelWallInteractionModels.C +parcels/derived/dsmcParcel/makeDsmcParcelInflowBoundaryModels.C LIB = $(FOAM_LIBBIN)/libdsmc diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index 1867670f70bba1d4e780d38ec8f58ab99801effc..b6d20bd630f09482206239cc63e20e4a63f443f5 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -27,6 +27,7 @@ License #include "DsmcCloud.H" #include "BinaryCollisionModel.H" #include "WallInteractionModel.H" +#include "InflowBoundaryModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -234,8 +235,8 @@ void Foam::DsmcCloud<ParcelType>::collisions() scalar sigmaTcRMax = sigmaTcRMax_[celli]; scalar selectedPairs = collisionSelectionRemainder_[celli] - + 0.5*nC*(nC-1)*nParticle_*sigmaTcRMax*deltaT - /mesh_.cellVolumes()[celli]; + + 0.5*nC*(nC-1)*nParticle_*sigmaTcRMax*deltaT + /mesh_.cellVolumes()[celli]; label nCandidates(selectedPairs); @@ -403,6 +404,14 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud particleProperties_, *this ) + ), + inflowBoundaryModel_ + ( + InflowBoundaryModel<DsmcCloud<ParcelType> >::New + ( + particleProperties_, + *this + ) ) { buildConstProps(); @@ -490,7 +499,8 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud ) ), binaryCollisionModel_(), - wallInteractionModel_() + wallInteractionModel_(), + inflowBoundaryModel_() { clear(); @@ -526,13 +536,14 @@ void Foam::DsmcCloud<ParcelType>::evolve() { typename ParcelType::trackData td(*this); - //this->injection().inject(td); - if (debug) { this->dumpParticlePositions(); } + // Insert new particles from the inflow boundary + this->inflowBoundary().inflow(); + // Move the particles ballistically with their current velocities Cloud<ParcelType>::move(td); diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H index 8ea6f31fe1207815aebcf69916fbf99efda8d928..5d9edc9c06f2ce2448cb53bc1ce6f3377fa42f8b 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H @@ -59,6 +59,9 @@ class BinaryCollisionModel; template<class CloudType> class WallInteractionModel; +template<class CloudType> +class InflowBoundaryModel; + /*---------------------------------------------------------------------------*\ Class DsmcCloud Declaration \*---------------------------------------------------------------------------*/ @@ -127,6 +130,10 @@ class DsmcCloud autoPtr<WallInteractionModel<DsmcCloud<ParcelType> > > wallInteractionModel_; + //- Inflow boundary model + autoPtr<InflowBoundaryModel<DsmcCloud<ParcelType> > > + inflowBoundaryModel_; + // Private Member Functions @@ -205,7 +212,7 @@ public: //- Return the number of real particles represented by one // parcel - inline label nParticle() const; + inline scalar nParticle() const; //- Return the cell occupancy addressing inline const List<DynamicList<ParcelType*> >& @@ -292,6 +299,14 @@ public: inline WallInteractionModel<DsmcCloud<ParcelType> >& wallInteraction(); + //- Return reference to wall interaction model + inline const InflowBoundaryModel<DsmcCloud<ParcelType> >& + inflowBoundary() const; + + //- Return non-const reference to wall interaction model + inline InflowBoundaryModel<DsmcCloud<ParcelType> >& + inflowBoundary(); + // Check diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H index 057570030e6b1c8c49ecb93b42d32c2dd0404635..39c25f5227b1e008761b68ae5b4a77eb7f502da1 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H @@ -57,7 +57,7 @@ Foam::DsmcCloud<ParcelType>::typeIdList() const template<class ParcelType> -inline Foam::label Foam::DsmcCloud<ParcelType>::nParticle() const +inline Foam::scalar Foam::DsmcCloud<ParcelType>::nParticle() const { return nParticle_; } @@ -166,6 +166,22 @@ Foam::DsmcCloud<ParcelType>::wallInteraction() } +template<class ParcelType> +inline const Foam::InflowBoundaryModel<Foam::DsmcCloud<ParcelType> >& +Foam::DsmcCloud<ParcelType>::inflowBoundary() const +{ + return inflowBoundaryModel_; +} + + +template<class ParcelType> +inline Foam::InflowBoundaryModel<Foam::DsmcCloud<ParcelType> >& +Foam::DsmcCloud<ParcelType>::inflowBoundary() +{ + return inflowBoundaryModel_(); +} + + template<class ParcelType> inline Foam::scalar Foam::DsmcCloud<ParcelType>::massInSystem() const { diff --git a/src/lagrangian/dsmc/parcels/derived/dsmcParcel/makeDsmcParcelInflowBoundaryModels.C b/src/lagrangian/dsmc/parcels/derived/dsmcParcel/makeDsmcParcelInflowBoundaryModels.C new file mode 100644 index 0000000000000000000000000000000000000000..c3ee121ff02fedac07f42ff28e5169fe4a7b9f33 --- /dev/null +++ b/src/lagrangian/dsmc/parcels/derived/dsmcParcel/makeDsmcParcelInflowBoundaryModels.C @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "dsmcParcel.H" +#include "DsmcCloud.H" +#include "FreeStream.H" +#include "NoInflow.H" + +namespace Foam +{ + makeInflowBoundaryModel(DsmcCloud<dsmcParcel>); + + // Add instances of inflow boundary model to the table + makeInflowBoundaryModelType + ( + FreeStream, + DsmcCloud, + dsmcParcel + ); + makeInflowBoundaryModelType + ( + NoInflow, + DsmcCloud, + dsmcParcel + ); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C index 5f00f4ca93594989f248f0bfaa9691df0ceb0dd3..1cf6fd90dcf09d46521d1079e8f34db1de2ce8d1 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C @@ -109,7 +109,8 @@ Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::LarsenBorgnakkeVariableHardS // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template <class CloudType> -Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::~LarsenBorgnakkeVariableHardSphere() +Foam::LarsenBorgnakkeVariableHardSphere<CloudType>:: +~LarsenBorgnakkeVariableHardSphere() {} diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H index 1e0f8bd9755d59781aa8466590dbd4185971f589..c95d70f24c1f4ad0cfa394728258594664c3f89a 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H @@ -50,7 +50,7 @@ class LarsenBorgnakkeVariableHardSphere { // Private data - //- Temperature + //- Relaxation collision number const scalar relaxationCollisionNumber_; diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C new file mode 100644 index 0000000000000000000000000000000000000000..ed55544077b937e09ac54c7a38bdc44a9ff91fd0 --- /dev/null +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C @@ -0,0 +1,218 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "FreeStream.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template <class CloudType> +Foam::FreeStream<CloudType>::FreeStream +( + const dictionary& dict, + CloudType& cloud +) +: + InflowBoundaryModel<CloudType>(dict, cloud, typeName), + patchIndex_(), + temperature_(readScalar(this->coeffDict().lookup("temperature"))), + velocity_(this->coeffDict().lookup("velocity")), + moleculeTypeIds_(), + numberDensities_(), + particleFluxAccumulators_() +{ + word patchName = this->coeffDict().lookup("patch"); + + patchIndex_ = cloud.mesh().boundaryMesh().findPatchID(patchName); + + const polyPatch& patch = cloud.mesh().boundaryMesh()[patchIndex_]; + + if (patchIndex_ == -1) + { + FatalErrorIn("Foam::DsmcCloud<ParcelType>::initialise") + << "patch " << patchName << " not found." << nl + << abort(FatalError); + } + + const dictionary& numberDensitiesDict + ( + this->coeffDict().subDict("numberDensities") + ); + + List<word> molecules(numberDensitiesDict.toc()); + + numberDensities_.setSize(molecules.size()); + + moleculeTypeIds_.setSize(molecules.size()); + + forAll(molecules, i) + { + numberDensities_[i] = readScalar + ( + numberDensitiesDict.lookup(molecules[i]) + ); + + moleculeTypeIds_[i] = findIndex(cloud.typeIdList(), molecules[i]); + + if (moleculeTypeIds_[i] == -1) + { + FatalErrorIn("Foam::DsmcCloud<ParcelType>::initialise") + << "typeId " << molecules[i] << "not defined in cloud." << nl + << abort(FatalError); + } + } + + numberDensities_ /= cloud.nParticle(); + + particleFluxAccumulators_.setSize + ( + molecules.size(), + Field<scalar>(patch.size(), 0) + ); +} + + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template <class CloudType> +Foam::FreeStream<CloudType>::~FreeStream() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template <class CloudType> +void Foam::FreeStream<CloudType>::inflow() +{ + CloudType& cloud(this->owner()); + + const polyMesh& mesh(cloud.mesh()); + + const scalar deltaT = mesh.time().deltaT().value(); + + Random& rndGen(cloud.rndGen()); + + const polyPatch& patch = mesh.boundaryMesh()[patchIndex_]; + + label particlesInserted = 0; + + // Add mass to the accumulators. negative face area dotted with the + // velocity to point flux into the domain. + + forAll(particleFluxAccumulators_, i) + { + particleFluxAccumulators_[i] += + -patch.faceAreas() & (velocity_*numberDensities_[i]*deltaT); + + forAll(particleFluxAccumulators_[i], f) + { + scalar& faceAccumulator = particleFluxAccumulators_[i][f]; + + // Number of particles to insert + label nI = max(label(faceAccumulator), 0); + + faceAccumulator -= nI; + + label typeId = moleculeTypeIds_[i]; + + scalar mass = cloud.constProps(typeId).mass(); + + labelList faceVertices = patch[f]; + + label globalFaceIndex = f + patch.start(); + + label cell = mesh.faceOwner()[globalFaceIndex]; + + const vector& fC = patch.faceCentres()[f]; + + for (label n = 0; n < nI; n++) + { + // Temporarily insert particles half way between the face and + // cell centres + vector p = 0.5*(fC + mesh.cellCentres()[cell]); + + // Normal unit vector *negative* so normal is pointing into the + // domain + vector nw = patch.faceAreas()[f]; + nw /= -mag(nw); + + // Wall tangential unit vector. Use the direction between the + // face centre and the first vertex in the list + vector tw1 = fC - (mesh.points()[faceVertices[0]]); + tw1 /= mag(tw1); + + // Other tangential unit vector. Rescaling in case face is not + // flat and nw and tw1 aren't perfectly orthogonal + vector tw2 = nw ^ tw1; + tw2 /= mag(tw2); + + scalar C = sqrt(CloudType::kb*temperature_/mass); + + vector U = + C + *( + rndGen.GaussNormal()*tw1 + + rndGen.GaussNormal()*tw2 + - sqrt(-2.0*log(max(1 - rndGen.scalar01(),VSMALL)))*nw + ); + + U += velocity_; + + scalar Ei = + 0.5*cloud.constProps(typeId).internalDegreesOfFreedom() + *CloudType::kb*temperature_; + + cloud.addNewParcel + ( + p, + U, + Ei, + cell, + typeId + ); + + particlesInserted++; + } + } + } + + reduce(particlesInserted, sumOp<label>()); + + Info<< " Particles inserted = " + << particlesInserted << endl; + + // Info<< "insert particles now! " << nl + // << temperature_ << nl + // << velocity_ << nl + // << moleculeTypeIds_ << nl + // << numberDensities_ << nl + // << particleFluxAccumulators_ << nl + // << patch + // << endl; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.H b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.H new file mode 100644 index 0000000000000000000000000000000000000000..6773decf848bd39965fd0b88ac8446ab277051e3 --- /dev/null +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.H @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::FreeStream + +Description + Inserting new particles across the faces of a specified patch for a free + stream. Uniform values of temperature, velocity and number densities + +\*---------------------------------------------------------------------------*/ + +#ifndef FreeStream_H +#define FreeStream_H + +#include "InflowBoundaryModel.H" +#include "polyMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class FreeStream Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class FreeStream +: + public InflowBoundaryModel<CloudType> +{ + + // Private data + + //- Index of patch to introduce particles across + label patchIndex_; + + //- Temperature of the free stream + scalar temperature_; + + //- Velocity of the free stream + vector velocity_; + + //- The molecule types to be introduced + List<label> moleculeTypeIds_; + + //- The number density of the species in the inflow + Field<scalar> numberDensities_; + + //- A List of Fields, one Field for every species to be introduced, each + // field entry corresponding to a face on the patch to be injected + // across. + List<Field<scalar> > particleFluxAccumulators_; + +public: + + //- Runtime type information + TypeName("FreeStream"); + + + // Constructors + + //- Construct from dictionary + FreeStream + ( + const dictionary& dict, + CloudType& cloud + ); + + + // Destructor + virtual ~FreeStream(); + + + // Member Functions + + //- Introduce particles + virtual void inflow(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "FreeStream.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/InflowBoundaryModel.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/InflowBoundaryModel.C new file mode 100644 index 0000000000000000000000000000000000000000..7fd83137c080754f68465a4b3c7d6e976be02be9 --- /dev/null +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/InflowBoundaryModel.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "InflowBoundaryModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::InflowBoundaryModel<CloudType>::InflowBoundaryModel +( + const dictionary& dict, + CloudType& owner, + const word& type +) +: dict_(dict), + owner_(owner), + coeffDict_(dict.subDict(type + "Coeffs")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::InflowBoundaryModel<CloudType>::~InflowBoundaryModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +const CloudType& Foam::InflowBoundaryModel<CloudType>::owner() const +{ + return owner_; +} + + +template<class CloudType> +CloudType& Foam::InflowBoundaryModel<CloudType>::owner() +{ + return owner_; +} + + +template<class CloudType> +const Foam::dictionary& Foam::InflowBoundaryModel<CloudType>::dict() const +{ + return dict_; +} + + +template<class CloudType> +const Foam::dictionary& Foam::InflowBoundaryModel<CloudType>::coeffDict() const +{ + return coeffDict_; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NewInflowBoundaryModel.C" + +// ************************************************************************* // + diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/InflowBoundaryModel.H b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/InflowBoundaryModel.H new file mode 100644 index 0000000000000000000000000000000000000000..92bc8d2f4d88a07a39db97f31b7ad99162b8969d --- /dev/null +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/InflowBoundaryModel.H @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::InflowBoundaryModel + + +Description + Templated inflow boundary model class + +SourceFiles + InflowBoundaryModel.C + NewInflowBoundaryModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef InflowBoundaryModel_H +#define InflowBoundaryModel_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class InflowBoundaryModel Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class InflowBoundaryModel +{ + // Private data + + //- The cloud dictionary + const dictionary& dict_; + + // Reference to the owner cloud class + CloudType& owner_; + + //- The coefficients dictionary + const dictionary coeffDict_; + + +public: + + //- Runtime type information + TypeName("InflowBoundaryModel"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + InflowBoundaryModel, + dictionary, + ( + const dictionary& dict, + CloudType& owner + ), + (dict, owner) + ); + + + // Constructors + + //- Construct from dictionary + InflowBoundaryModel + ( + const dictionary& dict, + CloudType& owner, + const word& type + ); + + + //- Destructor + virtual ~InflowBoundaryModel(); + + + //- Selector + static autoPtr<InflowBoundaryModel<CloudType> > New + ( + const dictionary& dict, + CloudType& owner + ); + + + // Access + + //- Return const access the owner cloud object + inline const CloudType& owner() const; + + //- Return non-const access the owner cloud object for manipulation + inline CloudType& owner(); + + //- Return the owner cloud dictionary + inline const dictionary& dict() const; + + //- Return the coefficients dictionary + inline const dictionary& coeffDict() const; + + //- Introduce particles + virtual void inflow() = 0; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeInflowBoundaryModel(CloudType) \ + \ + defineNamedTemplateTypeNameAndDebug(InflowBoundaryModel<CloudType>, 0); \ + \ + defineTemplateRunTimeSelectionTable \ + ( \ + InflowBoundaryModel<CloudType>, \ + dictionary \ + ); + + +#define makeInflowBoundaryModelType(SS, CloudType, ParcelType) \ + \ + defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \ + \ + InflowBoundaryModel<CloudType<ParcelType> >:: \ + adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \ + add##SS##CloudType##ParcelType##ConstructorToTable_; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "InflowBoundaryModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/NewInflowBoundaryModel.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/NewInflowBoundaryModel.C new file mode 100644 index 0000000000000000000000000000000000000000..0a6b2f530f71ba12098013ca515b49de530caf44 --- /dev/null +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/InflowBoundaryModel/NewInflowBoundaryModel.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "InflowBoundaryModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::autoPtr<Foam::InflowBoundaryModel<CloudType> > +Foam::InflowBoundaryModel<CloudType>::New +( + const dictionary& dict, + CloudType& owner +) +{ + word InflowBoundaryModelType + ( + dict.lookup("InflowBoundaryModel") + ); + + Info<< "Selecting InflowBoundaryModel " << InflowBoundaryModelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(InflowBoundaryModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "InflowBoundaryModel<CloudType>::New" + "(const dictionary&, CloudType&)" + ) << "Unknown InflowBoundaryModelType type " + << InflowBoundaryModelType + << ", constructor not in hash table" << nl << nl + << " Valid InflowBoundaryModel types are :" << nl + << dictionaryConstructorTablePtr_->toc() << exit(FatalError); + } + + return autoPtr<InflowBoundaryModel<CloudType> >(cstrIter()(dict, owner)); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.C new file mode 100644 index 0000000000000000000000000000000000000000..d04db500daa1fa762ada76543d72bb045a606da0 --- /dev/null +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.C @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "NoInflow.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template <class CloudType> +Foam::NoInflow<CloudType>::NoInflow +( + const dictionary& dict, + CloudType& cloud +) +: + InflowBoundaryModel<CloudType>(dict, cloud, typeName) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template <class CloudType> +Foam::NoInflow<CloudType>::~NoInflow() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template <class CloudType> +void Foam::NoInflow<CloudType>::inflow() +{} + + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.H b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.H new file mode 100644 index 0000000000000000000000000000000000000000..31adc04cccff9c94a0e9a76b6a582c063fb80220 --- /dev/null +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.H @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::NoInflow + +Description + Not inserting any particles + +\*---------------------------------------------------------------------------*/ + +#ifndef NoInflow_H +#define NoInflow_H + +#include "InflowBoundaryModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class NoInflow Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class NoInflow +: + public InflowBoundaryModel<CloudType> +{ +public: + + //- Runtime type information + TypeName("NoInflow"); + + + // Constructors + + //- Construct from dictionary + NoInflow + ( + const dictionary& dict, + CloudType& cloud + ); + + + // Destructor + virtual ~NoInflow(); + + + // Member Functions + + //- Introduce particles (none in this case) + virtual void inflow(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "NoInflow.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C b/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C index 3776848d8bce37237f069d4b7fb5f08bf83f68f8..23cd0bed34613953eca7b34f55296559bc100af0 100644 --- a/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C +++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C @@ -48,13 +48,6 @@ Foam::MaxwellianThermal<CloudType>::~MaxwellianThermal() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class CloudType> -bool Foam::MaxwellianThermal<CloudType>::active() const -{ - return true; -} - - template <class CloudType> void Foam::MaxwellianThermal<CloudType>::correct ( diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.H b/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.H index 38ce78ed7e6837a634b408d1e2b20d893aa11e46..1542d20ff051b9e9f16afecf36b2e406a127c23b 100644 --- a/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.H +++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.H @@ -72,9 +72,6 @@ public: // Member Functions - //- Flag to indicate whether model activates heat transfer model - bool active() const; - //- Apply wall correction virtual void correct ( diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.C b/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.C index ebd1316eec56c13f82041b7b705231a001bf7d6a..38e6621d30bcdfb697f461645cd5a686712ccce0 100644 --- a/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.C +++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.C @@ -50,13 +50,6 @@ Foam::SpecularReflection<CloudType>::~SpecularReflection() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class CloudType> -bool Foam::SpecularReflection<CloudType>::active() const -{ - return true; -} - - template <class CloudType> void Foam::SpecularReflection<CloudType>::correct ( diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.H b/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.H index 60625ecba05db27014049b8f8b59cfb048061aa5..67d0adf8b074f6f737878f136130f5cb152797d5 100644 --- a/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.H +++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.H @@ -70,9 +70,6 @@ public: // Member Functions - //- Flag to indicate whether model activates heat transfer model - bool active() const; - //- Apply wall correction virtual void correct ( diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/WallInteractionModel/WallInteractionModel.H b/src/lagrangian/dsmc/submodels/WallInteractionModel/WallInteractionModel/WallInteractionModel.H index b378c913765905cb55c28cae66bb2ea758ae4d1d..d8667201a7ab52a3a214ffceebf8daaf767c4d43 100644 --- a/src/lagrangian/dsmc/submodels/WallInteractionModel/WallInteractionModel/WallInteractionModel.H +++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/WallInteractionModel/WallInteractionModel.H @@ -124,9 +124,6 @@ public: // Member Functions - //- Flag to indicate whether model activates heat transfer model - virtual bool active() const = 0; - //- Apply wall correction virtual void correct (