diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelForces.H b/src/lagrangian/intermediate/parcels/include/makeParcelForces.H index eebc43b54b..3f5fc61506 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelForces.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelForces.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,6 +47,7 @@ License #include "SRFForce.H" #include "VirtualMassForce.H" #include "InterfaceForce.H" +#include "CoulombForce.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,7 +67,8 @@ License makeParticleForceModelType(PressureGradientForce, CloudType); \ makeParticleForceModelType(SRFForce, CloudType); \ makeParticleForceModelType(VirtualMassForce, CloudType); \ - makeParticleForceModelType(InterfaceForce, CloudType); + makeParticleForceModelType(InterfaceForce, CloudType); \ + makeParticleForceModelType(CoulombForce, CloudType); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H b/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H index f3f17230b4..2efc413d19 100644 --- a/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H +++ b/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,6 +43,7 @@ License #include "PressureGradientForce.H" #include "SRFForce.H" #include "VirtualMassForce.H" +#include "CoulombForce.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,7 +59,8 @@ License makeParticleForceModelType(ParamagneticForce, CloudType); \ makeParticleForceModelType(PressureGradientForce, CloudType); \ makeParticleForceModelType(SRFForce, CloudType); \ - makeParticleForceModelType(VirtualMassForce, CloudType); + makeParticleForceModelType(VirtualMassForce, CloudType); \ + makeParticleForceModelType(CoulombForce, CloudType); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.C new file mode 100644 index 0000000000..36e4b0da60 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.C @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#include "CoulombForce.H" +#include "demandDrivenData.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +Foam::volVectorField& Foam::CoulombForce::getOrReadField +( + const word& fieldName +) const +{ + auto* ptr = this->mesh().template getObjectPtr(fieldName); + + if (!ptr) + { + ptr = new volVectorField + ( + IOobject + ( + fieldName, + this->mesh().time().timeName(), + this->mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + this->mesh() + ); + this->mesh().objectRegistry::store(ptr); + } + + return *ptr; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::CoulombForce::CoulombForce +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict +) +: + ParticleForce(owner, mesh, dict, typeName, true), + qPtr_ + ( + Function1::New("q", this->coeffs(), &mesh) + ), + Ename_(this->coeffs().template getOrDefault("E", "E")), + EInterpPtr_(nullptr) +{} + + +template +Foam::CoulombForce::CoulombForce +( + const CoulombForce& pf +) +: + ParticleForce(pf), + qPtr_(pf.qPtr_.clone()), + Ename_(pf.Ename_), + EInterpPtr_(nullptr) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::CoulombForce::cacheFields(const bool store) +{ + if (store) + { + const volVectorField& E = getOrReadField(Ename_); + + EInterpPtr_.reset + ( + interpolation::New + ( + this->owner().solution().interpolationSchemes(), + E + ).ptr() + ); + } + else + { + EInterpPtr_.reset(nullptr); + } +} + + +template +Foam::forceSuSp Foam::CoulombForce::calcNonCoupled +( + const typename CloudType::parcelType& p, + const typename CloudType::parcelType::trackingData& td, + const scalar dt, + const scalar mass, + const scalar Re, + const scalar muc +) const +{ + const interpolation& EInterp = *EInterpPtr_; + + const scalar q = qPtr_->value(p.d()); + + // (YSSD:Eq. 6 - left term) + return forceSuSp + ( + q*EInterp.interpolate(p.coordinates(), p.currentTetIndices()), + Zero + ); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.H new file mode 100644 index 0000000000..c25aaf515d --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.H @@ -0,0 +1,224 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Class + Foam::CoulombForce + +Group + grpLagrangianIntermediateForceSubModels + +Description + Particle electric force model involving the Coulomb force calculation. + + \f[ + \vec{F}_\mathrm{E} = q \, \vec{E} + \f] + + where + + \vartable + \vec{F}_\mathrm{E} | Coulomb force [kg m s^{-2}] + q | Electric charge of particle [A s] + \vec{E} | Electric field [kg m^2 A^{-1} s^{-3} m^{-1}] + \endvartable + + 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 + +Usage + Minimal example by using \c constant/cloudProperties: + \verbatim + subModels + { + solution + { + interpolationSchemes + { + ; + } + } + + particleForces + { + Coulomb + { + q >; + E ; + } + } + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Reqd | Deflt + type | Type name: Coulomb | word | yes | - + q | Electric charge of particles | \ | yes | - + E | Name of electric field | word | no | E + \endtable + +Note + - Particle electric charge can be input as a function of particle diameter: + \verbatim + particleForces + { + Coulomb + { + q table + ( + // d [m] q [C = A s] + (1e-06 -5.0e-11) + (1e-05 -1.0e-10) + ); + E electricPotential:E; + } + } + \endverbatim + +SourceFiles + CoulombForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_CoulombForce_H +#define Foam_CoulombForce_H + +#include "ParticleForce.H" +#include "Function1.H" +#include "interpolation.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward Declarations +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class CoulombForce Declaration +\*---------------------------------------------------------------------------*/ + +template +class CoulombForce +: + public ParticleForce +{ + // Private Data + + //- Particle electric charge + autoPtr> qPtr_; + + //- Name of electric field + const word Ename_; + + //- Electric-field interpolator + mutable std::unique_ptr> EInterpPtr_; + + + // Private Member Functions + + //- Return requested volVectorField from the object registry + //- or read+register the field to the object registry + volVectorField& getOrReadField(const word& fieldName) const; + + +public: + + //- Runtime type information + TypeName("Coulomb"); + + + // Constructors + + //- Construct from mesh + CoulombForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict + ); + + //- Copy construct + CoulombForce(const CoulombForce& gf); + + //- No copy assignment + void operator=(const CoulombForce&) = delete; + + //- Construct and return a clone + virtual autoPtr> clone() const + { + return autoPtr> + ( + new CoulombForce(*this) + ); + } + + + //- Destructor + virtual ~CoulombForce() = default; + + + // Member Functions + + // Evaluation + + //- Cache fields + virtual void cacheFields(const bool store); + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const typename CloudType::parcelType::trackingData& td, + const scalar dt, + const scalar mass, + const scalar Re, + const scalar muc + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "CoulombForce.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //