ENH: Multiple updates to lagrangian/intermediate library

sub-models:
- now derived from a common base class
- copy/clone functionality added

cloud:
- makes use of cachedRandom class (instead of Random)
This commit is contained in:
andy
2010-10-20 12:54:34 +01:00
parent 75fabe3666
commit b8a89af08e
110 changed files with 2326 additions and 1461 deletions

View File

@ -293,7 +293,11 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
(
particleProperties_.lookup("cellValueSourceCorrection")
),
rndGen_(label(0)),
rndGen_
(
label(0),
readLabel(particleProperties_.lookup("randomSampleSize"))
),
cellOccupancyPtr_(),
rho_(rho),
U_(U),

View File

@ -49,7 +49,7 @@ SourceFiles
#include "kinematicCloud.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "Random.H"
#include "cachedRandom.H"
#include "fvMesh.H"
#include "volFields.H"
#include "fvMatrices.H"
@ -206,7 +206,7 @@ protected:
const Switch cellValueSourceCorrection_;
//- Random number generator - used by some injection routines
Random rndGen_;
cachedRandom rndGen_;
//- Cell occupancy information for each parcel, (demand driven)
autoPtr<List<DynamicList<ParcelType*> > > cellOccupancyPtr_;
@ -358,7 +358,7 @@ public:
// Cloud data
//- Return refernce to the random object
inline Random& rndGen();
inline cachedRandom& rndGen();
//- Return the cell occupancy information for each
// parcel, non-const access, the caller is

View File

@ -334,7 +334,7 @@ rotationalKineticEnergyOfSystem() const
template<class ParcelType>
inline Foam::Random& Foam::KinematicCloud<ParcelType>::rndGen()
inline Foam::cachedRandom& Foam::KinematicCloud<ParcelType>::rndGen()
{
return rndGen_;
}

View File

@ -30,9 +30,7 @@ License
template<class CloudType>
Foam::CollisionModel<CloudType>::CollisionModel(CloudType& owner)
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null)
SubModelBase<CloudType>(owner)
{}
@ -44,9 +42,14 @@ Foam::CollisionModel<CloudType>::CollisionModel
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs"))
SubModelBase<CloudType>(owner, dict, type)
{}
template<class CloudType>
Foam::CollisionModel<CloudType>::CollisionModel(CollisionModel<CloudType>& cm)
:
SubModelBase<CloudType>(cm)
{}
@ -57,6 +60,36 @@ Foam::CollisionModel<CloudType>::~CollisionModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::CollisionModel<CloudType>::nSubCycles() const
{
notImplemented
(
"Foam::label Foam::CollisionModel<CloudType>::nSubCycles() const"
);
return 0;
}
template<class CloudType>
bool Foam::CollisionModel<CloudType>::controlsWallInteraction() const
{
notImplemented
(
"bool Foam::CollisionModel<CloudType>::controlsWallInteraction()"
);
return false;
}
template<class CloudType>
void Foam::CollisionModel<CloudType>::collide()
{
notImplemented("void Foam::CollisionModel<CloudType>::collide()");
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollisionModelNew.C"

View File

@ -51,21 +51,9 @@ namespace Foam
template<class CloudType>
class CollisionModel
:
public SubModelBase<CloudType>
{
// Private data
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
//- The coefficients dictionary
const dictionary coeffDict_;
protected:
// Protected data
//- Convenience typedef for parcel type
@ -96,7 +84,7 @@ public:
//- Construct null from owner
CollisionModel(CloudType& owner);
//- Construct from dictionary
//- Construct from components
CollisionModel
(
const dictionary& dict,
@ -104,6 +92,18 @@ public:
const word& type
);
//- Construct copy
CollisionModel(CollisionModel<CloudType>& cm);
//- Construct and return a clone
virtual autoPtr<CollisionModel<CloudType> > clone()
{
return autoPtr<CollisionModel<CloudType> >
(
new CollisionModel<CloudType>(*this)
);
}
//- Destructor
virtual ~CollisionModel();
@ -117,36 +117,18 @@ public:
);
// Access
//- Return the owner cloud dictionary
inline const dictionary& dict() const;
//- 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 coefficients dictionary
inline const dictionary& coeffDict() const;
// Member Functions
//- Return the number of times to subcycle the current
// timestep to meet the criteria of the collision model
virtual label nSubCycles() const = 0;
//- Flag to indicate whether model activates injection model
virtual bool active() const = 0;
virtual label nSubCycles() const;
//- Indicates whether model determines wall collisions or not,
// used to determine what value to use for wallImpactDistance
virtual bool controlsWallInteraction() const = 0;
virtual bool controlsWallInteraction() const;
// Collision function
virtual void collide() = 0;
virtual void collide();
};
@ -172,10 +154,6 @@ public:
add##SS##CloudType##ParcelType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollisionModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository

View File

@ -1,56 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CollisionModel.H"
template<class CloudType>
const Foam::dictionary& Foam::CollisionModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const CloudType& Foam::CollisionModel<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
CloudType& Foam::CollisionModel<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::CollisionModel<CloudType>::coeffDict() const
{
return coeffDict_;
}
// ************************************************************************* //

View File

@ -35,12 +35,12 @@ Foam::CollisionModel<CloudType>::New
CloudType& owner
)
{
word CollisionModelType(dict.lookup("CollisionModel"));
word modelType(dict.lookup("CollisionModel"));
Info<< "Selecting CollisionModel " << CollisionModelType << endl;
Info<< "Selecting CollisionModel " << modelType << endl;
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(CollisionModelType);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
@ -51,8 +51,7 @@ Foam::CollisionModel<CloudType>::New
"const dictionary&, "
"CloudType&"
")"
) << "Unknown CollisionModelType type "
<< CollisionModelType
) << "Unknown CollisionModelType type " << modelType
<< ", constructor not in hash table" << nl << nl
<< " Valid CollisionModel types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError);

View File

@ -38,6 +38,16 @@ Foam::NoCollision<CloudType>::NoCollision
{}
template<class CloudType>
Foam::NoCollision<CloudType>::NoCollision
(
NoCollision<CloudType>& cm
)
:
CollisionModel<CloudType>(cm)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -60,12 +60,20 @@ public:
// Constructors
//- Construct from dictionary
NoCollision
(
const dictionary& dict,
CloudType& owner
);
//- Construct from components
NoCollision(const dictionary& dict, CloudType& owner);
//- Construct copy
NoCollision(NoCollision<CloudType>& cm);
//- Construct and return a clone
virtual autoPtr<CollisionModel<CloudType> > clone()
{
return autoPtr<CollisionModel<CloudType> >
(
new NoCollision<CloudType>(*this)
);
}
//- Destructor

View File

@ -564,6 +564,24 @@ Foam::PairCollision<CloudType>::PairCollision
{}
template<class CloudType>
Foam::PairCollision<CloudType>::PairCollision(PairCollision<CloudType>& cm)
:
CollisionModel<CloudType>(cm),
pairModel_(NULL),
wallModel_(NULL),
il_(cm.owner().mesh())
{
notImplemented
(
"Foam::PairCollision<CloudType>::PairCollision"
"("
"PairCollision<CloudType>& cm"
")"
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -602,13 +620,6 @@ Foam::label Foam::PairCollision<CloudType>::nSubCycles() const
}
template<class CloudType>
bool Foam::PairCollision<CloudType>::active() const
{
return true;
}
template<class CloudType>
bool Foam::PairCollision<CloudType>::controlsWallInteraction() const
{

View File

@ -147,12 +147,20 @@ public:
// Constructors
//- Construct from dictionary
PairCollision
(
const dictionary& dict,
CloudType& owner
);
//- Construct from components
PairCollision(const dictionary& dict, CloudType& owner);
//- Construct copy
PairCollision(PairCollision<CloudType>& cm);
//- Construct and return a clone
virtual autoPtr<CollisionModel<CloudType> > clone()
{
return autoPtr<CollisionModel<CloudType> >
(
new PairCollision<CloudType>(*this)
);
}
//- Destructor
@ -165,9 +173,6 @@ public:
// timestep to meet the criteria of the collision model.
virtual label nSubCycles() const;
//- Flag to indicate whether model activates injection model
virtual bool active() const;
//- Indicates whether model determines wall collisions or not,
// used to determine what value to use for wallImpactDistance
virtual bool controlsWallInteraction() const;

View File

@ -30,8 +30,7 @@ License
template<class CloudType>
Foam::DispersionModel<CloudType>::DispersionModel(CloudType& owner)
:
dict_(dictionary::null),
owner_(owner)
SubModelBase<CloudType>(owner)
{}
@ -39,11 +38,21 @@ template<class CloudType>
Foam::DispersionModel<CloudType>::DispersionModel
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& type
)
:
dict_(dict),
owner_(owner)
SubModelBase<CloudType>(dict, owner, type)
{}
template<class CloudType>
Foam::DispersionModel<CloudType>::DispersionModel
(
DispersionModel<CloudType>& dm
)
:
SubModelBase<CloudType>(dm)
{}
@ -57,23 +66,30 @@ Foam::DispersionModel<CloudType>::~DispersionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::DispersionModel<CloudType>::owner() const
Foam::vector Foam::DispersionModel<CloudType>::update
(
const scalar,
const label,
const vector&,
const vector& Uc,
vector&,
scalar&
)
{
return owner_;
}
notImplemented
(
"Foam::vector Foam::DispersionModel<CloudType>::update"
"("
"const scalar, "
"const label, "
"const vector&, "
"const vector&, "
"vector&, "
"scalar&"
")"
);
template<class CloudType>
CloudType& Foam::DispersionModel<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::DispersionModel<CloudType>::dict() const
{
return dict_;
return Uc;
}

View File

@ -34,6 +34,7 @@ Description
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,17 +47,9 @@ namespace Foam
template<class CloudType>
class DispersionModel
:
public SubModelBase<CloudType>
{
// Private data
//- Cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
public:
//- Runtime type information
@ -90,6 +83,26 @@ public:
CloudType& owner
);
//- Construct from components
DispersionModel
(
const dictionary& dict,
CloudType& owner,
const word& type
);
//- Construct copy
DispersionModel(DispersionModel<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DispersionModel<CloudType> > clone()
{
return autoPtr<DispersionModel<CloudType> >
(
new DispersionModel<CloudType>(*this)
);
}
//- Destructor
virtual ~DispersionModel();
@ -103,26 +116,8 @@ public:
);
// Access
//- Return the owner cloud object
const CloudType& owner() const;
//- Return the owner cloud object
CloudType& owner();
//- Return the dictionary
const dictionary& dict() const;
// Member Functions
//- Flag to indicate whether model activates injection model
virtual bool active() const = 0;
//- Cache carrier fields
virtual void cacheFields(const bool store) = 0;
//- Update (disperse particles)
virtual vector update
(
@ -132,7 +127,7 @@ public:
const vector& Uc,
vector& UTurb,
scalar& tTurb
) = 0;
);
};

View File

