mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added runtime selectable pair function add renamed
DeterministicPairForce to PairCollision. Moved force model details to SpringSliderDashpot class and reading from file at runtime.
This commit is contained in:
@ -35,7 +35,7 @@ void Foam::DirectInteractionList<ParticleType>::buildDirectInteractionList
|
||||
bool pointPointListBuild
|
||||
)
|
||||
{
|
||||
Info<< nl << "Building list of direct interaction neighbours" << endl;
|
||||
Info<< " Building list of direct interaction neighbours" << endl;
|
||||
|
||||
const polyMesh& mesh(il_.mesh());
|
||||
|
||||
@ -43,7 +43,7 @@ void Foam::DirectInteractionList<ParticleType>::buildDirectInteractionList
|
||||
|
||||
if (pointPointListBuild)
|
||||
{
|
||||
Info<< tab << "Point-Point direct interaction list build." << endl;
|
||||
Info<< " Point-Point direct interaction list build." << endl;
|
||||
|
||||
label pointJIndex;
|
||||
|
||||
@ -116,7 +116,7 @@ void Foam::DirectInteractionList<ParticleType>::buildDirectInteractionList
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< tab << "Point-Face, Edge-Edge direct interaction list build."
|
||||
Info<< " Point-Face, Edge-Edge direct interaction list build."
|
||||
<< endl;
|
||||
|
||||
forAll(mesh.points(), p)
|
||||
@ -319,8 +319,7 @@ Foam::DirectInteractionList<ParticleType>::DirectInteractionList
|
||||
}
|
||||
else if ((*this).size() == 1)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Single cell mesh, no direct interaction lists required."
|
||||
Info<< " Single cell mesh, no direct interaction lists required."
|
||||
<< endl;
|
||||
|
||||
(*this)[0].setSize(0);
|
||||
@ -337,7 +336,7 @@ Foam::DirectInteractionList<ParticleType>::DirectInteractionList
|
||||
labelListList(il.mesh().nCells()),
|
||||
il_(il)
|
||||
{
|
||||
Info<< "Read DirectInteractionList from disk not implemented" << endl;
|
||||
Info<< " Read DirectInteractionList from disk not implemented" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ Foam::scalar Foam::InteractionLists<ParticleType>::transTol = 1e-12;
|
||||
template<class ParticleType>
|
||||
void Foam::InteractionLists<ParticleType>::buildCellReferralLists()
|
||||
{
|
||||
Info<< nl << "Determining particle referring schedule" << endl;
|
||||
Info<< " Determining particle referring schedule" << endl;
|
||||
|
||||
const ReferredCellList<ParticleType>& refIntL(ril());
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ void Foam::ReferredCellList<ParticleType>::buildReferredCellList
|
||||
bool pointPointListBuild
|
||||
)
|
||||
{
|
||||
Info << nl << "Building list of referred interaction neighbours" << endl;
|
||||
Info<< " Building list of referred interaction neighbours" << endl;
|
||||
|
||||
const polyMesh& mesh(il_.mesh());
|
||||
|
||||
@ -1272,7 +1272,7 @@ void Foam::ReferredCellList<ParticleType>::buildReferredCellList
|
||||
|
||||
reduce(cellsReferredThisIteration, sumOp<label>());
|
||||
|
||||
Info<< tab << "Cells added this iteration: "
|
||||
Info<< " Cells added this iteration: "
|
||||
<< cellsReferredThisIteration << endl;
|
||||
}
|
||||
|
||||
@ -1288,7 +1288,7 @@ void Foam::ReferredCellList<ParticleType>::buildReferredCellList
|
||||
(*this)[rIL] = referredInteractionList[rIL];
|
||||
}
|
||||
|
||||
Info<< nl << "Finding real cells in range of referred cells" << endl;
|
||||
Info<< " Finding real cells in range of referred cells" << endl;
|
||||
|
||||
forAll(*this, rC)
|
||||
{
|
||||
@ -1487,7 +1487,7 @@ Foam::ReferredCellList<ParticleType>::ReferredCellList
|
||||
il_(il),
|
||||
cloud_(il_.mesh(), IDLList<ParticleType>())
|
||||
{
|
||||
Info<< "Read ReferredCellList from disk not implemented" << endl;
|
||||
Info<< " Read ReferredCellList from disk not implemented" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,9 @@ License
|
||||
#include "InteractingKinematicCloud.H"
|
||||
|
||||
#include "NoCollision.H"
|
||||
#include "DeterministicPairForce.H"
|
||||
#include "PairCollision.H"
|
||||
|
||||
#include "SpringSliderDashpot.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -49,10 +51,20 @@ License
|
||||
\
|
||||
makeCollisionModelType \
|
||||
( \
|
||||
DeterministicPairForce, \
|
||||
PairCollision, \
|
||||
InteractingKinematicCloud, \
|
||||
ParcelType \
|
||||
); \
|
||||
\
|
||||
makePairFunction(InteractingKinematicCloud<ParcelType>); \
|
||||
\
|
||||
makePairFunctionType \
|
||||
( \
|
||||
SpringSliderDashpot, \
|
||||
InteractingKinematicCloud, \
|
||||
ParcelType \
|
||||
);
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,7 +33,9 @@ License
|
||||
#include "InteractingKinematicCloud.H"
|
||||
|
||||
#include "NoCollision.H"
|
||||
#include "DeterministicPairForce.H"
|
||||
#include "PairCollision.H"
|
||||
|
||||
#include "SpringSliderDashpot.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -72,9 +74,19 @@ License
|
||||
\
|
||||
makeCollisionModelThermoType \
|
||||
( \
|
||||
DeterministicPairForce, \
|
||||
PairCollision, \
|
||||
InteractingKinematicCloud, \
|
||||
ParcelType, \
|
||||
ParcelType, \
|
||||
ThermoType \
|
||||
); \
|
||||
\
|
||||
makePairFunction(InteractingKinematicCloud<ParcelType<ThermoType> >); \
|
||||
\
|
||||
makePairFunctionThermoType \
|
||||
( \
|
||||
SpringSliderDashpot, \
|
||||
InteractingKinematicCloud, \
|
||||
ParcelType, \
|
||||
ThermoType \
|
||||
);
|
||||
|
||||
|
||||
@ -73,16 +73,6 @@ protected:
|
||||
typedef typename CloudType::parcelType parcelType;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Calculate the pair force between parcels
|
||||
virtual void evaluatePair
|
||||
(
|
||||
typename CloudType::parcelType& pA,
|
||||
typename CloudType::parcelType& pB
|
||||
) const = 0;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
||||
@ -26,18 +26,6 @@ License
|
||||
|
||||
#include "NoCollision.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::NoCollision<CloudType>::evaluatePair
|
||||
(
|
||||
typename CloudType::parcelType& pA,
|
||||
typename CloudType::parcelType& pB
|
||||
) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -69,9 +57,7 @@ bool Foam::NoCollision<CloudType>::active() const
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::NoCollision<CloudType>::collide()
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class NoCollision Declaration
|
||||
Class NoCollision Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
@ -52,18 +52,6 @@ class NoCollision
|
||||
public CollisionModel<CloudType>
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Calculate the pair force between parcels
|
||||
virtual void evaluatePair
|
||||
(
|
||||
typename CloudType::parcelType& pA,
|
||||
typename CloudType::parcelType& pB
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
||||
@ -24,12 +24,13 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "DeterministicPairForce.H"
|
||||
#include "PairCollision.H"
|
||||
#include "PairFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::DeterministicPairForce<CloudType>::buildCellOccupancy()
|
||||
void Foam::PairCollision<CloudType>::buildCellOccupancy()
|
||||
{
|
||||
Info<< "Build cell occupancy" << endl;
|
||||
|
||||
@ -46,53 +47,21 @@ void Foam::DeterministicPairForce<CloudType>::buildCellOccupancy()
|
||||
il_.ril().referParticles(cellOccupancy_);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::DeterministicPairForce<CloudType>::evaluatePair
|
||||
void Foam::PairCollision<CloudType>::evaluatePair
|
||||
(
|
||||
typename CloudType::parcelType& pA,
|
||||
typename CloudType::parcelType& pB
|
||||
) const
|
||||
{
|
||||
vector deltaP = (pB.position() - pA.position());
|
||||
|
||||
scalar deltaN = 0.5*(pA.d() + pB.d()) - mag(deltaP);
|
||||
|
||||
if (deltaN > 0)
|
||||
{
|
||||
//Particles in collision
|
||||
|
||||
vector n = deltaP/(mag(deltaP) + VSMALL);
|
||||
|
||||
vector Urel = pA.U() - pB.U();
|
||||
|
||||
// Effective radius
|
||||
scalar R = 0.5*pA.d()*pB.d()/(pA.d() + pB.d());
|
||||
|
||||
// Effective mass
|
||||
scalar M = pA.mass()*pB.mass()/(pA.mass() + pB.mass());
|
||||
|
||||
scalar E = 2e3;
|
||||
scalar sigma = 0.25;
|
||||
scalar alpha = 0.2;
|
||||
scalar b = 1.0;
|
||||
|
||||
scalar Estar = E/(2.0*(1-sqr(sigma)));
|
||||
scalar kN = (4.0/3.0)*sqrt(R)*Estar;
|
||||
scalar etaN = alpha*sqrt(M*kN)*pow(deltaN, 0.25);
|
||||
|
||||
vector normalForce = -(kN*pow(deltaN, b) + etaN*(Urel & n))*n;
|
||||
|
||||
pA.f() += normalForce;
|
||||
pB.f() -= normalForce;
|
||||
}
|
||||
pairFunction_->evaluatePair(pA, pB);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::DeterministicPairForce<CloudType>::DeterministicPairForce
|
||||
Foam::PairCollision<CloudType>::PairCollision
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
@ -100,6 +69,14 @@ Foam::DeterministicPairForce<CloudType>::DeterministicPairForce
|
||||
:
|
||||
CollisionModel<CloudType>(dict, owner, typeName),
|
||||
cellOccupancy_(owner.mesh().nCells()),
|
||||
pairFunction_
|
||||
(
|
||||
PairFunction<CloudType>::New
|
||||
(
|
||||
this->coeffDict(),
|
||||
this->owner()
|
||||
)
|
||||
),
|
||||
il_(owner.mesh(), 2.6e-5, true)
|
||||
{
|
||||
Info<< "SEARCH DISTANCE SQR HARD CODED" << endl;
|
||||
@ -109,21 +86,21 @@ Foam::DeterministicPairForce<CloudType>::DeterministicPairForce
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::DeterministicPairForce<CloudType>::~DeterministicPairForce()
|
||||
Foam::PairCollision<CloudType>::~PairCollision()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
bool Foam::DeterministicPairForce<CloudType>::active() const
|
||||
bool Foam::PairCollision<CloudType>::active() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::DeterministicPairForce<CloudType>::collide()
|
||||
void Foam::PairCollision<CloudType>::collide()
|
||||
{
|
||||
Info<< "Calculating collisions" << endl;
|
||||
|
||||
@ -219,7 +196,6 @@ void Foam::DeterministicPairForce<CloudType>::collide()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Info<< "ADD COLLISIONS WITH WALLS HERE, DOES NOT NEED TO BE A TRACKING "
|
||||
<< "OPERATION. CALCULATE DISTANCE TO SURFACES OF WALL TYPE AND APPLY "
|
||||
<< "WALL FORCE MODEL" << endl;
|
||||
@ -23,17 +23,17 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::DeterministicPairForce
|
||||
Foam::PairCollision
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
DeterministicPairForce.C
|
||||
PairCollision.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DeterministicPairForce_H
|
||||
#define DeterministicPairForce_H
|
||||
#ifndef PairCollision_H
|
||||
#define PairCollision_H
|
||||
|
||||
#include "CollisionModel.H"
|
||||
#include "InteractionLists.H"
|
||||
@ -43,12 +43,18 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
|
||||
template<class CloudType>
|
||||
class PairFunction;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DeterministicPairForce Declaration
|
||||
Class PairCollision Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class DeterministicPairForce
|
||||
class PairCollision
|
||||
:
|
||||
public CollisionModel<CloudType>
|
||||
{
|
||||
@ -57,6 +63,9 @@ class DeterministicPairForce
|
||||
//- Cell occupancy information for each parcel
|
||||
List<DynamicList<typename CloudType::parcelType*> > cellOccupancy_;
|
||||
|
||||
// //- PairFunction to calculate the interaction between two parcels
|
||||
autoPtr<PairFunction<CloudType> > pairFunction_;
|
||||
|
||||
//- Interactions lists determining which cells are in
|
||||
// interaction range of each other
|
||||
InteractionLists<typename CloudType::parcelType> il_;
|
||||
@ -67,13 +76,8 @@ class DeterministicPairForce
|
||||
//- Build the cell occupancy information for each parcel
|
||||
void buildCellOccupancy();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Calculate the pair force between parcels
|
||||
virtual void evaluatePair
|
||||
void evaluatePair
|
||||
(
|
||||
typename CloudType::parcelType& pA,
|
||||
typename CloudType::parcelType& pB
|
||||
@ -83,13 +87,13 @@ protected:
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("DeterministicPairForce");
|
||||
TypeName("PairCollision");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
DeterministicPairForce
|
||||
PairCollision
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
@ -97,7 +101,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~DeterministicPairForce();
|
||||
virtual ~PairCollision();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -117,7 +121,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "DeterministicPairForce.C"
|
||||
# include "PairCollision.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PairFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::autoPtr<Foam::PairFunction<CloudType> >
|
||||
Foam::PairFunction<CloudType>::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
)
|
||||
{
|
||||
word PairFunctionType(dict.lookup("PairFunction"));
|
||||
|
||||
Info<< "Selecting PairFunction " << PairFunctionType
|
||||
<< endl;
|
||||
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(PairFunctionType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"PairFunction<CloudType>::New"
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"CloudType&"
|
||||
")"
|
||||
) << "Unknown PairFunctionType type "
|
||||
<< PairFunctionType
|
||||
<< ", constructor not in hash table" << nl << nl
|
||||
<< " Valid PairFunction types are:" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<PairFunction<CloudType> >(cstrIter()(dict, owner));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,81 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PairFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::PairFunction<CloudType>::PairFunction
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
:
|
||||
dict_(dict),
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::PairFunction<CloudType>::~PairFunction()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
const CloudType&
|
||||
Foam::PairFunction<CloudType>::owner() const
|
||||
{
|
||||
return owner_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary& Foam::PairFunction<CloudType>::dict() const
|
||||
{
|
||||
return dict_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary&
|
||||
Foam::PairFunction<CloudType>::coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "NewPairFunction.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,183 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::PairFunction
|
||||
|
||||
Description
|
||||
Templated pair interaction class
|
||||
|
||||
SourceFiles
|
||||
PairFunction.C
|
||||
NewPairFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PairFunction_H
|
||||
#define PairFunction_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class PairFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class PairFunction
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- The cloud dictionary
|
||||
const dictionary& dict_;
|
||||
|
||||
//- Reference to the owner cloud class
|
||||
CloudType& owner_;
|
||||
|
||||
//- The coefficients dictionary
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("PairFunction");
|
||||
|
||||
//- Declare runtime constructor selection table
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
PairFunction,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
),
|
||||
(dict, owner)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
PairFunction
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PairFunction();
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<PairFunction<CloudType> > New
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
);
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
//- Calculate the pair interaction between parcels
|
||||
virtual void evaluatePair
|
||||
(
|
||||
typename CloudType::parcelType& pA,
|
||||
typename CloudType::parcelType& pB
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makePairFunction(CloudType) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(PairFunction<CloudType>, 0); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable \
|
||||
( \
|
||||
PairFunction<CloudType>, \
|
||||
dictionary \
|
||||
);
|
||||
|
||||
|
||||
#define makePairFunctionType(SS, CloudType, ParcelType) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
|
||||
\
|
||||
PairFunction<CloudType<ParcelType> >:: \
|
||||
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
|
||||
add##SS##CloudType##ParcelType##ConstructorToTable_;
|
||||
|
||||
|
||||
#define makePairFunctionThermoType(SS, CloudType, ParcelType, ThermoType) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug \
|
||||
( \
|
||||
SS<CloudType<ParcelType<ThermoType> > >, \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
PairFunction<CloudType<ParcelType<ThermoType> > >:: \
|
||||
adddictionaryConstructorToTable \
|
||||
<SS<CloudType<ParcelType<ThermoType> > > > \
|
||||
add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "PairFunction.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SpringSliderDashpot.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template <class CloudType>
|
||||
Foam::SpringSliderDashpot<CloudType>::SpringSliderDashpot
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
PairFunction<CloudType>(dict, cloud, typeName),
|
||||
Estar_(),
|
||||
Gstar_(),
|
||||
sigma_(dimensionedScalar(this->coeffDict().lookup("sigma")).value()),
|
||||
alpha_(dimensionedScalar(this->coeffDict().lookup("alpha")).value()),
|
||||
b_(dimensionedScalar(this->coeffDict().lookup("b")).value())
|
||||
{
|
||||
scalar E = dimensionedScalar(this->coeffDict().lookup("E")).value();
|
||||
|
||||
Estar_ = E/(2.0*(1.0 - sqr(sigma_)));
|
||||
|
||||
scalar G = E/(2.0*(1.0 + sigma_));
|
||||
|
||||
Gstar_ = G/(2.0*(2.0 - sigma_));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template <class CloudType>
|
||||
Foam::SpringSliderDashpot<CloudType>::~SpringSliderDashpot()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::SpringSliderDashpot<CloudType>::evaluatePair
|
||||
(
|
||||
typename CloudType::parcelType& pA,
|
||||
typename CloudType::parcelType& pB
|
||||
) const
|
||||
{
|
||||
vector deltaP = (pB.position() - pA.position());
|
||||
|
||||
scalar deltaN = 0.5*(pA.d() + pB.d()) - mag(deltaP);
|
||||
|
||||
if (deltaN > 0)
|
||||
{
|
||||
//Particles in collision
|
||||
|
||||
vector n = deltaP/(mag(deltaP) + VSMALL);
|
||||
|
||||
vector Urel = pA.U() - pB.U();
|
||||
|
||||
// Effective radius
|
||||
scalar R = 0.5*pA.d()*pB.d()/(pA.d() + pB.d());
|
||||
|
||||
// Effective mass
|
||||
scalar M = pA.mass()*pB.mass()/(pA.mass() + pB.mass());
|
||||
|
||||
scalar kN = (4.0/3.0)*sqrt(R)*Estar_;
|
||||
|
||||
scalar etaN = alpha_*sqrt(M*kN)*pow(deltaN, 0.25);
|
||||
|
||||
vector normalForce = -(kN*pow(deltaN, b_) + etaN*(Urel & n))*n;
|
||||
|
||||
pA.f() += normalForce;
|
||||
pB.f() -= normalForce;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,112 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::SpringSliderDashpot
|
||||
|
||||
Description
|
||||
Pair forces between particles colliding with a spring, slider, damper model
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SpringSliderDashpot_H
|
||||
#define SpringSliderDashpot_H
|
||||
|
||||
#include "PairFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SpringSliderDashpot Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class SpringSliderDashpot
|
||||
:
|
||||
public PairFunction<CloudType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Effective Young's modulus value, assuming both particles have
|
||||
// the same E value
|
||||
scalar Estar_;
|
||||
|
||||
//- Effective shear modulus value, assuming both particles have
|
||||
// the same Poisson's ratio and Young's modulus
|
||||
scalar Gstar_;
|
||||
|
||||
//- Poisson's ratio of both particles
|
||||
scalar sigma_;
|
||||
|
||||
//- alpha-coefficient, related to coefficient of restitution
|
||||
scalar alpha_;
|
||||
|
||||
//- Spring power (b = 1 for linear, b = 3/2 for Hertzian)
|
||||
scalar b_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("SpringSliderDashpot");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
SpringSliderDashpot(const dictionary& dict, CloudType& cloud);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~SpringSliderDashpot();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Calculate the pair interaction between parcels
|
||||
virtual void evaluatePair
|
||||
(
|
||||
typename CloudType::parcelType& pA,
|
||||
typename CloudType::parcelType& pB
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "SpringSliderDashpot.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user