From 10fa4fdcfdbc22cdff9cc1f32ecf0d6278acd42a Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Thu, 8 Apr 2010 16:40:29 +0100 Subject: [PATCH] ENH: Updates to lagrangian/intermediate library to provide link to surface film modelling - provides mechanism whereby particles can be re-introduced to a cloud - new injection models - new particle properties determined by pulling data from the surface film model --- src/lagrangian/intermediate/Make/files | 3 + src/lagrangian/intermediate/Make/options | 4 +- .../Templates/KinematicCloud/KinematicCloud.C | 18 +- .../Templates/KinematicCloud/KinematicCloud.H | 22 +- .../KinematicCloud/KinematicCloudI.H | 16 + .../Templates/ReactingCloud/ReactingCloud.C | 2 + .../ReactingMultiphaseCloud.C | 2 + .../Templates/ThermoCloud/ThermoCloud.C | 2 + .../KinematicParcel/KinematicParcel.C | 30 +- .../Templates/ThermoParcel/ThermoParcel.H | 3 + .../Templates/ThermoParcel/ThermoParcelI.H | 7 + ...keBasicReactingMultiphaseParcelSubmodels.C | 5 + .../makeBasicReactingParcelSubmodels.C | 2 + .../makeBasicKinematicParcelSubmodels.C | 2 + .../makeBasicThermoParcelSubmodels.C | 2 + .../makeKinematicParcelSurfaceFilmModels.H | 51 +++ ...eactingMultiphaseParcelSurfaceFilmModels.H | 74 +++++ .../makeReactingParcelSurfaceFilmModels.H | 84 +++++ .../makeThermoParcelSurfaceFilmModels.H | 59 ++++ .../InjectionModel/InjectionModel.C | 44 ++- .../InjectionModel/InjectionModel.H | 6 + .../NoSurfaceFilm/NoSurfaceFilm.C | 88 ++++++ .../NoSurfaceFilm/NoSurfaceFilm.H | 127 ++++++++ .../SurfaceFilmModel/NewSurfaceFilmModel.C | 66 ++++ .../SurfaceFilmModel/SurfaceFilmModel.C | 184 +++++++++++ .../SurfaceFilmModel/SurfaceFilmModel.H | 292 ++++++++++++++++++ .../SurfaceFilmModel/SurfaceFilmModelI.H | 93 ++++++ .../ThermoSurfaceFilm/ThermoSurfaceFilm.C | 173 +++++++++++ .../ThermoSurfaceFilm/ThermoSurfaceFilm.H | 148 +++++++++ .../ThermoSurfaceFilm/ThermoSurfaceFilmI.H | 135 ++++++++ .../injection/cloudInjection/cloudInjection.C | 118 +++++++ .../injection/cloudInjection/cloudInjection.H | 142 +++++++++ .../cloudInjection/cloudInjectionI.H | 44 +++ 33 files changed, 2020 insertions(+), 28 deletions(-) create mode 100644 src/lagrangian/intermediate/parcels/include/makeKinematicParcelSurfaceFilmModels.H create mode 100644 src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelSurfaceFilmModels.H create mode 100644 src/lagrangian/intermediate/parcels/include/makeReactingParcelSurfaceFilmModels.H create mode 100644 src/lagrangian/intermediate/parcels/include/makeThermoParcelSurfaceFilmModels.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/NoSurfaceFilm/NoSurfaceFilm.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/NoSurfaceFilm/NoSurfaceFilm.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/NewSurfaceFilmModel.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModelI.H create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.H create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilmI.H create mode 100644 src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjection.C create mode 100644 src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjection.H create mode 100644 src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjectionI.H diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 2ee3d31c3fa..8ac0c9f1b6b 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -49,6 +49,9 @@ RADIATION=submodels/addOns/radiation $(RADIATION)/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C $(RADIATION)/scatter/cloudScatter/cloudScatter.C +SURFACEFILM=submodels/addOns/surfaceFilmModel +$(SURFACEFILM)/injection/cloudInjection/cloudInjection.C + submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C KINEMATICINJECTION=submodels/Kinematic/InjectionModel diff --git a/src/lagrangian/intermediate/Make/options b/src/lagrangian/intermediate/Make/options index f3525972826..03d6e816cb0 100644 --- a/src/lagrangian/intermediate/Make/options +++ b/src/lagrangian/intermediate/Make/options @@ -15,9 +15,11 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \ -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ - -I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude + -I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \ + -I$(LIB_SRC)/surfaceFilmModels/lnInclude LIB_LIBS = \ + -lsurfaceFilmModels \ -lfiniteVolume \ -lmeshTools \ -llagrangian \ diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index dca0ecc37f3..acc98daf63d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -32,6 +32,7 @@ License #include "InjectionModel.H" #include "PatchInteractionModel.H" #include "PostProcessingModel.H" +#include "SurfaceFilmModel.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -77,6 +78,8 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud() g_.value() ); + this->surfaceFilm().inject(td); + this->injection().inject(td); if (coupled_) @@ -185,6 +188,15 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud *this ) ), + surfaceFilmModel_ + ( + SurfaceFilmModel<KinematicCloud<ParcelType> >::New + ( + this->particleProperties_, + *this, + g + ) + ), UIntegrator_ ( vectorIntegrationScheme::New @@ -270,14 +282,12 @@ template<class ParcelType> void Foam::KinematicCloud<ParcelType>::info() const { Info<< "Cloud: " << this->name() << nl - << " Total number of parcels added = " - << this->injection().parcelsAddedTotal() << nl - << " Total mass introduced = " - << this->injection().massInjected() << nl << " Current number of parcels = " << returnReduce(this->size(), sumOp<label>()) << nl << " Current mass in system = " << returnReduce(massInSystem(), sumOp<scalar>()) << nl; + this->injection().info(Info); + this->surfaceFilm().info(Info); } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index fb005b39d1e..701dc376e99 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -31,7 +31,9 @@ Description - Dispersion model - Drag model - Injection model - - Wall interaction model + - Patch interaction model + - Post-processing model + - Surface film model SourceFiles KinematicCloudI.H @@ -70,11 +72,15 @@ class DragModel; template<class CloudType> class InjectionModel; +template<class CloudType> +class PatchInteractionModel; + template<class CloudType> class PostProcessingModel; template<class CloudType> -class PatchInteractionModel; +class SurfaceFilmModel; + /*---------------------------------------------------------------------------*\ Class KinematicCloud Declaration @@ -173,6 +179,10 @@ protected: autoPtr<PostProcessingModel<KinematicCloud<ParcelType> > > postProcessingModel_; + //- Surface film model + autoPtr<SurfaceFilmModel<KinematicCloud<ParcelType> > > + surfaceFilmModel_; + // Reference to the particle integration schemes @@ -315,6 +325,14 @@ public: inline PostProcessingModel<KinematicCloud<ParcelType> >& postProcessing(); + //- Return const-access to the surface film model + inline const SurfaceFilmModel<KinematicCloud<ParcelType> >& + surfaceFilm() const; + + //- Return reference to the surface film model + inline SurfaceFilmModel<KinematicCloud<ParcelType> >& + surfaceFilm(); + // Integration schemes diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 75ff2f79553..1de33c6e81d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -181,6 +181,22 @@ Foam::KinematicCloud<ParcelType>::postProcessing() } +template<class ParcelType> +inline const Foam::SurfaceFilmModel<Foam::KinematicCloud<ParcelType> >& +Foam::KinematicCloud<ParcelType>::surfaceFilm() const +{ + return surfaceFilmModel_(); +} + + +template<class ParcelType> +inline Foam::SurfaceFilmModel<Foam::KinematicCloud<ParcelType> >& +Foam::KinematicCloud<ParcelType>::surfaceFilm() +{ + return surfaceFilmModel_(); +} + + template<class ParcelType> inline const Foam::vectorIntegrationScheme& Foam::KinematicCloud<ParcelType>::UIntegrator() const diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index 278634dedd4..bcf27896a9b 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -120,6 +120,8 @@ void Foam::ReactingCloud<ParcelType>::evolveCloud() this->g().value() ); + this->surfaceFilm().inject(td); + this->injection().inject(td); if (this->coupled()) diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index a70adc012af..3a559dcfd37 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -93,6 +93,8 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolveCloud() this->g().value() ); + this->surfaceFilm().inject(td); + this->injection().inject(td); if (this->coupled()) diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 3a26858a1a9..2eb30c1eb1f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -86,6 +86,8 @@ void Foam::ThermoCloud<ParcelType>::evolveCloud() this->g().value() ); + this->surfaceFilm().inject(td); + this->injection().inject(td); if (this->coupled()) diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 529f55edff5..a381c9d431a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -283,15 +283,31 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch ) { ParcelType& p = static_cast<ParcelType&>(*this); + + // Invoke poost-processing mdoel td.cloud().postProcessing().postPatch(p, patchI); - return td.cloud().patchInteraction().correct - ( - pp, - this->face(), - td.keepParticle, - U_ - ); + // Invoke surface film model + if (td.cloud().surfaceFilm().transferParcel(p, patchI)) + { + // Parcel transferred to the surface film + td.keepParticle = false; + + // All interactions done + return true; + } + else + { + // Invoke patch interaction model + return + td.cloud().patchInteraction().correct + ( + pp, + this->face(), + td.keepParticle, + U_ + ); + } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index c1050245f7b..6ae9d293904 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -296,6 +296,9 @@ public: //- Return const access to specific heat capacity inline scalar cp() const; + //- Return the parcel sensible enthalpy + inline scalar hs() const; + // Edit diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H index ba0843aca03..188de311579 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H @@ -217,6 +217,13 @@ inline Foam::scalar Foam::ThermoParcel<ParcelType>::cp() const } +template<class ParcelType> +inline Foam::scalar Foam::ThermoParcel<ParcelType>::hs() const +{ + return cp_*(T_ - 298.15); +} + + template<class ParcelType> inline Foam::scalar& Foam::ThermoParcel<ParcelType>::T() { diff --git a/src/lagrangian/intermediate/parcels/derived/BasicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/BasicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C index c6ba4bfcd52..21890776e6f 100644 --- a/src/lagrangian/intermediate/parcels/derived/BasicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/BasicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C @@ -41,6 +41,7 @@ License // Reacting multiphase #include "makeReactingMultiphaseParcelDevolatilisationModels.H" +#include "makeReactingMultiphaseParcelSurfaceFilmModels.H" #include "makeReactingMultiphaseParcelSurfaceReactionModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,6 +67,10 @@ namespace Foam ( BasicReactingMultiphaseParcel ); + makeReactingMultiphaseSurfaceFilmModels + ( + BasicReactingMultiphaseParcel + ); makeReactingMultiphaseSurfaceReactionModels ( BasicReactingMultiphaseParcel diff --git a/src/lagrangian/intermediate/parcels/derived/BasicReactingParcel/makeBasicReactingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/BasicReactingParcel/makeBasicReactingParcelSubmodels.C index 6fd08a0a943..9a7e2f9dea5 100644 --- a/src/lagrangian/intermediate/parcels/derived/BasicReactingParcel/makeBasicReactingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/BasicReactingParcel/makeBasicReactingParcelSubmodels.C @@ -38,6 +38,7 @@ License // Reacting #include "makeReactingParcelCompositionModels.H" #include "makeReactingParcelPhaseChangeModels.H" +#include "makeReactingParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,6 +57,7 @@ namespace Foam // Reacting sub-models makeReactingCompositionModels(BasicReactingParcel); makeReactingPhaseChangeModels(BasicReactingParcel); + makeReactingSurfaceFilmModels(BasicReactingParcel); }; diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C index a5be546fa3d..9ff005490b3 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C @@ -31,6 +31,7 @@ License #include "makeParcelInjectionModels.H" #include "makeParcelPatchInteractionModels.H" #include "makeParcelPostProcessingModels.H" +#include "makeKinematicParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,6 +43,7 @@ namespace Foam makeParcelInjectionModels(basicKinematicParcel); makeParcelPatchInteractionModels(basicKinematicParcel); makeParcelPostProcessingModels(basicKinematicParcel); + makeKinematicParcelSurfaceFilmModels(basicKinematicParcel); }; diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C index d497e8ce1ce..3ed5aaddb4f 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C @@ -34,6 +34,7 @@ License // Thermodynamic #include "makeParcelHeatTransferModels.H" +#include "makeThermoParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,6 +49,7 @@ namespace Foam // Thermo sub-models makeParcelHeatTransferModels(basicThermoParcel); + makeParcelSurfaceFilmModels(basicThermoParcel); }; diff --git a/src/lagrangian/intermediate/parcels/include/makeKinematicParcelSurfaceFilmModels.H b/src/lagrangian/intermediate/parcels/include/makeKinematicParcelSurfaceFilmModels.H new file mode 100644 index 00000000000..9f695653e6d --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeKinematicParcelSurfaceFilmModels.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef makeParcelSurfaceFilmModels_H +#define makeParcelSurfaceFilmModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "KinematicCloud.H" +#include "NoSurfaceFilm.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeKinematicParcelSurfaceFilmModels(ParcelType) \ + \ + makeSurfaceFilmModel(KinematicCloud<ParcelType>); \ + \ + makeSurfaceFilmModelType \ + ( \ + NoSurfaceFilm, \ + KinematicCloud, \ + ParcelType \ + ); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelSurfaceFilmModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelSurfaceFilmModels.H new file mode 100644 index 00000000000..92ed38da946 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelSurfaceFilmModels.H @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef makeReactingMultiphaseParcelSurfaceFilmModels_H +#define makeReactingMultiphaseParcelSurfaceFilmModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "thermoPhysicsTypes.H" +#include "ReactingMultiphaseCloud.H" + +#include "NoSurfaceFilm.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeReactingMultiphaseSurfaceFilmModels(ParcelType) \ + \ + makeReactingMultiphaseSurfaceFilmModelThermoType \ + ( \ + ParcelType, \ + constGasThermoPhysics \ + ); \ + makeReactingMultiphaseSurfaceFilmModelThermoType \ + ( \ + ParcelType, \ + gasThermoPhysics \ + ); \ + makeReactingMultiphaseSurfaceFilmModelThermoType \ + ( \ + ParcelType, \ + icoPoly8ThermoPhysics \ + ); + + +#define makeReactingMultiphaseSurfaceFilmModelThermoType(ParcelType, ThermoType)\ + \ + makeSurfaceFilmModel(KinematicCloud<ParcelType<ThermoType> >); \ + \ + makeSurfaceFilmModelThermoType \ + ( \ + NoSurfaceFilm, \ + KinematicCloud, \ + ParcelType, \ + ThermoType \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingParcelSurfaceFilmModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingParcelSurfaceFilmModels.H new file mode 100644 index 00000000000..b2b1bf2d892 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeReactingParcelSurfaceFilmModels.H @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef makeReactingParcelSurfaceFilmModels_H +#define makeReactingParcelSurfaceFilmModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "thermoPhysicsTypes.H" +#include "KinematicCloud.H" + +#include "NoSurfaceFilm.H" +#include "ThermoSurfaceFilm.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeReactingSurfaceFilmModels(ParcelType) \ + \ + makeReactingSurfaceFilmModelThermoType \ + ( \ + ParcelType, \ + constGasThermoPhysics \ + ); \ + \ + makeReactingSurfaceFilmModelThermoType \ + ( \ + ParcelType, \ + gasThermoPhysics \ + ); \ + \ + makeReactingSurfaceFilmModelThermoType \ + ( \ + ParcelType, \ + icoPoly8ThermoPhysics \ + ); + + +#define makeReactingSurfaceFilmModelThermoType(ParcelType, ThermoType) \ + \ + makeSurfaceFilmModel(KinematicCloud<ParcelType<ThermoType> >); \ + \ + makeSurfaceFilmModelThermoType \ + ( \ + NoSurfaceFilm, \ + KinematicCloud, \ + ParcelType, \ + ThermoType \ + ); \ + makeSurfaceFilmModelThermoType \ + ( \ + ThermoSurfaceFilm, \ + KinematicCloud, \ + ParcelType, \ + ThermoType \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeThermoParcelSurfaceFilmModels.H b/src/lagrangian/intermediate/parcels/include/makeThermoParcelSurfaceFilmModels.H new file mode 100644 index 00000000000..bf1ff47a206 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeThermoParcelSurfaceFilmModels.H @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef makeThermoParcelSurfaceFilmModels_H +#define makeThermoParcelSurfaceFilmModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "KinematicCloud.H" +#include "NoSurfaceFilm.H" +#include "ThermoSurfaceFilm.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeParcelSurfaceFilmModels(ParcelType) \ + \ + makeSurfaceFilmModel(KinematicCloud<ParcelType>); \ + \ + makeSurfaceFilmModelType \ + ( \ + NoSurfaceFilm, \ + KinematicCloud, \ + ParcelType \ + ); \ + \ + makeSurfaceFilmModelType \ + ( \ + ThermoSurfaceFilm, \ + KinematicCloud, \ + ParcelType \ + ); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 0c1157ff723..3ee135476b2 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -135,38 +135,46 @@ void Foam::InjectionModel<CloudType>::findCellAtPosition vector& position ) { - const vector p0 = position; + const volVectorField& cellCentres = owner_.mesh().C(); - bool foundCell = false; + const vector p0 = position; cellI = owner_.mesh().findCell(position); + label procI = -1; + if (cellI >= 0) { - const vector& C = owner_.mesh().C()[cellI]; - position += SMALL*(C - position); - - foundCell = owner_.mesh().pointInCell(position, cellI); + procI = Pstream::myProcNo(); + } + reduce(procI, maxOp<label>()); + if (procI != Pstream::myProcNo()) + { + cellI = -1; } - reduce(foundCell, orOp<bool>()); // Last chance - find nearest cell and try that one // - the point is probably on an edge - if (!foundCell) + if (procI == -1) { cellI = owner_.mesh().findNearestCell(position); - if (cellI >= 0) { - const vector& C = owner_.mesh().C()[cellI]; - position += SMALL*(C - position); + position += SMALL*(cellCentres[cellI] - position); - foundCell = owner_.mesh().pointInCell(position, cellI); + if (owner_.mesh().pointInCell(position, cellI)) + { + procI = Pstream::myProcNo(); + } + } + reduce(procI, maxOp<label>()); + if (procI != Pstream::myProcNo()) + { + cellI = -1; } - reduce(foundCell, orOp<bool>()); } - if (!foundCell) + if (procI == -1) { FatalErrorIn ( @@ -436,6 +444,14 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td) } +template<class CloudType> +void Foam::InjectionModel<CloudType>::info(Ostream& os) const +{ + os << " Total number of parcels added = " << parcelsAddedTotal_ << nl + << " Total mass introduced = " << massInjected_ << nl; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "NewInjectionModel.C" diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H index 33965decd29..999e249c724 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H @@ -316,6 +316,12 @@ public: //- Flag to identify whether model fully describes the parcel virtual bool fullyDescribed() const = 0; + + + // I-O + + //- Write surface film info to stream + virtual void info(Ostream& os) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/NoSurfaceFilm/NoSurfaceFilm.C b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/NoSurfaceFilm/NoSurfaceFilm.C new file mode 100644 index 00000000000..3e647f9fdb4 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/NoSurfaceFilm/NoSurfaceFilm.C @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#include "NoSurfaceFilm.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::NoSurfaceFilm<CloudType>::NoSurfaceFilm +( + const dictionary&, + CloudType& owner, + const dimensionedVector& +) +: + SurfaceFilmModel<CloudType>(owner) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::NoSurfaceFilm<CloudType>::~NoSurfaceFilm() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +bool Foam::NoSurfaceFilm<CloudType>::active() const +{ + return false; +} + + +template<class CloudType> +bool Foam::NoSurfaceFilm<CloudType>::transferParcel +( + const parcelType&, + const label +) +{ + return false; +} + + +template<class CloudType> +void Foam::NoSurfaceFilm<CloudType>::setParcelProperties +( + parcelType&, + const label +) +{ + // do nothing +} + + +template<class CloudType> +void Foam::NoSurfaceFilm<CloudType>::info(Ostream&) const +{ + // do nothing +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/NoSurfaceFilm/NoSurfaceFilm.H b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/NoSurfaceFilm/NoSurfaceFilm.H new file mode 100644 index 00000000000..0fbbecee3bc --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/NoSurfaceFilm/NoSurfaceFilm.H @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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::NoSurfaceFilm + +Description + Place holder for 'none' option + +SourceFiles + NoSurfaceFilm.C + +\*---------------------------------------------------------------------------*/ + +#ifndef NoSurfaceFilm_H +#define NoSurfaceFilm_H + +#include "SurfaceFilmModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class NoSurfaceFilm Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class NoSurfaceFilm +: + public SurfaceFilmModel<CloudType> +{ +protected: + + // Protected data + + //- Convenience typedef for parcel type + typedef typename CloudType::parcelType parcelType; + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from components + NoSurfaceFilm + ( + const dictionary&, + CloudType&, + const dimensionedVector& + ); + + + //- Destructor + virtual ~NoSurfaceFilm(); + + + // Member Functions + + // Evaluation + + //- Flag to indicate whether model activates the surface film model + virtual bool active() const; + + //- Transfer parcel from cloud to surface film + // Returns true if parcel is to be transferred + virtual bool transferParcel + ( + const parcelType& p, + const label patchI + ); + + //- Set parcel properties + virtual void setParcelProperties + ( + parcelType& p, + const label filmCellI + ); + + + // I-O + + //- Write surface film info to stream + virtual void info(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "NoSurfaceFilm.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/NewSurfaceFilmModel.C b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/NewSurfaceFilmModel.C new file mode 100644 index 00000000000..97ced9e9595 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/NewSurfaceFilmModel.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#include "SurfaceFilmModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::autoPtr<Foam::SurfaceFilmModel<CloudType> > +Foam::SurfaceFilmModel<CloudType>::New +( + const dictionary& dict, + CloudType& owner, + const dimensionedVector& g +) +{ + word SurfaceFilmModelType(dict.lookup("SurfaceFilmModel")); + + Info<< "Selecting SurfaceFilmModel " << SurfaceFilmModelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(SurfaceFilmModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "SurfaceFilmModel<CloudType>::New" + "(" + "const dictionary&, " + "CloudType&" + ")" + ) << "Unknown SurfaceFilmModel type " + << SurfaceFilmModelType + << ", constructor not in hash table" << nl << nl + << " Valid SurfaceFilmModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); + } + + return autoPtr<SurfaceFilmModel<CloudType> >(cstrIter()(dict, owner, g)); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C new file mode 100644 index 00000000000..fdf6ff0e4f4 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C @@ -0,0 +1,184 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#include "SurfaceFilmModel.H" +#include "mathematicalConstants.H" +#include "surfaceFilmModel.H" +#include "directMappedWallPolyPatch.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel(CloudType& owner) +: + dict_(dictionary::null), + owner_(owner), + g_(dimensionedVector("zero", dimAcceleration, vector::zero)), + coeffDict_(dictionary::null), + injectorCellsPatch_(0), + massParcelPatch_(0), + diameterParcelPatch_(0), + UFilmPatch_(0), + rhoFilmPatch_(0), + nParcelsTransferred_(0), + nParcelsInjected_(0) +{} + + +template<class CloudType> +Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel +( + const dictionary& dict, + CloudType& owner, + const dimensionedVector& g, + const word& type +) +: + dict_(dict), + owner_(owner), + g_(g), + coeffDict_(dict.subDict(type + "Coeffs")), + injectorCellsPatch_(0), + massParcelPatch_(0), + diameterParcelPatch_(0), + UFilmPatch_(0), + rhoFilmPatch_(0), + nParcelsTransferred_(0), + nParcelsInjected_(0) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::SurfaceFilmModel<CloudType>::~SurfaceFilmModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +template<class TrackData> +void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td) +{ + // Retrieve the film model from the owner database + const surfaceFilmModels::surfaceFilmModel& filmModel = + this->owner().db().objectRegistry::lookupObject + <surfaceFilmModels::surfaceFilmModel> + ( + "surfaceFilmProperties" + ); + + const labelList& filmPatches = filmModel.filmBottomPatchIDs(); + const labelList& primaryPatches = filmModel.primaryPatchIDs(); + + forAll(filmPatches, i) + { + const label primaryPatchI = primaryPatches[i]; + const directMappedWallPolyPatch& wpp = + refCast<const directMappedWallPolyPatch> + ( + this->owner().mesh().boundaryMesh()[primaryPatchI] + ); + + injectorCellsPatch_ = wpp.faceCells(); + + const label filmPatchI = filmPatches[i]; + const mapDistribute& distMap = wpp.map(); + cacheFilmFields(filmPatchI, distMap, filmModel); + + forAll(injectorCellsPatch_, j) + { + if (diameterParcelPatch_[j] > 0) + { + const label cellI = injectorCellsPatch_[j]; + const point& pos = this->owner().mesh().C()[cellI]; + + // Create a new parcel + typename CloudType::parcelType* pPtr = + new typename CloudType::parcelType(td.cloud(), pos, cellI); + setParcelProperties(*pPtr, j); + + // Check new parcel properties +// td.cloud().checkParcelProperties(*pPtr, 0.0, true); + td.cloud().checkParcelProperties(*pPtr, 0.0, false); + + // Add the new parcel to the cloud + td.cloud().addParticle(pPtr); + + nParcelsInjected_++; + } + } + } +} + + +template<class CloudType> +void Foam::SurfaceFilmModel<CloudType>::cacheFilmFields +( + const label filmPatchI, + const mapDistribute& distMap, + const surfaceFilmModels::surfaceFilmModel& filmModel +) +{ + massParcelPatch_ = filmModel.massForPrimary().boundaryField()[filmPatchI]; + distMap.distribute(massParcelPatch_); + + diameterParcelPatch_ = + filmModel.diametersForPrimary().boundaryField()[filmPatchI]; + distMap.distribute(diameterParcelPatch_); + + UFilmPatch_ = filmModel.U().boundaryField()[filmPatchI]; + distMap.distribute(UFilmPatch_); + + rhoFilmPatch_ = filmModel.rho().boundaryField()[filmPatchI]; + distMap.distribute(rhoFilmPatch_); +} + + +template<class CloudType> +void Foam::SurfaceFilmModel<CloudType>::setParcelProperties +( + parcelType& p, + const label filmFaceI +) const +{ + // Set parcel properties + scalar vol = mathematical::pi/6.0*pow3(diameterParcelPatch_[filmFaceI]); + p.d() = diameterParcelPatch_[filmFaceI]; + p.U() = UFilmPatch_[filmFaceI]; + p.rho() = rhoFilmPatch_[filmFaceI]; + + p.nParticle() = massParcelPatch_[filmFaceI]/p.rho()/vol; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NewSurfaceFilmModel.C" + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H new file mode 100644 index 00000000000..145b1f421fc --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H @@ -0,0 +1,292 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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::SurfaceFilmModel + +Description + Templated wall surface film model class. + +SourceFiles + SurfaceFilmModel.C + NewSurfaceFilmModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SurfaceFilmModel_H +#define SurfaceFilmModel_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +namespace surfaceFilmModels +{ + class surfaceFilmModel; +} + +class mapDistribute; + +/*---------------------------------------------------------------------------*\ + Class SurfaceFilmModel Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class SurfaceFilmModel +{ +protected: + + // Protected data + + //- Convenience typedef to the cloud's parcel type + typedef typename CloudType::parcelType parcelType; + + //- The cloud dictionary + const dictionary& dict_; + + //- Reference to the owner cloud class + CloudType& owner_; + + //- Gravitational acceleration constant + const dimensionedVector& g_; + + //- The coefficients dictionary + const dictionary coeffDict_; + + + // Cached injector fields per film patch + + //- Injector cell / patch face + labelList injectorCellsPatch_; + + //- Parcel mass / patch face + scalarList massParcelPatch_; + + //- Parcel diameter / patch face + scalarList diameterParcelPatch_; + + //- Film velocity / patch face + List<vector> UFilmPatch_; + + //- Film density / patch face + scalarList rhoFilmPatch_; + + + // Counters + + //- Number of parcels transferred to the film model + label nParcelsTransferred_; + + //- Number of parcels injected from the film model + label nParcelsInjected_; + + + // Protected functions + + //- Cache the film fields in preparation for injection + virtual void cacheFilmFields + ( + const label filmPatchI, + const mapDistribute& distMap, + const surfaceFilmModels::surfaceFilmModel& filmModel + ); + + //- Set the individual parcel properties + virtual void setParcelProperties + ( + parcelType& p, + const label filmFaceI + ) const; + + +public: + + //- Runtime type information + TypeName("SurfaceFilmModel"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + SurfaceFilmModel, + dictionary, + ( + const dictionary& dict, + CloudType& owner, + const dimensionedVector& g + ), + (dict, owner, g) + ); + + + // Constructors + + //- Construct null from owner + SurfaceFilmModel(CloudType& owner); + + //- Construct from dictionary + SurfaceFilmModel + ( + const dictionary& dict, + CloudType& owner, + const dimensionedVector& g, + const word& type + ); + + + //- Destructor + virtual ~SurfaceFilmModel(); + + + //- Selector + static autoPtr<SurfaceFilmModel<CloudType> > New + ( + const dictionary& dict, + CloudType& owner, + const dimensionedVector& g + ); + + + // Member Functions + + // Access + + //- Return the owner cloud dictionary + inline const dictionary& dict() const; + + //- Return const access the owner cloud object + inline const CloudType& owner() const; + + //- Return non-const access the owner cloud object for manipulation + inline CloudType& owner(); + + //- Return gravitational acceleration constant + inline const dimensionedVector& g() const; + + //- Return the coefficients dictionary + inline const dictionary& coeffDict() const; + + //- Return const access to the number of parcels transferred to the + // film model + inline label nParcelsTransferred() const; + + //- Return non-const access to the number of parcels transferred to + // the film model + inline label& nParcelsTransferred(); + + //- Return const access to the number of parcels injected from the + // film model + inline label nParcelsInjected() const; + + //- Return non-const access to the number of parcels injected from + // the film model + inline label& nParcelsInjected(); + + + // Member Functions + + //- Flag to indicate whether model activates the surface film model + virtual bool active() const = 0; + + //- Transfer parcel from cloud to surface film + // Returns true if parcel is to be transferred + virtual bool transferParcel + ( + const parcelType& p, + const label patchI + ) = 0; + + //- Inject parcels into the cloud + template<class TrackData> + void inject(TrackData& td); + + + // I-O + + //- Write surface film info to stream + virtual void info(Ostream& os) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSurfaceFilmModel(CloudType) \ + \ + defineNamedTemplateTypeNameAndDebug(SurfaceFilmModel<CloudType>, 0); \ + \ + defineTemplateRunTimeSelectionTable \ + ( \ + SurfaceFilmModel<CloudType>, \ + dictionary \ + ); + + +#define makeSurfaceFilmModelType(SS, CloudType, ParcelType) \ + \ + defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \ + \ + SurfaceFilmModel<CloudType<ParcelType> >:: \ + adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \ + add##SS##CloudType##ParcelType##ConstructorToTable_; + + +#define makeSurfaceFilmModelThermoType(SS, CloudType, ParcelType, ThermoType) \ + \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + SS<CloudType<ParcelType<ThermoType> > >, \ + 0 \ + ); \ + \ + SurfaceFilmModel<CloudType<ParcelType<ThermoType> > >:: \ + adddictionaryConstructorToTable \ + <SS<CloudType<ParcelType<ThermoType> > > > \ + add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_; + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "SurfaceFilmModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "SurfaceFilmModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModelI.H b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModelI.H new file mode 100644 index 00000000000..af3deb48e69 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModelI.H @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#include "SurfaceFilmModel.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +const Foam::dictionary& Foam::SurfaceFilmModel<CloudType>::dict() const +{ + return dict_; +} + + +template<class CloudType> +const CloudType& Foam::SurfaceFilmModel<CloudType>::owner() const +{ + return owner_; +} + + +template<class CloudType> +CloudType& Foam::SurfaceFilmModel<CloudType>::owner() +{ + return owner_; +} + + +template<class CloudType> +const Foam::dimensionedVector& Foam::SurfaceFilmModel<CloudType>::g() const +{ + return g_; +} + + +template<class CloudType> +const Foam::dictionary& Foam::SurfaceFilmModel<CloudType>::coeffDict() const +{ + return coeffDict_; +} + + +template<class CloudType> +Foam::label& Foam::SurfaceFilmModel<CloudType>::nParcelsTransferred() +{ + return nParcelsTransferred_; +} + + +template<class CloudType> +Foam::label Foam::SurfaceFilmModel<CloudType>::nParcelsTransferred() const +{ + return nParcelsTransferred_; +} + + +template<class CloudType> +Foam::label& Foam::SurfaceFilmModel<CloudType>::nParcelsInjected() +{ + return nParcelsInjected_; +} + + +template<class CloudType> +Foam::label Foam::SurfaceFilmModel<CloudType>::nParcelsInjected() const +{ + return nParcelsInjected_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C new file mode 100644 index 00000000000..d0c1ba984e3 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#include "ThermoSurfaceFilm.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm +( + const dictionary& dict, + CloudType& owner, + const dimensionedVector& g +) +: + SurfaceFilmModel<CloudType>(dict, owner, g, typeName), + TFilmPatch_(0), + cpFilmPatch_(0) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ThermoSurfaceFilm<CloudType>::~ThermoSurfaceFilm() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +bool Foam::ThermoSurfaceFilm<CloudType>::active() const +{ + return true; +} + + +template<class CloudType> +bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel +( + const parcelType& p, + const label patchI +) +{ + // Retrieve the film model from the owner database + surfaceFilmModels::surfaceFilmModel& filmModel = + const_cast<surfaceFilmModels::surfaceFilmModel&> + ( + this->owner().db().objectRegistry:: + lookupObject<surfaceFilmModels::surfaceFilmModel> + ( + "surfaceFilmProperties" + ) + ); + + if (filmModel.isFilmPatch(patchI)) + { + const polyPatch& pp = this->owner().mesh().boundaryMesh()[patchI]; + + label faceI = pp.whichFace(p.face()); + + // Patch face normal + const vector& nf = pp.faceNormals()[faceI]; + + // Relative parcel velocity + const vector Urel = + p.U() - this->owner().U().boundaryField()[patchI][faceI]; + + // Parcel mass + const scalar m = p.nParticle()*p.mass(); + + // Add the particle properties as sources to the film model + filmModel.addSources + ( + patchI, + faceI, + m, // mass + m*(Urel - nf*(Urel & nf)), // tangential momentum + m*mag(Urel & nf), // impingement pressure + m*p.hs() // energy + ); + + if (debug) + { + Info<< "ThermoSurfaceFilm<CloudType>::transferParcel:" << nl + << " Effective increase in film height = " + << p.nParticle()*p.volume()/mag(pp.faceAreas()[faceI]) << endl; + } + + this->nParcelsTransferred()++; + + // Flag to remove parcel p from owner cloud + return true; + } + else + { + return false; + } +} + + +template<class CloudType> +void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields +( + const label filmPatchI, + const mapDistribute& distMap, + const surfaceFilmModels::surfaceFilmModel& filmModel +) +{ + SurfaceFilmModel<CloudType>::cacheFilmFields + ( + filmPatchI, + distMap, + filmModel + ); + + TFilmPatch_ = filmModel.T().boundaryField()[filmPatchI]; + distMap.distribute(TFilmPatch_); + + cpFilmPatch_ = filmModel.cp().boundaryField()[filmPatchI]; + distMap.distribute(cpFilmPatch_); +} + + +template<class CloudType> +void Foam::ThermoSurfaceFilm<CloudType>::setParcelProperties +( + parcelType& p, + const label filmFaceI +) const +{ + SurfaceFilmModel<CloudType>::setParcelProperties(p, filmFaceI); + + // Set parcel properties + p.T() = TFilmPatch_[filmFaceI]; + p.cp() = cpFilmPatch_[filmFaceI]; +} + + +template<class CloudType> +void Foam::ThermoSurfaceFilm<CloudType>::info(Ostream& os) const +{ + os << " Parcels transferred to film = " + << returnReduce(this->nParcelsTransferred(), sumOp<label>()) << nl + << " Number of film parcels added = " + << returnReduce(this->nParcelsInjected(), sumOp<label>()) << nl; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.H b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.H new file mode 100644 index 00000000000..af594cc5e59 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.H @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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::ThermoSurfaceFilm + +Description + Thermo parcel surface film model. + +SourceFiles + ThermoSurfaceFilm.C + ThermoSurfaceFilmI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef ThermoSurfaceFilm_H +#define ThermoSurfaceFilm_H + +#include "SurfaceFilmModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ThermoSurfaceFilm Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class ThermoSurfaceFilm +: + public SurfaceFilmModel<CloudType> +{ +protected: + + // Protected data + + //- Convenience typedef to the cloud's parcel type + typedef typename CloudType::parcelType parcelType; + + + // Cached injector fields per film patch + + //- Film temperature / patch face + scalarList TFilmPatch_; + + //- Film specific heat capacity / patch face + scalarList cpFilmPatch_; + + + // Protected functions + + //- Cache the film fields in preparation for injection + virtual void cacheFilmFields + ( + const label filmPatchI, + const mapDistribute& distMap, + const surfaceFilmModels::surfaceFilmModel& filmModel + ); + + //- Set the individual parcel properties + virtual void setParcelProperties + ( + parcelType& p, + const label filmFaceI + ) const; + + +public: + + //- Runtime type information + TypeName("ThermoSurfaceFilm"); + + + // Constructors + + //- Construct from components + ThermoSurfaceFilm + ( + const dictionary& dict, + CloudType& owner, + const dimensionedVector& g + ); + + + //- Destructor + virtual ~ThermoSurfaceFilm(); + + + // Member Functions + + // Evaluation + + //- Flag to indicate whether model activates surface film model + virtual bool active() const; + + //- Transfer parcel from cloud to surface film + // Returns true if parcel is to be transferred + virtual bool transferParcel + ( + const parcelType& p, + const label patchI + ); + + + // I-O + + //- Write surface film info to stream + virtual void info(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ThermoSurfaceFilm.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilmI.H b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilmI.H new file mode 100644 index 00000000000..aeebf2c4180 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilmI.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#include "ThermoSurfaceFilm.H" +#include "DimensionedFields.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +inline const Foam::word& +Foam::ThermoSurfaceFilm<CloudType>::filmRegionName() const +{ + return filmRegionName_; +} + + +template<class CloudType> +inline const Foam::wordList& +Foam::ThermoSurfaceFilm<CloudType>::patchNames() const +{ + return patchNames_; +} + + +template<class CloudType> +inline const Foam::polyMesh& +Foam::ThermoSurfaceFilm<CloudType>::filmRegion() const +{ + return filmRegion_; +} + + +template<class CloudType> +inline const Foam::volScalarField& +Foam::ThermoSurfaceFilm<CloudType>::hf() const +{ + return hf_; +} + + +template<class CloudType> +inline const Foam::volScalarField& +Foam::ThermoSurfaceFilm<CloudType>::rho() const +{ + return rho_; +} + + +template<class CloudType> +inline const Foam::volVectorField& +Foam::ThermoSurfaceFilm<CloudType>::U() const +{ + return U_; +} + + +template<class CloudType> +inline const Foam::volScalarField& +Foam::ThermoSurfaceFilm<CloudType>::p() const +{ + return p_; +} + + +template<class CloudType> +inline const Foam::volScalarField& +Foam::ThermoSurfaceFilm<CloudType>::h() const +{ + return h_; +} + + +template<class CloudType> +inline const Foam::volScalarField& +Foam::ThermoSurfaceFilm<CloudType>::mu() const +{ + return mu_; +} + + +template<class CloudType> +inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& +Foam::ThermoSurfaceFilm<CloudType>::rhoSp() +{ + return rhoSp_; +} + + +template<class CloudType> +inline Foam::DimensionedField<Foam::vector, Foam::volMesh>& +Foam::ThermoSurfaceFilm<CloudType>::USp() +{ + return USp_; +} + + +template<class CloudType> +inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& +Foam::ThermoSurfaceFilm<CloudType>::hSp() +{ + return hSp_; +} + + +template<class CloudType> +inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>& +Foam::ThermoSurfaceFilm<CloudType>::pSp() +{ + return pSp_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjection.C b/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjection.C new file mode 100644 index 00000000000..8f41c437583 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjection.C @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#include "cloudInjection.H" +#include "addToRunTimeSelectionTable.H" +#include "fvMesh.H" +#include "Time.H" +#include "mathematicalConstants.H" +#include "Random.H" +#include "volFields.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(cloudInjection, 0); + addToRunTimeSelectionTable(injectionModel, cloudInjection, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::cloudInjection::cloudInjection +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + injectionModel(type(), owner, dict), + cloudName_(coeffs_.lookup("cloudName")), + cloud_ + ( + const_cast<kinematicCloud&> + ( + owner.mesh().lookupObject<kinematicCloud>(cloudName_) + ) + ), + particlesPerParcel_(readScalar(coeffs_.lookup("particlesPerParcel"))), + rndGen_(label(0)), + parcelPDF_(pdfs::pdf::New(coeffs_.subDict("parcelPDF"), rndGen_)), + diameter_(owner.film().nCells(), 0.0) +{ + forAll(diameter_, faceI) + { + diameter_[faceI] = parcelPDF_->sample(); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::cloudInjection::~cloudInjection() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::cloudInjection::correct +( + scalarField& massToInject, + scalarField& diameterToInject +) +{ + const scalarField& rhoFilm = owner().rho(); + + // Collect the data to be transferred + forAll(massToInject, cellI) + { + scalar rho = rhoFilm[cellI]; + scalar diam = diameter_[cellI]; + scalar minMass = particlesPerParcel_*rho*mathematical::pi/6*pow3(diam); + + if (massToInject[cellI] > minMass) + { + // All mass can be injected - set particle diameter + diameterToInject[cellI] = diameter_[cellI]; + + // Retrieve new particle diameter sample + diameter_[cellI] = parcelPDF_->sample(); + } + else + { + // Mass below minimum threshold - cannot be injected + massToInject[cellI] = 0.0; + diameterToInject[cellI] = -1.0; + } + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjection.H b/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjection.H new file mode 100644 index 00000000000..ec9d544e16e --- /dev/null +++ b/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjection.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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::cloudInjection + +Description + Cloud injection model + +SourceFiles + cloudInjection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cloudInjection_H +#define cloudInjection_H + +#include "injectionModel.H" +#include "kinematicCloud.H" +#include "pdf.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class cloudInjection Declaration +\*---------------------------------------------------------------------------*/ + +class cloudInjection +: + public injectionModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + cloudInjection(const cloudInjection&); + + //- Disallow default bitwise assignment + void operator=(const cloudInjection&); + + +protected: + + // Protected data + + //- Name of the cloud owner for newly ejected parcels + word cloudName_; + + //- Reference to the cloud + kinematicCloud& cloud_; + + //- Number of particles per parcel + scalar particlesPerParcel_; + + //- Random number generator + Random rndGen_; + + //- Parcel size PDF model + const autoPtr<pdfs::pdf> parcelPDF_; + + //- Diameters of particles to inject into the cloud + scalarList diameter_; + + +public: + + //- Runtime type information + TypeName("cloudInjection"); + + + // Constructors + + //- Construct from surface film model + cloudInjection(const surfaceFilmModel& owner, const dictionary& dict); + + + //- Destructor + virtual ~cloudInjection(); + + + // Member Functions + + // Access + + //- Return the cloud name + inline const word& cloudName() const; + + //- Return a reference to the cloud + inline const kinematicCloud& cloud() const; + + + // Evolution + + //- Correct + virtual void correct + ( + scalarField& massToInject, + scalarField& diameterToInject + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "cloudInjectionI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjectionI.H b/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjectionI.H new file mode 100644 index 00000000000..4c85267e6a2 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/addOns/surfaceFilmModel/injection/cloudInjection/cloudInjectionI.H @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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/>. + +\*---------------------------------------------------------------------------*/ + +#include "cloudInjection.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::word& +Foam::surfaceFilmModels::cloudInjection::cloudName() const +{ + return cloudName_; +} + + +inline const Foam::kinematicCloud& +Foam::surfaceFilmModels::cloudInjection::cloud() const +{ + return cloud_; +} + + +// ************************************************************************* // -- GitLab