re-packaged particle forces into class

This commit is contained in:
andy 2009-04-14 17:06:44 +01:00
parent 66c2cfa1b6
commit ef39baacfc
9 changed files with 338 additions and 79 deletions

View File

@ -76,6 +76,10 @@ submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C
IntegrationScheme/makeIntegrationSchemes.C
/* particle forces */
particleForces/particleForces.C
/* phase properties */
phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C

View File

@ -101,11 +101,8 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
U_(U),
mu_(mu),
g_(g),
forces_(mesh_, particleProperties_, g_.value()),
interpolationSchemes_(particleProperties_.subDict("interpolationSchemes")),
forcesDict_(particleProperties_.subDict("forces")),
forceGravity_(forcesDict_.lookup("gravity")),
forceVirtualMass_(forcesDict_.lookup("virtualMass")),
forcePressureGradient_(forcesDict_.lookup("pressureGradient")),
dispersionModel_
(
DispersionModel<KinematicCloud<ParcelType> >::New

View File

@ -51,7 +51,7 @@ SourceFiles
#include "fvMesh.H"
#include "volFields.H"
#include "fvMatrices.H"
#include "fvm.H"
#include "particleForces.H"
#include "IntegrationSchemesFwd.H"
@ -129,25 +129,13 @@ class KinematicCloud
const dimensionedVector& g_;
//- Optional particle forces
particleForces forces_;
//- Interpolation schemes dictionary
dictionary interpolationSchemes_;
// Forces to include in particle motion evaluation
//- Dictionary of forces
dictionary forcesDict_;
//- Gravity
Switch forceGravity_;
//- Virtual mass
Switch forceVirtualMass_;
//- Pressure gradient
Switch forcePressureGradient_;
// References to the cloud sub-models
//- Dispersion model
@ -261,6 +249,10 @@ public:
inline const dimensionedVector& g() const;
//- Optional particle forces
inline const particleForces& forces() const;
// Interpolations
//- Return reference to the interpolation dictionary

View File

@ -24,6 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "fvmSup.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
@ -100,6 +102,14 @@ Foam::KinematicCloud<ParcelType>::g() const
}
template<class ParcelType>
inline const Foam::particleForces&
Foam::KinematicCloud<ParcelType>::forces() const
{
return forces_;
}
template<class ParcelType>
inline const Foam::dictionary&
Foam::KinematicCloud<ParcelType>::interpolationSchemes() const
@ -108,28 +118,6 @@ Foam::KinematicCloud<ParcelType>::interpolationSchemes() const
}
template<class ParcelType>
inline Foam::Switch Foam::KinematicCloud<ParcelType>::forceGravity() const
{
return forceGravity_;
}
template<class ParcelType>
inline Foam::Switch Foam::KinematicCloud<ParcelType>::forceVirtualMass() const
{
return forceVirtualMass_;
}
template<class ParcelType>
inline Foam::Switch Foam::KinematicCloud<ParcelType>::
forcePressureGradient() const
{
return forcePressureGradient_;
}
template<class ParcelType>
inline const Foam::DispersionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::dispersion() const

View File

@ -142,27 +142,8 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
// Return linearised term from drag model
Cud = td.cloud().drag().Cu(U - Uc_, d, rhoc_, rho, muc_);
// Initialise total force (per unit mass)
vector Ftot = vector::zero;
// Gravity force
if (td.cloud().forceGravity())
{
Ftot += td.g()*(1 - rhoc_/rho);
}
// Virtual mass force
if (td.cloud().forceVirtualMass())
{
// Ftot += td.constProps().Cvm()*rhoc_/rho*d(Uc - U)/dt;
}
// Pressure gradient force
if (td.cloud().forcePressureGradient())
{
// const vector& delta = td.cloud().mesh().deltaCoeffs()[cellI];
// Ftot += rhoc_/rho*(U & (delta^Uc_));
}
// Calculate particle forces
vector Ftot = td.cloud().forces().calc(cellI, dt, rhoc_, rho, Uc_, U);
// New particle velocity

View File

@ -95,9 +95,6 @@ public:
//- Minimum particle mass [kg]
const scalar minParticleMass_;
//- Virtual mass coefficient []
const scalar Cvm_;
public:
@ -114,9 +111,6 @@ public:
//- Return const access to the minimum particle mass
inline scalar minParticleMass() const;
//- Return const access to the virtual mass coefficient
inline scalar Cvm() const;
};

