From d6155f802d62643f92a63553d62adfd9fa32baa4 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Mon, 14 Feb 2011 15:49:46 +0000 Subject: [PATCH] ENH: Initial check-in of re-worked particle forces --- src/lagrangian/intermediate/Make/files | 8 +- .../Templates/KinematicCloud/KinematicCloud.C | 35 +- .../Templates/KinematicCloud/KinematicCloud.H | 33 +- .../KinematicCloud/KinematicCloudI.H | 10 +- .../KinematicParcel/KinematicParcel.C | 41 +- .../KinematicParcel/KinematicParcel.H | 15 + .../KinematicParcel/KinematicParcelI.H | 21 + .../Templates/ThermoParcel/ThermoParcel.H | 6 + .../Templates/ThermoParcel/ThermoParcelI.H | 14 + .../makeBasicKinematicParcelForces.C | 40 ++ .../makeBasicKinematicParcelSubmodels.C | 4 +- .../makeBasicReactingMultiphaseParcelForces.C | 40 ++ ...keBasicReactingMultiphaseParcelSubmodels.C | 4 +- .../makeBasicReactingParcelForces.C | 40 ++ .../makeBasicReactingParcelSubmodels.C | 4 +- .../makeBasicThermoParcelForces.C | 40 ++ .../makeBasicThermoParcelSubmodels.C | 4 +- .../parcels/include/makeParcelForces.H | 89 +++++ .../parcels/include/makeThermoParcelForces.H | 96 +++++ .../particleForces/particleForces.C | 362 ------------------ .../particleForces/particleForces.H | 229 ----------- .../ParticleForceList/ParticleForceList.C | 155 ++++++++ .../ParticleForceList/ParticleForceList.H | 152 ++++++++ .../ParticleForceList/ParticleForceListI.H} | 40 +- .../Kinematic/DragModel/DragModel/DragModel.H | 157 -------- .../NonSphereDrag/NonSphereDragForce.C} | 56 ++- .../NonSphereDrag/NonSphereDragForce.H} | 58 ++- .../DragForce/SphereDrag/SphereDragForce.C} | 73 ++-- .../DragForce/SphereDrag/SphereDragForce.H} | 59 ++- .../Gravity/GravityForce.C} | 60 ++- .../ParticleForces/Gravity/GravityForce.H | 135 +++++++ .../ParticleForces/Gravity/GravityForceI.H | 35 ++ .../Paramagnetic/ParamagneticForce.C | 120 ++++++ .../Paramagnetic/ParamagneticForce.H | 148 +++++++ .../Paramagnetic/ParamagneticForceI.H | 44 +++ .../ParticleForce/ParticleForce.C | 110 ++++++ .../ParticleForce/ParticleForce.H | 215 +++++++++++ .../ParticleForce/ParticleForceI.H} | 40 +- .../ParticleForce/ParticleForceNew.C} | 46 ++- .../PressureGradient/PressureGradientForce.C | 106 +++++ .../PressureGradient/PressureGradientForce.H | 140 +++++++ .../PressureGradient/PressureGradientForceI.H | 49 +++ .../Kinematic/ParticleForces/SRF/SRFForce.C | 106 +++++ .../SRF/SRFForce.H} | 73 ++-- .../ParticleForces/forceSuSp/forceSuSp.H | 146 +++++++ .../ParticleForces/forceSuSp/forceSuSpI.H | 129 +++++++ .../BrownianMotion/BrownianMotionForce.C | 210 ++++++++++ .../BrownianMotion/BrownianMotionForce.H | 162 ++++++++ .../BrownianMotion/BrownianMotionForceI.H | 42 ++ .../constant/coalCloud1Properties | 11 +- .../constant/limestoneCloud1Properties | 11 +- .../filter/constant/reactingCloud1Properties | 11 +- .../constant/reactingCloud1Properties | 13 +- .../constant/reactingCloud1Properties | 13 +- .../constant/reactingCloud1Properties | 11 +- .../constant/kinematicCloud1Properties | 11 +- .../constant/thermoCloud1Properties | 11 +- .../constant/reactingCloud1Properties | 75 ---- .../constant/reactingCloud1Properties | 14 +- 59 files changed, 3010 insertions(+), 1172 deletions(-) create mode 100644 src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C create mode 100644 src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C create mode 100644 src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C create mode 100644 src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C create mode 100644 src/lagrangian/intermediate/parcels/include/makeParcelForces.H create mode 100644 src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H delete mode 100644 src/lagrangian/intermediate/particleForces/particleForces.C delete mode 100644 src/lagrangian/intermediate/particleForces/particleForces.H create mode 100644 src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C create mode 100644 src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H rename src/lagrangian/intermediate/{parcels/include/makeParcelDragModels.H => submodels/ForceTypes/ParticleForceList/ParticleForceListI.H} (57%) delete mode 100644 src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.H rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/NonSphereDrag/NonSphereDrag.C => ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C} (67%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/NonSphereDrag/NonSphereDrag.H => ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H} (74%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/SphereDrag/SphereDrag.C => ParticleForces/DragForce/SphereDrag/SphereDragForce.C} (64%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/SphereDrag/SphereDrag.H => ParticleForces/DragForce/SphereDrag/SphereDragForce.H} (63%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/DragModel/DragModel.C => ParticleForces/Gravity/GravityForce.C} (61%) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForceI.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForceI.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/NoDrag/NoDrag.C => ParticleForces/ParticleForce/ParticleForceI.H} (65%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/DragModel/DragModelNew.C => ParticleForces/ParticleForce/ParticleForceNew.C} (61%) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/NoDrag/NoDrag.H => ParticleForces/SRF/SRFForce.H} (59%) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForceI.H diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 63fa90db0d1..ad96a400fd2 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -23,6 +23,7 @@ KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel $(KINEMATICPARCEL)/basicKinematicParcel.C $(KINEMATICPARCEL)/defineBasicKinematicParcel.C $(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C +$(KINEMATICPARCEL)/makeBasicKinematicParcelForces.C /* thermo parcel sub-models */ @@ -30,6 +31,7 @@ THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel $(THERMOPARCEL)/basicThermoParcel.C $(THERMOPARCEL)/defineBasicThermoParcel.C $(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C +$(THERMOPARCEL)/makeBasicThermoParcelForces.C /* reacting parcel sub-models */ @@ -37,6 +39,7 @@ REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel $(REACTINGPARCEL)/basicReactingParcel.C $(REACTINGPARCEL)/defineBasicReactingParcel.C $(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C +$(REACTINGPARCEL)/makeBasicReactingParcelForces.C /* reacting multiphase parcel sub-models */ @@ -44,6 +47,7 @@ REACTINGMPPARCEL=$(DERIVEDPARCELS)/basicReactingMultiphaseParcel $(REACTINGMPPARCEL)/basicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C +$(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelForces.C /* bolt-on models */ @@ -78,10 +82,6 @@ $(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphase IntegrationScheme/makeIntegrationSchemes.C -/* particle forces */ -particleForces/particleForces.C - - /* phase properties */ phaseProperties/phaseProperties/phaseProperties.C phaseProperties/phaseProperties/phasePropertiesIO.C diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index fc589f53880..1c43f9e025f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -30,7 +30,6 @@ License #include "CollisionModel.H" #include "DispersionModel.H" -#include "DragModel.H" #include "InjectionModel.H" #include "PatchInteractionModel.H" #include "PostProcessingModel.H" @@ -209,15 +208,6 @@ void Foam::KinematicCloud<ParcelType>::setModels() ).ptr() ); - dragModel_.reset - ( - DragModel<KinematicCloud<ParcelType> >::New - ( - subModelProperties_, - *this - ).ptr() - ); - injectionModel_.reset ( InjectionModel<KinematicCloud<ParcelType> >::New @@ -306,7 +296,7 @@ void Foam::KinematicCloud<ParcelType>::preEvolve() Info<< "\nSolving cloud " << this->name() << endl; this->dispersion().cacheFields(true); - forces_.cacheFields(true, solution_.interpolationSchemes()); + forces_.cacheFields(true); updateCellOccupancy(); } @@ -390,7 +380,7 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud } else { -// this->surfaceFilm().injectStreadyState(td); +// this->surfaceFilm().injectSteadyState(td); this->injection().injectSteadyState(td, solution_.deltaT()); @@ -473,7 +463,7 @@ void Foam::KinematicCloud<ParcelType>::postEvolve() } this->dispersion().cacheFields(false); - forces_.cacheFields(false, solution_.interpolationSchemes()); + forces_.cacheFields(false); this->postProcessing().post(); @@ -488,9 +478,10 @@ void Foam::KinematicCloud<ParcelType>::cloudReset(KinematicCloud<ParcelType>& c) rndGen_ = c.rndGen_; + forces_.transfer(c.forces_); + collisionModel_ = c.collisionModel_->clone(); dispersionModel_= c.dispersionModel_->clone(); - dragModel_ = c.dragModel_->clone(); injectionModel_ = c.injectionModel_->clone(); patchInteractionModel_ = c.patchInteractionModel_->clone(); postProcessingModel_ = c.postProcessingModel_->clone(); @@ -540,10 +531,15 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud U_(U), mu_(mu), g_(g), - forces_(mesh_, particleProperties_, g_.value(), solution_.active()), + forces_ + ( + *this, + mesh_, + particleProperties_.subOrEmptyDict("particleForces"), + solution_.active() + ), collisionModel_(NULL), dispersionModel_(NULL), - dragModel_(NULL), injectionModel_(NULL), patchInteractionModel_(NULL), postProcessingModel_(NULL), @@ -606,7 +602,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud const word& name ) : - Cloud<ParcelType>(c.mesh(), name, c), + Cloud<ParcelType>(c.mesh_, name, c), kinematicCloud(), cloudCopyPtr_(NULL), mesh_(c.mesh_), @@ -623,7 +619,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud forces_(c.forces_), collisionModel_(c.collisionModel_->clone()), dispersionModel_(c.dispersionModel_->clone()), - dragModel_(c.dragModel_->clone()), injectionModel_(c.injectionModel_->clone()), patchInteractionModel_(c.patchInteractionModel_->clone()), postProcessingModel_(c.postProcessingModel_->clone()), @@ -661,7 +656,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud c.UCoeff_() ) ) - {} @@ -698,10 +692,9 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud U_(c.U_), mu_(c.mu_), g_(c.g_), - forces_(mesh), + forces_(*this, mesh), collisionModel_(NULL), dispersionModel_(NULL), - dragModel_(NULL), injectionModel_(NULL), patchInteractionModel_(NULL), postProcessingModel_(NULL), diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index b1020c1e205..a9244fa0209 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -29,10 +29,14 @@ Description - holds a 'cloudSolution' class that stores all relevant solution info + - particle forces + - buoyancy + - drag + - pressure gradient + - sub-models: - Collision model - Dispersion model - - Drag model - Injection model - Patch interaction model - Post-processing model @@ -55,7 +59,6 @@ SourceFiles #include "fvMesh.H" #include "volFields.H" #include "fvMatrices.H" -#include "particleForces.H" #include "IntegrationSchemesFwd.H" @@ -72,9 +75,6 @@ class CollisionModel; template<class CloudType> class DispersionModel; -template<class CloudType> -class DragModel; - template<class CloudType> class InjectionModel; @@ -98,6 +98,14 @@ class KinematicCloud public Cloud<ParcelType>, public kinematicCloud { +public: + + //- Type of parcel the cloud was instantiated for + typedef ParcelType parcelType; + + +private: + // Private data //- Cloud copy pointer @@ -316,7 +324,7 @@ protected: //- Optional particle forces - particleForces forces_; + typename ParcelType::forceType forces_; // References to the cloud sub-models @@ -329,9 +337,6 @@ protected: autoPtr<DispersionModel<KinematicCloud<ParcelType> > > dispersionModel_; - //- Drag transfer model - autoPtr<DragModel<KinematicCloud<ParcelType> > > dragModel_; - //- Injector model autoPtr<InjectionModel<KinematicCloud<ParcelType> > > injectionModel_; @@ -450,10 +455,6 @@ public: virtual ~KinematicCloud(); - //- Type of parcel the cloud was instantiated for - typedef ParcelType parcelType; - - // Member Functions // Access @@ -521,7 +522,7 @@ public: //- Optional particle forces - inline const particleForces& forces() const; + inline const typename ParcelType::forceType& forces() const; // Sub-models @@ -542,10 +543,6 @@ public: inline DispersionModel<KinematicCloud<ParcelType> >& dispersion(); - //- Return const-access to the drag model - inline const DragModel<KinematicCloud<ParcelType> >& - drag() const; - //- Return const access to the injection model inline const InjectionModel<KinematicCloud<ParcelType> >& injection() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 457e39abaea..62128ef7ed5 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -257,7 +257,7 @@ Foam::KinematicCloud<ParcelType>::g() const template<class ParcelType> -inline const Foam::particleForces& +inline const typename ParcelType::forceType& Foam::KinematicCloud<ParcelType>::forces() const { 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> inline const Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >& Foam::KinematicCloud<ParcelType>::injection() const diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index c2310d34539..54bde90c774 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -176,37 +176,13 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity scalar& Cud ) const { - const polyMesh& mesh = this->cloud().pMesh(); - - // Momentum transfer coefficient - const scalar utc = td.cloud().drag().utc(Re, d, mu) + ROOTVSMALL; - - tetIndices tetIs = this->currentTetIndices(); + const typename ParcelType::forceType& forces = td.cloud().forces(); // Momentum source due to particle forces - const vector Fcp = mass*td.cloud().forces().calcCoupled - ( - this->position(), - tetIs, - dt, - rhoc_, - rho, - Uc_, - U, - d - ); - - const vector Fncp = mass*td.cloud().forces().calcNonCoupled - ( - this->position(), - tetIs, - dt, - rhoc_, - rho, - Uc_, - U, - d - ); + const ParcelType& p = static_cast<const ParcelType&>(*this); + const forceSuSp Fcp = forces.calcCoupled(p, dt, Re, rho, mu); + const forceSuSp Fncp = forces.calcNonCoupled(p, dt, Re, rho, mu); + const forceSuSp Feff = Fcp + Fncp; // New particle velocity @@ -214,8 +190,8 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity // Update velocity - treat as 3-D const scalar As = this->areaS(d); - const vector ap = Uc_ + (Fcp + Fncp + Su)/(utc*As); - const scalar bp = 6.0*utc/(rho*d); + const vector ap = Uc_ + (mass*Feff.Su() + Su)/(As*Feff.Sp()); + const scalar bp = 6.0*Feff.Sp()/(rho*d); Cud = bp; @@ -224,9 +200,10 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity 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 + const polyMesh& mesh = this->cloud().pMesh(); meshTools::constrainDirection(mesh, mesh.solutionD(), Unew); meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans); diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index 003e07ee460..327c3e82f0a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -56,6 +56,8 @@ SourceFiles #include "labelFieldIOField.H" #include "vectorFieldIOField.H" +#include "ParticleForceList.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -88,6 +90,10 @@ class KinematicParcel { public: + //- Type of force to be used by this parcel type + typedef ParticleForceList<KinematicCloud<ParcelType> > forceType; + + //- Class to hold kinematic particle constant properties class constantProperties { @@ -456,6 +462,15 @@ public: //- Return const access to turbulent velocity fluctuation 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 inline const collisionRecordList& collisionRecords() const; diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H index bdf143cbe59..c1d61003f82 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H @@ -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> inline bool& Foam::KinematicParcel<ParcelType>::active() { diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index e455c1773e5..e3e20063c6c 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -344,6 +344,12 @@ public: //- Return the parcel sensible enthalpy 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 diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H index ada4b93a102..0ebff1def9a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H @@ -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> inline Foam::scalar& Foam::ThermoParcel<ParcelType>::T() { diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C new file mode 100644 index 00000000000..5d7f1b57bfa --- /dev/null +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C @@ -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); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C index 27c54abfd29..a401d40b20c 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -40,7 +39,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(basicKinematicParcel); - makeParcelDragModels(basicKinematicParcel); makeParcelInjectionModels(basicKinematicParcel); makeParcelCollisionModels(basicKinematicParcel); makeParcelPatchInteractionModels(basicKinematicParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C new file mode 100644 index 00000000000..3122dc2fb88 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C @@ -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); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C index fa38f8a5e2f..aa272e23d4b 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -51,7 +50,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(basicReactingMultiphaseParcel); - makeParcelDragModels(basicReactingMultiphaseParcel); makeReactingMultiphaseParcelInjectionModels(basicReactingMultiphaseParcel); makeParcelCollisionModels(basicReactingMultiphaseParcel); makeParcelPatchInteractionModels(basicReactingMultiphaseParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C new file mode 100644 index 00000000000..094f1a37de2 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C @@ -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); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C index b1e39780115..9f708827bf9 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeReactingParcelInjectionModels.H" // Reacting variant #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -47,7 +46,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(basicReactingParcel); - makeParcelDragModels(basicReactingParcel); makeReactingParcelInjectionModels(basicReactingParcel); makeParcelCollisionModels(basicReactingParcel); makeParcelPatchInteractionModels(basicReactingParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C new file mode 100644 index 00000000000..3ada6d849d9 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C @@ -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); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C index 289e6d38cd0..91be53b9df6 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -43,7 +42,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(basicThermoParcel); - makeParcelDragModels(basicThermoParcel); makeParcelInjectionModels(basicThermoParcel); makeParcelCollisionModels(basicThermoParcel); makeParcelPatchInteractionModels(basicThermoParcel); diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelForces.H b/src/lagrangian/intermediate/parcels/include/makeParcelForces.H new file mode 100644 index 00000000000..bc04078abdd --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeParcelForces.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H b/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H new file mode 100644 index 00000000000..a39f748559c --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/particleForces/particleForces.C b/src/lagrangian/intermediate/particleForces/particleForces.C deleted file mode 100644 index 124b21c2e19..00000000000 --- a/src/lagrangian/intermediate/particleForces/particleForces.C +++ /dev/null @@ -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; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/particleForces/particleForces.H b/src/lagrangian/intermediate/particleForces/particleForces.H deleted file mode 100644 index 0f655be004e..00000000000 --- a/src/lagrangian/intermediate/particleForces/particleForces.H +++ /dev/null @@ -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 - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C new file mode 100644 index 00000000000..9d7426824c0 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C @@ -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; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H new file mode 100644 index 00000000000..dc9f3811a0f --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelDragModels.H b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceListI.H similarity index 57% rename from src/lagrangian/intermediate/parcels/include/makeParcelDragModels.H rename to src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceListI.H index d849b7833e8..e358dbc3d33 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelDragModels.H +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceListI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- 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 +{ + return owner_; +} -#include "NoDrag.H" -#include "NonSphereDrag.H" -#include "SphereDrag.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<class CloudType> +inline CloudType& Foam::ParticleForceList<CloudType>::owner() +{ + return owner_; +} -#define makeParcelDragModels(ParcelType) \ - \ - makeDragModel(KinematicCloud<ParcelType>); \ - \ - makeDragModelType(NoDrag, KinematicCloud, ParcelType); \ - makeDragModelType(NonSphereDrag, KinematicCloud, ParcelType); \ - makeDragModelType(SphereDrag, KinematicCloud, ParcelType); +template<class CloudType> +inline const Foam::fvMesh& Foam::ParticleForceList<CloudType>::mesh() const +{ + return mesh_; +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#endif +template<class CloudType> +inline const Foam::dictionary& Foam::ParticleForceList<CloudType>::dict() const +{ + return dict_; +} + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.H b/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.H deleted file mode 100644 index f52111545d3..00000000000 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.H +++ /dev/null @@ -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 - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C similarity index 67% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C index 822592e2aa1..b6f54ea92ac 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- 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 * * * * * * * * * * * * * * // template<class CloudType> -Foam::NonSphereDrag<CloudType>::NonSphereDrag +Foam::NonSphereDragForce<CloudType>::NonSphereDragForce ( + CloudType& owner, + const fvMesh& mesh, const dictionary& dict, - CloudType& owner + const word& forceType ) : - DragModel<CloudType>(dict, owner, typeName), - phi_(readScalar(this->coeffDict().lookup("phi"))), + ParticleForce<CloudType>(owner, mesh, dict, forceType), + phi_(readScalar(this->coeffs().lookup("phi"))), a_(exp(2.3288 - 6.4581*phi_ + 2.4486*sqr(phi_))), b_(0.0964 + 0.5565*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> -Foam::NonSphereDrag<CloudType>::NonSphereDrag +Foam::NonSphereDragForce<CloudType>::NonSphereDragForce ( - const NonSphereDrag<CloudType>& dm + const NonSphereDragForce<CloudType>& df ) : - DragModel<CloudType>(dm), - phi_(dm.phi_), - a_(dm.a_), - b_(dm.b_), - c_(dm.c_), - d_(dm.d_) + ParticleForce<CloudType>(df), + phi_(df.phi_), + a_(df.a_), + b_(df.b_), + c_(df.c_), + d_(df.d_) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class CloudType> -Foam::NonSphereDrag<CloudType>::~NonSphereDrag() +Foam::NonSphereDragForce<CloudType>::~NonSphereDragForce() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 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; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H similarity index 74% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.H rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H index 1d6fc02b002..d6d2712c8ad 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H @@ -57,31 +57,28 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef NonSphereDrag_H -#define NonSphereDrag_H +#ifndef NonSphereDragForce_H +#define NonSphereDragForce_H -#include "DragModel.H" +#include "ParticleForce.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class NonSphereDrag Declaration + Class NonSphereDragForce Declaration \*---------------------------------------------------------------------------*/ template<class CloudType> -class NonSphereDrag +class NonSphereDragForce : - public DragModel<CloudType> + public ParticleForce<CloudType> { protected: // Protected Data - //- Flag to indicate `Simple model' - bool simpleModel_; - //- Ratio of surface of sphere having same volume as particle to // actual surface area of particle (0 < phi <= 1) scalar phi_; @@ -98,38 +95,59 @@ protected: scalar d_; + // Private Member Functions + + //- Drag coefficient + scalar Cd(const scalar Re) const; + + public: //- Runtime type information - TypeName("NonSphereDrag"); + TypeName("nonSphereDrag"); // Constructors - //- Construct from dictionary - NonSphereDrag(const dictionary& dict, CloudType& owner); + //- Construct from mesh + NonSphereDragForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); //- Construct copy - NonSphereDrag(const NonSphereDrag<CloudType>& dm); + NonSphereDragForce(const NonSphereDragForce<CloudType>& df); //- 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 - virtual ~NonSphereDrag(); + virtual ~NonSphereDragForce(); // Member Functions - //- Return drag coefficient - scalar Cd(const scalar Re) 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; }; @@ -140,7 +158,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "NonSphereDrag.C" +# include "NonSphereDragForce.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C similarity index 64% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C index 7d0c0727cfb..64955508c9f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,55 +23,80 @@ License \*---------------------------------------------------------------------------*/ -#include "SphereDrag.H" +#include "SphereDragForce.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class CloudType> +Foam::scalar Foam::SphereDragForce<CloudType>::Cd(const scalar Re) const +{ + scalar Cd; + if (Re < SMALL) + { + Cd = GREAT; + } + else if (Re > 1000.0) + { + Cd = 0.424; + } + else + { + Cd = 24.0/Re*(1.0 + 1.0/6.0*pow(Re, 2.0/3.0)); + } + + return Cd; +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class CloudType> -Foam::SphereDrag<CloudType>::SphereDrag +Foam::SphereDragForce<CloudType>::SphereDragForce ( - const dictionary&, - CloudType& owner + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType ) : - DragModel<CloudType>(owner) + ParticleForce<CloudType>(owner, mesh, dict, forceType) {} template<class CloudType> -Foam::SphereDrag<CloudType>::SphereDrag(const SphereDrag<CloudType>& dm) +Foam::SphereDragForce<CloudType>::SphereDragForce +( + const SphereDragForce<CloudType>& df +) : - DragModel<CloudType>(dm) + ParticleForce<CloudType>(df) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class CloudType> -Foam::SphereDrag<CloudType>::~SphereDrag() +Foam::SphereDragForce<CloudType>::~SphereDragForce() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> -Foam::scalar Foam::SphereDrag<CloudType>::Cd(const scalar Re) const +Foam::forceSuSp Foam::SphereDragForce<CloudType>::calcNonCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const { - scalar Cd; - if (Re < SMALL) - { - Cd = GREAT; - } - else if (Re > 1000.0) - { - Cd = 0.424; - } - else - { - Cd = 24.0/Re*(1.0 + 1.0/6.0*pow(Re, 2.0/3.0)); - } + forceSuSp value(vector::zero, 0.0); - return Cd; + value.Sp() = Cd(Re)*Re/p.d()*muc/8.0 + ROOTVSMALL; + + return value; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H similarity index 63% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.H rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H index 643d421e092..af1efe0c013 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,63 +22,84 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::SphereDrag + Foam::SphereDragForce Description Drag model based on assumption of solid spheres \*---------------------------------------------------------------------------*/ -#ifndef SphereDrag_H -#define SphereDrag_H +#ifndef SphereDragForce_H +#define SphereDragForce_H -#include "DragModel.H" +#include "ParticleForce.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class SphereDrag Declaration + Class SphereDragForce Declaration \*---------------------------------------------------------------------------*/ 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: //- Runtime type information - TypeName("SphereDrag"); + TypeName("sphereDrag"); // Constructors - //- Construct from dictionary - SphereDrag(const dictionary& dict, CloudType& owner); + //- Construct from mesh + SphereDragForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); //- Construct copy - SphereDrag(const SphereDrag<CloudType>& dm); + SphereDragForce(const SphereDragForce<CloudType>& df); //- 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 - virtual ~SphereDrag(); + virtual ~SphereDragForce(); // Member Functions - //- Return drag coefficient - scalar Cd(const scalar Re) 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; }; @@ -89,7 +110,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "SphereDrag.C" +# include "SphereDragForce.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C similarity index 61% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C index 9be9e23bb39..cabb623111f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,73 +23,57 @@ License \*---------------------------------------------------------------------------*/ -#include "DragModel.H" +#include "GravityForce.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class CloudType> -Foam::DragModel<CloudType>::DragModel(CloudType& owner) -: - SubModelBase<CloudType>(owner) -{} - - -template<class CloudType> -Foam::DragModel<CloudType>::DragModel +Foam::GravityForce<CloudType>::GravityForce ( - const dictionary& dict, 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> -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> -Foam::DragModel<CloudType>::~DragModel() +Foam::GravityForce<CloudType>::~GravityForce() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> -Foam::scalar Foam::DragModel<CloudType>::Cd(const scalar) const -{ - notImplemented - ( - "Foam::scalar Foam::DragModel<CloudType>::Cd(const scalar) const" - ); - return 0.0; -} - - -template<class CloudType> -Foam::scalar Foam::DragModel<CloudType>::utc +Foam::forceSuSp Foam::GravityForce<CloudType>::calcNonCoupled ( + const typename CloudType::parcelType& p, + const scalar dt, const scalar Re, - const scalar d, - const scalar mu + const scalar rhoc, + const scalar muc ) const { - const scalar Cd = this->Cd(Re); - - return Cd*Re/d*mu/8.0; -} + forceSuSp value(vector::zero, 0.0); + value.Su() = g_*(1.0 - rhoc/p.rho()); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + return value; +} -#include "DragModelNew.C" // ************************************************************************* // - diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H new file mode 100644 index 00000000000..db57228f55a --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForceI.H new file mode 100644 index 00000000000..b34b82a669a --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForceI.H @@ -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_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C new file mode 100644 index 00000000000..82cf9933f6e --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C @@ -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; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H new file mode 100644 index 00000000000..69b51d85c7c --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForceI.H new file mode 100644 index 00000000000..34be6491bb3 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForceI.H @@ -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_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C new file mode 100644 index 00000000000..1716b7055b9 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C @@ -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" + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H new file mode 100644 index 00000000000..45c29b4dc38 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceI.H similarity index 65% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceI.H index be46f9946a9..24aa098e59f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,44 +23,40 @@ License \*---------------------------------------------------------------------------*/ -#include "NoDrag.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<class CloudType> -Foam::NoDrag<CloudType>::NoDrag(const dictionary& dict, CloudType& owner) -: - DragModel<CloudType>(owner) -{} +inline const CloudType& Foam::ParticleForce<CloudType>::owner() const +{ + return owner_; +} template<class CloudType> -Foam::NoDrag<CloudType>::NoDrag(const NoDrag<CloudType>& dm) -: - DragModel<CloudType>(dm.owner_) -{} - +inline CloudType& Foam::ParticleForce<CloudType>::owner() +{ + return owner_; +} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class CloudType> -Foam::NoDrag<CloudType>::~NoDrag() -{} - +inline const Foam::fvMesh& Foam::ParticleForce<CloudType>::mesh() const +{ + return mesh_; +} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> -bool Foam::NoDrag<CloudType>::active() const +inline const Foam::dictionary& Foam::ParticleForce<CloudType>::dict() const { - return false; + return dict_; } template<class CloudType> -Foam::scalar Foam::NoDrag<CloudType>::Cd(const scalar) const +inline const Foam::dictionary& Foam::ParticleForce<CloudType>::coeffs() const { - return 0.0; + return coeffs_; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModelNew.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceNew.C similarity index 61% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModelNew.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceNew.C index 054c0bd8057..9c282054c9a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModelNew.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,41 +23,55 @@ License \*---------------------------------------------------------------------------*/ -#include "DragModel.H" +#include "ParticleForce.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 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, - CloudType& owner + const word& forceType ) { - const word modelType(dict.lookup("DragModel")); - - Info<< "Selecting DragModel " << modelType << endl; + Info<< " Selecting particle force " << forceType << endl; typename dictionaryConstructorTable::iterator cstrIter = - dictionaryConstructorTablePtr_->find(modelType); + dictionaryConstructorTablePtr_->find(forceType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalErrorIn ( - "DragModel<CloudType>::New" + "ParticleForce<CloudType>::New" "(" - "const dictionary&," - "CloudType&" + "CloudType&, " + "const fvMesh&, " + "const dictionary&, " + "const word&" ")" - ) << "Unknown DragModel type " - << modelType << nl << nl - << "Valid DragModel types are:" << nl + ) << "Unknown particle force type " + << forceType + << ", constructor not in hash table" << nl << nl + << " Valid particle force types are:" << nl << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } - return autoPtr<DragModel<CloudType> >(cstrIter()(dict, owner)); + return autoPtr<ParticleForce<CloudType> > + ( + cstrIter() + ( + owner, + mesh, + dict, + forceType + ) + ); + } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C new file mode 100644 index 00000000000..a4c93323293 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C @@ -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; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H new file mode 100644 index 00000000000..a1fe759caf1 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H new file mode 100644 index 00000000000..ac81740903e --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H @@ -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); + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C new file mode 100644 index 00000000000..3cf383a996c --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C @@ -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; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H similarity index 59% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.H rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H index 742bb0d3018..ce28b8e2888 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,66 +22,95 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::NoDrag + Foam::SRFForce Description - Dummy drag model for 'none' + Calculates particle SRF reference frame force + +SourceFiles + SRFForceI.H + SRFForce.C \*---------------------------------------------------------------------------*/ -#ifndef NoDrag_H -#define NoDrag_H +#ifndef SRFForce_H +#define SRFForce_H -#include "DragModel.H" +#include "ParticleForce.H" +#include "SRFModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { + +class fvMesh; + /*---------------------------------------------------------------------------*\ - Class NoDrag Declaration + Class SRFForce Declaration \*---------------------------------------------------------------------------*/ 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: //- Runtime type information - TypeName("none"); + TypeName("SRF"); // Constructors - //- Construct from dictionary - NoDrag(const dictionary&, CloudType&); + //- Construct from mesh + SRFForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); //- Construct copy - NoDrag(const NoDrag<CloudType>& dm); + SRFForce(const SRFForce& srff); //- 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 - virtual ~NoDrag(); + virtual ~SRFForce(); // Member Functions - //- Flag to indicate whether model activates drag model - bool active() const; + // Evaluation - //- Return drag coefficient - scalar Cd(const scalar) const; + //- 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; }; @@ -92,7 +121,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "NoDrag.C" + #include "SRFForce.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H new file mode 100644 index 00000000000..76f378ed900 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H new file mode 100644 index 00000000000..2b945cfb19d --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H @@ -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); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C new file mode 100644 index 00000000000..7032b6311a7 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C @@ -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; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H new file mode 100644 index 00000000000..32f23b2b2ba --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForceI.H b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForceI.H new file mode 100644 index 00000000000..8bc3da87eb2 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForceI.H @@ -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_; +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties index cd5f1054015..9c86605535f 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties @@ -90,18 +90,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties index 699ce6d46be..dc7a66b0752 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties @@ -74,18 +74,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties index 599aa8567d0..166d7ff81cf 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties @@ -89,18 +89,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ReactingMultiphaseLookupTableInjection; - DragModel SphereDrag; - DispersionModel none; PatchInteractionModel LocalInteraction; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties index 60b93e7d13c..1220745bf2a 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties @@ -89,18 +89,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel none; PatchInteractionModel StandardWallInteraction; @@ -132,7 +131,7 @@ subModels U0 (0 0 0); sizeDistribution { - pdfType uniform; + distributionModelType uniform; uniformDistribution { minValue 100e-06; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index e28b21992b5..f63b8aede5b 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -89,18 +89,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel PatchInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; @@ -135,7 +134,7 @@ subModels flowRateProfile constant 1; sizeDistribution { - pdfType general; + distributionModelType general; generalDistribution { distribution diff --git a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties index 823e4111abd..b3dd3291e53 100644 --- a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties @@ -86,18 +86,17 @@ constantProperties particleForces { - gravity off; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel none; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties index 4896ab3e809..2e461cec12b 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties @@ -58,18 +58,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties index 451e2419c72..5be7a02a51d 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties @@ -73,18 +73,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/steadyReactingParcelFoam/counterFlowFlame2D/constant/reactingCloud1Properties b/tutorials/lagrangian/steadyReactingParcelFoam/counterFlowFlame2D/constant/reactingCloud1Properties index 95c7bb4f9ee..be708f1baf4 100644 --- a/tutorials/lagrangian/steadyReactingParcelFoam/counterFlowFlame2D/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/steadyReactingParcelFoam/counterFlowFlame2D/constant/reactingCloud1Properties @@ -18,81 +18,6 @@ FoamFile solution { 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; } diff --git a/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index 1201e969082..92c9d0c25c3 100644 --- a/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -22,6 +22,7 @@ solution transient no; // yes; calcFrequency 10; maxTrackTime 5.0; + maxCo 0.3; coupled true; cellValueSourceCorrection off; @@ -99,10 +100,11 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } @@ -110,8 +112,6 @@ subModels { InjectionModel PatchInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; @@ -146,7 +146,7 @@ subModels flowRateProfile constant 1; sizeDistribution { - pdfType general; + distributionModelType general; generalDistribution { distribution -- GitLab