ENH: Initial check-in of re-worked particle forces

This commit is contained in:
andy
2011-02-14 15:49:46 +00:00
parent 4275e01b66
commit d6155f802d
59 changed files with 3029 additions and 1191 deletions

View File

@ -23,6 +23,7 @@ KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel
$(KINEMATICPARCEL)/basicKinematicParcel.C $(KINEMATICPARCEL)/basicKinematicParcel.C
$(KINEMATICPARCEL)/defineBasicKinematicParcel.C $(KINEMATICPARCEL)/defineBasicKinematicParcel.C
$(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C $(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C
$(KINEMATICPARCEL)/makeBasicKinematicParcelForces.C
/* thermo parcel sub-models */ /* thermo parcel sub-models */
@ -30,6 +31,7 @@ THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel
$(THERMOPARCEL)/basicThermoParcel.C $(THERMOPARCEL)/basicThermoParcel.C
$(THERMOPARCEL)/defineBasicThermoParcel.C $(THERMOPARCEL)/defineBasicThermoParcel.C
$(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C $(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C
$(THERMOPARCEL)/makeBasicThermoParcelForces.C
/* reacting parcel sub-models */ /* reacting parcel sub-models */
@ -37,6 +39,7 @@ REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel
$(REACTINGPARCEL)/basicReactingParcel.C $(REACTINGPARCEL)/basicReactingParcel.C
$(REACTINGPARCEL)/defineBasicReactingParcel.C $(REACTINGPARCEL)/defineBasicReactingParcel.C
$(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C $(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C
$(REACTINGPARCEL)/makeBasicReactingParcelForces.C
/* reacting multiphase parcel sub-models */ /* reacting multiphase parcel sub-models */
@ -44,6 +47,7 @@ REACTINGMPPARCEL=$(DERIVEDPARCELS)/basicReactingMultiphaseParcel
$(REACTINGMPPARCEL)/basicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/basicReactingMultiphaseParcel.C
$(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C
$(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C
$(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelForces.C
/* bolt-on models */ /* bolt-on models */
@ -78,10 +82,6 @@ $(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphase
IntegrationScheme/makeIntegrationSchemes.C IntegrationScheme/makeIntegrationSchemes.C
/* particle forces */
particleForces/particleForces.C
/* phase properties */ /* phase properties */
phaseProperties/phaseProperties/phaseProperties.C phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C phaseProperties/phaseProperties/phasePropertiesIO.C

View File

@ -30,7 +30,6 @@ License
#include "CollisionModel.H" #include "CollisionModel.H"
#include "DispersionModel.H" #include "DispersionModel.H"
#include "DragModel.H"
#include "InjectionModel.H" #include "InjectionModel.H"
#include "PatchInteractionModel.H" #include "PatchInteractionModel.H"
#include "PostProcessingModel.H" #include "PostProcessingModel.H"
@ -209,15 +208,6 @@ void Foam::KinematicCloud<ParcelType>::setModels()
).ptr() ).ptr()
); );
dragModel_.reset
(
DragModel<KinematicCloud<ParcelType> >::New
(
subModelProperties_,
*this
).ptr()
);
injectionModel_.reset injectionModel_.reset
( (
InjectionModel<KinematicCloud<ParcelType> >::New InjectionModel<KinematicCloud<ParcelType> >::New
@ -306,7 +296,7 @@ void Foam::KinematicCloud<ParcelType>::preEvolve()
Info<< "\nSolving cloud " << this->name() << endl; Info<< "\nSolving cloud " << this->name() << endl;
this->dispersion().cacheFields(true); this->dispersion().cacheFields(true);
forces_.cacheFields(true, solution_.interpolationSchemes()); forces_.cacheFields(true);
updateCellOccupancy(); updateCellOccupancy();
} }
@ -390,7 +380,7 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud
} }
else else
{ {
// this->surfaceFilm().injectStreadyState(td); // this->surfaceFilm().injectSteadyState(td);
this->injection().injectSteadyState(td, solution_.deltaT()); this->injection().injectSteadyState(td, solution_.deltaT());
@ -473,7 +463,7 @@ void Foam::KinematicCloud<ParcelType>::postEvolve()
} }
this->dispersion().cacheFields(false); this->dispersion().cacheFields(false);
forces_.cacheFields(false, solution_.interpolationSchemes()); forces_.cacheFields(false);
this->postProcessing().post(); this->postProcessing().post();
@ -488,9 +478,10 @@ void Foam::KinematicCloud<ParcelType>::cloudReset(KinematicCloud<ParcelType>& c)
rndGen_ = c.rndGen_; rndGen_ = c.rndGen_;
forces_.transfer(c.forces_);
collisionModel_ = c.collisionModel_->clone(); collisionModel_ = c.collisionModel_->clone();
dispersionModel_= c.dispersionModel_->clone(); dispersionModel_= c.dispersionModel_->clone();
dragModel_ = c.dragModel_->clone();
injectionModel_ = c.injectionModel_->clone(); injectionModel_ = c.injectionModel_->clone();
patchInteractionModel_ = c.patchInteractionModel_->clone(); patchInteractionModel_ = c.patchInteractionModel_->clone();
postProcessingModel_ = c.postProcessingModel_->clone(); postProcessingModel_ = c.postProcessingModel_->clone();
@ -540,10 +531,15 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
U_(U), U_(U),
mu_(mu), mu_(mu),
g_(g), g_(g),
forces_(mesh_, particleProperties_, g_.value(), solution_.active()), forces_
(
*this,
mesh_,
particleProperties_.subOrEmptyDict("particleForces"),
solution_.active()
),
collisionModel_(NULL), collisionModel_(NULL),
dispersionModel_(NULL), dispersionModel_(NULL),
dragModel_(NULL),
injectionModel_(NULL), injectionModel_(NULL),
patchInteractionModel_(NULL), patchInteractionModel_(NULL),
postProcessingModel_(NULL), postProcessingModel_(NULL),
@ -606,7 +602,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
const word& name const word& name
) )
: :
Cloud<ParcelType>(c.mesh(), name, c), Cloud<ParcelType>(c.mesh_, name, c),
kinematicCloud(), kinematicCloud(),
cloudCopyPtr_(NULL), cloudCopyPtr_(NULL),
mesh_(c.mesh_), mesh_(c.mesh_),
@ -623,7 +619,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
forces_(c.forces_), forces_(c.forces_),
collisionModel_(c.collisionModel_->clone()), collisionModel_(c.collisionModel_->clone()),
dispersionModel_(c.dispersionModel_->clone()), dispersionModel_(c.dispersionModel_->clone()),
dragModel_(c.dragModel_->clone()),
injectionModel_(c.injectionModel_->clone()), injectionModel_(c.injectionModel_->clone()),
patchInteractionModel_(c.patchInteractionModel_->clone()), patchInteractionModel_(c.patchInteractionModel_->clone()),
postProcessingModel_(c.postProcessingModel_->clone()), postProcessingModel_(c.postProcessingModel_->clone()),
@ -661,7 +656,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
c.UCoeff_() c.UCoeff_()
) )
) )
{} {}
@ -698,10 +692,9 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
U_(c.U_), U_(c.U_),
mu_(c.mu_), mu_(c.mu_),
g_(c.g_), g_(c.g_),
forces_(mesh), forces_(*this, mesh),
collisionModel_(NULL), collisionModel_(NULL),
dispersionModel_(NULL), dispersionModel_(NULL),
dragModel_(NULL),
injectionModel_(NULL), injectionModel_(NULL),
patchInteractionModel_(NULL), patchInteractionModel_(NULL),
postProcessingModel_(NULL), postProcessingModel_(NULL),

View File