View File

@ -37,8 +37,7 @@ inline Foam::KinematicParcel<ParcelType>::constantProperties::constantProperties
minParticleMass_
(
dimensionedScalar(dict_.lookup("minParticleMass")).value()
),
Cvm_(dimensionedScalar(dict_.lookup("Cvm")).value())
)
{}
@ -116,14 +115,6 @@ Foam::KinematicParcel<ParcelType>::constantProperties::minParticleMass() const
}
template <class ParcelType>
inline Foam::scalar
Foam::KinematicParcel<ParcelType>::constantProperties::Cvm() const
{
return Cvm_;
}
// * * * * * * * * * * * trackData Member Functions * * * * * * * * * * * * //
template <class ParcelType>

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "particleForces.H"
#include "fvMesh.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::particleForces::particleForces
(
const fvMesh& mesh,
const dictionary& dict,
const vector& g
)
:
mesh_(mesh),
dict_(dict.subDict("particleForces")),
g_(g),
gravity_(dict_.lookup("gravity")),
virtualMass_(dict_.lookup("virtualMass")),
Cvm_(0.0),
pressureGradient_(dict_.lookup("pressureGradient")),
gradUName_("unknown_gradUName")
{
if (gravity_)
{
dict_.lookup("Cvm") >> Cvm_;
}
if (pressureGradient_)
{
dict_.lookup("gradU") >> gradUName_;
}
}
Foam::particleForces::particleForces(const particleForces& f)
:
mesh_(f.mesh_),
dict_(f.dict_),
g_(f.g_),
gravity_(f.gravity_),
virtualMass_(f.virtualMass_),
Cvm_(f.Cvm_),
pressureGradient_(f.pressureGradient_),
gradUName_(f.gradUName_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::particleForces::~particleForces()
{}
// * * * * * * * * * * * * * * * 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::Switch Foam::particleForces::pressureGradient() const
{
return pressureGradient_;
}
const Foam::word& Foam::particleForces::gradUName() const
{
return gradUName_;
}
Foam::vector Foam::particleForces::calc
(
const label cellI,
const scalar dt,
const scalar rhoc,
const scalar rho,
const vector& Uc,
const vector& U
) const
{
vector Ftot = vector::zero;
// Gravity force
if (gravity_)
{
Ftot += g_*(1.0 - rhoc/rho);
}
// Virtual mass force
if (virtualMass_)
{
notImplemented("Foam::particleForces::calc(...) - virtualMass force");
// Ftot += Cvm_*rhoc/rho*d(Uc - U)/dt;
}
// Pressure gradient force
if (pressureGradient_)
{
const volSymmTensorField& gradU =
mesh_.lookupObject<volSymmTensorField>(gradUName_);
Ftot += rhoc/rho*(U & gradU[cellI]);
}
return Ftot;
}
// ************************************************************************* //

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::particleForces
Description
Particle forces
SourceFiles
particleForces.C
\*---------------------------------------------------------------------------*/
#ifndef particleForces_H
#define particleForces_H
#include "dictionary.H"
#include "Switch.H"
#include "vector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward class declarations
class fvMesh;
/*---------------------------------------------------------------------------*\
Class particleForces Declaration
\*---------------------------------------------------------------------------*/
class particleForces
{
// Private data
//- Reference to the mesh database
const fvMesh& mesh_;
//- The particleForces dictionary
const dictionary& dict_;
//- Gravity
const vector g_;
// Forces to include in particle motion evaluation
//- Gravity
Switch gravity_;
//- Virtual mass
Switch virtualMass_;
//- Virtual mass force coefficient
scalar Cvm_;
//- Pressure gradient
Switch pressureGradient_;
//- Name of velocity gradient field for pressure gradient force
word gradUName_;
public:
// Constructors
//- Construct from mesh, dictionary and gravity
particleForces
(
const fvMesh& mesh,
const dictionary& dict,
const vector& g
);
//- 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
Switch Cvm() const;
//- Return pressure gradient force activate switch
Switch pressureGradient() const;
//- Return the name of the velocity gradient field
const word& gradUName() const;
// Evaluation
//- Calculate the net particle force
vector calc
(
const label cellI,
const scalar dt,
const scalar rhoc,
const scalar rho,
const vector& Uc,
const vector& U
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //