diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H index d5cc69f8ba..4615278aa0 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H @@ -37,6 +37,7 @@ License #include "ParticleTrap.H" #include "PatchCollisionDensity.H" #include "PatchPostProcessing.H" +#include "RemoveParcels.H" #include "VoidFraction.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,6 +53,7 @@ License makeCloudFunctionObjectType(ParticleTrap, CloudType); \ makeCloudFunctionObjectType(PatchCollisionDensity, CloudType); \ makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ + makeCloudFunctionObjectType(RemoveParcels, CloudType); \ makeCloudFunctionObjectType(VoidFraction, CloudType); diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeReactingParcelCloudFunctionObjects.H index ca86c65d63..a11f3de2e2 100644 --- a/src/lagrangian/intermediate/parcels/include/makeReactingParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeReactingParcelCloudFunctionObjects.H @@ -38,6 +38,7 @@ License #include "ParticleTrap.H" #include "PatchCollisionDensity.H" #include "PatchPostProcessing.H" +#include "RemoveParcels.H" #include "VoidFraction.H" #include "WeberNumberReacting.H" @@ -54,6 +55,7 @@ License makeCloudFunctionObjectType(ParticleTrap, CloudType); \ makeCloudFunctionObjectType(PatchCollisionDensity, CloudType); \ makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ + makeCloudFunctionObjectType(RemoveParcels, CloudType); \ makeCloudFunctionObjectType(VoidFraction, CloudType); \ makeCloudFunctionObjectType(WeberNumberReacting, CloudType); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/RemoveParcels/RemoveParcels.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/RemoveParcels/RemoveParcels.C new file mode 100644 index 0000000000..62a7d40910 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/RemoveParcels/RemoveParcels.C @@ -0,0 +1,287 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "RemoveParcels.H" +#include "fvMesh.H" +#include "faceZone.H" +#include "OFstream.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::RemoveParcels::makeLogFile +( + const word& zoneName, + const label zoneI, + const label nFaces, + const scalar totArea +) +{ + // Create the output file if not already created + if (log_) + { + DebugInfo<< "Creating output file." << endl; + + if (Pstream::master()) + { + // Create directory if does not exist + mkDir(this->writeTimeDir()); + + // Open new file at start up + outputFilePtr_.set + ( + zoneI, + new OFstream + ( + this->writeTimeDir()/(type() + '_' + zoneName + ".dat") + ) + ); + + outputFilePtr_[zoneI] + << "# Source : " << type() << nl + << "# Face zone : " << zoneName << nl + << "# Faces : " << nFaces << nl + << "# Area : " << totArea << nl + << "# Time" << tab << "nParcels" << tab << "mass" << endl; + } + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template +void Foam::RemoveParcels::postEvolve +( + const typename parcelType::trackingData& td +) +{ + Info<< this->modelName() << " output:" << nl; + + const fvMesh& mesh = this->owner().mesh(); + const faceZoneMesh& fzm = mesh.faceZones(); + + forAll(faceZoneIDs_, i) + { + const word& zoneName = fzm[faceZoneIDs_[i]].name(); + + scalar zoneMass = returnReduce(mass_[i], sumOp()); + label zoneNParcels = returnReduce(nParcels_[i], sumOp