@ -29,10 +29,14 @@ Description
- holds a 'cloudSolution' class that stores all relevant solution info - holds a 'cloudSolution' class that stores all relevant solution info
- particle forces
- buoyancy
- drag
- pressure gradient
- sub-models: - sub-models:
- Collision model - Collision model
- Dispersion model - Dispersion model
- Drag model
- Injection model - Injection model
- Patch interaction model - Patch interaction model
- Post-processing model - Post-processing model
@ -55,7 +59,6 @@ SourceFiles
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "particleForces.H"
#include "IntegrationSchemesFwd.H" #include "IntegrationSchemesFwd.H"
@ -72,9 +75,6 @@ class CollisionModel;
template<class CloudType> template<class CloudType>
class DispersionModel; class DispersionModel;
template<class CloudType>
class DragModel;
template<class CloudType> template<class CloudType>
class InjectionModel; class InjectionModel;
@ -98,6 +98,14 @@ class KinematicCloud
public Cloud<ParcelType>, public Cloud<ParcelType>,
public kinematicCloud public kinematicCloud
{ {
public:
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
private:
// Private data // Private data
//- Cloud copy pointer //- Cloud copy pointer
@ -316,7 +324,7 @@ protected:
//- Optional particle forces //- Optional particle forces
particleForces forces_; typename ParcelType::forceType forces_;
// References to the cloud sub-models // References to the cloud sub-models
@ -329,9 +337,6 @@ protected:
autoPtr<DispersionModel<KinematicCloud<ParcelType> > > autoPtr<DispersionModel<KinematicCloud<ParcelType> > >
dispersionModel_; dispersionModel_;
//- Drag transfer model
autoPtr<DragModel<KinematicCloud<ParcelType> > > dragModel_;
//- Injector model //- Injector model
autoPtr<InjectionModel<KinematicCloud<ParcelType> > > autoPtr<InjectionModel<KinematicCloud<ParcelType> > >
injectionModel_; injectionModel_;
@ -450,10 +455,6 @@ public:
virtual ~KinematicCloud(); virtual ~KinematicCloud();
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
// Member Functions // Member Functions
// Access // Access
@ -521,7 +522,7 @@ public:
//- Optional particle forces //- Optional particle forces
inline const particleForces& forces() const; inline const typename ParcelType::forceType& forces() const;
// Sub-models // Sub-models
@ -542,10 +543,6 @@ public:
inline DispersionModel<KinematicCloud<ParcelType> >& inline DispersionModel<KinematicCloud<ParcelType> >&
dispersion(); dispersion();
//- Return const-access to the drag model
inline const DragModel<KinematicCloud<ParcelType> >&
drag() const;
//- Return const access to the injection model //- Return const access to the injection model
inline const InjectionModel<KinematicCloud<ParcelType> >& inline const InjectionModel<KinematicCloud<ParcelType> >&
injection() const; injection() const;

View File

@ -257,7 +257,7 @@ Foam::KinematicCloud<ParcelType>::g() const
template<class ParcelType> template<class ParcelType>
inline const Foam::particleForces& inline const typename ParcelType::forceType&
Foam::KinematicCloud<ParcelType>::forces() const Foam::KinematicCloud<ParcelType>::forces() const
{ {
return forces_; return forces_;
@ -296,14 +296,6 @@ Foam::KinematicCloud<ParcelType>::dispersion()
} }
template<class ParcelType>
inline const Foam::DragModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::drag() const
{
return dragModel_;
}
template<class ParcelType> template<class ParcelType>
inline const Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >& inline const Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::injection() const Foam::KinematicCloud<ParcelType>::injection() const

View File

@ -176,37 +176,13 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
scalar& Cud scalar& Cud
) const ) const
{ {
const polyMesh& mesh = this->cloud().pMesh(); const typename ParcelType::forceType& forces = td.cloud().forces();
// Momentum transfer coefficient
const scalar utc = td.cloud().drag().utc(Re, d, mu) + ROOTVSMALL;
tetIndices tetIs = this->currentTetIndices();
// Momentum source due to particle forces // Momentum source due to particle forces
const vector Fcp = mass*td.cloud().forces().calcCoupled const ParcelType& p = static_cast<const ParcelType&>(*this);
( const forceSuSp Fcp = forces.calcCoupled(p, dt, Re, rho, mu);
this->position(), const forceSuSp Fncp = forces.calcNonCoupled(p, dt, Re, rho, mu);
tetIs, const forceSuSp Feff = Fcp + Fncp;
dt,
rhoc_,
rho,
Uc_,
U,
d
);
const vector Fncp = mass*td.cloud().forces().calcNonCoupled
(
this->position(),
tetIs,
dt,
rhoc_,
rho,
Uc_,
U,
d
);
// New particle velocity // New particle velocity
@ -214,8 +190,8 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
// Update velocity - treat as 3-D // Update velocity - treat as 3-D
const scalar As = this->areaS(d); const scalar As = this->areaS(d);
const vector ap = Uc_ + (Fcp + Fncp + Su)/(utc*As); const vector ap = Uc_ + (mass*Feff.Su() + Su)/(As*Feff.Sp());
const scalar bp = 6.0*utc/(rho*d); const scalar bp = 6.0*Feff.Sp()/(rho*d);
Cud = bp; Cud = bp;
@ -224,9 +200,10 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
vector Unew = Ures.value(); vector Unew = Ures.value();
dUTrans += dt*(utc*As*(Ures.average() - Uc_) - Fcp); dUTrans += dt*(Fncp.Sp()*As*(Ures.average() - Uc_) - mass*Fcp.Su());
// Apply correction to velocity and dUTrans for reduced-D cases // Apply correction to velocity and dUTrans for reduced-D cases
const polyMesh& mesh = this->cloud().pMesh();
meshTools::constrainDirection(mesh, mesh.solutionD(), Unew); meshTools::constrainDirection(mesh, mesh.solutionD(), Unew);
meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans); meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans);

View File

@ -56,6 +56,8 @@ SourceFiles
#include "labelFieldIOField.H" #include "labelFieldIOField.H"
#include "vectorFieldIOField.H" #include "vectorFieldIOField.H"
#include "ParticleForceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -88,6 +90,10 @@ class KinematicParcel
{ {
public: public:
//- Type of force to be used by this parcel type
typedef ParticleForceList<KinematicCloud<ParcelType> > forceType;
//- Class to hold kinematic particle constant properties //- Class to hold kinematic particle constant properties
class constantProperties class constantProperties
{ {
@ -456,6 +462,15 @@ public:
//- Return const access to turbulent velocity fluctuation //- Return const access to turbulent velocity fluctuation
inline const vector& UTurb() const; inline const vector& UTurb() const;
//- Return const access to carrier density [kg/m3]
inline scalar rhoc() const;
//- Return const access to carrier velocity [m/s]
inline const vector& Uc() const;
//- Return const access to carrier viscosity [Pa.s]
inline scalar muc() const;
//- Return const access to the collision records //- Return const access to the collision records
inline const collisionRecordList& collisionRecords() const; inline const collisionRecordList& collisionRecords() const;

View File

@ -409,6 +409,27 @@ inline const Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb() const
} }
template <class ParcelType>
inline Foam::scalar Foam::KinematicParcel<ParcelType>::rhoc() const
{
return rhoc_;
}
template <class ParcelType>
inline const Foam::vector& Foam::KinematicParcel<ParcelType>::Uc() const
{
return Uc_;
}
template <class ParcelType>
inline Foam::scalar Foam::KinematicParcel<ParcelType>::muc() const
{
return muc_;
}
template<class ParcelType> template<class ParcelType>
inline bool& Foam::KinematicParcel<ParcelType>::active() inline bool& Foam::KinematicParcel<ParcelType>::active()
{ {

View File

@ -344,6 +344,12 @@ public:
//- Return the parcel sensible enthalpy //- Return the parcel sensible enthalpy
inline scalar hs() const; inline scalar hs() const;
//- Return const access to carrier temperature
inline scalar Tc() const;
//- Return const access to carrier specific heat capacity
inline scalar Cpc() const;
// Edit // Edit

View File

@ -321,6 +321,20 @@ inline Foam::scalar Foam::ThermoParcel<ParcelType>::hs() const
} }
template<class ParcelType>
inline Foam::scalar Foam::ThermoParcel<ParcelType>::Tc() const
{
return Tc_;
}
template<class ParcelType>
inline Foam::scalar Foam::ThermoParcel<ParcelType>::Cpc() const
{
return Cpc_;
}
template<class ParcelType> template<class ParcelType>
inline Foam::scalar& Foam::ThermoParcel<ParcelType>::T() inline Foam::scalar& Foam::ThermoParcel<ParcelType>::T()
{ {

View File

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "basicKinematicParcel.H"
// Kinematic
#include "makeParcelForces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Kinematic sub-models
makeParcelForces(basicKinematicParcel);
};
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,7 +27,6 @@ License
// Kinematic // Kinematic
#include "makeParcelDispersionModels.H" #include "makeParcelDispersionModels.H"
#include "makeParcelDragModels.H"
#include "makeParcelInjectionModels.H" #include "makeParcelInjectionModels.H"
#include "makeParcelCollisionModels.H" #include "makeParcelCollisionModels.H"
#include "makeParcelPatchInteractionModels.H" #include "makeParcelPatchInteractionModels.H"
@ -40,7 +39,6 @@ namespace Foam
{ {
// Kinematic sub-models // Kinematic sub-models
makeParcelDispersionModels(basicKinematicParcel); makeParcelDispersionModels(basicKinematicParcel);
makeParcelDragModels(basicKinematicParcel);
makeParcelInjectionModels(basicKinematicParcel); makeParcelInjectionModels(basicKinematicParcel);
makeParcelCollisionModels(basicKinematicParcel); makeParcelCollisionModels(basicKinematicParcel);
makeParcelPatchInteractionModels(basicKinematicParcel); makeParcelPatchInteractionModels(basicKinematicParcel);

View File

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "basicReactingMultiphaseParcel.H"
// Using thermodynamic variant
#include "makeThermoParcelForces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Kinematic sub-models
makeThermoParcelForces(basicReactingMultiphaseParcel);
};
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,7 +27,6 @@ License
// Kinematic // Kinematic
#include "makeParcelDispersionModels.H" #include "makeParcelDispersionModels.H"
#include "makeParcelDragModels.H"
#include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant
#include "makeParcelCollisionModels.H" #include "makeParcelCollisionModels.H"
#include "makeParcelPatchInteractionModels.H" #include "makeParcelPatchInteractionModels.H"
@ -51,7 +50,6 @@ namespace Foam
{ {
// Kinematic sub-models // Kinematic sub-models
makeParcelDispersionModels(basicReactingMultiphaseParcel); makeParcelDispersionModels(basicReactingMultiphaseParcel);
makeParcelDragModels(basicReactingMultiphaseParcel);
makeReactingMultiphaseParcelInjectionModels(basicReactingMultiphaseParcel); makeReactingMultiphaseParcelInjectionModels(basicReactingMultiphaseParcel);
makeParcelCollisionModels(basicReactingMultiphaseParcel); makeParcelCollisionModels(basicReactingMultiphaseParcel);
makeParcelPatchInteractionModels(basicReactingMultiphaseParcel); makeParcelPatchInteractionModels(basicReactingMultiphaseParcel);

View File

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "basicReactingParcel.H"
// Using thermodynamic variant
#include "makeThermoParcelForces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Kinematic sub-models
makeThermoParcelForces(basicReactingParcel);
};
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,7 +27,6 @@ License
// Kinematic // Kinematic
#include "makeParcelDispersionModels.H" #include "makeParcelDispersionModels.H"
#include "makeParcelDragModels.H"
#include "makeReactingParcelInjectionModels.H" // Reacting variant #include "makeReactingParcelInjectionModels.H" // Reacting variant
#include "makeParcelCollisionModels.H" #include "makeParcelCollisionModels.H"
#include "makeParcelPatchInteractionModels.H" #include "makeParcelPatchInteractionModels.H"
@ -47,7 +46,6 @@ namespace Foam
{ {
// Kinematic sub-models // Kinematic sub-models
makeParcelDispersionModels(basicReactingParcel); makeParcelDispersionModels(basicReactingParcel);
makeParcelDragModels(basicReactingParcel);
makeReactingParcelInjectionModels(basicReactingParcel); makeReactingParcelInjectionModels(basicReactingParcel);
makeParcelCollisionModels(basicReactingParcel); makeParcelCollisionModels(basicReactingParcel);
makeParcelPatchInteractionModels(basicReactingParcel); makeParcelPatchInteractionModels(basicReactingParcel);

View File

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "basicThermoParcel.H"
// Using thermodynamic variant
#include "makeThermoParcelForces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Kinematic sub-models
makeThermoParcelForces(basicThermoParcel);
};
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,7 +27,6 @@ License
// Kinematic // Kinematic
#include "makeParcelDispersionModels.H" #include "makeParcelDispersionModels.H"
#include "makeParcelDragModels.H"
#include "makeParcelInjectionModels.H" #include "makeParcelInjectionModels.H"
#include "makeParcelCollisionModels.H" #include "makeParcelCollisionModels.H"
#include "makeParcelPatchInteractionModels.H" #include "makeParcelPatchInteractionModels.H"
@ -43,7 +42,6 @@ namespace Foam
{ {
// Kinematic sub-models // Kinematic sub-models
makeParcelDispersionModels(basicThermoParcel); makeParcelDispersionModels(basicThermoParcel);
makeParcelDragModels(basicThermoParcel);
makeParcelInjectionModels(basicThermoParcel); makeParcelInjectionModels(basicThermoParcel);
makeParcelCollisionModels(basicThermoParcel); makeParcelCollisionModels(basicThermoParcel);
makeParcelPatchInteractionModels(basicThermoParcel); makeParcelPatchInteractionModels(basicThermoParcel);

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
\*---------------------------------------------------------------------------*/
#ifndef makeParcelForces_H
#define makeParcelForces_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "KinematicCloud.H"
#include "SphereDragForce.H"
#include "NonSphereDragForce.H"
#include "GravityForce.H"
#include "ParamagneticForce.H"
#include "PressureGradientForce.H"
#include "SRFForce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeParcelForces(ParcelType) \
\
makeParticleForceModel(KinematicCloud<ParcelType>); \
\
makeParticleForceModelType \
( \
SphereDragForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
NonSphereDragForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
GravityForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
ParamagneticForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
PressureGradientForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
SRFForce, \
KinematicCloud, \
ParcelType \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,96 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
\*---------------------------------------------------------------------------*/
#ifndef makeThermoParcelForces_H
#define makeThermoParcelForces_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "KinematicCloud.H"
#include "SphereDragForce.H"
#include "NonSphereDragForce.H"
#include "BrownianMotionForce.H"
#include "GravityForce.H"
#include "ParamagneticForce.H"
#include "PressureGradientForce.H"
#include "SRFForce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeThermoParcelForces(ParcelType) \
\
makeParticleForceModel(KinematicCloud<ParcelType>); \
\
makeParticleForceModelType \
( \
SphereDragForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
NonSphereDragForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
BrownianMotionForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
GravityForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
ParamagneticForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
PressureGradientForce, \
KinematicCloud, \
ParcelType \
); \
makeParticleForceModelType \
( \
SRFForce, \
KinematicCloud, \
ParcelType \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,362 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2011 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 "particleForces.H"
#include "fvMesh.H"
#include "volFields.H"
#include "fvcGrad.H"
#include "mathematicalConstants.H"
#include "electromagneticConstants.H"
#include "SRFModel.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::particleForces::deleteFields()
{
if (gradUPtr_)
{
delete gradUPtr_;
gradUPtr_ = NULL;
}
if (HdotGradHInterPtr_)
{
delete HdotGradHInterPtr_;
HdotGradHInterPtr_ = NULL;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::particleForces::particleForces(const fvMesh& mesh)
:
mesh_(mesh),
dict_(dictionary::null),
g_(vector::zero),
gradUPtr_(NULL),
HdotGradHInterPtr_(NULL),
gravity_(false),
virtualMass_(false),
Cvm_(0.0),
pressureGradient_(false),
paramagnetic_(false),
magneticSusceptibility_(0.0),
refFrame_(rfInertial),
UName_("undefined_UName"),
HdotGradHName_("undefined_HdotGradHName")
{}
Foam::particleForces::particleForces
(
const fvMesh& mesh,
const dictionary& dict,
const vector& g,
const bool readFields
)
:
mesh_(mesh),
dict_(dict.subOrEmptyDict("particleForces")),
g_(g),
gradUPtr_(NULL),
HdotGradHInterPtr_(NULL),
gravity_(false),
virtualMass_(false),
Cvm_(0.0),
pressureGradient_(false),
paramagnetic_(false),
magneticSusceptibility_(0.0),
refFrame_(rfInertial),
UName_(dict_.lookupOrDefault<word>("UName", "U")),
HdotGradHName_(dict_.lookupOrDefault<word>("HdotGradHName", "HdotGradH"))
{
if (readFields)
{
dict_.lookup("gravity") >> gravity_;
dict_.lookup("virtualMass") >> virtualMass_;
dict_.lookup("pressureGradient") >> pressureGradient_;
dict_.lookup("paramagnetic") >> paramagnetic_;
if (virtualMass_)
{
dict_.lookup("Cvm") >> Cvm_;
}
if (paramagnetic_)
{
dict_.lookup("magneticSusceptibility") >> magneticSusceptibility_;
}
}
if (dict_.found("referenceFrame"))
{
word rf(dict_.lookup("referenceFrame"));
if (rf == "SRF")
{
refFrame_ = rfSRF;
}
else if (rf != "inertial")
{
FatalErrorIn
(
"Foam::particleForces::particleForces"
"("
"const fvMesh&, "
"const dictionary&, "
"const vector&, "
"const bool"
")"
)
<< "Unknown referenceFrame, options are inertial and SRF."
<< abort(FatalError);
}
}
}
Foam::particleForces::particleForces(const particleForces& f)
:
mesh_(f.mesh_),
dict_(f.dict_),
g_(f.g_),
gradUPtr_(f.gradUPtr_),
HdotGradHInterPtr_(f.HdotGradHInterPtr_),
gravity_(f.gravity_),
virtualMass_(f.virtualMass_),
Cvm_(f.Cvm_),
pressureGradient_(f.pressureGradient_),
paramagnetic_(f.paramagnetic_),
magneticSusceptibility_(f.magneticSusceptibility_),
refFrame_(f.refFrame_),
UName_(f.UName_),
HdotGradHName_(f.HdotGradHName_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::particleForces::~particleForces()
{
deleteFields();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::dictionary& Foam::particleForces::dict() const
{
return dict_;
}
const Foam::vector& Foam::particleForces::g() const
{
return g_;
}
Foam::Switch Foam::particleForces::gravity() const
{
return gravity_;
}
Foam::Switch Foam::particleForces::virtualMass() const
{
return virtualMass_;
}
Foam::scalar Foam::particleForces::Cvm() const
{
return Cvm_;
}
Foam::Switch Foam::particleForces::pressureGradient() const
{
return pressureGradient_;
}
Foam::Switch Foam::particleForces::paramagnetic() const
{
return paramagnetic_;
}
Foam::scalar Foam::particleForces::magneticSusceptibility() const
{
return magneticSusceptibility_;
}
const Foam::word& Foam::particleForces::UName() const
{
return UName_;
}
const Foam::word& Foam::particleForces::HdotGradHName() const
{
return HdotGradHName_;
}
void Foam::particleForces::cacheFields
(
const bool store,
const dictionary& interpolationSchemes
)
{
if (store)
{
if (pressureGradient_)
{
const volVectorField& U =
mesh_.lookupObject<volVectorField>(UName_);
gradUPtr_ = fvc::grad(U).ptr();
}
if (paramagnetic_)
{
const volVectorField& HdotGradH =
mesh_.lookupObject<volVectorField>(HdotGradHName_);
HdotGradHInterPtr_ = interpolation<vector>::New
(
interpolationSchemes,
HdotGradH
).ptr();
}
}
else
{
deleteFields();
}
}
Foam::vector Foam::particleForces::calcCoupled
(
const vector& position,
const tetIndices& tetIs,
const scalar dt,
const scalar rhoc,
const scalar rho,
const vector& Uc,
const vector& U,
const scalar d
) const
{
vector accelTot = vector::zero;
// Virtual mass force
if (virtualMass_)
{
notImplemented
(
"Foam::particleForces::calcCoupled(...) - virtual mass force"
);
// accelTot += Cvm_*rhoc/rho*d(Uc - U)/dt;
}
// Pressure gradient force
if (pressureGradient_)
{
const volTensorField& gradU = *gradUPtr_;
accelTot += rhoc/rho*(U & gradU[tetIs.cell()]);
}
return accelTot;
}
Foam::vector Foam::particleForces::calcNonCoupled
(
const vector& position,
const tetIndices& tetIs,
const scalar dt,
const scalar rhoc,
const scalar rho,
const vector& Uc,
const vector& U,
const scalar d
) const
{
vector accelTot = vector::zero;
// Gravity force
if (gravity_)
{
accelTot += g_*(1.0 - rhoc/rho);
}
// Magnetic field force
if (paramagnetic_)
{
const interpolation<vector>& HdotGradHInter = *HdotGradHInterPtr_;
accelTot +=
3.0*constant::electromagnetic::mu0.value()/rho
*magneticSusceptibility_/(magneticSusceptibility_ + 3)
*HdotGradHInter.interpolate(position, tetIs);
// force is:
// 4.0
// *constant::mathematical::pi
// *constant::electromagnetic::mu0.value()
// *pow3(d/2)
// *magneticSusceptibility_/(magneticSusceptibility_ + 3)
// *HdotGradH[cellI];
// which is divided by mass (pi*d^3*rho/6) to produce
// acceleration
}
if (refFrame_ == rfSRF)
{
const SRF::SRFModel& srf =
mesh_.lookupObject<SRF::SRFModel>("SRFProperties");
const vector& omega = srf.omega().value();
const vector& axis = srf.axis();
vector r = position - axis*(axis & position);
// Coriolis and centrifugal acceleration terms
accelTot += 2*(U ^ omega) + (omega ^ (r ^ omega));
}
return accelTot;
}
// ************************************************************************* //

View File

@ -1,229 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2011 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/>.
Class
Foam::particleForces
Description
Provides a mechanism to calculate particle forces
Note: forces are force per unit mass (accelerations)
SourceFiles
particleForces.C
\*---------------------------------------------------------------------------*/
#ifndef particleForces_H
#define particleForces_H
#include "dictionary.H"
#include "Switch.H"
#include "vector.H"
#include "volFieldsFwd.H"
#include "interpolation.H"
#include "tetIndices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward class declarations
class fvMesh;
/*---------------------------------------------------------------------------*\
Class particleForces Declaration
\*---------------------------------------------------------------------------*/
class particleForces
{
// Private data
//- Reference frame type
enum refFrame
{
rfInertial,
rfSRF
};
//- Reference to the mesh database
const fvMesh& mesh_;
//- The particleForces dictionary
const dictionary dict_;
//- Gravity
const vector g_;
//- Velocity gradient field
const volTensorField* gradUPtr_;
//- HdotGradH interpolator
const interpolation<vector>* HdotGradHInterPtr_;
// Forces to include in particle motion evaluation
//- Gravity
Switch gravity_;
//- Virtual mass
Switch virtualMass_;
//- Virtual mass force coefficient
scalar Cvm_;
//- Pressure gradient
Switch pressureGradient_;
//- Paramagnetic force
Switch paramagnetic_;
//- Magnetic susceptibility of particle
scalar magneticSusceptibility_;
//- Reference frame accelerations
refFrame refFrame_;
// Additional info
//- Name of velocity field - default = "U"
const word UName_;
//- Name of paramagnetic field strength field - default =
// "HdotGradH"
const word HdotGradHName_;
// Private Member Functions
//- Delete cached carrier fields
void deleteFields();
public:
// Constructors
//- Construct null from mesh reference
particleForces(const fvMesh& mesh);
//- Construct from mesh, dictionary and gravity
particleForces
(
const fvMesh& mesh,
const dictionary& dict,
const vector& g,
const bool readFields = true
);
//- Construct copy
particleForces(const particleForces& f);
//- Destructor
~particleForces();
// Member Functions
// Access
//- Return the particleForces dictionary
const dictionary& dict() const;
//- Return the gravity vector
const vector& g() const;
//- Return gravity force activate switch
Switch gravity() const;
//- Return virtual mass force activate switch
Switch virtualMass() const;
//- Return virtual mass force coefficient
scalar Cvm() const;
//- Return pressure gradient force activate switch
Switch pressureGradient() const;
//- Return name of velocity field
const word& UName() const;
//- Return paramagnetic force activate switch
Switch paramagnetic() const;
//- Return magnetic susceptibility
scalar magneticSusceptibility() const;
//- Return name of paramagnetic field strength field
const word& HdotGradHName() const;
// Evaluation
//- Cache carrier fields
void cacheFields
(
const bool store,
const dictionary& interpolationSchemes
);
//- Calculate action/reaction forces between carrier and particles
vector calcCoupled
(
const vector& position,
const tetIndices& tetIs,
const scalar dt,
const scalar rhoc,
const scalar rho,
const vector& Uc,
const vector& U,
const scalar d
) const;
//- Calculate external forces applied to the particles
vector calcNonCoupled
(
const vector& position,
const tetIndices& tetIs,
const scalar dt,
const scalar rhoc,
const scalar rho,
const vector& Uc,
const vector& U,
const scalar d
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "ParticleForceList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ParticleForceList<CloudType>::ParticleForceList
(
CloudType& owner,
const fvMesh& mesh
)
:
PtrList<ParticleForce<CloudType> >(),
owner_(owner),
mesh_(mesh),
dict_(dictionary::null)
{}
template<class CloudType>
Foam::ParticleForceList<CloudType>::ParticleForceList
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const bool readFields
)
:
PtrList<ParticleForce<CloudType> >(),
owner_(owner),
mesh_(mesh),
dict_(dict)
{
if (readFields)
{
const wordList models(dict.lookup("activeForces"));
Info<< "Constructing particle forces" << endl;
if (models.size() > 0)
{
this->setSize(models.size());
forAll(models, i)
{
set
(
i,
ParticleForce<CloudType>::New(owner, mesh, dict, models[i])
);
}
}
else
{
Info<< " none" << endl;
}
}
}
template<class CloudType>
Foam::ParticleForceList<CloudType>::ParticleForceList
(
const ParticleForceList& pf
)
:
PtrList<ParticleForce<CloudType> >(pf),
owner_(pf.owner_),
mesh_(pf.mesh_),
dict_(pf.dict_)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ParticleForceList<CloudType>::~ParticleForceList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ParticleForceList<CloudType>::cacheFields(const bool store)
{
forAll(*this, i)
{
this->operator[](i).cacheFields(store);
}
}
template<class CloudType>
Foam::forceSuSp Foam::ParticleForceList<CloudType>::calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value(vector::zero, 0.0);
forAll(*this, i)
{
value += this->operator[](i).calcCoupled(p, dt, Re, rhoc, muc);
}
return value;
}
template<class CloudType>
Foam::forceSuSp Foam::ParticleForceList<CloudType>::calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value(vector::zero, 0.0);
forAll(*this, i)
{
value += this->operator[](i).calcNonCoupled(p, dt, Re, rhoc, muc);
}
return value;
}
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
Class
Foam::ParticleForceList
Description
List of particle forces
SourceFiles
ParticleForceListI.H
ParticleForceList.C
\*---------------------------------------------------------------------------*/
#ifndef ParticleForceList_H
#define ParticleForceList_H
#include "ParticleForce.H"
#include "forceSuSp.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ParticleForceList Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ParticleForceList
:
public PtrList<ParticleForce<CloudType> >
{
// Private data
//- Reference to the owner cloud
CloudType& owner_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Forces dictionary
const dictionary dict_;
public:
// Constructors
//- Null constructor
ParticleForceList(CloudType& owner, const fvMesh& mesh);
//- Construct from mesh
ParticleForceList
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const bool readFields
);
//- Construct copy
ParticleForceList(const ParticleForceList& pfl);
//- Destructor
virtual ~ParticleForceList();
// Member Functions
// Access
//- Return const access to the cloud owner
inline const CloudType& owner() const;
//- Return refernce to the cloud owner
inline CloudType& owner();
//- Return the mesh database
inline const fvMesh& mesh() const;
//- Return the forces dictionary
inline const dictionary& dict() const;
// Evaluation
//- Cache fields
virtual void cacheFields(const bool store);
//- Calculate the coupled force
virtual forceSuSp calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
//- Calculate the non-coupled force
virtual forceSuSp calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleForceListI.H"
#ifdef NoRepository
#include "ParticleForceList.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,30 +23,34 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef makeParcelDragModels_H
#define makeParcelDragModels_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "KinematicCloud.H" template<class CloudType>
inline const CloudType& Foam::ParticleForceList<CloudType>::owner() const
#include "NoDrag.H" {
#include "NonSphereDrag.H" return owner_;
#include "SphereDrag.H" }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeParcelDragModels(ParcelType) \
\
makeDragModel(KinematicCloud<ParcelType>); \
\
makeDragModelType(NoDrag, KinematicCloud, ParcelType); \
makeDragModelType(NonSphereDrag, KinematicCloud, ParcelType); \
makeDragModelType(SphereDrag, KinematicCloud, ParcelType);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<class CloudType>
inline CloudType& Foam::ParticleForceList<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
inline const Foam::fvMesh& Foam::ParticleForceList<CloudType>::mesh() const
{
return mesh_;
}
template<class CloudType>
inline const Foam::dictionary& Foam::ParticleForceList<CloudType>::dict() const
{
return dict_;
}
#endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,157 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-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/>.
Class
Foam::DragModel
Description
Templated drag model class
SourceFiles
DragModel.C
DragModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef DragModel_H
#define DragModel_H
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class DragModel Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class DragModel
:
public SubModelBase<CloudType>
{
public:
//- Runtime type information
TypeName("DragModel");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
DragModel,
dictionary,
(
const dictionary& dict,
CloudType& owner
),
(dict, owner)
);
// Constructors
//- Construct null from owner
DragModel(CloudType& owner);
//- Construct from components
DragModel
(
const dictionary& dict,
CloudType& owner,
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();
//- Selector
static autoPtr<DragModel<CloudType> > New
(
const dictionary& dict,
CloudType& cloud
);
// Member Functions
//- Return drag coefficient
virtual scalar Cd(const scalar Re) const;
//- Return momentum transfer coefficient
// Drag force per unit particle surface area = utc(U - Up)
scalar utc(const scalar Re, const scalar d, const scalar mu) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeDragModel(CloudType) \
\
defineNamedTemplateTypeNameAndDebug(DragModel<CloudType>, 0); \
\
defineTemplateRunTimeSelectionTable(DragModel<CloudType>, dictionary);
#define makeDragModelType(SS, CloudType, ParcelType) \
\
defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
\
DragModel<CloudType<ParcelType> >:: \
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
add##SS##CloudType##ParcelType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "DragModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,19 +23,30 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "NonSphereDrag.H" #include "NonSphereDragForce.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::NonSphereDragForce<CloudType>::Cd(const scalar Re) const
{
return 24.0/(Re + ROOTVSMALL)*(1.0 + a_*pow(Re, b_)) + Re*c_/(Re + d_);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::NonSphereDrag<CloudType>::NonSphereDrag Foam::NonSphereDragForce<CloudType>::NonSphereDragForce
( (
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict, const dictionary& dict,
CloudType& owner const word& forceType
) )
: :
DragModel<CloudType>(dict, owner, typeName), ParticleForce<CloudType>(owner, mesh, dict, forceType),
phi_(readScalar(this->coeffDict().lookup("phi"))), phi_(readScalar(this->coeffs().lookup("phi"))),
a_(exp(2.3288 - 6.4581*phi_ + 2.4486*sqr(phi_))), a_(exp(2.3288 - 6.4581*phi_ + 2.4486*sqr(phi_))),
b_(0.0964 + 0.5565*phi_), b_(0.0964 + 0.5565*phi_),
c_(exp(4.9050 - 13.8944*phi_ + 18.4222*sqr(phi_) - 10.2599*pow3(phi_))), c_(exp(4.9050 - 13.8944*phi_ + 18.4222*sqr(phi_) - 10.2599*pow3(phi_))),
@ -58,33 +69,44 @@ Foam::NonSphereDrag<CloudType>::NonSphereDrag
template<class CloudType> template<class CloudType>
Foam::NonSphereDrag<CloudType>::NonSphereDrag Foam::NonSphereDragForce<CloudType>::NonSphereDragForce
( (
const NonSphereDrag<CloudType>& dm const NonSphereDragForce<CloudType>& df
) )
: :
DragModel<CloudType>(dm), ParticleForce<CloudType>(df),
phi_(dm.phi_), phi_(df.phi_),
a_(dm.a_), a_(df.a_),
b_(dm.b_), b_(df.b_),
c_(dm.c_), c_(df.c_),
d_(dm.d_) d_(df.d_)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::NonSphereDrag<CloudType>::~NonSphereDrag() Foam::NonSphereDragForce<CloudType>::~NonSphereDragForce()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::scalar Foam::NonSphereDrag<CloudType>::Cd(const scalar Re) const Foam::forceSuSp Foam::NonSphereDragForce<CloudType>::calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{ {
return 24.0/(Re + ROOTVSMALL)*(1.0 + a_*pow(Re, b_)) + Re*c_/(Re + d_); forceSuSp value(vector::zero, 0.0);
value.Sp() = Cd(Re)*Re/p.d()*muc/8.0 + ROOTVSMALL;
return value;
} }

View File

@ -57,31 +57,28 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef NonSphereDrag_H #ifndef NonSphereDragForce_H
#define NonSphereDrag_H #define NonSphereDragForce_H
#include "DragModel.H" #include "ParticleForce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class NonSphereDrag Declaration Class NonSphereDragForce Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CloudType> template<class CloudType>
class NonSphereDrag class NonSphereDragForce
: :
public DragModel<CloudType> public ParticleForce<CloudType>
{ {
protected: protected:
// Protected Data // Protected Data
//- Flag to indicate `Simple model'
bool simpleModel_;
//- Ratio of surface of sphere having same volume as particle to //- Ratio of surface of sphere having same volume as particle to
// actual surface area of particle (0 < phi <= 1) // actual surface area of particle (0 < phi <= 1)
scalar phi_; scalar phi_;
@ -98,38 +95,59 @@ protected:
scalar d_; scalar d_;
// Private Member Functions
//- Drag coefficient
scalar Cd(const scalar Re) const;
public: public:
//- Runtime type information //- Runtime type information
TypeName("NonSphereDrag"); TypeName("nonSphereDrag");
// Constructors // Constructors
//- Construct from dictionary //- Construct from mesh
NonSphereDrag(const dictionary& dict, CloudType& owner); NonSphereDragForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
//- Construct copy //- Construct copy
NonSphereDrag(const NonSphereDrag<CloudType>& dm); NonSphereDragForce(const NonSphereDragForce<CloudType>& df);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<DragModel<CloudType> > clone() const virtual autoPtr<ParticleForce<CloudType> > clone() const
{ {
return autoPtr<DragModel<CloudType> > return autoPtr<ParticleForce<CloudType> >
( (
new NonSphereDrag<CloudType>(*this) new NonSphereDragForce<CloudType>(*this)
); );
} }
//- Destructor //- Destructor
virtual ~NonSphereDrag(); virtual ~NonSphereDragForce();
// Member Functions // Member Functions
//- Return drag coefficient // Evaluation
scalar Cd(const scalar Re) const;
//- Calculate the non-coupled force
virtual forceSuSp calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
}; };
@ -140,7 +158,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "NonSphereDrag.C" # include "NonSphereDragForce.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,39 +23,12 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "SphereDrag.H" #include "SphereDragForce.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::SphereDrag<CloudType>::SphereDrag Foam::scalar Foam::SphereDragForce<CloudType>::Cd(const scalar Re) const
(
const dictionary&,
CloudType& owner
)
:
DragModel<CloudType>(owner)
{}
template<class CloudType>
Foam::SphereDrag<CloudType>::SphereDrag(const SphereDrag<CloudType>& dm)
:
DragModel<CloudType>(dm)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SphereDrag<CloudType>::~SphereDrag()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::SphereDrag<CloudType>::Cd(const scalar Re) const
{ {
scalar Cd; scalar Cd;
if (Re < SMALL) if (Re < SMALL)
@ -75,4 +48,56 @@ Foam::scalar Foam::SphereDrag<CloudType>::Cd(const scalar Re) const
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SphereDragForce<CloudType>::SphereDragForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
)
:
ParticleForce<CloudType>(owner, mesh, dict, forceType)
{}
template<class CloudType>
Foam::SphereDragForce<CloudType>::SphereDragForce
(
const SphereDragForce<CloudType>& df
)
:
ParticleForce<CloudType>(df)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SphereDragForce<CloudType>::~SphereDragForce()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::forceSuSp Foam::SphereDragForce<CloudType>::calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value(vector::zero, 0.0);
value.Sp() = Cd(Re)*Re/p.d()*muc/8.0 + ROOTVSMALL;
return value;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,63 +22,84 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::SphereDrag Foam::SphereDragForce
Description Description
Drag model based on assumption of solid spheres Drag model based on assumption of solid spheres
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef SphereDrag_H #ifndef SphereDragForce_H
#define SphereDrag_H #define SphereDragForce_H
#include "DragModel.H" #include "ParticleForce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class SphereDrag Declaration Class SphereDragForce Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CloudType> template<class CloudType>
class SphereDrag class SphereDragForce
: :
public DragModel<CloudType> public ParticleForce<CloudType>
{ {
// Private Member Functions
//- Drag coefficient
scalar Cd(const scalar Re) const;
public: public:
//- Runtime type information //- Runtime type information
TypeName("SphereDrag"); TypeName("sphereDrag");
// Constructors // Constructors
//- Construct from dictionary //- Construct from mesh
SphereDrag(const dictionary& dict, CloudType& owner); SphereDragForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
//- Construct copy //- Construct copy
SphereDrag(const SphereDrag<CloudType>& dm); SphereDragForce(const SphereDragForce<CloudType>& df);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<DragModel<CloudType> > clone() const virtual autoPtr<ParticleForce<CloudType> > clone() const
{ {
return autoPtr<DragModel<CloudType> > return autoPtr<ParticleForce<CloudType> >
( (
new SphereDrag<CloudType>(*this) new SphereDragForce<CloudType>(*this)
); );
} }
//- Destructor //- Destructor
virtual ~SphereDrag(); virtual ~SphereDragForce();
// Member Functions // Member Functions
//- Return drag coefficient // Evaluation
scalar Cd(const scalar Re) const;
//- Calculate the non-coupled force
virtual forceSuSp calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
}; };
@ -89,7 +110,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "SphereDrag.C" # include "SphereDragForce.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,73 +23,57 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "DragModel.H" #include "GravityForce.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::DragModel<CloudType>::DragModel(CloudType& owner) Foam::GravityForce<CloudType>::GravityForce
:
SubModelBase<CloudType>(owner)
{}
template<class CloudType>
Foam::DragModel<CloudType>::DragModel
( (
const dictionary& dict,
CloudType& owner, CloudType& owner,
const word& type const fvMesh& mesh,
const dictionary& dict,
const word& forceType
) )
: :
SubModelBase<CloudType>(owner, dict, type) ParticleForce<CloudType>(owner, mesh, dict, forceType),
g_(owner.g().value())
{} {}
template<class CloudType> template<class CloudType>
Foam::DragModel<CloudType>::DragModel(const DragModel<CloudType>& dm) Foam::GravityForce<CloudType>::GravityForce(const GravityForce& gf)
: :
SubModelBase<CloudType>(dm) ParticleForce<CloudType>(gf),
g_(gf.g_)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::DragModel<CloudType>::~DragModel() Foam::GravityForce<CloudType>::~GravityForce()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::scalar Foam::DragModel<CloudType>::Cd(const scalar) const Foam::forceSuSp Foam::GravityForce<CloudType>::calcNonCoupled
{
notImplemented
(
"Foam::scalar Foam::DragModel<CloudType>::Cd(const scalar) const"
);
return 0.0;
}
template<class CloudType>
Foam::scalar Foam::DragModel<CloudType>::utc
( (
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re, const scalar Re,
const scalar d, const scalar rhoc,
const scalar mu const scalar muc
) const ) const
{ {
const scalar Cd = this->Cd(Re); forceSuSp value(vector::zero, 0.0);
return Cd*Re/d*mu/8.0; value.Su() = g_*(1.0 - rhoc/p.rho());
return value;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "DragModelNew.C"
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,135 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
Class
Foam::GravityForce
Description
Calculates particle gravity force
SourceFiles
GravityForceI.H
GravityForce.C
\*---------------------------------------------------------------------------*/
#ifndef GravityForce_H
#define GravityForce_H
#include "ParticleForce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class GravityForce Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class GravityForce
:
public ParticleForce<CloudType>
{
// Private data
//- Reference to the acceleration due to gravity
const vector& g_;
public:
//- Runtime type information
TypeName("gravity");
// Constructors
//- Construct from mesh
GravityForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
//- Construct copy
GravityForce(const GravityForce& gf);
//- Construct and return a clone
virtual autoPtr<ParticleForce<CloudType> > clone() const
{
return autoPtr<ParticleForce<CloudType> >
(
new GravityForce<CloudType>(*this)
);
}
//- Destructor
virtual ~GravityForce();
// Member Functions
// Access
//- Return the the acceleration due to gravity
inline const vector& g() const;
// Evaluation
//- Calculate the non-coupled force
virtual forceSuSp calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "GravityForceI.H"
#ifdef NoRepository
#include "GravityForce.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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>
inline const Foam::vector& Foam::GravityForce<CloudType>::g() const
{
return g_;
}
// ************************************************************************* //

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "ParamagneticForce.H"
#include "demandDrivenData.H"
#include "electromagneticConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ParamagneticForce<CloudType>::ParamagneticForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
)
:
ParticleForce<CloudType>(owner, mesh, dict, forceType),
HdotGradHName_
(
this->coeffs().template lookupOrDefault<word>("HdotGradH", "HdotGradH")
),
HdotGradHInterpPtr_(NULL),
magneticSusceptibility_
(
readScalar(this->coeffs().lookup("magneticSusceptibility"))
)
{}
template<class CloudType>
Foam::ParamagneticForce<CloudType>::ParamagneticForce
(
const ParamagneticForce& pf
)
:
ParticleForce<CloudType>(pf),
HdotGradHName_(pf.HdotGradHName_),
HdotGradHInterpPtr_(pf.HdotGradHInterpPtr_),
magneticSusceptibility_(pf.magneticSusceptibility_)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ParamagneticForce<CloudType>::~ParamagneticForce()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ParamagneticForce<CloudType>::cacheFields(const bool store)
{
if (store)
{
const volVectorField& HdotGradH =
this->mesh().template lookupObject<volVectorField>(HdotGradHName_);
HdotGradHInterpPtr_ = interpolation<vector>::New
(
this->owner().solution().interpolationSchemes(),
HdotGradH
).ptr();
}
else
{
deleteDemandDrivenData(HdotGradHInterpPtr_);
}
}
template<class CloudType>
Foam::forceSuSp Foam::ParamagneticForce<CloudType>::calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value(vector::zero, 0.0);
const interpolation<vector>& HdotGradHInterp = *HdotGradHInterpPtr_;
value.Su()=
3.0*constant::electromagnetic::mu0.value()/p.rho()
*magneticSusceptibility_/(magneticSusceptibility_ + 3)
*HdotGradHInterp.interpolate(p.position(), p.currentTetIndices());
return value;
}
// ************************************************************************* //

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
Class
Foam::ParamagneticForce
Description
Calculates particle paramagnetic (magnetic field) force
SourceFiles
ParamagneticForceI.H
ParamagneticForce.C
\*---------------------------------------------------------------------------*/
#ifndef ParamagneticForce_H
#define ParamagneticForce_H
#include "ParticleForce.H"
#include "interpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class ParamagneticForce Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ParamagneticForce
:
public ParticleForce<CloudType>
{
// Private data
//- Name of paramagnetic field strength field - default = "HdotGradH"
const word HdotGradHName_;
//- HdotGradH interpolator
const interpolation<vector>* HdotGradHInterpPtr_;
//- Magnetic susceptibility of particle
const scalar magneticSusceptibility_;
public:
//- Runtime type information
TypeName("paramagnetic");
// Constructors
//- Construct from mesh
ParamagneticForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
//- Construct copy
ParamagneticForce(const ParamagneticForce& gf);
//- Construct and return a clone
virtual autoPtr<ParticleForce<CloudType> > clone() const
{
return autoPtr<ParticleForce<CloudType> >
(
new ParamagneticForce<CloudType>(*this)
);
}
//- Destructor
virtual ~ParamagneticForce();
// Member Functions
// Access
//- Return the name of paramagnetic field strength field
const word& HdotGradHName() const;
//- Return the magnetic susceptibility of particle
scalar magneticSusceptibility() const;
// Evaluation
//- Cache fields
virtual void cacheFields(const bool store);
//- Calculate the non-coupled force
virtual forceSuSp calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParamagneticForceI.H"
#ifdef NoRepository
#include "ParamagneticForce.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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>
inline const Foam::word&
Foam::ParamagneticForce<CloudType>::HdotGradHName() const
{
return HdotGradHName_;
}
template<class CloudType>
inline Foam::scalar
Foam::ParamagneticForce<CloudType>::magneticSusceptibility() const
{
return magneticSusceptibility_;
}
// ************************************************************************* //

View File

@ -0,0 +1,110 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "ParticleForce.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ParticleForce<CloudType>::ParticleForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
)
:
owner_(owner),
mesh_(mesh),
dict_(dict),
coeffs_(dict.subOrEmptyDict(forceType + "Coeffs"))
{}
template<class CloudType>
Foam::ParticleForce<CloudType>::ParticleForce(const ParticleForce& pf)
:
owner_(pf.owner_),
mesh_(pf.mesh_),
dict_(pf.dict_),
coeffs_(pf.coeffs_)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ParticleForce<CloudType>::~ParticleForce()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ParticleForce<CloudType>::cacheFields(const bool store)
{}
template<class CloudType>
Foam::forceSuSp Foam::ParticleForce<CloudType>::calcCoupled
(
const typename CloudType::parcelType&,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value;
value.Su() = vector::zero;
value.Sp() = 0.0;
return value;
}
template<class CloudType>
Foam::forceSuSp Foam::ParticleForce<CloudType>::calcNonCoupled
(
const typename CloudType::parcelType&,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value;
value.Su() = vector::zero;
value.Sp() = 0.0;
return value;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleForceNew.C"
// ************************************************************************* //

View File

@ -0,0 +1,215 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
Class
Foam::ParticleForce
Description
Abstract base class for particle forces
SourceFiles
ParticleForceI.H
ParticleForce.C
ParticleForceNew.C
\*---------------------------------------------------------------------------*/
#ifndef ParticleForce_H
#define ParticleForce_H
#include "dictionary.H"
#include "forceSuSp.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ParticleForce Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ParticleForce
{
// Private data
//- Reference to the owner cloud
CloudType& owner_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Forces dictionary
const dictionary dict_;
//- Force coefficients dictaionary
const dictionary coeffs_;
public:
//- Runtime type information
TypeName("particleForce");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
ParticleForce,
dictionary,
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
),
(owner, mesh, dict, forceType)
);
//- Convenience typedef for return type
typedef VectorSpace<Vector<vector>, vector, 2> returnType;
// Constructors
//- Construct from mesh
ParticleForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
//- Construct copy
ParticleForce(const ParticleForce& pf);
//- Construct and return a clone
virtual autoPtr<ParticleForce<CloudType> > clone() const
{
return autoPtr<ParticleForce<CloudType> >
(
new ParticleForce<CloudType>(*this)
);
}
//- Destructor
virtual ~ParticleForce();
//- Selector
static autoPtr<ParticleForce<CloudType> > New
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
// Member Functions
// Access
//- Return const access to the cloud owner
inline const CloudType& owner() const;
//- Return refernce to the cloud owner
inline CloudType& owner();
//- Return the mesh database
inline const fvMesh& mesh() const;
//- Return the forces dictionary
inline const dictionary& dict() const;
//- Return the force coefficients dictionary
inline const dictionary& coeffs() const;
// Evaluation
//- Cache fields
virtual void cacheFields(const bool store);
//- Calculate the coupled force
virtual forceSuSp calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
//- Calculate the non-coupled force
virtual forceSuSp calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleForceI.H"
#ifdef NoRepository
#include "ParticleForce.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeParticleForceModel(CloudType) \
\
defineNamedTemplateTypeNameAndDebug(ParticleForce<CloudType>, 0); \
defineTemplateRunTimeSelectionTable(ParticleForce<CloudType>, dictionary);
#define makeParticleForceModelType(SS, CloudType, ParcelType) \
\
defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
\
ParticleForce<CloudType<ParcelType> >:: \
adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
add##SS##CloudType##ParcelType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,44 +23,40 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "NoDrag.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::NoDrag<CloudType>::NoDrag(const dictionary& dict, CloudType& owner) inline const CloudType& Foam::ParticleForce<CloudType>::owner() const
:
DragModel<CloudType>(owner)
{}
template<class CloudType>
Foam::NoDrag<CloudType>::NoDrag(const NoDrag<CloudType>& dm)
:
DragModel<CloudType>(dm.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::NoDrag<CloudType>::~NoDrag()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::NoDrag<CloudType>::active() const
{ {
return false; return owner_;
} }
template<class CloudType> template<class CloudType>
Foam::scalar Foam::NoDrag<CloudType>::Cd(const scalar) const inline CloudType& Foam::ParticleForce<CloudType>::owner()
{ {
return 0.0; return owner_;
}
template<class CloudType>
inline const Foam::fvMesh& Foam::ParticleForce<CloudType>::mesh() const
{
return mesh_;
}
template<class CloudType>
inline const Foam::dictionary& Foam::ParticleForce<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
inline const Foam::dictionary& Foam::ParticleForce<CloudType>::coeffs() const
{
return coeffs_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,41 +23,55 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "DragModel.H" #include "ParticleForce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::autoPtr<Foam::DragModel<CloudType> > Foam::DragModel<CloudType>::New Foam::autoPtr<Foam::ParticleForce<CloudType> >
Foam::ParticleForce<CloudType>::New
( (
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict, const dictionary& dict,
CloudType& owner const word& forceType
) )
{ {
const word modelType(dict.lookup("DragModel")); Info<< " Selecting particle force " << forceType << endl;
Info<< "Selecting DragModel " << modelType << endl;
typename dictionaryConstructorTable::iterator cstrIter = typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType); dictionaryConstructorTablePtr_->find(forceType);
if (cstrIter == dictionaryConstructorTablePtr_->end()) if (cstrIter == dictionaryConstructorTablePtr_->end())
{ {
FatalErrorIn FatalErrorIn
( (
"DragModel<CloudType>::New" "ParticleForce<CloudType>::New"
"(" "("
"const dictionary&," "CloudType&, "
"CloudType&" "const fvMesh&, "
"const dictionary&, "
"const word&"
")" ")"
) << "Unknown DragModel type " ) << "Unknown particle force type "
<< modelType << nl << nl << forceType
<< "Valid DragModel types are:" << nl << ", constructor not in hash table" << nl << nl
<< " Valid particle force types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalError);
} }
return autoPtr<DragModel<CloudType> >(cstrIter()(dict, owner)); return autoPtr<ParticleForce<CloudType> >
(
cstrIter()
(
owner,
mesh,
dict,
forceType
)
);
} }

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "PressureGradientForce.H"
#include "fvcGrad.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PressureGradientForce<CloudType>::PressureGradientForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
)
:
ParticleForce<CloudType>(owner, mesh, dict, forceType),
UName_(this->coeffs().lookup("U")),
gradUPtr_(NULL)
{}
template<class CloudType>
Foam::PressureGradientForce<CloudType>::PressureGradientForce
(
const PressureGradientForce& pgf
)
:
ParticleForce<CloudType>(pgf),
UName_(pgf.UName_),
gradUPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType>
Foam::PressureGradientForce<CloudType>::~PressureGradientForce()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::PressureGradientForce<CloudType>::cacheFields(const bool store)
{
if (store)
{
const volVectorField& U = this->mesh().template
lookupObject<volVectorField>(UName_);
gradUPtr_ = fvc::grad(U).ptr();
}
else
{
if (gradUPtr_)
{
delete gradUPtr_;
gradUPtr_ = NULL;
}
}
}
template<class CloudType>
Foam::forceSuSp Foam::PressureGradientForce<CloudType>::calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value(vector::zero, 0.0);
const volTensorField& gradU = *gradUPtr_;
value.Su() = rhoc/p.rho()*(p.U() & gradU[p.cell()]);
return value;
}
// ************************************************************************* //

View File

@ -0,0 +1,140 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
Class
Foam::PressureGradientForce
Description
Calculates particle pressure gradient force
SourceFiles
PressureGradientForceI.H
PressureGradientForce.C
\*---------------------------------------------------------------------------*/
#ifndef PressureGradientForce_H
#define PressureGradientForce_H
#include "ParticleForce.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class PressureGradientForce Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class PressureGradientForce
:
public ParticleForce<CloudType>
{
// Private data
//- Name of velocity field
const word UName_;
//- Velocity gradient field
const volTensorField* gradUPtr_;
public:
//- Runtime type information
TypeName("pressureGradient");
// Constructors
//- Construct from mesh
PressureGradientForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
//- Construct copy
PressureGradientForce(const PressureGradientForce& pgf);
//- Construct and return a clone
virtual autoPtr<ParticleForce<CloudType> > clone() const
{
return autoPtr<ParticleForce<CloudType> >
(
new PressureGradientForce<CloudType>(*this)
);
}
//- Destructor
virtual ~PressureGradientForce();
// Member Functions
// Access
//- Return const access to the velocity gradient field
inline const volTensorField& gradU() const;
// Evaluation
//- Cache fields
virtual void cacheFields(const bool store);
//- Calculate the non-coupled force
virtual forceSuSp calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PressureGradientForceI.H"
#ifdef NoRepository
#include "PressureGradientForce.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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::volTensorField& Foam::PressureGradientForce<CloudType>::gradU()
const
{
if (gradUPtr_)
{
return *gradUPtr_;
}
else
{
FatalErrorIn
(
"const volTensorField& PressureGradientForce<CloudType>::gradU()"
"const"
) << "gradU field not allocated" << abort(FatalError);
return reinterpret_cast<const volTensorField>(0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "SRFForce.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SRFForce<CloudType>::SRFForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
)
:
ParticleForce<CloudType>(owner, mesh, dict, forceType),
srfPtr_(NULL)
{}
template<class CloudType>
Foam::SRFForce<CloudType>::SRFForce
(
const SRFForce& srff
)
:
ParticleForce<CloudType>(srff),
srfPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SRFForce<CloudType>::~SRFForce()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::SRFForce<CloudType>::cacheFields(const bool store)
{
if (store)
{
const typename SRF::SRFModel& model = this->mesh().template
lookupObject<SRF::SRFModel>("SRFProperties");
srfPtr_ = &model;
}
else
{
srfPtr_ = NULL;
}
}
template<class CloudType>
Foam::forceSuSp Foam::SRFForce<CloudType>::calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value(vector::zero, 0.0);
const typename SRF::SRFModel& srf = *srfPtr_;
const vector& omega = srf.omega().value();
const vector& axis = srf.axis();
const vector r = p.position() - axis*(axis & p.position());
// Coriolis and centrifugal acceleration terms
value.Su() = 2.0*(p.U() ^ omega) + (omega ^ (r ^ omega));
return value;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,66 +22,95 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::NoDrag Foam::SRFForce
Description Description
Dummy drag model for 'none' Calculates particle SRF reference frame force
SourceFiles
SRFForceI.H
SRFForce.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef NoDrag_H #ifndef SRFForce_H
#define NoDrag_H #define SRFForce_H
#include "DragModel.H" #include "ParticleForce.H"
#include "SRFModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
class fvMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class NoDrag Declaration Class SRFForce Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CloudType> template<class CloudType>
class NoDrag class SRFForce
: :
public DragModel<CloudType> public ParticleForce<CloudType>
{ {
// Private data
//- Pointer to the SRF model
const typename SRF::SRFModel* srfPtr_;
public: public:
//- Runtime type information //- Runtime type information
TypeName("none"); TypeName("SRF");
// Constructors // Constructors
//- Construct from dictionary //- Construct from mesh
NoDrag(const dictionary&, CloudType&); SRFForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
//- Construct copy //- Construct copy
NoDrag(const NoDrag<CloudType>& dm); SRFForce(const SRFForce& srff);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<DragModel<CloudType> > clone() const virtual autoPtr<ParticleForce<CloudType> > clone() const
{ {
return autoPtr<DragModel<CloudType> > return autoPtr<ParticleForce<CloudType> >
( (
new NoDrag<CloudType>(*this) new ParticleForce<CloudType>(*this)
); );
} }
//- Destructor //- Destructor
virtual ~NoDrag(); virtual ~SRFForce();
// Member Functions // Member Functions
//- Flag to indicate whether model activates drag model // Evaluation
bool active() const;
//- Return drag coefficient //- Cache fields
scalar Cd(const scalar) const; virtual void cacheFields(const bool store);
//- Calculate the non-coupled force
virtual forceSuSp calcNonCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
}; };
@ -92,7 +121,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "NoDrag.C" #include "SRFForce.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
Class
Foam::forceSuSp
Description
Helper container for force Su and Sp terms
SourceFiles
forceSuSpI.H
\*---------------------------------------------------------------------------*/
#ifndef forceSuSp_H
#define forceSuSp_H
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions
class forceSuSp;
inline forceSuSp operator+(const forceSuSp& susp1, const forceSuSp& susp2);
inline forceSuSp operator*(const forceSuSp& susp, const scalar s);
/*---------------------------------------------------------------------------*\
Class forceSuSp Declaration
\*---------------------------------------------------------------------------*/
class forceSuSp
:
public Tuple2<vector, scalar>
{
public:
//- Component labeling enumeration
enum components
{
SU = 0,
SP = 1
};
// Constructors
//- Construct null
inline forceSuSp();
//- Construct given VectorSpace
inline forceSuSp(const Tuple2<vector, scalar>& susp);
//- Construct given two components
inline forceSuSp(const vector& Su, const scalar Sp);
//- Construct from Istream
inline forceSuSp(Istream&);
// Member Functions
// Access
//- Return const access to the explicit contribution
inline const vector& Su() const;
//- Return const access to the implicit contribution
inline scalar Sp() const;
// Edit
//- Return reference to the explicit contribution
inline vector& Su();
//- Return reference to the explicit contribution
inline scalar& Sp();
// Operators
//- Assignment
inline void operator=(const forceSuSp& susp);
//- Addition
inline void operator+=(const forceSuSp& susp);
//- Subtraction
inline void operator-=(const forceSuSp& susp);
// Friend operators
//- Addition
friend inline forceSuSp operator*
(
const forceSuSp& susp1,
const forceSuSp& susp2
);
//- Multiplication
friend inline forceSuSp operator*
(
const scalar s,
const forceSuSp& susp
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "forceSuSpI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,129 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
inline Foam::forceSuSp::forceSuSp()
{}
inline Foam::forceSuSp::forceSuSp
(
const Tuple2<vector, scalar>& fs
)
:
Tuple2<vector, scalar>(fs)
{}
inline Foam::forceSuSp::forceSuSp(const vector& Su, const scalar Sp)
{
first() = Su;
second() = Sp;
}
inline Foam::forceSuSp::forceSuSp(Istream& is)
:
Tuple2<vector, scalar>(is)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::vector& Foam::forceSuSp::Su() const
{
return first();
}
inline Foam::scalar Foam::forceSuSp::Sp() const
{
return second();
}
inline Foam::vector& Foam::forceSuSp::Su()
{
return first();
}
inline Foam::scalar& Foam::forceSuSp::Sp()
{
return second();
}
// * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * * //
inline void Foam::forceSuSp::operator=(const forceSuSp& susp)
{
first() = susp.first();
second() = susp.second();
}
inline void Foam::forceSuSp::operator+=(const forceSuSp& susp)
{
first() += susp.first();
second() += susp.second();
}
inline void Foam::forceSuSp::operator-=(const forceSuSp& susp)
{
first() -= susp.first();
second() -= susp.second();
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
inline Foam::forceSuSp Foam::operator+
(
const forceSuSp& susp1,
const forceSuSp& susp2
)
{
return forceSuSp
(
susp1.first() + susp2.first(),
susp1.second() + susp2.second()
);
}
inline Foam::forceSuSp Foam::operator*
(
const scalar s,
const forceSuSp& susp
)
{
return forceSuSp(susp.first()*s, susp.second()*s);
}
// ************************************************************************* //

View File

@ -0,0 +1,210 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "BrownianMotionForce.H"
#include "mathematicalConstants.H"
#include "demandDrivenData.H"
using namespace Foam::constant;
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::BrownianMotionForce<CloudType>::erfInv(const scalar y) const
{
const scalar a = 0.147;
scalar k = 2.0/(mathematical::pi*a) + 0.5*log(1.0 - y*y);
scalar h = log(1.0 - y*y)/a;
scalar x = sqrt(-k + sqrt(k*k - h));
if (y < 0.0)
{
return -x;
}
else
{
return x;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::BrownianMotionForce<CloudType>::BrownianMotionForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
)
:
ParticleForce<CloudType>(owner, mesh, dict, forceType),
rndGen_(owner.rndGen()),
lambda_(readScalar(this->coeffs().lookup("lambda"))),
turbulence_(readBool(this->coeffs().lookup("turbulence"))),
turbulenceModelPtr_(NULL),
kPtr_(NULL),
ownK_(false)
{
if (turbulence_)
{
HashTable<const compressible::turbulenceModel*> models =
this->mesh().objectRegistry::lookupClass
<
compressible::turbulenceModel
>();
if (models.size() == 1)
{
turbulenceModelPtr_ = models.begin()();
}
else
{
FatalErrorIn
(
"Foam::BrownianMotionForce<CloudType>::BrownianMotionForce"
"("
"CloudType&, "
"const fvMesh&, "
"const dictionary&"
")"
) << "Unable to find a valid turbulence model in mesh database"
<< exit(FatalError);
}
}
}
template<class CloudType>
Foam::BrownianMotionForce<CloudType>::BrownianMotionForce
(
const BrownianMotionForce& bmf
)
:
ParticleForce<CloudType>(bmf),
rndGen_(bmf.rndGen_),
lambda_(bmf.lambda_),
turbulence_(bmf.turbulence_),
turbulenceModelPtr_(NULL),
kPtr_(NULL),
ownK_(false)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType>
Foam::BrownianMotionForce<CloudType>::~BrownianMotionForce()
{
turbulenceModelPtr_ = NULL;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::BrownianMotionForce<CloudType>::cacheFields(const bool store)
{
if (turbulence_)
{
if (store)
{
tmp<volScalarField> tk = turbulenceModelPtr_->k();
if (tk.isTmp())
{
kPtr_ = tk.ptr();
ownK_ = true;
}
else
{
kPtr_ = tk.operator->();
ownK_ = false;
}
}
else
{
if (ownK_ && kPtr_)
{
deleteDemandDrivenData(kPtr_);
ownK_ = false;
}
}
}
}
template<class CloudType>
Foam::forceSuSp Foam::BrownianMotionForce<CloudType>::calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const
{
forceSuSp value(vector::zero, 0.0);
const scalar dp = p.d();
const scalar Tc = p.Tc();
const scalar eta = rndGen_.sample01<scalar>();
const scalar alpha = 2.0*lambda_/dp;
const scalar cc = 1.0 + alpha*(1.257 + 0.4*exp(-1.1/alpha));
const scalar sigma = physicoChemical::sigma.value();
scalar f = 0.0;
if (turbulence_)
{
const scalar mp = p.mass();
const label cellI = p.cell();
const volScalarField& k = *kPtr_;
const scalar kc = k[cellI];
const scalar Dp = sigma*Tc*cc/(3*mathematical::pi*muc*dp);
f = eta/mp*sqrt(2.0*sqr(kc)*sqr(Tc)/(Dp*dt));
}
else
{
const scalar rhop = p.rho();
const scalar s0 =
216*muc*sigma*Tc/(sqr(mathematical::pi)*pow5(dp)*(rhop/rhoc)*cc);
f = eta*sqrt(mathematical::pi*s0/dt);
}
const scalar sqrt2 = sqrt(2.0);
for (label i = 0; i < 3; i++)
{
const scalar x = rndGen_.sample01<scalar>();
const scalar eta = sqrt2*erfInv(2*x - 1.0);
value.Su()[i] = f*eta;
}
return value;
}
// ************************************************************************* //

View File

@ -0,0 +1,162 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
Class
Foam::BrownianMotionForce
Description
Calculates particle Brownian motion force
SourceFiles
BrownianMotionForceI.H
BrownianMotionForce.C
\*---------------------------------------------------------------------------*/
#ifndef BrownianMotionForce_H
#define BrownianMotionForce_H
#include "ParticleForce.H"
#include "cachedRandom.H"
#include "turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class BrownianMotionForce Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class BrownianMotionForce
:
public ParticleForce<CloudType>
{
// Private data
//- Reference to the cloud random number generator
cachedRandom& rndGen_;
//- Molecular free path length [m]
const scalar lambda_;
//- Turbulence flag
bool turbulence_;
//- Reference to a compressible turbulence model
const compressible::turbulenceModel* turbulenceModelPtr_;
//- Pointer to the turbulence kinetic energy field
const volScalarField* kPtr_;
//- Flag that indicates ownership of turbulence k field
bool ownK_;
// Private Member Functions
//- Inverse erf for Gaussian distribution
scalar erfInv(const scalar y) const;
public:
//- Runtime type information
TypeName("BrownianMotion");
// Constructors
//- Construct from mesh
BrownianMotionForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict,
const word& forceType
);
//- Construct copy
BrownianMotionForce(const BrownianMotionForce& bmf);
//- Construct and return a clone
virtual autoPtr<ParticleForce<CloudType> > clone() const
{
return autoPtr<ParticleForce<CloudType> >
(
new BrownianMotionForce<CloudType>(*this)
);
}
//- Destructor
virtual ~BrownianMotionForce();
// Member Functions
// Access
//- Return const access to the molecular free path length [m]
inline scalar lambda() const;
//- Return const access to the turbulence flag
inline bool turbulence() const;
// Evaluation
//- Cache fields
virtual void cacheFields(const bool store);
//- Calculate the non-coupled force
virtual forceSuSp calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar Re,
const scalar rhoc,
const scalar muc
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "BrownianMotionForceI.H"
#ifdef NoRepository
#include "BrownianMotionForce.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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>
inline Foam::scalar Foam::BrownianMotionForce<CloudType>::lambda() const
{
return lambda_;
}
template<class CloudType>
inline bool Foam::BrownianMotionForce<CloudType>::turbulence() const
{
return turbulence_;
}
// ************************************************************************* //

View File

@ -90,18 +90,17 @@ constantProperties
particleForces particleForces
{ {
gravity on; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
subModels subModels
{ {
InjectionModel ManualInjection; InjectionModel ManualInjection;
DragModel SphereDrag;
DispersionModel StochasticDispersionRAS; DispersionModel StochasticDispersionRAS;
PatchInteractionModel StandardWallInteraction; PatchInteractionModel StandardWallInteraction;

View File

@ -74,18 +74,17 @@ constantProperties
particleForces particleForces
{ {
gravity on; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
subModels subModels
{ {
InjectionModel ManualInjection; InjectionModel ManualInjection;
DragModel SphereDrag;
DispersionModel StochasticDispersionRAS; DispersionModel StochasticDispersionRAS;
PatchInteractionModel StandardWallInteraction; PatchInteractionModel StandardWallInteraction;

View File

@ -89,18 +89,17 @@ constantProperties
particleForces particleForces
{ {
gravity on; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
subModels subModels
{ {
InjectionModel ReactingMultiphaseLookupTableInjection; InjectionModel ReactingMultiphaseLookupTableInjection;
DragModel SphereDrag;
DispersionModel none; DispersionModel none;
PatchInteractionModel LocalInteraction; PatchInteractionModel LocalInteraction;

View File

@ -89,18 +89,17 @@ constantProperties
particleForces particleForces
{ {
gravity on; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
subModels subModels
{ {
InjectionModel ManualInjection; InjectionModel ManualInjection;
DragModel SphereDrag;
DispersionModel none; DispersionModel none;
PatchInteractionModel StandardWallInteraction; PatchInteractionModel StandardWallInteraction;
@ -132,7 +131,7 @@ subModels
U0 (0 0 0); U0 (0 0 0);
sizeDistribution sizeDistribution
{ {
pdfType uniform; distributionModelType uniform;
uniformDistribution uniformDistribution
{ {
minValue 100e-06; minValue 100e-06;

View File

@ -89,18 +89,17 @@ constantProperties
particleForces particleForces
{ {
gravity on; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
subModels subModels
{ {
InjectionModel PatchInjection; InjectionModel PatchInjection;
DragModel SphereDrag;
DispersionModel StochasticDispersionRAS; DispersionModel StochasticDispersionRAS;
PatchInteractionModel StandardWallInteraction; PatchInteractionModel StandardWallInteraction;
@ -135,7 +134,7 @@ subModels
flowRateProfile constant 1; flowRateProfile constant 1;
sizeDistribution sizeDistribution
{ {
pdfType general; distributionModelType general;
generalDistribution generalDistribution
{ {
distribution distribution

View File

@ -86,18 +86,17 @@ constantProperties
particleForces particleForces
{ {
gravity off; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
subModels subModels
{ {
InjectionModel ManualInjection; InjectionModel ManualInjection;
DragModel SphereDrag;
DispersionModel none; DispersionModel none;
PatchInteractionModel StandardWallInteraction; PatchInteractionModel StandardWallInteraction;

View File

@ -58,18 +58,17 @@ constantProperties
particleForces particleForces
{ {
gravity on; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
subModels subModels
{ {
InjectionModel ManualInjection; InjectionModel ManualInjection;
DragModel SphereDrag;
DispersionModel StochasticDispersionRAS; DispersionModel StochasticDispersionRAS;
PatchInteractionModel StandardWallInteraction; PatchInteractionModel StandardWallInteraction;

View File

@ -73,18 +73,17 @@ constantProperties
particleForces particleForces
{ {
gravity on; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
subModels subModels
{ {
InjectionModel ManualInjection; InjectionModel ManualInjection;
DragModel SphereDrag;
DispersionModel StochasticDispersionRAS; DispersionModel StochasticDispersionRAS;
PatchInteractionModel StandardWallInteraction; PatchInteractionModel StandardWallInteraction;

View File

@ -18,81 +18,6 @@ FoamFile
solution solution
{ {
active no; active no;
integrationSchemes
{
U Euler;
T Analytical;
}
}
constantProperties
{
parcelTypeId 1;
rhoMin 1e-15;
minParticleMass 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1400;
T0 313;
Cp0 1680;
youngsModulus 2e9;
poissonsRatio 0.35;
epsilon0 0.8;
f0 0.3;
Tvap 400;
Tbp 400;
Pr 0.7;
LDevol 0;
hRetentionCoeff 1;
constantVolume true;
}
particleForces
{
gravity off;
virtualMass off;
pressureGradient off;
paramagnetic off;
}
subModels
{
InjectionModel none;
CollisionModel none;
DragModel none;
DispersionModel none;
PatchInteractionModel none;
HeatTransferModel none;
CompositionModel none;
PhaseChangeModel none;
DevolatilisationModel none;
SurfaceReactionModel none;
PostProcessingModel none;
SurfaceFilmModel none;
radiation off;
} }

View File

@ -22,6 +22,7 @@ solution
transient no; // yes; transient no; // yes;
calcFrequency 10; calcFrequency 10;
maxTrackTime 5.0; maxTrackTime 5.0;
maxCo 0.3;
coupled true; coupled true;
cellValueSourceCorrection off; cellValueSourceCorrection off;
@ -99,10 +100,11 @@ constantProperties
particleForces particleForces
{ {
gravity on; activeForces
virtualMass off; (
pressureGradient off; sphereDrag
paramagnetic off; gravity
);
} }
@ -110,8 +112,6 @@ subModels
{ {
InjectionModel PatchInjection; InjectionModel PatchInjection;
DragModel SphereDrag;
DispersionModel StochasticDispersionRAS; DispersionModel StochasticDispersionRAS;
PatchInteractionModel StandardWallInteraction; PatchInteractionModel StandardWallInteraction;
@ -146,7 +146,7 @@ subModels
flowRateProfile constant 1; flowRateProfile constant 1;
sizeDistribution sizeDistribution
{ {
pdfType general; distributionModelType general;
generalDistribution generalDistribution
{ {
distribution distribution