diff --git a/src/lagrangian/intermediate/parcels/derived/chargeParcel/makeChargeParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/chargeParcel/makeChargeParcelSubmodels.C index 84d66a6752..bf99d0737b 100644 --- a/src/lagrangian/intermediate/parcels/derived/chargeParcel/makeChargeParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/chargeParcel/makeChargeParcelSubmodels.C @@ -30,7 +30,7 @@ License #include "makeReactingParcelCloudFunctionObjects.H" // Kinematic -#include "makeThermoParcelForces.H" // thermo variant +#include "makeChargeParcelForces.H" #include "makeParcelDispersionModels.H" #include "makeChargeParcelInjectionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -58,7 +58,7 @@ License makeReactingParcelCloudFunctionObjects(chargeCloud); // Kinematic sub-models -makeThermoParcelForces(chargeCloud); +makeChargeParcelForces(chargeCloud); makeParcelDispersionModels(chargeCloud); makeChargeParcelInjectionModels(chargeCloud); makeParcelPatchInteractionModels(chargeCloud); diff --git a/src/lagrangian/intermediate/parcels/include/makeChargeParcelForces.H b/src/lagrangian/intermediate/parcels/include/makeChargeParcelForces.H new file mode 100644 index 0000000000..681ac1fe24 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeChargeParcelForces.H @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_makeChargeParcelForces_H +#define Foam_makeChargeParcelForces_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "SphereDragForce.H" +#include "NonSphereDragForce.H" + +#include "SaffmanMeiLiftForce.H" +#include "TomiyamaLiftForce.H" + +#include "GravityForce.H" +#include "NonInertialFrameForce.H" +#include "ParamagneticForce.H" +#include "PressureGradientForce.H" +#include "SRFForce.H" +#include "VirtualMassForce.H" + +#include "CoulombForce.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeChargeParcelForces(CloudType) \ + \ + makeParticleForceModel(CloudType); \ + makeParticleForceModelType(SphereDragForce, CloudType); \ + makeParticleForceModelType(NonSphereDragForce, CloudType); \ + makeParticleForceModelType(SaffmanMeiLiftForce, CloudType); \ + makeParticleForceModelType(TomiyamaLiftForce, CloudType); \ + makeParticleForceModelType(GravityForce, CloudType); \ + makeParticleForceModelType(NonInertialFrameForce, CloudType); \ + makeParticleForceModelType(ParamagneticForce, CloudType); \ + makeParticleForceModelType(PressureGradientForce, CloudType); \ + makeParticleForceModelType(SRFForce, CloudType); \ + makeParticleForceModelType(VirtualMassForce, CloudType); \ + makeParticleForceModelType(CoulombForce, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Charge/ParticleForces/Coulomb/CoulombForce.C b/src/lagrangian/intermediate/submodels/Charge/ParticleForces/Coulomb/CoulombForce.C new file mode 100644 index 0000000000..39046ebb8e --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Charge/ParticleForces/Coulomb/CoulombForce.C @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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), + Ename_(this->coeffs().template getOrDefault("E", "E")), + EInterpPtr_(nullptr) +{} + + +template +Foam::CoulombForce::CoulombForce +( + const CoulombForce& pf +) +: + ParticleForce(pf), + Ename_(pf.Ename_), + EInterpPtr_(pf.EInterpPtr_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::CoulombForce::cacheFields(const bool store) +{ + if (store) + { + const volVectorField& E = getOrReadField(Ename_); + + EInterpPtr_ = interpolation::New + ( + this->owner().solution().interpolationSchemes(), + E + ).ptr(); + } + else + { + deleteDemandDrivenData(EInterpPtr_); + } +} + + +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_; + + // (YSSD:Eq. 6 - left term) + return forceSuSp + ( + p.eq()*EInterp.interpolate(p.coordinates(), p.currentTetIndices()), + Zero + ); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Charge/ParticleForces/Coulomb/CoulombForce.H b/src/lagrangian/intermediate/submodels/Charge/ParticleForces/Coulomb/CoulombForce.H new file mode 100644 index 0000000000..63b18f3f7b --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Charge/ParticleForces/Coulomb/CoulombForce.H @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 wherein the Coulomb force is calculated. + + \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 + { + particleForces + { + Coulomb; + } + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Reqd | Deflt + type | Type name: Coulomb | word | yes | - + \endtable + +SourceFiles + CoulombForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_CoulombForce_H +#define Foam_CoulombForce_H + +#include "ParticleForce.H" +#include "interpolation.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward Declarations +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class CoulombForce Declaration +\*---------------------------------------------------------------------------*/ + +template +class CoulombForce +: + public ParticleForce +{ + // Private Data + + //- Name of electric field + const word Ename_; + + //- Electric-field interpolator + const interpolation* 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); + + //- Construct and return a clone + virtual autoPtr> clone() const + { + return autoPtr> + ( + new CoulombForce(*this) + ); + } + + //- No copy assignment + void operator=(const CoulombForce&) = delete; + + + //- 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 + +// ************************************************************************* //