@ -24,17 +24,18 @@ License
\*---------------------------------------------------------------------------*/
#include "DispersionRASModel.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::DispersionRASModel<CloudType>::DispersionRASModel
(
const dictionary& dict,
const dictionary&,
CloudType& owner
)
:
DispersionModel<CloudType>(dict, owner),
DispersionModel<CloudType>(owner),
turbulence_
(
owner.mesh().objectRegistry::lookupObject<compressible::RASModel>
@ -49,6 +50,24 @@ Foam::DispersionRASModel<CloudType>::DispersionRASModel
{}
template<class CloudType>
Foam::DispersionRASModel<CloudType>::DispersionRASModel
(
DispersionRASModel<CloudType>& dm
)
:
DispersionModel<CloudType>(dm),
turbulence_(dm.turbulence_),
kPtr_(dm.kPtr_),
ownK_(dm.ownK_),
epsilonPtr_(dm.epsilonPtr_),
ownEpsilon_(dm.ownEpsilon_)
{
dm.ownK_ = false;
dm.ownEpsilon_ = false;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -93,18 +112,27 @@ void Foam::DispersionRASModel<CloudType>::cacheFields(const bool store)
{
if (ownK_ && kPtr_)
{
delete kPtr_;
kPtr_ = NULL;
deleteDemandDrivenData(kPtr_);
ownK_ = false;
}
if (ownEpsilon_ && epsilonPtr_)
{
delete epsilonPtr_;
epsilonPtr_ = NULL;
deleteDemandDrivenData(epsilonPtr_);
ownEpsilon_ = false;
}
}
}
template<class CloudType>
void Foam::DispersionRASModel<CloudType>::write(Ostream& os) const
{
DispersionModel<CloudType>::write(os);
os.writeKeyword("ownK") << ownK_ << token::END_STATEMENT << endl;
os.writeKeyword("ownEpsilon") << ownEpsilon_ << token::END_STATEMENT
<< endl;
}
// ************************************************************************* //

View File

@ -80,11 +80,19 @@ public:
// Constructors
//- Construct from components
DispersionRASModel
(
const dictionary& dict,
CloudType& owner
);
DispersionRASModel(const dictionary& dict, CloudType& owner);
//- Construct copy
DispersionRASModel(DispersionRASModel<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DispersionModel<CloudType> > clone()
{
return autoPtr<DispersionModel<CloudType> >
(
new DispersionRASModel<CloudType>(*this)
);
}
//- Destructor
@ -101,6 +109,12 @@ public:
{
return turbulence_;
}
// I-O
//- Write
virtual void write(Ostream& os) const;
};

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "GradientDispersionRAS.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -35,10 +36,25 @@ Foam::GradientDispersionRAS<CloudType>::GradientDispersionRAS
)
:
DispersionRASModel<CloudType>(dict, owner),
gradkPtr_(NULL)
gradkPtr_(NULL),
ownGradK_(false)
{}
template<class CloudType>
Foam::GradientDispersionRAS<CloudType>::GradientDispersionRAS
(
GradientDispersionRAS<CloudType>& dm
)
:
DispersionRASModel<CloudType>(dm),
gradkPtr_(dm.gradkPtr_),
ownGradK_(dm.ownGradK_)
{
dm.ownGradK_ = false;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -50,13 +66,6 @@ Foam::GradientDispersionRAS<CloudType>::~GradientDispersionRAS()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::GradientDispersionRAS<CloudType>::active() const
{
return true;
}
template<class CloudType>
void Foam::GradientDispersionRAS<CloudType>::cacheFields(const bool store)
{
@ -65,13 +74,15 @@ void Foam::GradientDispersionRAS<CloudType>::cacheFields(const bool store)
if (store)
{
gradkPtr_ = fvc::grad(*this->kPtr_).ptr();
ownGradK_ = true;
}
else
{
if (gradkPtr_)
if (ownGradK_)
{
delete gradkPtr_;
deleteDemandDrivenData(gradkPtr_);
gradkPtr_ = NULL;
ownGradK_ = false;
}
}
}
@ -88,6 +99,8 @@ Foam::vector Foam::GradientDispersionRAS<CloudType>::update
scalar& tTurb
)
{
cachedRandom& rnd = this->owner().rndGen();
const scalar cps = 0.16432;
const volScalarField& k = *this->kPtr_;
@ -120,8 +133,8 @@ Foam::vector Foam::GradientDispersionRAS<CloudType>::update
scalar rsq = 10.0;
while ((rsq > 1.0) || (rsq == 0.0))
{
x1 = 2.0*this->owner().rndGen().scalar01() - 1.0;
x2 = 2.0*this->owner().rndGen().scalar01() - 1.0;
x1 = 2.0*rnd.sample01<scalar>() - 1.0;
x2 = 2.0*rnd.sample01<scalar>() - 1.0;
rsq = x1*x1 + x2*x2;
}

View File

@ -54,8 +54,13 @@ protected:
// Locally cached turbulence fields
//- Gradient of k
const volVectorField* gradkPtr_;
// Locally cached turbulence fields
//- Gradient of k
const volVectorField* gradkPtr_;
//- Take ownership of the grad(k)
bool ownGradK_;
public:
@ -67,11 +72,19 @@ public:
// Constructors
//- Construct from components
GradientDispersionRAS
(
const dictionary& dict,
CloudType& owner
);
GradientDispersionRAS(const dictionary& dict, CloudType& owner);
//- Construct copy
GradientDispersionRAS(GradientDispersionRAS<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DispersionModel<CloudType> > clone()
{
return autoPtr<DispersionModel<CloudType> >
(
new GradientDispersionRAS<CloudType>(*this)
);
}
//- Destructor
@ -80,9 +93,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Cache carrier fields
virtual void cacheFields(const bool store);

View File

@ -28,16 +28,19 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::NoDispersion<CloudType>::NoDispersion
(
const dictionary&,
CloudType& owner
)
Foam::NoDispersion<CloudType>::NoDispersion(const dictionary&, CloudType& owner)
:
DispersionModel<CloudType>(owner)
{}
template<class CloudType>
Foam::NoDispersion<CloudType>::NoDispersion(NoDispersion<CloudType>& dm)
:
DispersionModel<CloudType>(dm.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -54,13 +57,6 @@ bool Foam::NoDispersion<CloudType>::active() const
}
template<class CloudType>
void Foam::NoDispersion<CloudType>::cacheFields(const bool)
{
// do nothing
}
template<class CloudType>
Foam::vector Foam::NoDispersion<CloudType>::update
(

View File

@ -57,11 +57,19 @@ public:
// Constructors
//- Construct from components
NoDispersion
(
const dictionary& dict,
CloudType& owner
);
NoDispersion(const dictionary& dict, CloudType& owner);
//- Construct copy
NoDispersion(NoDispersion<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DispersionModel<CloudType> > clone()
{
return autoPtr<DispersionModel<CloudType> >
(
new NoDispersion<CloudType>(*this)
);
}
//- Destructor
@ -73,9 +81,6 @@ public:
//- Flag to indicate whether model activates injection model
virtual bool active() const;
//- Cache carrier fields
virtual void cacheFields(const bool store);
//- Update (disperse particles)
virtual vector update
(

View File

@ -38,6 +38,16 @@ Foam::StochasticDispersionRAS<CloudType>::StochasticDispersionRAS
{}
template<class CloudType>
Foam::StochasticDispersionRAS<CloudType>::StochasticDispersionRAS
(
StochasticDispersionRAS<CloudType>& dm
)
:
DispersionRASModel<CloudType>(dm)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -47,13 +57,6 @@ Foam::StochasticDispersionRAS<CloudType>::~StochasticDispersionRAS()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::StochasticDispersionRAS<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::vector Foam::StochasticDispersionRAS<CloudType>::update
(
@ -65,6 +68,8 @@ Foam::vector Foam::StochasticDispersionRAS<CloudType>::update
scalar& tTurb
)
{
cachedRandom& rnd = this->owner().rndGen();
const scalar cps = 0.16432;
const volScalarField& k = *this->kPtr_;
@ -88,7 +93,7 @@ Foam::vector Foam::StochasticDispersionRAS<CloudType>::update
tTurb = 0.0;
scalar sigma = sqrt(2.0*k[cellI]/3.0);
vector dir = 2.0*this->owner().rndGen().vector01() - vector::one;
vector dir = 2.0*rnd.sample01<vector>() - vector::one;
dir /= mag(dir) + SMALL;
// Numerical Recipes... Ch. 7. Random Numbers...
@ -97,8 +102,8 @@ Foam::vector Foam::StochasticDispersionRAS<CloudType>::update
scalar rsq = 10.0;
while ((rsq > 1.0) || (rsq == 0.0))
{
x1 = 2.0*this->owner().rndGen().scalar01() - 1.0;
x2 = 2.0*this->owner().rndGen().scalar01() - 1.0;
x1 = 2.0*rnd.sample01<scalar>() - 1.0;
x2 = 2.0*rnd.sample01<scalar>() - 1.0;
rsq = x1*x1 + x2*x2;
}

View File

@ -59,11 +59,19 @@ public:
// Constructors
//- Construct from components
StochasticDispersionRAS
(
const dictionary& dict,
CloudType& owner
);
StochasticDispersionRAS(const dictionary& dict, CloudType& owner);
//- Construct copy
StochasticDispersionRAS(StochasticDispersionRAS<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DispersionModel<CloudType> > clone()
{
return autoPtr<DispersionModel<CloudType> >
(
new StochasticDispersionRAS<CloudType>(*this)
);
}
//- Destructor
@ -72,9 +80,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
virtual bool active() const;
//- Update (disperse particles)
virtual vector update
(

View File

@ -30,9 +30,7 @@ License
template<class CloudType>
Foam::DragModel<CloudType>::DragModel(CloudType& owner)
:
dict_(dictionary::null),
coeffDict_(dictionary::null),
owner_(owner)
SubModelBase<CloudType>(owner)
{}
@ -44,9 +42,14 @@ Foam::DragModel<CloudType>::DragModel
const word& type
)
:
dict_(dict),
coeffDict_(dict.subDict(type + "Coeffs")),
owner_(owner)
SubModelBase<CloudType>(owner, dict, type)
{}
template<class CloudType>
Foam::DragModel<CloudType>::DragModel(const DragModel<CloudType>& dm)
:
SubModelBase<CloudType>(dm)
{}
@ -60,23 +63,13 @@ Foam::DragModel<CloudType>::~DragModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::DragModel<CloudType>::owner() const
Foam::scalar Foam::DragModel<CloudType>::Cd(const scalar) const
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::DragModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const Foam::dictionary& Foam::DragModel<CloudType>::coeffDict() const
{
return coeffDict_;
notImplemented
(
"Foam::scalar Foam::DragModel<CloudType>::Cd(const scalar) const"
);
return 0.0;
}

View File

@ -51,19 +51,9 @@ namespace Foam
template<class CloudType>
class DragModel
:
public SubModelBase<CloudType>
{
// Private data
//- The cloud dictionary
const dictionary& dict_;
//- The model coefficients dictionary
const dictionary& coeffDict_;
//- Reference to the owner cloud class
CloudType& owner_;
public:
//- Runtime type information
@ -96,6 +86,18 @@ public:
const word& type
);
//- Construct copy
DragModel(const DragModel<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DragModel<CloudType> > clone() const
{
return autoPtr<DragModel<CloudType> >
(
new DragModel<CloudType>(*this)
);
}
//- Destructor
virtual ~DragModel();
@ -109,25 +111,10 @@ public:
);
// Access
//- Return the owner cloud object
const CloudType& owner() const;
//- Return the dictionary
const dictionary& dict() const;
//- Return the coefficients dictionary
const dictionary& coeffDict() const;
// Member Functions
//- Flag to indicate whether model activates drag model
virtual bool active() const = 0;
//- Return drag coefficient
virtual scalar Cd(const scalar Re) const = 0;
virtual scalar Cd(const scalar Re) const;
//- Return momentum transfer coefficient
// Drag force per unit particle surface area = utc(U - Up)

View File

@ -34,6 +34,13 @@ Foam::NoDrag<CloudType>::NoDrag(const dictionary& dict, CloudType& owner)
{}
template<class CloudType>
Foam::NoDrag<CloudType>::NoDrag(const NoDrag<CloudType>& dm)
:
DragModel<CloudType>(dm.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>

View File

@ -56,11 +56,19 @@ public:
// Constructors
//- Construct from dictionary
NoDrag
(
const dictionary&,
CloudType&
);
NoDrag(const dictionary&, CloudType&);
//- Construct copy
NoDrag(const NoDrag<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DragModel<CloudType> > clone() const
{
return autoPtr<DragModel<CloudType> >
(
new NoDrag<CloudType>(*this)
);
}
//- Destructor

View File

@ -58,6 +58,21 @@ Foam::NonSphereDrag<CloudType>::NonSphereDrag
}
template<class CloudType>
Foam::NonSphereDrag<CloudType>::NonSphereDrag
(
const NonSphereDrag<CloudType>& dm
)
:
DragModel<CloudType>(dm),
phi_(dm.phi_),
a_(dm.a_),
b_(dm.b_),
c_(dm.c_),
d_(dm.d_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -67,13 +82,6 @@ Foam::NonSphereDrag<CloudType>::~NonSphereDrag()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::NonSphereDrag<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::NonSphereDrag<CloudType>::Cd(const scalar Re) const
{

View File

@ -110,6 +110,18 @@ public:
//- Construct from dictionary
NonSphereDrag(const dictionary& dict, CloudType& owner);
//- Construct copy
NonSphereDrag(const NonSphereDrag<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DragModel<CloudType> > clone() const
{
return autoPtr<DragModel<CloudType> >
(
new NonSphereDrag<CloudType>(*this)
);
}
//- Destructor
virtual ~NonSphereDrag();
@ -117,9 +129,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates drag model
bool active() const;
//- Return drag coefficient
scalar Cd(const scalar Re) const;
};

View File

@ -38,6 +38,13 @@ Foam::SphereDrag<CloudType>::SphereDrag
{}
template<class CloudType>
Foam::SphereDrag<CloudType>::SphereDrag(const SphereDrag<CloudType>& dm)
:
DragModel<CloudType>(dm)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
@ -47,13 +54,6 @@ Foam::SphereDrag<CloudType>::~SphereDrag()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class CloudType>
bool Foam::SphereDrag<CloudType>::active() const
{
return true;
}
template <class CloudType>
Foam::scalar Foam::SphereDrag<CloudType>::Cd(const scalar Re) const
{

View File

@ -56,11 +56,19 @@ public:
// Constructors
//- Construct from dictionary
SphereDrag
(
const dictionary& dict,
CloudType& owner
);
SphereDrag(const dictionary& dict, CloudType& owner);
//- Construct copy
SphereDrag(const SphereDrag<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DragModel<CloudType> > clone() const
{
return autoPtr<DragModel<CloudType> >
(
new SphereDrag<CloudType>(*this)
);
}
//- Destructor
@ -69,9 +77,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates drag model
bool active() const;
//- Return drag coefficient
scalar Cd(const scalar Re) const;
};

View File

@ -89,43 +89,14 @@ Foam::ConeInjection<CloudType>::ConeInjection
),
flowRateProfile_
(
DataEntry<scalar>::New
(
"flowRateProfile",
this->coeffDict()
)
),
Umag_
(
DataEntry<scalar>::New
(
"Umag",
this->coeffDict()
)
),
thetaInner_
(
DataEntry<scalar>::New
(
"thetaInner",
this->coeffDict()
)
),
thetaOuter_
(
DataEntry<scalar>::New
(
"thetaOuter",
this->coeffDict()
)
DataEntry<scalar>::New("flowRateProfile", this->coeffDict())
),
Umag_(DataEntry<scalar>::New("Umag", this->coeffDict())),
thetaInner_(DataEntry<scalar>::New("thetaInner", this->coeffDict())),
thetaOuter_(DataEntry<scalar>::New("thetaOuter", this->coeffDict())),
parcelPDF_
(
pdfs::pdf::New
(
this->coeffDict().subDict("parcelPDF"),
owner.rndGen()
)
pdfs::pdf::New(this->coeffDict().subDict("parcelPDF"), owner.rndGen())
),
tanVec1_(vector::zero),
tanVec2_(vector::zero)
@ -137,9 +108,10 @@ Foam::ConeInjection<CloudType>::ConeInjection
vector tangent = vector::zero;
scalar magTangent = 0.0;
cachedRandom& rnd = this->owner().rndGen();
while (magTangent < SMALL)
{
vector v = this->owner().rndGen().vector01();
vector v = rnd.sample01<vector>();
tangent = v - (v & direction_)*direction_;
magTangent = mag(tangent);
@ -162,6 +134,30 @@ Foam::ConeInjection<CloudType>::ConeInjection
}
template<class CloudType>
Foam::ConeInjection<CloudType>::ConeInjection
(
const ConeInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
duration_(im.duration_),
position_(im.position_),
injectorCell_(im.injectorCell_),
injectorTetFace_(im.injectorTetFace_),
injectorTetPt_(im.injectorTetPt_),
direction_(im.direction_),
parcelsPerSecond_(im.parcelsPerSecond_),
flowRateProfile_(im.flowRateProfile_().clone().ptr()),
Umag_(im.Umag_().clone().ptr()),
thetaInner_(im.thetaInner_().clone().ptr()),
thetaOuter_(im.thetaOuter_().clone().ptr()),
parcelPDF_(im.parcelPDF_().clone().ptr()),
tanVec1_(im.tanVec1_),
tanVec2_(im.tanVec2_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -171,13 +167,6 @@ Foam::ConeInjection<CloudType>::~ConeInjection()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ConeInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::ConeInjection<CloudType>::timeEnd() const
{
@ -207,24 +196,26 @@ void Foam::ConeInjection<CloudType>::setPositionAndCell
template<class CloudType>
void Foam::ConeInjection<CloudType>::setProperties
(
const label parcelI,
const label,
const label,
const scalar time,
typename CloudType::parcelType& parcel
)
{
cachedRandom& rnd = this->owner().rndGen();
// set particle velocity
const scalar deg2Rad = pi/180.0;
scalar t = time - this->SOI_;
scalar ti = thetaInner_().value(t);
scalar to = thetaOuter_().value(t);
scalar coneAngle = this->owner().rndGen().scalar01()*(to - ti) + ti;
scalar coneAngle = deg2Rad*rnd.position<scalar>(ti, to);
coneAngle *= deg2Rad;
scalar alpha = sin(coneAngle);
scalar dcorr = cos(coneAngle);
scalar beta = twoPi*this->owner().rndGen().scalar01();
scalar beta = twoPi*rnd.sample01<scalar>();
vector normal = alpha*(tanVec1_*cos(beta) + tanVec2_*sin(beta));
vector dirVec = dcorr*direction_;

View File

@ -119,18 +119,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Number of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -142,11 +134,19 @@ public:
// Constructors
//- Construct from dictionary
ConeInjection
(
const dictionary& dict,
CloudType& owner
);
ConeInjection(const dictionary& dict, CloudType& owner);
//- Construct copy
ConeInjection(const ConeInjection<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new ConeInjection<CloudType>(*this)
);
}
//- Destructor
@ -155,9 +155,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;

View File

@ -120,43 +120,14 @@ Foam::ConeInjectionMP<CloudType>::ConeInjectionMP
),
flowRateProfile_
(
DataEntry<scalar>::New
(
"flowRateProfile",
this->coeffDict()
)
),
Umag_
(
DataEntry<scalar>::New
(
"Umag",
this->coeffDict()
)
),
thetaInner_
(
DataEntry<scalar>::New
(
"thetaInner",
this->coeffDict()
)
),
thetaOuter_
(
DataEntry<scalar>::New
(
"thetaOuter",
this->coeffDict()
)
DataEntry<scalar>::New("flowRateProfile", this->coeffDict())
),
Umag_(DataEntry<scalar>::New("Umag", this->coeffDict())),
thetaInner_(DataEntry<scalar>::New("thetaInner", this->coeffDict())),
thetaOuter_(DataEntry<scalar>::New("thetaOuter", this->coeffDict())),
parcelPDF_
(
pdfs::pdf::New
(
this->coeffDict().subDict("parcelPDF"),
owner.rndGen()
)
pdfs::pdf::New(this->coeffDict().subDict("parcelPDF"), owner.rndGen())
),
nInjected_(this->parcelsAddedTotal()),
tanVec1_(positions_.size()),
@ -171,9 +142,10 @@ Foam::ConeInjectionMP<CloudType>::ConeInjectionMP
vector tangent = vector::zero;
scalar magTangent = 0.0;
cachedRandom& rnd = this->owner().rndGen();
while (magTangent < SMALL)
{
vector v = this->owner().rndGen().vector01();
vector v = rnd.sample01<vector>();
tangent = v - (v & axes_[i])*axes_[i];
magTangent = mag(tangent);
@ -200,6 +172,33 @@ Foam::ConeInjectionMP<CloudType>::ConeInjectionMP
}
template<class CloudType>
Foam::ConeInjectionMP<CloudType>::ConeInjectionMP
(
const ConeInjectionMP<CloudType>& im
)
:
InjectionModel<CloudType>(im),
positionsFile_(im.positionsFile_),
positions_(im.positions_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_),
axesFile_(im.axesFile_),
axes_(im.axes_),
duration_(im.duration_),
parcelsPerInjector_(im.parcelsPerInjector_),
flowRateProfile_(im.flowRateProfile_().clone().ptr()),
Umag_(im.Umag_().clone().ptr()),
thetaInner_(im.thetaInner_().clone().ptr()),
thetaOuter_(im.thetaOuter_().clone().ptr()),
parcelPDF_(im.parcelPDF_().clone().ptr()),
nInjected_(im.nInjected_),
tanVec1_(im.tanVec1_),
tanVec2_(im.tanVec2_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -209,13 +208,6 @@ Foam::ConeInjectionMP<CloudType>::~ConeInjectionMP()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ConeInjectionMP<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::ConeInjectionMP<CloudType>::timeEnd() const
{
@ -253,6 +245,8 @@ void Foam::ConeInjectionMP<CloudType>::setProperties
typename CloudType::parcelType& parcel
)
{
cachedRandom& rnd = this->owner().rndGen();
// set particle velocity
const label i = parcelI%positions_.size();
@ -261,17 +255,16 @@ void Foam::ConeInjectionMP<CloudType>::setProperties
scalar t = time - this->SOI_;
scalar ti = thetaInner_().value(t);
scalar to = thetaOuter_().value(t);
scalar coneAngle = this->owner().rndGen().scalar01()*(to - ti) + ti;
scalar coneAngle = deg2Rad*rnd.position<scalar>(ti, to);
coneAngle *= deg2Rad;
scalar alpha = sin(coneAngle);
scalar dcorr = cos(coneAngle);
scalar beta = twoPi*this->owner().rndGen().scalar01();
scalar beta = twoPi*rnd.sample01<scalar>();
vector normal = alpha*(tanVec1_[i]*cos(beta) + tanVec2_[i]*sin(beta));
vector dirVec = dcorr*axes_[i];
dirVec += normal;
dirVec /= mag(dirVec);
parcel.U() = Umag_().value(t)*dirVec;

View File

@ -129,18 +129,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Number of parcels to introduce over the time step
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -152,11 +144,19 @@ public:
// Constructors
//- Construct from dictionary
ConeInjectionMP
(
const dictionary& dict,
CloudType& owner
);
ConeInjectionMP(const dictionary& dict, CloudType& owner);
//- Construct copy
ConeInjectionMP(const ConeInjectionMP<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new ConeInjectionMP<CloudType>(*this)
);
}
//- Destructor
@ -165,9 +165,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;

View File

@ -147,6 +147,29 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
}
template<class CloudType>
Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
(
const FieldActivatedInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
factor_(im.factor_),
referenceField_(im.referenceField_),
thresholdField_(im.thresholdField_),
positionsFile_(im.positionsFile_),
positions_(im.positions_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_),
nParcelsPerInjector_(im.nParcelsPerInjector_),
nParcelsInjected_(im.nParcelsInjected_),
U0_(im.U0_),
diameters_(im.diameters_),
parcelPDF_(im.parcelPDF_().clone().ptr())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -119,18 +119,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -142,11 +134,19 @@ public:
// Constructors
//- Construct from dictionary
FieldActivatedInjection
(
const dictionary& dict,
CloudType& owner
);
FieldActivatedInjection(const dictionary& dict, CloudType& owner);
//- Construct copy
FieldActivatedInjection(const FieldActivatedInjection<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new FieldActivatedInjection<CloudType>(*this)
);
}
//- Destructor

View File

@ -71,7 +71,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
newParticles_.clear();
Random& rnd = this->owner().rndGen();
cachedRandom& rnd = this->owner().rndGen();
// Diameter factor, when splitting particles into 4, this is the
// factor that modifies the diameter.
@ -118,7 +118,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
}
label cI =
generationCells_[rnd.integer(0, generationCells_.size() - 1)];
generationCells_[rnd.position(0, generationCells_.size() - 1)];
// Pick a particle at random from the cell - if there are
// none, insert one at the cell centre. Otherwise, split an
@ -146,7 +146,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
}
else
{
label cPI = rnd.integer(0, cellOccupancy[cI].size() - 1);
label cPI = rnd.position(0, cellOccupancy[cI].size() - 1);
// This has to be a reference to the pointer so that it
// can be set to NULL when the particle is deleted.
@ -157,7 +157,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
scalar pD = pPtr->d();
// Select bigger particles by preference
if ((pD/pPtr->dTarget()) < rnd.scalar01())
if ((pD/pPtr->dTarget()) < rnd.sample01<scalar>())
{
continue;
}
@ -390,6 +390,29 @@ Foam::InflationInjection<CloudType>::InflationInjection
}
template<class CloudType>
Foam::InflationInjection<CloudType>::InflationInjection
(
const Foam::InflationInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
generationSetName_(im.generationSetName_),
inflationSetName_(im.inflationSetName_),
generationCells_(im.generationCells_),
inflationCells_(im.inflationCells_),
duration_(im.duration_),
flowRateProfile_(im.flowRateProfile_().clone().ptr()),
growthRate_(im.growthRate_().clone().ptr()),
newParticles_(im.newParticles_),
volumeAccumulator_(im.volumeAccumulator_),
fraction_(im.fraction_),
selfSeed_(im.selfSeed_),
dSeed_(im.dSeed_),
parcelPDF_(im.parcelPDF_().clone().ptr())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -399,13 +422,6 @@ Foam::InflationInjection<CloudType>::~InflationInjection()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::InflationInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::InflationInjection<CloudType>::timeEnd() const
{

View File

@ -116,18 +116,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -139,11 +131,19 @@ public:
// Constructors
//- Construct from dictionary
InflationInjection
(
const dictionary& dict,
CloudType& owner
);
InflationInjection(const dictionary& dict, CloudType& owner);
//- Construct copy
InflationInjection(const InflationInjection<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new InflationInjection<CloudType>(*this)
);
}
//- Destructor
@ -152,9 +152,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;

View File

@ -37,9 +37,9 @@ void Foam::InjectionModel<CloudType>::readProps()
IOobject propsDictHeader
(
"injectionProperties",
owner_.db().time().timeName(),
"uniform"/cloud::prefix/owner_.name(),
owner_.db(),
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
@ -60,16 +60,16 @@ void Foam::InjectionModel<CloudType>::readProps()
template<class CloudType>
void Foam::InjectionModel<CloudType>::writeProps()
{
if (owner_.db().time().outputTime())
if (this->owner().db().time().outputTime())
{
IOdictionary propsDict
(
IOobject
(
"injectionProperties",
owner_.db().time().timeName(),
"uniform"/cloud::prefix/owner_.name(),
owner_.db(),
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
@ -86,6 +86,58 @@ void Foam::InjectionModel<CloudType>::writeProps()
}
template<class CloudType>
Foam::label Foam::InjectionModel<CloudType>::parcelsToInject
(
const scalar time0,
const scalar time1
) const
{
notImplemented
(
"Foam::label Foam::InjectionModel<CloudType>::parcelsToInject"
"("
"const scalar, "
"const scalar"
") const"
);
return 0;
}
template<class CloudType>
Foam::scalar Foam::InjectionModel<CloudType>::volumeToInject
(
const scalar time0,
const scalar time1
) const
{
notImplemented
(
"Foam::scalar Foam::InjectionModel<CloudType>::volumeToInject"
"("
"const scalar, "
"const scalar"
") const"
);
return 0.0;
}
template<class CloudType>
bool Foam::InjectionModel<CloudType>::validInjection(const label parcelI)
{
notImplemented
(
"bool Foam::InjectionModel<CloudType>::validInjection(const label)"
);
return false;
}
template<class CloudType>
void Foam::InjectionModel<CloudType>::prepareForNextTimeStep
(
@ -138,11 +190,11 @@ bool Foam::InjectionModel<CloudType>::findCellAtPosition
bool errorOnNotFound
)
{
const volVectorField& cellCentres = owner_.mesh().C();
const volVectorField& cellCentres = this->owner().mesh().C();
const vector p0 = position;
owner_.findCellFacePt
this->owner().findCellFacePt
(
position,
cellI,
@ -172,13 +224,13 @@ bool Foam::InjectionModel<CloudType>::findCellAtPosition
// probably on an edge
if (procI == -1)
{
cellI = owner_.mesh().findNearestCell(position);
cellI = this->owner().mesh().findNearestCell(position);
if (cellI >= 0)
{
position += SMALL*(cellCentres[cellI] - position);
if (owner_.mesh().pointInCell(position, cellI))
if (this->owner().mesh().pointInCell(position, cellI))
{
procI = Pstream::myProcNo();
}
@ -283,7 +335,7 @@ void Foam::InjectionModel<CloudType>::postInjectCheck
if (allParcelsAdded > 0)
{
Info<< nl
<< "--> Cloud: " << owner_.name() << nl
<< "--> Cloud: " << this->owner().name() << nl
<< " Added " << allParcelsAdded << " new parcels" << nl << endl;
}
@ -294,7 +346,7 @@ void Foam::InjectionModel<CloudType>::postInjectCheck
massInjected_ += returnReduce(massAdded, sumOp<scalar>());
// Update time for start of next injection
time0_ = owner_.db().time().value();
time0_ = this->owner().db().time().value();
// Increment number of injections
nInjections_++;
@ -309,9 +361,7 @@ void Foam::InjectionModel<CloudType>::postInjectCheck
template<class CloudType>
Foam::InjectionModel<CloudType>::InjectionModel(CloudType& owner)
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null),
SubModelBase<CloudType>(owner),
SOI_(0.0),
volumeTotal_(0.0),
massTotal_(0.0),
@ -335,12 +385,10 @@ Foam::InjectionModel<CloudType>::InjectionModel
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs")),
SOI_(readScalar(coeffDict_.lookup("SOI"))),
SubModelBase<CloudType>(owner, dict, type),
SOI_(readScalar(this->coeffDict().lookup("SOI"))),
volumeTotal_(0.0),
massTotal_(dimensionedScalar(coeffDict_.lookup("massTotal")).value()),
massTotal_(readScalar(this->coeffDict().lookup("massTotal"))),
massInjected_(0.0),
nInjections_(0),
parcelsAddedTotal_(0),
@ -355,7 +403,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
Info<< " Constructing " << owner.mesh().nGeometricD() << "-D injection"
<< endl;
const word parcelBasisType = coeffDict_.lookup("parcelBasisType");
const word parcelBasisType = this->coeffDict().lookup("parcelBasisType");
if (parcelBasisType == "mass")
{
@ -373,7 +421,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
<< "variable now does not determine anything."
<< endl;
nParticleFixed_ = readScalar(coeffDict_.lookup("nParticle"));
nParticleFixed_ = readScalar(this->coeffDict().lookup("nParticle"));
}
else
{
@ -393,6 +441,26 @@ Foam::InjectionModel<CloudType>::InjectionModel
}
template<class CloudType>
Foam::InjectionModel<CloudType>::InjectionModel
(
const InjectionModel<CloudType>& im
)
:
SubModelBase<CloudType>(im),
SOI_(im.SOI_),
volumeTotal_(im.volumeTotal_),
massTotal_(im.massTotal_),
massInjected_(im.massInjected_),
nInjections_(im.nInjections_),
parcelsAddedTotal_(im.parcelsAddedTotal_),
parcelBasis_(im.parcelBasis_),
nParticleFixed_(im.nParticleFixed_),
time0_(im.time0_),
timeStep0_(im.timeStep0_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -402,18 +470,30 @@ Foam::InjectionModel<CloudType>::~InjectionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::InjectionModel<CloudType>::timeEnd() const
{
notImplemented
(
"Foam::scalar Foam::InjectionModel<CloudType>::timeEnd() const"
);
return 0.0;
}
template<class CloudType>
template<class TrackData>
void Foam::InjectionModel<CloudType>::inject(TrackData& td)
{
if (!active())
if (this->active())
{
return;
}
const scalar time = owner_.db().time().value();
const scalar carrierDt = owner_.db().time().deltaTValue();
const polyMesh& mesh = owner_.mesh();
const scalar time = this->owner().db().time().value();
const scalar carrierDt = this->owner().db().time().deltaTValue();
const polyMesh& mesh = this->owner().mesh();
// Prepare for next time step
label parcelsAdded = 0;
@ -512,6 +592,68 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
}
template<class CloudType>
void Foam::InjectionModel<CloudType>::setPositionAndCell
(
const label parcelI,
const label nParcels,
const scalar time,
vector& position,
label& cellOwner,
label& tetFaceI,
label& tetPtI
)
{
notImplemented
(
"void Foam::InjectionModel<CloudType>::setPositionAndCell"
"("
"const label, "
"const label, "
"const scalar, "
"vector&, "
"label&, "
"label&, "
"label&"
")"
);
}
template<class CloudType>
void Foam::InjectionModel<CloudType>::setProperties
(
const label parcelI,
const label nParcels,
const scalar time,
typename CloudType::parcelType& parcel
)
{
notImplemented
(
"void Foam::InjectionModel<CloudType>::setProperties"
"("
"const label, "
"const label, "
"const scalar, "
"typename CloudType::parcelType&"
")"
);
}
template<class CloudType>
bool Foam::InjectionModel<CloudType>::fullyDescribed() const
{
notImplemented
(
"bool Foam::InjectionModel<CloudType>::fullyDescribed() const"
);
return false;
}
template<class CloudType>
void Foam::InjectionModel<CloudType>::info(Ostream& os) const
{

View File

@ -51,6 +51,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -63,6 +64,8 @@ namespace Foam
template<class CloudType>
class InjectionModel
:
public SubModelBase<CloudType>
{
public:
@ -80,18 +83,6 @@ public:
private:
// Private data
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
//- The coefficients dictionary
const dictionary coeffDict_;
// Private Member Functions
//- Read injector properties from previous run (if applicable)
@ -156,18 +147,18 @@ protected:
(
const scalar time0,
const scalar time1
) = 0;
) const;
//- Volume of parcels to introduce over the time step relative to SOI
virtual scalar volumeToInject
(
const scalar time0,
const scalar time1
) = 0;
) const;
//- Additional flag to identify whether or not injection of parcelI is
// permitted
virtual bool validInjection(const label parcelI) = 0;
virtual bool validInjection(const label parcelI);
//- Determine properties for next time step/injection interval
virtual void prepareForNextTimeStep
@ -238,6 +229,18 @@ public:
const word& type
);
//- Construct copy
InjectionModel(const InjectionModel<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new InjectionModel<CloudType>(*this)
);
}
//- Destructor
virtual ~InjectionModel();
@ -251,27 +254,8 @@ public:
);
// Access
//- Return the owner cloud dictionary
inline const dictionary& dict() const;
//- 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 coefficients dictionary
inline const dictionary& coeffDict() const;
// Member Functions
//- Flag to indicate whether model activates injection model
virtual bool active() const = 0;
// Global information
//- Return the start-of-injection time
@ -287,7 +271,7 @@ public:
inline scalar massInjected() const;
//- Return the end-of-injection time
virtual scalar timeEnd() const = 0;
virtual scalar timeEnd() const;
// Counters
@ -317,7 +301,7 @@ public:
label& cellOwner,
label& tetFaceI,
label& tetPtI
) = 0;
);
//- Set the parcel properties
virtual void setProperties
@ -326,15 +310,15 @@ public:
const label nParcels,
const scalar time,
typename CloudType::parcelType& parcel
) = 0;
);
//- Flag to identify whether model fully describes the parcel
virtual bool fullyDescribed() const = 0;
virtual bool fullyDescribed() const;
// I-O
//- Write surface film info to stream
//- Write injection info to stream
virtual void info(Ostream& os) const;
};

View File

@ -25,33 +25,7 @@ License
#include "InjectionModel.H"
template<class CloudType>
const Foam::dictionary& Foam::InjectionModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const CloudType& Foam::InjectionModel<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
CloudType& Foam::InjectionModel<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::InjectionModel<CloudType>::coeffDict() const
{
return coeffDict_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::InjectionModel<CloudType>::timeStart() const

View File

@ -123,6 +123,23 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
}
template<class CloudType>
Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
(
const KinematicLookupTableInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
inputFileName_(im.inputFileName_),
duration_(im.duration_),
nParcelsPerSecond_(im.nParcelsPerSecond_),
injectors_(im.injectors_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -132,13 +149,6 @@ Foam::KinematicLookupTableInjection<CloudType>::~KinematicLookupTableInjection()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::KinematicLookupTableInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::timeEnd() const
{

View File

@ -96,18 +96,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -119,12 +111,23 @@ public:
// Constructors
//- Construct from dictionary
KinematicLookupTableInjection(const dictionary& dict, CloudType& owner);
//- Construct copy
KinematicLookupTableInjection
(
const dictionary& dict,
CloudType& owner
const KinematicLookupTableInjection<CloudType>& im
);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new KinematicLookupTableInjection<CloudType>(*this)
);
}
//- Destructor
virtual ~KinematicLookupTableInjection();
@ -132,9 +135,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;

View File

@ -157,6 +157,24 @@ Foam::ManualInjection<CloudType>::ManualInjection
}
template<class CloudType>
Foam::ManualInjection<CloudType>::ManualInjection
(
const ManualInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
positionsFile_(im.positionsFile_),
positions_(im.positions_),
diameters_(im.diameters_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_),
U0_(im.U0_),
parcelPDF_(im.parcelPDF_().clone().ptr())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -166,13 +184,6 @@ Foam::ManualInjection<CloudType>::~ManualInjection()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ManualInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::ManualInjection<CloudType>::timeEnd() const
{

View File

@ -79,7 +79,7 @@ class ManualInjection
//- List of tetPt labels corresponding to injector positions
labelList injectorTetPts_;
//- Initial parcel velocity
//- Initial parcel velocity
const vector U0_;
//- Parcel size PDF model
@ -91,18 +91,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -114,11 +106,19 @@ public:
// Constructors
//- Construct from dictionary
ManualInjection
(
const dictionary& dict,
CloudType& owner
);
ManualInjection(const dictionary& dict, CloudType& owner);
//- Construct copy
ManualInjection(const ManualInjection<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new ManualInjection<CloudType>(*this)
);
}
//- Destructor
@ -127,9 +127,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;

View File

@ -63,6 +63,13 @@ Foam::NoInjection<CloudType>::NoInjection
{}
template<class CloudType>
Foam::NoInjection<CloudType>::NoInjection(const NoInjection<CloudType>& im)
:
InjectionModel<CloudType>(im.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -56,18 +56,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar,
const scalar
);
virtual label parcelsToInject(const scalar, const scalar);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar,
const scalar
);
virtual scalar volumeToInject(const scalar, const scalar);
public:
@ -79,11 +71,19 @@ public:
// Constructors
//- Construct from components
NoInjection
(
const dictionary&,
CloudType&
);
NoInjection(const dictionary&, CloudType&);
//- Construct copy
NoInjection(const NoInjection<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new NoInjection<CloudType>(*this)
);
}
//- Destructor

View File

@ -76,6 +76,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
:
InjectionModel<CloudType>(dict, owner, typeName),
patchName_(this->coeffDict().lookup("patchName")),
patchId_(owner.mesh().boundaryMesh().findPatchID(patchName_)),
duration_(readScalar(this->coeffDict().lookup("duration"))),
parcelsPerSecond_
(
@ -84,26 +85,16 @@ Foam::PatchInjection<CloudType>::PatchInjection
U0_(this->coeffDict().lookup("U0")),
flowRateProfile_
(
DataEntry<scalar>::New
(
"flowRateProfile",
this->coeffDict()
)
DataEntry<scalar>::New("flowRateProfile", this->coeffDict())
),
parcelPDF_
(
pdfs::pdf::New
(
this->coeffDict().subDict("parcelPDF"),
owner.rndGen()
)
pdfs::pdf::New(this->coeffDict().subDict("parcelPDF"), owner.rndGen())
),
injectorCells_(),
cellOwners_(),
fraction_(1.0)
{
const label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_);
if (patchId < 0)
if (patchId_ < 0)
{
FatalErrorIn
(
@ -117,11 +108,11 @@ Foam::PatchInjection<CloudType>::PatchInjection
<< nl << exit(FatalError);
}
const polyPatch& patch = owner.mesh().boundaryMesh()[patchId];
const polyPatch& patch = owner.mesh().boundaryMesh()[patchId_];
injectorCells_ = patch.faceCells();
cellOwners_ = patch.faceCells();
label patchSize = injectorCells_.size();
label patchSize = cellOwners_.size();
label totalPatchSize = patchSize;
reduce(totalPatchSize, sumOp<label>());
fraction_ = scalar(patchSize)/totalPatchSize;
@ -132,6 +123,25 @@ Foam::PatchInjection<CloudType>::PatchInjection
}
template<class CloudType>
Foam::PatchInjection<CloudType>::PatchInjection
(
const PatchInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
patchName_(im.patchName_),
patchId_(im.patchId_),
duration_(im.duration_),
parcelsPerSecond_(im.parcelsPerSecond_),
U0_(im.U0_),
flowRateProfile_(im.flowRateProfile_().clone().ptr()),
parcelPDF_(im.parcelPDF_().clone().ptr()),
cellOwners_(im.cellOwners_),
fraction_(im.fraction_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -141,13 +151,6 @@ Foam::PatchInjection<CloudType>::~PatchInjection()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::PatchInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::PatchInjection<CloudType>::timeEnd() const
{
@ -167,26 +170,29 @@ void Foam::PatchInjection<CloudType>::setPositionAndCell
label& tetPtI
)
{
if (injectorCells_.size() > 0)
if (cellOwners_.size() > 0)
{
label cellI = this->owner().rndGen().integer
(
0,
injectorCells_.size() - 1
);
cachedRandom& rnd = this->owner().rndGen();
label cellI = rnd.position<label>(0, cellOwners_.size() - 1);
cellOwner = injectorCells_[cellI];
cellOwner = cellOwners_[cellI];
// The position is at the cell centre, which could be in any
// tet of the decomposed cell, so arbitrarily choose the first
// face of the cell as the tetFace and the first point after
// the base point on the face as the tetPt. The tracking will
// pick the cell consistent with the motion in the first
// tracking step.
// The position is between the face and cell centre, which could be
// in any tet of the decomposed cell, so arbitrarily choose the first
// face of the cell as the tetFace and the first point after the base
// point on the face as the tetPt. The tracking will pick the cell
// consistent with the motion in the firsttracking step.
tetFaceI = this->owner().mesh().cells()[cellOwner][0];
tetPtI = 1;
position = this->owner().mesh().C()[cellOwner];
// position perturbed between cell and patch face centres
const vector& pc = this->owner().mesh().C()[cellOwner];
const vector& pf =
this->owner().mesh().Cf().boundaryField()[patchId_][cellI];
const scalar a = rnd.sample01<scalar>();
const vector d = pf - pc;
position = pc + 0.5*a*d;
}
else
{

View File

@ -70,6 +70,9 @@ class PatchInjection
//- Name of patch
const word patchName_;
//- Id of patch
const label patchId_;
//- Injection duration [s]
const scalar duration_;
@ -86,7 +89,7 @@ class PatchInjection
const autoPtr<pdfs::pdf> parcelPDF_;
//- List of cell labels corresponding to injector positions
labelList injectorCells_;
labelList cellOwners_;
//- Fraction of injection controlled by this processor
scalar fraction_;
@ -97,18 +100,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -120,11 +115,19 @@ public:
// Constructors
//- Construct from dictionary
PatchInjection
(
const dictionary& dict,
CloudType& owner
);
PatchInjection(const dictionary& dict, CloudType& owner);
//- Construct copy
PatchInjection(const PatchInjection<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new PatchInjection<CloudType>(*this)
);
}
//- Destructor
@ -133,9 +136,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;

View File

@ -55,16 +55,16 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
)
:
PatchInteractionModel<CloudType>(dict, cloud, typeName),
patchProperties_(this->coeffDict().lookup("patches")),
patchIds_(patchProperties_.size())
patchData_(this->coeffDict().lookup("patches")),
patchIds_(patchData_.size())
{
const polyMesh& mesh = cloud.mesh();
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
// check that user patches are valid region patches
forAll(patchProperties_, patchI)
forAll(patchData_, patchI)
{
const word& patchName = patchProperties_[patchI].patchName();
const word& patchName = patchData_[patchI].patchName();
patchIds_[patchI] = bMesh.findPatchID(patchName);
if (patchIds_[patchI] < 0)
{
@ -97,16 +97,16 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
}
// check that interactions are valid/specified
forAll(patchProperties_, patchI)
forAll(patchData_, patchI)
{
const word& interactionTypeName =
patchProperties_[patchI].interactionTypeName();
patchData_[patchI].interactionTypeName();
const typename PatchInteractionModel<CloudType>::interactionType& it =
this->wordToInteractionType(interactionTypeName);
if (it == PatchInteractionModel<CloudType>::itOther)
{
const word& patchName = patchProperties_[patchI].patchName();
const word& patchName = patchData_[patchI].patchName();
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
<< "Unknown patch interaction type "
<< interactionTypeName << " for patch " << patchName
@ -118,6 +118,18 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
}
template<class CloudType>
Foam::LocalInteraction<CloudType>::LocalInteraction
(
const LocalInteraction<CloudType>& pim
)
:
PatchInteractionModel<CloudType>(pim),
patchData_(pim.patchData_),
patchIds_(pim.patchIds_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
@ -127,13 +139,6 @@ Foam::LocalInteraction<CloudType>::~LocalInteraction()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::LocalInteraction<CloudType>::active() const
{
return true;
}
template <class CloudType>
bool Foam::LocalInteraction<CloudType>::correct
(
@ -155,7 +160,7 @@ bool Foam::LocalInteraction<CloudType>::correct
typename PatchInteractionModel<CloudType>::interactionType it =
this->wordToInteractionType
(
patchProperties_[patchI].interactionTypeName()
patchData_[patchI].interactionTypeName()
);
switch (it)
@ -192,10 +197,10 @@ bool Foam::LocalInteraction<CloudType>::correct
if (Un > 0)
{
U -= (1.0 + patchProperties_[patchI].e())*Un*nw;
U -= (1.0 + patchData_[patchI].e())*Un*nw;
}
U -= patchProperties_[patchI].mu()*Ut;
U -= patchData_[patchI].mu()*Ut;
// Return velocity to global space
U += Up;
@ -208,15 +213,16 @@ bool Foam::LocalInteraction<CloudType>::correct
(
"bool LocalInteraction<CloudType>::correct"
"("
"typename CloudType::parcelType&, "
"const polyPatch&, "
"const label, "
"bool&, "
"vector&"
"scalar&, "
"const tetIndices&"
") const"
) << "Unknown interaction type "
<< patchProperties_[patchI].interactionTypeName()
<< patchData_[patchI].interactionTypeName()
<< "(" << it << ") for patch "
<< patchProperties_[patchI].patchName()
<< patchData_[patchI].patchName()
<< ". Valid selections are:" << this->interactionTypeNames_
<< endl << abort(FatalError);
}

View File

@ -51,7 +51,7 @@ class LocalInteraction
// Private data
//- List of participating patches
const List<patchInteractionData> patchProperties_;
const List<patchInteractionData> patchData_;
//- List of participating patch ids
List<label> patchIds_;
@ -73,7 +73,19 @@ public:
// Constructors
//- Construct from dictionary
LocalInteraction(const dictionary& dict, CloudType& cloud);
LocalInteraction(const dictionary& dict, CloudType& owner);
//- Construct copy from owner cloud and patch interaction model
LocalInteraction(const LocalInteraction<CloudType>& pim);
//- Construct and return a clone using supplied owner cloud
virtual autoPtr<PatchInteractionModel<CloudType> > clone() const
{
return autoPtr<PatchInteractionModel<CloudType> >
(
new LocalInteraction<CloudType>(*this)
);
}
//- Destructor
@ -82,9 +94,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates patch interaction model
virtual bool active() const;
//- Apply velocity correction
// Returns true if particle remains in same cell
virtual bool correct

View File

@ -103,46 +103,7 @@ public:
Istream& is,
patchInteractionData& pid
);
/* {
is.check
(
"Istream& operator>>"
"(Istream&, patchInteractionData&)"
);
const dictionaryEntry entry(dictionary::null, is);
pid.patchName_ = entry.keyword();
entry.lookup("type") >> pid.interactionTypeName_;
pid.e_ = entry.lookupOrDefault<scalar>("e", 1.0);
pid.mu_ = entry.lookupOrDefault<scalar>("mu", 0.0);
if
(
PatchInteractionModel<CloudType>::wordToInteractionType
(
pid.interactionTypeName_
)
== PatchInteractionModel<CloudType>::itOther)
{
FatalErrorIn
(
"friend Istream& operator>>"
"("
"Istream&, "
"patchInteractionData&"
")"
) << "Unknown patch interaction type "
<< pid.interactionTypeName_
<< ". Valid selections are:"
<< PatchInteractionModel<CloudType>::
interactionTypeNames_
<< endl << abort(FatalError);
}
return is;
}
*/};
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -104,6 +104,17 @@ Foam::PatchInteractionModel<CloudType>::wordToInteractionType
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
(
CloudType& owner
)
:
SubModelBase<CloudType>(owner),
UName_("unknown_UName")
{}
template<class CloudType>
Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
(
@ -112,10 +123,20 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs")),
UName_(coeffDict_.lookupOrDefault<word>("UName", "U"))
SubModelBase<CloudType>(owner, dict, type),
// UName_(this->coeffDict().lookupOrDefault<word>("UName", "U"))
UName_(this->coeffDict().lookup("UName"))
{}
template<class CloudType>
Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
(
const PatchInteractionModel<CloudType>& pim
)
:
SubModelBase<CloudType>(pim),
UName_(pim.UName_)
{}
@ -128,29 +149,6 @@ Foam::PatchInteractionModel<CloudType>::~PatchInteractionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType&
Foam::PatchInteractionModel<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::PatchInteractionModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const Foam::dictionary&
Foam::PatchInteractionModel<CloudType>::coeffDict() const
{
return coeffDict_;
}
template<class CloudType>
const Foam::word& Foam::PatchInteractionModel<CloudType>::UName() const
{
@ -158,6 +156,31 @@ const Foam::word& Foam::PatchInteractionModel<CloudType>::UName() const
}
template<class CloudType>
bool Foam::PatchInteractionModel<CloudType>::correct
(
typename CloudType::parcelType&,
const polyPatch&,
bool&,
const scalar,
const tetIndices&
) const
{
notImplemented
(
"bool Foam::PatchInteractionModel<CloudType>::correct"
"("
"typename CloudType::parcelType&, "
"const polyPatch&, "
"bool&, "
"const scalar, "
"const tetIndices& "
") const"
);
return false;
}
template<class CloudType>
void Foam::PatchInteractionModel<CloudType>::patchData
(

View File

@ -42,6 +42,7 @@ SourceFiles
#include "polyPatch.H"
#include "wallPolyPatch.H"
#include "tetIndices.H"
#include "SubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,6 +55,8 @@ namespace Foam
template<class CloudType>
class PatchInteractionModel
:
public SubModelBase<CloudType>
{
public:
@ -75,15 +78,6 @@ private:
// Private data
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
//- The coefficients dictionary
const dictionary coeffDict_;
//- Name of velocity field - default = "U"
const word UName_;
@ -109,6 +103,9 @@ public:
// Constructors
//- Construct null from owner
PatchInteractionModel(CloudType& owner);
//- Construct from components
PatchInteractionModel
(
@ -117,6 +114,18 @@ public:
const word& type
);
//- Construct copy
PatchInteractionModel(const PatchInteractionModel<CloudType>& pim);
//- Construct and return a clone
virtual autoPtr<PatchInteractionModel<CloudType> > clone() const
{
return autoPtr<PatchInteractionModel<CloudType> >
(
new PatchInteractionModel<CloudType>(*this)
);
}
//- Destructor
virtual ~PatchInteractionModel();
@ -132,15 +141,6 @@ public:
// Access
//- Return the owner cloud object
const CloudType& owner() const;
//- Return the dictionary
const dictionary& dict() const;
//- Return the coefficients dictionary
const dictionary& coeffDict() const;
//- Return name of velocity field
const word& UName() const;
@ -153,9 +153,6 @@ public:
//- Convert word to interaction result
static interactionType wordToInteractionType(const word& itWord);
//- Flag to indicate whether model activates patch interaction model
virtual bool active() const = 0;
//- Apply velocity correction
// Returns true if particle remains in same cell
virtual bool correct
@ -165,7 +162,7 @@ public:
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const = 0;
) const;
//- Calculate the patch normal and velocity to interact with,
// accounting for patch motion if required.

View File

@ -39,6 +39,14 @@ Foam::Rebound<CloudType>::Rebound
{}
template<class CloudType>
Foam::Rebound<CloudType>::Rebound(const Rebound<CloudType>& pim)
:
PatchInteractionModel<CloudType>(pim),
UFactor_(pim.UFactor_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -48,13 +56,6 @@ Foam::Rebound<CloudType>::~Rebound()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::Rebound<CloudType>::active() const
{
return true;
}
template<class CloudType>
bool Foam::Rebound<CloudType>::correct
(

View File

@ -62,19 +62,28 @@ public:
// Constructors
//- Construct from dictionary
//- Construct from dictionary
Rebound(const dictionary& dict, CloudType& cloud);
//- Construct copy
Rebound(const Rebound<CloudType>& pim);
//- Construct and return a clone
virtual autoPtr<PatchInteractionModel<CloudType> > clone() const
{
return autoPtr<PatchInteractionModel<CloudType> >
(
new Rebound<CloudType>(*this)
);
}
//- Destructor
virtual ~Rebound();
// Member Functions
//- Flag to indicate whether model activates patch interaction model
virtual bool active() const;
//- Apply velocity correction
// Returns true if particle remains in same cell
virtual bool correct

View File

@ -76,6 +76,19 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
}
template<class CloudType>
Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
(
const StandardWallInteraction<CloudType>& pim
)
:
PatchInteractionModel<CloudType>(pim),
interactionType_(pim.interactionType_),
e_(pim.e_),
mu_(pim.mu_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
@ -85,13 +98,6 @@ Foam::StandardWallInteraction<CloudType>::~StandardWallInteraction()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::StandardWallInteraction<CloudType>::active() const
{
return true;
}
template <class CloudType>
bool Foam::StandardWallInteraction<CloudType>::correct
(

View File

@ -85,6 +85,18 @@ public:
//- Construct from dictionary
StandardWallInteraction(const dictionary& dict, CloudType& cloud);
//- Construct copy from owner cloud and patch interaction model
StandardWallInteraction(const StandardWallInteraction<CloudType>& pim);
//- Construct and return a clone using supplied owner cloud
virtual autoPtr<PatchInteractionModel<CloudType> > clone() const
{
return autoPtr<PatchInteractionModel<CloudType> >
(
new StandardWallInteraction<CloudType>(*this)
);
}
//- Destructor
virtual ~StandardWallInteraction();
@ -92,9 +104,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates patch interaction model
virtual bool active() const;
//- Apply velocity correction
// Returns true if particle remains in same cell
virtual bool correct

View File

@ -30,7 +30,7 @@ License
template<class CloudType>
void Foam::NoPostProcessing<CloudType>::write()
{
// do nothing
// do nothing
}
@ -47,6 +47,16 @@ Foam::NoPostProcessing<CloudType>::NoPostProcessing
{}
template<class CloudType>
Foam::NoPostProcessing<CloudType>::NoPostProcessing
(
const NoPostProcessing<CloudType>& ppm
)
:
PostProcessingModel<CloudType>(ppm.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -70,7 +80,17 @@ void Foam::NoPostProcessing<CloudType>::postPatch
const label
)
{
// do nothing
// do nothing
}
template<class CloudType>
void Foam::NoPostProcessing<CloudType>::postFace
(
const typename CloudType::parcelType&
)
{
// do nothing
}

View File

@ -70,6 +70,18 @@ public:
//- Construct from components
NoPostProcessing(const dictionary&, CloudType&);
//- Construct copy
NoPostProcessing(const NoPostProcessing<CloudType>& ppm);
//- Construct and return a clone
virtual autoPtr<PostProcessingModel<CloudType> > clone() const
{
return autoPtr<PostProcessingModel<CloudType> >
(
new NoPostProcessing<CloudType>(*this)
);
}
//- Destructor
virtual ~NoPostProcessing();
@ -88,6 +100,9 @@ public:
const typename CloudType::parcelType& p,
const label patchI
);
//- Gather particle data when hit face
virtual void postFace(const typename CloudType::parcelType& p);
};

View File

@ -61,20 +61,20 @@ void Foam::PatchPostProcessing<CloudType>::write()
if (Pstream::master())
{
fileName outputDir;
fileName outputDir = this->owner().time().path();
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir =
mesh_.time().path()/".."/"postProcessing"/cloud::prefix/
outputDir/".."/"postProcessing"/cloud::prefix/
this->owner().name()/this->owner().time().timeName();
}
else
{
outputDir =
mesh_.time().path()/"postProcessing"/cloud::prefix/
outputDir/"postProcessing"/cloud::prefix/
this->owner().name()/this->owner().time().timeName();
}
@ -86,7 +86,7 @@ void Foam::PatchPostProcessing<CloudType>::write()
outputDir/patchNames_[patchI] + ".post",
IOstream::ASCII,
IOstream::currentVersion,
mesh_.time().writeCompression()
this->owner().time().writeCompression()
);
List<string> globalData;
@ -120,15 +120,15 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
)
:
PostProcessingModel<CloudType>(dict, owner, typeName),
mesh_(owner.mesh()),
maxStoredParcels_(readLabel(this->coeffDict().lookup("maxStoredParcels"))),
patchNames_(this->coeffDict().lookup("patches")),
patchData_(patchNames_.size()),
patchIds_(patchNames_.size())
{
const polyBoundaryMesh& bMesh = this->owner().mesh().boundaryMesh();
forAll(patchNames_, patchI)
{
const label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
const label id = bMesh.findPatchID(patchNames_[patchI]);
if (id < 0)
{
FatalErrorIn
@ -139,7 +139,7 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
"CloudType& owner"
")"
)<< "Requested patch " << patchNames_[patchI] << " not found" << nl
<< "Available patches are: " << mesh_.boundaryMesh().names() << nl
<< "Available patches are: " << bMesh.names() << nl
<< exit(FatalError);
}
patchIds_[patchI] = id;
@ -147,6 +147,20 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
}
template<class CloudType>
Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
(
const PatchPostProcessing<CloudType>& ppm
)
:
PostProcessingModel<CloudType>(ppm),
maxStoredParcels_(ppm.maxStoredParcels_),
patchNames_(ppm.patchNames_),
patchData_(ppm.patchData_),
patchIds_(ppm.patchIds_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -156,13 +170,6 @@ Foam::PatchPostProcessing<CloudType>::~PatchPostProcessing()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::PatchPostProcessing<CloudType>::active() const
{
return true;
}
template<class CloudType>
void Foam::PatchPostProcessing<CloudType>::postPatch
(
@ -180,4 +187,9 @@ void Foam::PatchPostProcessing<CloudType>::postPatch
}
template<class CloudType>
void Foam::PatchPostProcessing<CloudType>::postFace(const parcelType&)
{}
// ************************************************************************* //

View File

@ -55,9 +55,6 @@ class PatchPostProcessing
typedef typename CloudType::parcelType parcelType;
//- Reference to the mesh
const polyMesh& mesh_;
//- Maximum number of parcels to store
label maxStoredParcels_;
@ -96,6 +93,18 @@ public:
//- Construct from dictionary
PatchPostProcessing(const dictionary& dict, CloudType& owner);
//- Construct copy
PatchPostProcessing(const PatchPostProcessing<CloudType>& ppm);
//- Construct and return a clone
virtual autoPtr<PostProcessingModel<CloudType> > clone() const
{
return autoPtr<PostProcessingModel<CloudType> >
(
new PatchPostProcessing<CloudType>(*this)
);
}
//- Destructor
virtual ~PatchPostProcessing();
@ -105,9 +114,6 @@ public:
// Access
//- Return const access to the mesh
inline const polyMesh& mesh() const;
//- Return maximum number of parcels to store per patch
inline label maxStoredParcels() const;
@ -120,15 +126,11 @@ public:
// Evaluation
//- Flag to indicate whether model activates post-processing model
virtual bool active() const;
//- Gather post-processing info on patch
virtual void postPatch
(
const parcelType& p,
const label patchI
);
virtual void postPatch(const parcelType& p, const label patchI);
//- Gather particle data when hit face - not used
virtual void postFace(const parcelType& p);
};

View File

@ -23,13 +23,6 @@ License
\*---------------------------------------------------------------------------*/
template<class CloudType>
const Foam::polyMesh& Foam::PatchPostProcessing<CloudType>::mesh() const
{
return mesh_;
}
template<class CloudType>
Foam::label Foam::PatchPostProcessing<CloudType>::maxStoredParcels() const
{

View File

@ -25,14 +25,21 @@ License
#include "PostProcessingModel.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class CloudType>
void Foam::PostProcessingModel<CloudType>::write()
{
notImplemented("void Foam::PostProcessingModel<CloudType>::write()");
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PostProcessingModel<CloudType>::PostProcessingModel(CloudType& owner)
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null)
SubModelBase<CloudType>(owner)
{}
@ -44,9 +51,17 @@ Foam::PostProcessingModel<CloudType>::PostProcessingModel
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs"))
SubModelBase<CloudType>(owner, dict, type)
{}
template<class CloudType>
Foam::PostProcessingModel<CloudType>::PostProcessingModel
(
const PostProcessingModel<CloudType>& ppm
)
:
SubModelBase<CloudType>(ppm)
{}
@ -62,13 +77,47 @@ Foam::PostProcessingModel<CloudType>::~PostProcessingModel()
template<class CloudType>
void Foam::PostProcessingModel<CloudType>::post()
{
if (owner_.time().outputTime())
if (this->owner().time().outputTime())
{
this->write();
}
}
template<class CloudType>
void Foam::PostProcessingModel<CloudType>::postPatch
(
const typename CloudType::parcelType&,
const label
)
{
notImplemented
(
"void Foam::PostProcessingModel<CloudType>::postPatch"
"("
"const typename CloudType::parcelType&,"
"const label"
")"
);
}
template<class CloudType>
void Foam::PostProcessingModel<CloudType>::postFace
(
const typename CloudType::parcelType&
)
{
notImplemented
(
"void Foam::PostProcessingModel<CloudType>::postFace"
"("
"const typename CloudType::parcelType&"
")"
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PostProcessingModelNew.C"

View File

@ -39,6 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,25 +52,13 @@ namespace Foam
template<class CloudType>
class PostProcessingModel
:
public SubModelBase<CloudType>
{
// Private data
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
//- The coefficients dictionary
const dictionary coeffDict_;
protected:
// Protected Member Functions
//- Write post-processing info
virtual void write() = 0;
virtual void write();
public:
@ -104,6 +93,18 @@ public:
const word& type
);
//- Construct copy
PostProcessingModel(const PostProcessingModel<CloudType>& ppm);
//- Construct and return a clone
virtual autoPtr<PostProcessingModel<CloudType> > clone() const
{
return autoPtr<PostProcessingModel<CloudType> >
(
new PostProcessingModel<CloudType>(*this)
);
}
//- Destructor
virtual ~PostProcessingModel();
@ -119,35 +120,20 @@ public:
// Member Functions
// Access
//- Return the owner cloud dictionary
inline const dictionary& dict() const;
//- 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 coefficients dictionary
inline const dictionary& coeffDict() const;
// Evaluation
//- Main post-processing function
virtual void post();
//- Flag to indicate whether model activates post-processing model
virtual bool active() const = 0;
//- Gather post-processing info on patch
virtual void postPatch
(
const typename CloudType::parcelType& p,
const label patchI
) = 0;
);
//- Gather post-processing info on a face
virtual void postFace(const typename CloudType::parcelType& p);
};
@ -177,10 +163,6 @@ public:
add##SS##CloudType##ParcelType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PostProcessingModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository

View File

@ -1,54 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
template<class CloudType>
const Foam::dictionary& Foam::PostProcessingModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const CloudType& Foam::PostProcessingModel<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
CloudType& Foam::PostProcessingModel<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::PostProcessingModel<CloudType>::coeffDict() const
{
return coeffDict_;
}
// ************************************************************************* //

View File

@ -40,6 +40,16 @@ Foam::NoSurfaceFilm<CloudType>::NoSurfaceFilm
{}
template<class CloudType>
Foam::NoSurfaceFilm<CloudType>::NoSurfaceFilm
(
const NoSurfaceFilm<CloudType>& sfm
)
:
SurfaceFilmModel<CloudType>(sfm.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -67,13 +67,20 @@ public:
// Constructors
//- Construct from components
NoSurfaceFilm
(
const dictionary&,
CloudType&,
const dimensionedVector&
);
//- Construct from dictionary
NoSurfaceFilm(const dictionary&, CloudType&, const dimensionedVector&);
//- Construct copy
NoSurfaceFilm(const NoSurfaceFilm<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<SurfaceFilmModel<CloudType> > clone() const
{
return autoPtr<SurfaceFilmModel<CloudType> >
(
new NoSurfaceFilm<CloudType>(*this)
);
}
//- Destructor

View File

@ -35,11 +35,8 @@ using namespace Foam::constant;
template<class CloudType>
Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel(CloudType& owner)
:
dict_(dictionary::null),
owner_(owner),
SubModelBase<CloudType>(owner),
g_(dimensionedVector("zero", dimAcceleration, vector::zero)),
coeffDict_(dictionary::null),
active_(false),
massParcelPatch_(0),
diameterParcelPatch_(0),
UFilmPatch_(0),
@ -58,11 +55,8 @@ Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel
const word& type
)
:
dict_(dict),
owner_(owner),
SubModelBase<CloudType>(owner, dict, type),
g_(g),
coeffDict_(dict.subDict(type + "Coeffs")),
active_(true),
massParcelPatch_(0),
diameterParcelPatch_(0),
UFilmPatch_(0),
@ -72,6 +66,23 @@ Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel
{}
template<class CloudType>
Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel
(
const SurfaceFilmModel<CloudType>& sfm
)
:
SubModelBase<CloudType>(sfm),
g_(sfm.g_),
massParcelPatch_(sfm.massParcelPatch_),
diameterParcelPatch_(sfm.diameterParcelPatch_),
UFilmPatch_(sfm.UFilmPatch_),
rhoFilmPatch_(sfm.rhoFilmPatch_),
nParcelsTransferred_(sfm.nParcelsTransferred_),
nParcelsInjected_(sfm.nParcelsInjected_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -81,11 +92,31 @@ Foam::SurfaceFilmModel<CloudType>::~SurfaceFilmModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::SurfaceFilmModel<CloudType>::transferParcel
(
const parcelType& p,
const label patchI
)
{
notImplemented
(
"bool Foam::SurfaceFilmModel<CloudType>::transferParcel"
"("
"const parcelType&, "
"const label"
")"
);
return false;
}
template<class CloudType>
template<class TrackData>
void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
{
if (!active_)
if (!this->active())
{
return;
}
@ -201,6 +232,13 @@ void Foam::SurfaceFilmModel<CloudType>::setParcelProperties
}
template<class CloudType>
void Foam::SurfaceFilmModel<CloudType>::info(Ostream& os) const
{
// do nothing
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "SurfaceFilmModelNew.C"

View File

@ -39,6 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,6 +60,8 @@ class mapDistribute;
template<class CloudType>
class SurfaceFilmModel
:
public SubModelBase<CloudType>
{
protected:
@ -67,21 +70,9 @@ protected:
//- Convenience typedef to the cloud's parcel type
typedef typename CloudType::parcelType parcelType;
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
//- Gravitational acceleration constant
const dimensionedVector& g_;
//- The coefficients dictionary
const dictionary coeffDict_;
//- Active flag
bool active_;
// Cached injector fields per film patch
@ -150,7 +141,7 @@ public:
//- Construct null from owner
SurfaceFilmModel(CloudType& owner);
//- Construct from dictionary
//- Construct from components
SurfaceFilmModel
(
const dictionary& dict,
@ -159,6 +150,18 @@ public:
const word& type
);
//- Construct copy
SurfaceFilmModel(const SurfaceFilmModel<CloudType>& sfm);
//- Construct and return a clone
virtual autoPtr<SurfaceFilmModel<CloudType> > clone() const
{
return autoPtr<SurfaceFilmModel<CloudType> >
(
new SurfaceFilmModel<CloudType>(*this)
);
}
//- Destructor
virtual ~SurfaceFilmModel();
@ -177,21 +180,9 @@ public:
// Access
//- Return the owner cloud dictionary
inline const dictionary& dict() const;
//- 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 gravitational acceleration constant
inline const dimensionedVector& g() const;
//- Return the coefficients dictionary
inline const dictionary& coeffDict() const;
//- Return const access to the number of parcels transferred to the
// film model
inline label nParcelsTransferred() const;
@ -211,16 +202,13 @@ public:
// Member Functions
//- Flag to indicate whether model activates the surface film model
virtual bool active() const = 0;
//- Transfer parcel from cloud to surface film
// Returns true if parcel is to be transferred
virtual bool transferParcel
(
const parcelType& p,
const label patchI
) = 0;
);
//- Inject parcels into the cloud
template<class TrackData>
@ -230,7 +218,7 @@ public:
// I-O
//- Write surface film info to stream
virtual void info(Ostream& os) const = 0;
virtual void info(Ostream& os) const;
};

View File

@ -27,27 +27,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const Foam::dictionary& Foam::SurfaceFilmModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const CloudType& Foam::SurfaceFilmModel<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
CloudType& Foam::SurfaceFilmModel<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
const Foam::dimensionedVector& Foam::SurfaceFilmModel<CloudType>::g() const
{
@ -55,13 +34,6 @@ const Foam::dimensionedVector& Foam::SurfaceFilmModel<CloudType>::g() const
}
template<class CloudType>
const Foam::dictionary& Foam::SurfaceFilmModel<CloudType>::coeffDict() const
{
return coeffDict_;
}
template<class CloudType>
Foam::label& Foam::SurfaceFilmModel<CloudType>::nParcelsTransferred()
{

View File

@ -27,6 +27,15 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CompositionModel<CloudType>::CompositionModel(CloudType& owner)
:
SubModelBase<CloudType>(owner),
thermo_(owner.thermo()),
phaseProps_()
{}
template<class CloudType>
Foam::CompositionModel<CloudType>::CompositionModel
(
@ -35,13 +44,11 @@ Foam::CompositionModel<CloudType>::CompositionModel
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs")),
SubModelBase<CloudType>(owner, dict, type),
thermo_(owner.thermo()),
phaseProps_
(
coeffDict_.lookup("phases"),
this->coeffDict().lookup("phases"),
thermo_.carrier().species(),
thermo_.liquids().components(),
thermo_.solids().components()
@ -49,6 +56,18 @@ Foam::CompositionModel<CloudType>::CompositionModel
{}
template<class CloudType>
Foam::CompositionModel<CloudType>::CompositionModel
(
const CompositionModel<CloudType>& cm
)
:
SubModelBase<CloudType>(cm),
thermo_(cm.thermo_),
phaseProps_(cm.phaseProps_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -58,27 +77,6 @@ Foam::CompositionModel<CloudType>::~CompositionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::CompositionModel<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::CompositionModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const Foam::dictionary& Foam::CompositionModel<CloudType>::coeffDict() const
{
return coeffDict_;
}
template<class CloudType>
const Foam::SLGThermo& Foam::CompositionModel<CloudType>::thermo() const
{
@ -328,6 +326,55 @@ Foam::scalarField Foam::CompositionModel<CloudType>::X
}
template<class CloudType>
const Foam::scalarField& Foam::CompositionModel<CloudType>::YMixture0() const
{
notImplemented
(
"const scalarField& Foam::CompositionModel<CloudType>::YMixture0() "
"const"
);
return scalarField::null();
}
template<class CloudType>
Foam::label Foam::CompositionModel<CloudType>::idGas() const
{
notImplemented
(
"Foam::label Foam::CompositionModel<CloudType>::idGas() const"
);
return -1;
}
template<class CloudType>
Foam::label Foam::CompositionModel<CloudType>::idLiquid() const
{
notImplemented
(
"Foam::label Foam::CompositionModel<CloudType>::idLiquid() const"
);
return -1;
}
template<class CloudType>
Foam::label Foam::CompositionModel<CloudType>::idSolid() const
{
notImplemented
(
"Foam::label Foam::CompositionModel<CloudType>::idSolid() const"
);
return -1;
}
template<class CloudType>
Foam::scalar Foam::CompositionModel<CloudType>::H
(

View File

@ -58,18 +58,10 @@ namespace Foam
template<class CloudType>
class CompositionModel
:
public SubModelBase<CloudType>
{
// Private data
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner injection class
CloudType& owner_;
//- The coefficients dictionary
const dictionary& coeffDict_;
//- Reference to the thermo database
const SLGThermo& thermo_;
@ -98,6 +90,9 @@ public:
// Constructors
//- Construct null from owner
CompositionModel(CloudType& owner);
//- Construct from dictionary
CompositionModel
(
@ -106,6 +101,18 @@ public:
const word& type
);
//- Construct copy
CompositionModel(const CompositionModel<CloudType>& cm);
//- Construct and return a clone
virtual autoPtr<CompositionModel<CloudType> > clone() const
{
return autoPtr<CompositionModel<CloudType> >
(
new CompositionModel<CloudType>(*this)
);
}
//- Destructor
virtual ~CompositionModel();
@ -123,15 +130,6 @@ public:
// Access
//- Return the cloud object
const CloudType& owner() const;
//- Return the cloud dictionary
const dictionary& dict() const;
//- Return the coefficients dictionary
const dictionary& coeffDict() const;
//- Return the thermo database
const SLGThermo& thermo() const;
@ -197,19 +195,19 @@ public:
//- Return the list of mixture mass fractions
// If only 1 phase, return component fractions of that phase
virtual const scalarField& YMixture0() const = 0;
virtual const scalarField& YMixture0() const;
// Indices of gas, liquid and solid phases in phase properties
// list - returns -1 if not applicable
//- Gas id
virtual label idGas() const = 0;
virtual label idGas() const;
//- Liquid id
virtual label idLiquid() const = 0;
virtual label idLiquid() const;
//- Solid id
virtual label idSolid() const = 0;
virtual label idSolid() const;
// Evaluation

View File

@ -135,6 +135,20 @@ Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction
}
template<class CloudType>
Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction
(
const SingleMixtureFraction<CloudType>& cm
)
:
CompositionModel<CloudType>(cm),
idGas_(cm.idGas_),
idLiquid_(cm.idLiquid_),
idSolid_(cm.idSolid_),
YMixture0_(cm.YMixture0_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -89,6 +89,18 @@ public:
//- Construct from dictionary
SingleMixtureFraction(const dictionary& dict, CloudType& owner);
//- Construct copy
SingleMixtureFraction(const SingleMixtureFraction<CloudType>& cm);
//- Construct and return a clone
virtual autoPtr<CompositionModel<CloudType> > clone() const
{
return autoPtr<CompositionModel<CloudType> >
(
new SingleMixtureFraction<CloudType>(*this)
);
}
//- Destructor
virtual ~SingleMixtureFraction();

View File

@ -91,6 +91,19 @@ Foam::SinglePhaseMixture<CloudType>::SinglePhaseMixture
}
template<class CloudType>
Foam::SinglePhaseMixture<CloudType>::SinglePhaseMixture
(
const SinglePhaseMixture<CloudType>& cm
)
:
CompositionModel<CloudType>(cm),
idGas_(cm.idGas_),
idLiquid_(cm.idLiquid_),
idSolid_(cm.idSolid_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -83,6 +83,18 @@ public:
//- Construct from dictionary
SinglePhaseMixture(const dictionary& dict, CloudType& owner);
//- Construct copy
SinglePhaseMixture(const SinglePhaseMixture<CloudType>& cm);
//- Construct and return a clone
virtual autoPtr<CompositionModel<CloudType> > clone() const
{
return autoPtr<CompositionModel<CloudType> >
(
new SinglePhaseMixture<CloudType>(*this)
);
}
//- Destructor
virtual ~SinglePhaseMixture();

View File

@ -122,6 +122,23 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
}
template<class CloudType>
Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
(
const ReactingLookupTableInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
inputFileName_(im.inputFileName_),
duration_(im.duration_),
nParcelsPerSecond_(im.nParcelsPerSecond_),
injectors_(im.injectors_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -131,13 +148,6 @@ Foam::ReactingLookupTableInjection<CloudType>::~ReactingLookupTableInjection()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ReactingLookupTableInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::timeEnd() const
{

View File

@ -99,18 +99,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -128,6 +120,21 @@ public:
CloudType& owner
);
//- Construct copy
ReactingLookupTableInjection
(
const ReactingLookupTableInjection<CloudType>& im
);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new ReactingLookupTableInjection<CloudType>(*this)
);
}
//- Destructor
virtual ~ReactingLookupTableInjection();
@ -135,9 +142,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;

View File

@ -106,6 +106,20 @@ Foam::LiquidEvaporation<CloudType>::LiquidEvaporation
}
template<class CloudType>
Foam::LiquidEvaporation<CloudType>::LiquidEvaporation
(
const LiquidEvaporation<CloudType>& pcm
)
:
PhaseChangeModel<CloudType>(pcm),
liquids_(pcm.owner().thermo().liquids()),
activeLiquids_(pcm.activeLiquids_),
liqToCarrierMap_(pcm.liqToCarrierMap_),
liqToLiqMap_(pcm.liqToLiqMap_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
@ -115,13 +129,6 @@ Foam::LiquidEvaporation<CloudType>::~LiquidEvaporation()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::LiquidEvaporation<CloudType>::active() const
{
return true;
}
template<class CloudType>
void Foam::LiquidEvaporation<CloudType>::calculate
(

View File

@ -84,11 +84,19 @@ public:
// Constructors
//- Construct from dictionary
LiquidEvaporation
(
const dictionary& dict,
CloudType& cloud
);
LiquidEvaporation(const dictionary& dict, CloudType& cloud);
//- Construct copy
LiquidEvaporation(const LiquidEvaporation<CloudType>& pcm);
//- Construct and return a clone
virtual autoPtr<PhaseChangeModel<CloudType> > clone() const
{
return autoPtr<PhaseChangeModel<CloudType> >
(
new LiquidEvaporation<CloudType>(*this)
);
}
//- Destructor
@ -97,9 +105,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates phase change model
virtual bool active() const;
//- Update model
virtual void calculate
(

View File

@ -38,6 +38,16 @@ Foam::NoPhaseChange<CloudType>::NoPhaseChange
{}
template<class CloudType>
Foam::NoPhaseChange<CloudType>::NoPhaseChange
(
const NoPhaseChange<CloudType>& pcm
)
:
PhaseChangeModel<CloudType>(pcm.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>

View File

@ -58,6 +58,18 @@ public:
//- Construct from dictionary
NoPhaseChange(const dictionary&, CloudType&);
//- Construct copy
NoPhaseChange(const NoPhaseChange<CloudType>& pcm);
//- Construct and return a clone
virtual autoPtr<PhaseChangeModel<CloudType> > clone() const
{
return autoPtr<PhaseChangeModel<CloudType> >
(
new NoPhaseChange<CloudType>(*this)
);
}
//- Destructor
virtual ~NoPhaseChange();

View File

@ -75,13 +75,22 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
CloudType& owner
)
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null),
SubModelBase<CloudType>(owner),
enthalpyTransfer_(etLatentHeat)
{}
template<class CloudType>
Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
(
const PhaseChangeModel<CloudType>& pcm
)
:
SubModelBase<CloudType>(pcm),
enthalpyTransfer_(pcm.enthalpyTransfer_)
{}
template<class CloudType>
Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
(
@ -90,12 +99,10 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs")),
SubModelBase<CloudType>(owner, dict, type),
enthalpyTransfer_
(
wordToEnthalpyTransfer(coeffDict_.lookup("enthalpyTransfer"))
wordToEnthalpyTransfer(this->coeffDict().lookup("enthalpyTransfer"))
)
{}
@ -108,26 +115,6 @@ Foam::PhaseChangeModel<CloudType>::~PhaseChangeModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::PhaseChangeModel<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::PhaseChangeModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const Foam::dictionary& Foam::PhaseChangeModel<CloudType>::coeffDict() const
{
return coeffDict_;
}
template<class CloudType>
const typename Foam::PhaseChangeModel<CloudType>::enthalpyTransferType&
@ -137,6 +124,38 @@ Foam::PhaseChangeModel<CloudType>::enthalpyTransfer() const
}
template<class CloudType>
void Foam::PhaseChangeModel<CloudType>::calculate
(
const scalar,
const label,
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
scalarField&
) const
{
notImplemented
(
"void Foam::PhaseChangeModel<CloudType>::calculate"
"("
"const scalar, "
"const label, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"scalarField&"
") const"
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PhaseChangeModelNew.C"

View File

@ -39,6 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,6 +52,8 @@ namespace Foam
template<class CloudType>
class PhaseChangeModel
:
public SubModelBase<CloudType>
{
public:
@ -71,15 +74,6 @@ protected:
// Protected data
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
//- The coefficient dictionary
const dictionary coeffDict_;
//- Enthalpy transfer type enumeration
enthalpyTransferType enthalpyTransfer_;
@ -125,6 +119,18 @@ public:
const word& type
);
//- Construct copy
PhaseChangeModel(const PhaseChangeModel<CloudType>& pcm);
//- Construct and return a clone
virtual autoPtr<PhaseChangeModel<CloudType> > clone() const
{
return autoPtr<PhaseChangeModel<CloudType> >
(
new PhaseChangeModel<CloudType>(*this)
);
}
//- Destructor
virtual ~PhaseChangeModel();
@ -140,24 +146,12 @@ public:
// Access
//- Return the owner cloud object
const CloudType& owner() const;
//- Return the cloud dictionary
const dictionary& dict() const;
//- Return the coefficient dictionary
const dictionary& coeffDict() const;
//- Return the enthalpy transfer type enumeration
const enthalpyTransferType& enthalpyTransfer() const;
// Member Functions
//- Flag to indicate whether model activates phase change model
virtual bool active() const = 0;
//- Update model
virtual void calculate
(
@ -170,7 +164,7 @@ public:
const scalar Ts,
const scalar pc,
scalarField& dMassPC
) const = 0;
) const;
};

View File

@ -43,6 +43,18 @@ Foam::ConstantRateDevolatilisation<CloudType>::ConstantRateDevolatilisation
{}
template <class CloudType>
Foam::ConstantRateDevolatilisation<CloudType>::ConstantRateDevolatilisation
(
const ConstantRateDevolatilisation<CloudType>& dm
)
:
DevolatilisationModel<CloudType>(dm),
A0_(dm.A0_),
volatileResidualCoeff_(dm.volatileResidualCoeff_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
@ -52,13 +64,6 @@ Foam::ConstantRateDevolatilisation<CloudType>::~ConstantRateDevolatilisation()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ConstantRateDevolatilisation<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::ConstantRateDevolatilisation<CloudType>::calculate
(

View File

@ -70,12 +70,23 @@ public:
// Constructors
//- Construct from dictionary
ConstantRateDevolatilisation(const dictionary& dict, CloudType& owner);
//- Construct copy
ConstantRateDevolatilisation
(
const dictionary& dict,
CloudType& owner
const ConstantRateDevolatilisation<CloudType>& dm
);
//- Construct and return a clone
virtual autoPtr<DevolatilisationModel<CloudType> > clone() const
{
return autoPtr<DevolatilisationModel<CloudType> >
(
new ConstantRateDevolatilisation<CloudType>(*this)
);
}
//- Destructor
virtual ~ConstantRateDevolatilisation();
@ -83,9 +94,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates devolatilisation model
virtual bool active() const;
//- Update model
virtual scalar calculate
(

View File

@ -33,9 +33,7 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
CloudType& owner
)
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null)
SubModelBase<CloudType>(owner)
{}
@ -47,9 +45,17 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs"))
SubModelBase<CloudType>(owner, dict, type)
{}
template<class CloudType>
Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
(
const DevolatilisationModel<CloudType>& dm
)
:
SubModelBase<CloudType>(dm)
{}
@ -61,25 +67,34 @@ Foam::DevolatilisationModel<CloudType>::~DevolatilisationModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::DevolatilisationModel<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::DevolatilisationModel<CloudType>::dict() const
Foam::scalar Foam::DevolatilisationModel<CloudType>::calculate
(
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
bool&
) const
{
return dict_;
}
notImplemented
(
"void Foam::DevolatilisationModel<CloudType>::calculate"
"("
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"bool&, "
") const"
);
template<class CloudType>
const Foam::dictionary&
Foam::DevolatilisationModel<CloudType>::coeffDict() const
{
return coeffDict_;
return 0.0;
}

View File

@ -39,6 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,21 +52,9 @@ namespace Foam
template<class CloudType>
class DevolatilisationModel
:
public SubModelBase<CloudType>
{
protected:
// Protected data
//- The cloud dictionary
const dictionary& dict_;
//- Reference to the owner cloud class
CloudType& owner_;
//- The coefficient dictionary
const dictionary coeffDict_;
public:
//- Runtime type information
@ -98,6 +87,18 @@ public:
const word& type
);
//- Construct copy
DevolatilisationModel(const DevolatilisationModel<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DevolatilisationModel<CloudType> > clone() const
{
return autoPtr<DevolatilisationModel<CloudType> >
(
new DevolatilisationModel<CloudType>(*this)
);
}
//- Destructor
virtual ~DevolatilisationModel();
@ -111,23 +112,8 @@ public:
);
// Access
//- Return the owner cloud object
const CloudType& owner() const;
//- Return the cloud dictionary
const dictionary& dict() const;
//- Return the coefficient dictionary
const dictionary& coeffDict() const;
// Member Functions
//- Flag to indicate whether model activates devolatilisation model
virtual bool active() const = 0;
//- Update model
virtual scalar calculate
(
@ -138,7 +124,7 @@ public:
const scalar YVolatile0,
const scalar YVolatile,
bool& canCombust
) const = 0;
) const;
};

View File

@ -38,6 +38,16 @@ Foam::NoDevolatilisation<CloudType>::NoDevolatilisation
{}
template<class CloudType>
Foam::NoDevolatilisation<CloudType>::NoDevolatilisation
(
const NoDevolatilisation<CloudType>& dm
)
:
DevolatilisationModel<CloudType>(dm.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
@ -69,7 +79,6 @@ Foam::scalar Foam::NoDevolatilisation<CloudType>::calculate
// Model does not stop combustion taking place
canCombust = true;
// Nothing more to do...
return 0.0;
}

View File

@ -59,6 +59,18 @@ public:
//- Construct from dictionary
NoDevolatilisation(const dictionary&, CloudType& owner);
//- Construct copy
NoDevolatilisation(const NoDevolatilisation<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DevolatilisationModel<CloudType> > clone() const
{
return autoPtr<DevolatilisationModel<CloudType> >
(
new NoDevolatilisation<CloudType>(*this)
);
}
//- Destructor
virtual ~NoDevolatilisation();

View File

@ -45,6 +45,20 @@ SingleKineticRateDevolatilisation
{}
template<class CloudType>
Foam::SingleKineticRateDevolatilisation<CloudType>::
SingleKineticRateDevolatilisation
(
const SingleKineticRateDevolatilisation<CloudType>& dm
)
:
DevolatilisationModel<CloudType>(dm),
A1_(dm.A1_),
E_(dm.E_),
volatileResidualCoeff_(dm.volatileResidualCoeff_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
@ -55,13 +69,6 @@ Foam::SingleKineticRateDevolatilisation<CloudType>::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::SingleKineticRateDevolatilisation<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::SingleKineticRateDevolatilisation<CloudType>::calculate
(

View File

@ -78,6 +78,21 @@ public:
CloudType& owner
);
//- Construct copy
SingleKineticRateDevolatilisation
(
const SingleKineticRateDevolatilisation<CloudType>& dm
);
//- Construct and return a clone
virtual autoPtr<DevolatilisationModel<CloudType> > clone() const
{
return autoPtr<DevolatilisationModel<CloudType> >
(
new SingleKineticRateDevolatilisation<CloudType>(*this)
);
}
//- Destructor
virtual ~SingleKineticRateDevolatilisation();
@ -85,9 +100,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates devolatilisation model
virtual bool active() const;
//- Update model
virtual scalar calculate
(

View File

@ -125,6 +125,24 @@ ReactingMultiphaseLookupTableInjection
}
template<class CloudType>
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
ReactingMultiphaseLookupTableInjection
(
const ReactingMultiphaseLookupTableInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
inputFileName_(im.inputFileName_),
duration_(im.duration_),
nParcelsPerSecond_(im.nParcelsPerSecond_),
injectors_(im.injectors_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
@ -135,13 +153,6 @@ Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const

View File

@ -102,18 +102,10 @@ protected:
// Protected Member Functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
virtual label parcelsToInject(const scalar time0, const scalar time1);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
virtual scalar volumeToInject(const scalar time0, const scalar time1);
public:
@ -131,6 +123,21 @@ public:
CloudType& owner
);
//- Construct copy
ReactingMultiphaseLookupTableInjection
(
const ReactingMultiphaseLookupTableInjection<CloudType>& im
);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new ReactingMultiphaseLookupTableInjection<CloudType>(*this)
);
}
//- Destructor
virtual ~ReactingMultiphaseLookupTableInjection();
@ -138,9 +145,6 @@ public:
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;

View File

@ -27,7 +27,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class CloudType>
template<class CloudType>
Foam::NoSurfaceReaction<CloudType>::NoSurfaceReaction
(
const dictionary&,
@ -38,6 +38,16 @@ Foam::NoSurfaceReaction<CloudType>::NoSurfaceReaction
{}
template<class CloudType>
Foam::NoSurfaceReaction<CloudType>::NoSurfaceReaction
(
const NoSurfaceReaction<CloudType>& srm
)
:
SurfaceReactionModel<CloudType>(srm.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>

View File

@ -56,11 +56,19 @@ public:
// Constructors
//- Construct from dictionary
NoSurfaceReaction
(
const dictionary& dict,
CloudType& owner
);
NoSurfaceReaction(const dictionary& dict, CloudType& owner);
//- Construct copy
NoSurfaceReaction(const NoSurfaceReaction<CloudType>& srm);
//- Construct and return a clone
virtual autoPtr<SurfaceReactionModel<CloudType> > clone() const
{
return autoPtr<SurfaceReactionModel<CloudType> >
(
new NoSurfaceReaction<CloudType>(*this)
);
}
//- Destructor

View File

@ -33,9 +33,7 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
CloudType& owner
)
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null)
SubModelBase<CloudType>(owner)
{}
@ -47,9 +45,17 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
const word& type
)
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs"))
SubModelBase<CloudType>(owner, dict, type)
{}
template<class CloudType>
Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
(
const SurfaceReactionModel<CloudType>& srm
)
:
SubModelBase<CloudType>(srm)
{}
@ -63,23 +69,52 @@ Foam::SurfaceReactionModel<CloudType>::~SurfaceReactionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::SurfaceReactionModel<CloudType>::owner() const
Foam::scalar Foam::SurfaceReactionModel<CloudType>::calculate
(
const scalar,
const label,
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
const scalarField&,
const scalarField&,
const scalarField&,
const scalarField&,
const scalar,
scalarField&,
scalarField&,
scalarField&,
scalarField&
) const
{
return owner_;
}
notImplemented
(
"Foam::scalar Foam::SurfaceReactionModel<CloudType>::calculate"
"("
"const scalar, "
"const label, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalarField&, "
"const scalarField&, "
"const scalarField&, "
"const scalarField&, "
"const scalar, "
"scalarField&, "
"scalarField&, "
"scalarField&, "
"scalarField&"
") const"
);
template<class CloudType>
const Foam::dictionary& Foam::SurfaceReactionModel<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const Foam::dictionary& Foam::SurfaceReactionModel<CloudType>::coeffDict() const
{
return coeffDict_;
return 0.0;
}

View File

@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,19 +53,9 @@ namespace Foam
template<class CloudType>
class SurfaceReactionModel
:
public SubModelBase<CloudType>
{
// 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
@ -99,6 +89,18 @@ public:
const word& type
);
//- Construct copy
SurfaceReactionModel(const SurfaceReactionModel<CloudType>& srm);
//- Construct and return a clone
virtual autoPtr<SurfaceReactionModel<CloudType> > clone() const
{
return autoPtr<SurfaceReactionModel<CloudType> >
(
new SurfaceReactionModel<CloudType>(*this)
);
}
//- Destructor
virtual ~SurfaceReactionModel();
@ -112,23 +114,8 @@ public:
);
// Access
//- Return the owner cloud object
const CloudType& owner() const;
//- Return the cloud dictionary
const dictionary& dict() const;
//- Return the coefficients dictionary
const dictionary& coeffDict() const;
// Member Functions
//- Flag to indicate whether model activates surface reaction model
virtual bool active() const = 0;
//- Update surface reactions
// Returns the heat of reaction
virtual scalar calculate
@ -150,7 +137,7 @@ public:
scalarField& dMassLiquid,
scalarField& dMassSolid,
scalarField& dMassSRCarrier
) const = 0;
) const;
};

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 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 "SubModelBase.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SubModelBase<CloudType>::SubModelBase(CloudType& owner)
:
owner_(owner),
dict_(dictionary::null),
coeffDict_(dictionary::null)
{}
template<class CloudType>
Foam::SubModelBase<CloudType>::SubModelBase
(
CloudType& owner,
const dictionary& dict,
const word& name
)
:
owner_(owner),
dict_(dict),
coeffDict_(dict.subDict(name + "Coeffs"))
{}
template<class CloudType>
Foam::SubModelBase<CloudType>::SubModelBase(const SubModelBase<CloudType>& smb)
:
owner_(smb.owner_),
dict_(smb.dict_),
coeffDict_(smb.coeffDict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SubModelBase<CloudType>::~SubModelBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::SubModelBase<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::SubModelBase<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const Foam::dictionary& Foam::SubModelBase<CloudType>::coeffDict() const
{
return coeffDict_;
}
template<class CloudType>
CloudType& Foam::SubModelBase<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
bool Foam::SubModelBase<CloudType>::active() const
{
return true;
}
template<class CloudType>
void Foam::SubModelBase<CloudType>::cacheFields(const bool)
{
// do nothing
}
template<class CloudType>
void Foam::SubModelBase<CloudType>::write(Ostream& os) const
{
os.writeKeyword("owner") << owner_.name() << token::END_STATEMENT << nl;
// not writing complete cloud dictionary, only coeffs
// os << dict_;
os << coeffDict_;
}
// ************************************************************************* //

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 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::SubModelBase
Description
Base class for cloud sub-models
SourceFiles
SubModelBase.C
\*---------------------------------------------------------------------------*/
#ifndef SubModelBase_H
#define SubModelBase_H
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class SubModelBase;
/*---------------------------------------------------------------------------*\
Class SubModelBase Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class SubModelBase
{
protected:
// Protected Data
//- Reference to the cloud
CloudType& owner_;
//- Reference to the cloud dictionary
const dictionary& dict_;
//- Reference to the coefficients dictionary
const dictionary& coeffDict_;
public:
// Constructors
//- Construct null from owner cloud
SubModelBase(CloudType& owner);
//- Construct from owner cloud, dictionary, and model type name
SubModelBase
(
CloudType& owner,
const dictionary& dict,
const word& name
);
//- Construct as copy
SubModelBase(const SubModelBase<CloudType>& smb);
//- Destructor
virtual ~SubModelBase();
// Member Functions
// Access
//- Return const access to the cloud dictionary
const dictionary& dict() const;
//- Return const access to the owner cloud
const CloudType& owner() const;
//- Return const access to the coefficients dictionary
const dictionary& coeffDict() const;
//- Return the model 'active' status - default active = true
virtual bool active() const;
//- Cache dependant sub-model fields
virtual void cacheFields(const bool store);
// Edit
//- Return non-const access to the owner cloud for manipulation
CloudType& owner();
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "SubModelBase.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More