diff --git a/src/lagrangian/parcel/parcels/include/makeParcelCloudFunctionObjects.H b/src/lagrangian/parcel/parcels/include/makeParcelCloudFunctionObjects.H index 89cf873ed4..815e0bfaed 100644 --- a/src/lagrangian/parcel/parcels/include/makeParcelCloudFunctionObjects.H +++ b/src/lagrangian/parcel/parcels/include/makeParcelCloudFunctionObjects.H @@ -38,7 +38,7 @@ License #include "PatchPostProcessing.H" #include "RelativeVelocity.H" #include "SizeDistribution.H" -#include "VoidFraction.H" +#include "VolumeFraction.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,7 +56,7 @@ License makeCloudFunctionObjectType(PatchCollisionDensity, CloudType); \ makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ makeCloudFunctionObjectType(RelativeVelocity, CloudType); \ - makeCloudFunctionObjectType(VoidFraction, CloudType); \ + makeCloudFunctionObjectType(VolumeFraction, CloudType); \ makeCloudFunctionObjectType(SizeDistribution, CloudType); \ makeCloudFunctionObjectType(VolumeFlux, CloudType); diff --git a/src/lagrangian/parcel/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C b/src/lagrangian/parcel/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C deleted file mode 100644 index 97ea6ffff3..0000000000 --- a/src/lagrangian/parcel/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C +++ /dev/null @@ -1,139 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation - \\/ 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 . - -\*---------------------------------------------------------------------------*/ - -#include "VoidFraction.H" - -// * * * * * * * * * * * * * Protectd Member Functions * * * * * * * * * * * // - -template -void Foam::VoidFraction::write() -{ - if (thetaPtr_.valid()) - { - thetaPtr_->write(); - } - else - { - FatalErrorInFunction - << "thetaPtr not valid" << abort(FatalError); - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::VoidFraction::VoidFraction -( - const dictionary& dict, - CloudType& owner, - const word& modelName -) -: - CloudFunctionObject(dict, owner, modelName, typeName), - thetaPtr_(nullptr) -{} - - -template -Foam::VoidFraction::VoidFraction -( - const VoidFraction& vf -) -: - CloudFunctionObject(vf), - thetaPtr_(nullptr) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::VoidFraction::~VoidFraction() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::VoidFraction::preEvolve() -{ - if (thetaPtr_.valid()) - { - thetaPtr_->primitiveFieldRef() = 0.0; - } - else - { - const fvMesh& mesh = this->owner().mesh(); - - thetaPtr_.reset - ( - new volScalarField - ( - IOobject - ( - this->owner().name() + "Theta", - mesh.time().name(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar(dimless, 0) - ) - ); - } -} - - -template -void Foam::VoidFraction::postEvolve() -{ - volScalarField& theta = thetaPtr_(); - - const fvMesh& mesh = this->owner().mesh(); - - theta.primitiveFieldRef() /= mesh.time().deltaTValue()*mesh.V(); - - CloudFunctionObject::postEvolve(); -} - - -template -void Foam::VoidFraction::postMove -( - parcelType& p, - const scalar dt, - const point&, - bool& -) -{ - volScalarField& theta = thetaPtr_(); - - theta[p.cell()] += dt*p.nParticle()*p.volume(); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/parcel/submodels/CloudFunctionObjects/VolumeFraction/VolumeFraction.C b/src/lagrangian/parcel/submodels/CloudFunctionObjects/VolumeFraction/VolumeFraction.C new file mode 100644 index 0000000000..f5b7435606 --- /dev/null +++ b/src/lagrangian/parcel/submodels/CloudFunctionObjects/VolumeFraction/VolumeFraction.C @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +#include "VolumeFraction.H" + +// * * * * * * * * * * * * * Protectd Member Functions * * * * * * * * * * * // + +template +void Foam::VolumeFraction::write() +{ + this->owner().alpha()->write(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::VolumeFraction::VolumeFraction +( + const dictionary& dict, + CloudType& owner, + const word& modelName +) +: + CloudFunctionObject(dict, owner, modelName, typeName) +{} + + +template +Foam::VolumeFraction::VolumeFraction +( + const VolumeFraction& vf +) +: + CloudFunctionObject(vf) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::VolumeFraction::~VolumeFraction() +{} + + +// ************************************************************************* // diff --git a/src/lagrangian/parcel/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H b/src/lagrangian/parcel/submodels/CloudFunctionObjects/VolumeFraction/VolumeFraction.H similarity index 68% rename from src/lagrangian/parcel/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H rename to src/lagrangian/parcel/submodels/CloudFunctionObjects/VolumeFraction/VolumeFraction.H index 1f383dd53a..a9f6dd9a18 100644 --- a/src/lagrangian/parcel/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H +++ b/src/lagrangian/parcel/submodels/CloudFunctionObjects/VolumeFraction/VolumeFraction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,21 +22,20 @@ License along with OpenFOAM. If not, see . Class - Foam::VoidFraction + Foam::VolumeFraction Description - Creates particle void fraction field on carrier phase + Creates particle volume fraction field on carrier phase SourceFiles - VoidFraction.C + VolumeFraction.C \*---------------------------------------------------------------------------*/ -#ifndef VoidFraction_H -#define VoidFraction_H +#ifndef VolumeFraction_H +#define VolumeFraction_H #include "CloudFunctionObject.H" -#include "volFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,26 +43,14 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class VoidFraction Declaration + Class VolumeFraction Declaration \*---------------------------------------------------------------------------*/ template -class VoidFraction +class VolumeFraction : public CloudFunctionObject { - // Private Data - - // Typedefs - - //- Convenience typedef for parcel type - typedef typename CloudType::parcelType parcelType; - - - //- Void fraction field - autoPtr thetaPtr_; - - protected: // Protected Member Functions @@ -75,13 +62,13 @@ protected: public: //- Runtime type information - TypeName("voidFraction"); + TypeName("volumeFraction"); // Constructors //- Construct from dictionary - VoidFraction + VolumeFraction ( const dictionary& dict, CloudType& owner, @@ -89,40 +76,20 @@ public: ); //- Construct copy - VoidFraction(const VoidFraction& vf); + VolumeFraction(const VolumeFraction& vf); //- Construct and return a clone virtual autoPtr> clone() const { return autoPtr> ( - new VoidFraction(*this) + new VolumeFraction(*this) ); } //- Destructor - virtual ~VoidFraction(); - - - // Member Functions - - // Evaluation - - //- Pre-evolve hook - virtual void preEvolve(); - - //- Post-evolve hook - virtual void postEvolve(); - - //- Post-move hook - virtual void postMove - ( - parcelType& p, - const scalar dt, - const point& position0, - bool& keepParticle - ); + virtual ~VolumeFraction(); }; @@ -133,7 +100,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "VoidFraction.C" + #include "VolumeFraction.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //