Skip to content
Snippets Groups Projects
Commit b93b8aff authored by Kutalmış Berçin's avatar Kutalmış Berçin
Browse files

ENH: ChargeCloud: new space charge density function object

parent c63cdfd1
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ License
#include "chargeCloud.H"
#include "makeReactingParcelCloudFunctionObjects.H"
#include "makeChargeParcelCloudFunctionObjects.H"
// Kinematic
#include "makeChargeParcelForces.H"
......@@ -55,7 +55,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeReactingParcelCloudFunctionObjects(chargeCloud);
makeChargeParcelCloudFunctionObjects(chargeCloud);
// Kinematic sub-models
makeChargeParcelForces(chargeCloud);
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 makeChargeParcelCloudFunctionObjects_H
#define makeChargeParcelCloudFunctionObjects_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "FaceInteraction.H"
#include "FacePostProcessing.H"
#include "ParticleCollector.H"
#include "ParticleErosion.H"
#include "ParticleTracks.H"
#include "ParticleTrap.H"
#include "ParticleZoneInfo.H"
#include "PatchCollisionDensity.H"
#include "PatchInteractionFields.H"
#include "PatchPostProcessing.H"
#include "PatchParticleHistogram.H"
#include "RemoveParcels.H"
#include "VoidFraction.H"
#include "NusseltNumber.H"
#include "HeatTransferCoeff.H"
#include "ThermoReynoldsNumber.H"
#include "WeberNumberReacting.H"
#include "ParticleDose.H"
#include "SpaceChargeDensity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeChargeParcelCloudFunctionObjects(CloudType) \
\
makeCloudFunctionObject(CloudType); \
\
makeCloudFunctionObjectType(FaceInteraction, CloudType); \
makeCloudFunctionObjectType(FacePostProcessing, CloudType); \
makeCloudFunctionObjectType(ParticleCollector, CloudType); \
makeCloudFunctionObjectType(ParticleErosion, CloudType); \
makeCloudFunctionObjectType(ParticleTracks, CloudType); \
makeCloudFunctionObjectType(ParticleTrap, CloudType); \
makeCloudFunctionObjectType(ParticleZoneInfo, CloudType); \
makeCloudFunctionObjectType(PatchCollisionDensity, CloudType); \
makeCloudFunctionObjectType(PatchInteractionFields, CloudType); \
makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \
makeCloudFunctionObjectType(PatchParticleHistogram, CloudType); \
makeCloudFunctionObjectType(RemoveParcels, CloudType); \
makeCloudFunctionObjectType(VoidFraction, CloudType); \
makeCloudFunctionObjectType(NusseltNumber, CloudType); \
makeCloudFunctionObjectType(HeatTransferCoeff, CloudType); \
makeCloudFunctionObjectType(ThermoReynoldsNumber, CloudType); \
makeCloudFunctionObjectType(WeberNumberReacting, CloudType); \
makeCloudFunctionObjectType(ParticleDose, CloudType); \
makeCloudFunctionObjectType(SpaceChargeDensity, CloudType);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "SpaceChargeDensity.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class CloudType>
void Foam::SpaceChargeDensity<CloudType>::write()
{
if (erhoPtr_)
{
erhoPtr_->write();
}
else
{
FatalErrorInFunction
<< "erhoPtr not valid" << abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SpaceChargeDensity<CloudType>::SpaceChargeDensity
(
const dictionary& dict,
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
mPtr_(nullptr),
qPtr_(nullptr),
cPtr_(nullptr),
erhoPtr_(nullptr)
{}
template<class CloudType>
Foam::SpaceChargeDensity<CloudType>::SpaceChargeDensity
(
const SpaceChargeDensity<CloudType>& vf
)
:
CloudFunctionObject<CloudType>(vf),
mPtr_(nullptr),
qPtr_(nullptr),
cPtr_(nullptr),
erhoPtr_(nullptr)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::SpaceChargeDensity<CloudType>::preEvolve
(
const typename parcelType::trackingData& td
)
{
const fvMesh& mesh = this->owner().mesh();
if (mPtr_)
{
mPtr_->primitiveFieldRef() = 0.0;
}
else
{
mPtr_.reset
(
new volScalarField
(
IOobject
(
this->owner().name() + "m",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimMass, Zero)
)
);
}
if (qPtr_)
{
qPtr_->primitiveFieldRef() = 0.0;
}
else
{
qPtr_.reset
(
new volScalarField
(
IOobject
(
this->owner().name() + "q",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimCurrent*dimTime, Zero)
)
);
}
if (cPtr_)
{
cPtr_->primitiveFieldRef() = 0.0;
}
else
{
cPtr_.reset
(
new volScalarField
(
IOobject
(
this->owner().name() + "c",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimMass*dimTime, Zero)
)
);
}
if (erhoPtr_)
{
erhoPtr_->primitiveFieldRef() = 0.0;
}
else
{
erhoPtr_.reset
(
new volScalarField
(
IOobject
(
this->owner().name() + "erho",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(dimCurrent*dimTime/dimVolume, Zero)
)
);
}
}
template<class CloudType>
void Foam::SpaceChargeDensity<CloudType>::postEvolve
(
const typename parcelType::trackingData& td
)
{
volScalarField& m = mPtr_();
volScalarField& q = qPtr_();
volScalarField& c = cPtr_();
volScalarField& erho = erhoPtr_();
auto& own = this->owner();
const fvMesh& mesh = own.mesh();
c.primitiveFieldRef() /= mesh.time().deltaTValue()*mesh.V();
// (YSSD:Eq. 4)
// sum masses and charges in cells
forAllConstIters(own, parcelIter)
{
const parcelType& p = parcelIter();
m[p.cell()] += p.mass()*p.nParticle();
q[p.cell()] += p.eq()*p.nParticle();
}
forAllConstIters(own, parcelIter)
{
const parcelType& p = parcelIter();
// (YSSD:Eq. 5)
erho[p.cell()] = q[p.cell()]/m[p.cell()]*c[p.cell()];
}
CloudFunctionObject<CloudType>::postEvolve(td);
}
template<class CloudType>
void Foam::SpaceChargeDensity<CloudType>::postMove
(
parcelType& p,
const scalar dt,
const point&,
bool&
)
{
volScalarField& c = cPtr_();
// (YSSD:Eq. 3)
c[p.cell()] += p.mass()*p.nParticle()*dt;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::SpaceChargeDensity
Group
grpLagrangianIntermediateFunctionObjects
Description
References:
\verbatim
Governing equations (tag:YSSD):
Ye, Q., Steigleder, T., Scheibe, A., & Domnick, J. (2002).
Numerical simulation of the electrostatic powder coating process
with a corona spray gun. Journal of Electrostatics, 54(2), 189-205.
DOI:10.1016/S0304-3886(01)00181-4
\endverbatim
SourceFiles
SpaceChargeDensity.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_SpaceChargeDensity_H
#define Foam_SpaceChargeDensity_H
#include "CloudFunctionObject.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class SpaceChargeDensity Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class SpaceChargeDensity
:
public CloudFunctionObject<CloudType>
{
// Private Data
// Typedefs
//- Convenience typedef for parcel type
typedef typename CloudType::parcelType parcelType;
//- Particle mass field
autoPtr<volScalarField> mPtr_;
//- Particle electric-charge field
autoPtr<volScalarField> qPtr_;
//- Particle specific concentration field
autoPtr<volScalarField> cPtr_;
//- Space charge density field
autoPtr<volScalarField> erhoPtr_;
protected:
// Protected Member Functions
//- Write post-processing info
virtual void write();
public:
//- Runtime type information
TypeName("spaceChargeDensity");
// Constructors
//- Construct from dictionary
SpaceChargeDensity
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Copy construct
SpaceChargeDensity(const SpaceChargeDensity<CloudType>& vf);
//- Construct and return a clone
virtual autoPtr<CloudFunctionObject<CloudType>> clone() const
{
return autoPtr<CloudFunctionObject<CloudType>>
(
new SpaceChargeDensity<CloudType>(*this)
);
}
//- No copy assignment
void operator=(const SpaceChargeDensity<CloudType>&) = delete;
//- Destructor
virtual ~SpaceChargeDensity() = default;
// Member Functions
// Evaluation
//- Pre-evolve hook
virtual void preEvolve
(
const typename parcelType::trackingData& td
);
//- Post-evolve hook
virtual void postEvolve
(
const typename parcelType::trackingData& td
);
//- Post-move hook
virtual void postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "SpaceChargeDensity.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment