From ce307be5403a7697b819dcae4a6c4697abfe5fb0 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 14 Aug 2020 13:06:01 +0100 Subject: [PATCH 1/3] lagrangian/basic/particle: Remove inclusion of Cloud header This isolates the particle implementation a little more, allowing it to be constructed as a throwaway tracking object. --- .../field/nearWallFields/findCellParticle.H | 3 +- .../field/streamLine/streamLineParticle.H | 3 +- src/lagrangian/basic/IOPosition/IOPosition.C | 3 +- src/lagrangian/basic/IOPosition/IOPosition.H | 19 +++++--- .../basic/IOPosition/IOPositionName.C | 36 +++++++++++++++ src/lagrangian/basic/Make/files | 1 + src/lagrangian/basic/particle/particle.C | 1 + src/lagrangian/basic/particle/particle.H | 1 - .../basic/particle/particleTemplates.C | 1 + .../molecule/molecule/molecule.H | 1 + .../clouds/Templates/SprayCloud/SprayCloud.H | 3 +- .../ReactingMultiphaseParcelIO.C | 44 +++---------------- .../ReactingParcel/ReactingParcelIO.C | 15 +++---- .../Templates/SprayParcel/SprayParcelIO.C | 4 +- .../Templates/ThermoParcel/ThermoParcelIO.C | 4 +- src/lagrangian/solidParticle/solidParticle.H | 1 + .../trackedParticle/trackedParticle.H | 3 +- 17 files changed, 81 insertions(+), 62 deletions(-) create mode 100644 src/lagrangian/basic/IOPosition/IOPositionName.C diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index ba53724399..c7447767c0 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ SourceFiles #define findCellParticle_H #include "particle.H" +#include "Cloud.H" #include "autoPtr.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/functionObjects/field/streamLine/streamLineParticle.H b/src/functionObjects/field/streamLine/streamLineParticle.H index b0d5784dc6..0fc1b325e8 100644 --- a/src/functionObjects/field/streamLine/streamLineParticle.H +++ b/src/functionObjects/field/streamLine/streamLineParticle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,7 @@ SourceFiles #define streamLineParticle_H #include "particle.H" +#include "Cloud.H" #include "autoPtr.H" #include "interpolation.H" #include "vectorList.H" diff --git a/src/lagrangian/basic/IOPosition/IOPosition.C b/src/lagrangian/basic/IOPosition/IOPosition.C index 88083ebb3f..183a6428d5 100644 --- a/src/lagrangian/basic/IOPosition/IOPosition.C +++ b/src/lagrangian/basic/IOPosition/IOPosition.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "IOPosition.H" +#include "polyMesh.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/lagrangian/basic/IOPosition/IOPosition.H b/src/lagrangian/basic/IOPosition/IOPosition.H index 1a315a62ab..9e52c45132 100644 --- a/src/lagrangian/basic/IOPosition/IOPosition.H +++ b/src/lagrangian/basic/IOPosition/IOPosition.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,6 +42,13 @@ SourceFiles namespace Foam { +/*---------------------------------------------------------------------------*\ + Class IOPositionName Declaration +\*---------------------------------------------------------------------------*/ + +TemplateName(IOPosition); + + /*---------------------------------------------------------------------------*\ Class IOPosition Declaration \*---------------------------------------------------------------------------*/ @@ -49,7 +56,8 @@ namespace Foam template class IOPosition : - public regIOobject + public regIOobject, + public IOPositionName { // Private Data @@ -60,12 +68,13 @@ class IOPosition public: - // Static data + //- Type information + + using IOPositionName::typeName; - //- Runtime type name information. Use cloud type. virtual const word& type() const { - return Cloud::typeName; + return IOPositionName::typeName; } diff --git a/src/lagrangian/basic/IOPosition/IOPositionName.C b/src/lagrangian/basic/IOPosition/IOPositionName.C new file mode 100644 index 0000000000..c0537513ce --- /dev/null +++ b/src/lagrangian/basic/IOPosition/IOPositionName.C @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "IOPosition.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(IOPositionName, 0); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/basic/Make/files b/src/lagrangian/basic/Make/files index 044d340f7a..ab257894f8 100644 --- a/src/lagrangian/basic/Make/files +++ b/src/lagrangian/basic/Make/files @@ -1,5 +1,6 @@ particle/particle.C particle/particleIO.C +IOPosition/IOPositionName.C passiveParticle/passiveParticleCloud.C indexedParticle/indexedParticleCloud.C diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C index 2f0fe6f70c..4f70a74294 100644 --- a/src/lagrangian/basic/particle/particle.C +++ b/src/lagrangian/basic/particle/particle.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "particle.H" +#include "mapPolyMesh.H" #include "transform.H" #include "treeDataCell.H" #include "cubicEqn.H" diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H index e6b9538d80..36b966fd77 100644 --- a/src/lagrangian/basic/particle/particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -35,7 +35,6 @@ Description #include "vector.H" #include "barycentric.H" #include "barycentricTensor.H" -#include "Cloud.H" #include "IDLList.H" #include "pointField.H" #include "faceList.H" diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index 36a9404abe..a284a07b63 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -23,6 +23,7 @@ License \*---------------------------------------------------------------------------*/ +#include "particle.H" #include "IOPosition.H" #include "cyclicPolyPatch.H" diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H index 6b9be7481c..789ef8b13e 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H @@ -38,6 +38,7 @@ SourceFiles #define molecule_H #include "particle.H" +#include "Cloud.H" #include "IOstream.H" #include "autoPtr.H" #include "diagTensor.H" diff --git a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H index 11537da8bf..2aa74caba0 100644 --- a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H @@ -69,7 +69,8 @@ TemplateName(SprayCloud); template class SprayCloud : - public CloudType + public CloudType, + public SprayCloudName { public: diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C index 517a43c3b5..dea15801c6 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C @@ -117,7 +117,7 @@ void Foam::ReactingMultiphaseParcel::readFields const wordList& stateLabels = compModel.stateLabels(); // Set storage for each Y... for each parcel - forAllIter(typename Cloud>, c, iter) + forAllIter(typename CloudType, c, iter) { ReactingMultiphaseParcel& p = iter(); p.YGas_.setSize(gasNames.size(), 0.0); @@ -139,12 +139,7 @@ void Foam::ReactingMultiphaseParcel::readFields ); label i = 0; - forAllIter - ( - typename Cloud>, - c, - iter - ) + forAllIter(typename CloudType, c, iter) { ReactingMultiphaseParcel& p = iter(); p.YGas_[j] = YGas[i++]/(p.Y()[GAS] + rootVSmall); @@ -164,12 +159,7 @@ void Foam::ReactingMultiphaseParcel::readFields ); label i = 0; - forAllIter - ( - typename Cloud>, - c, - iter - ) + forAllIter(typename CloudType, c, iter) { ReactingMultiphaseParcel& p = iter(); p.YLiquid_[j] = YLiquid[i++]/(p.Y()[LIQ] + rootVSmall); @@ -189,12 +179,7 @@ void Foam::ReactingMultiphaseParcel::readFields ); label i = 0; - forAllIter - ( - typename Cloud>, - c, - iter - ) + forAllIter(typename CloudType, c, iter) { ReactingMultiphaseParcel& p = iter(); p.YSolid_[j] = YSolid[i++]/(p.Y()[SLD] + rootVSmall); @@ -242,12 +227,7 @@ void Foam::ReactingMultiphaseParcel::writeFields ); label i = 0; - forAllConstIter - ( - typename Cloud>, - c, - iter - ) + forAllConstIter(typename CloudType, c, iter) { const ReactingMultiphaseParcel& p0 = iter(); YGas[i++] = p0.YGas()[j]*p0.Y()[GAS]; @@ -271,12 +251,7 @@ void Foam::ReactingMultiphaseParcel::writeFields ); label i = 0; - forAllConstIter - ( - typename Cloud>, - c, - iter - ) + forAllConstIter(typename CloudType, c, iter) { const ReactingMultiphaseParcel& p0 = iter(); YLiquid[i++] = p0.YLiquid()[j]*p0.Y()[LIQ]; @@ -300,12 +275,7 @@ void Foam::ReactingMultiphaseParcel::writeFields ); label i = 0; - forAllConstIter - ( - typename Cloud>, - c, - iter - ) + forAllConstIter(typename CloudType, c, iter) { const ReactingMultiphaseParcel& p0 = iter(); YSolid[i++] = p0.YSolid()[j]*p0.Y()[SLD]; diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelIO.C b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelIO.C index 88ebdca0da..a8f808df0b 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelIO.C +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelIO.C @@ -111,7 +111,7 @@ void Foam::ReactingParcel::readFields c.checkFieldIOobject(c, mass0); label i = 0; - forAllIter(typename Cloud>, c, iter) + forAllIter(typename CloudType, c, iter) { ReactingParcel& p = iter(); p.mass0_ = mass0[i++]; @@ -128,7 +128,7 @@ void Foam::ReactingParcel::readFields // Set storage for each Y... for each parcel - forAllIter(typename Cloud>, c, iter) + forAllIter(typename CloudType, c, iter) { ReactingParcel& p = iter(); p.Y_.setSize(nPhases, 0.0); @@ -148,7 +148,7 @@ void Foam::ReactingParcel::readFields ); label i = 0; - forAllIter(typename Cloud>, c, iter) + forAllIter(typename CloudType, c, iter) { ReactingParcel& p = iter(); p.Y_[j] = Y[i++]; @@ -181,7 +181,7 @@ void Foam::ReactingParcel::writeFields IOField mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np); label i = 0; - forAllConstIter(typename Cloud>, c, iter) + forAllConstIter(typename CloudType, c, iter) { const ReactingParcel& p = iter(); mass0[i++] = p.mass0_; @@ -208,12 +208,7 @@ void Foam::ReactingParcel::writeFields np ); label i = 0; - forAllConstIter - ( - typename Cloud>, - c, - iter - ) + forAllConstIter(typename CloudType, c, iter) { const ReactingParcel& p = iter(); Y[i++] = p.Y()[j]; diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelIO.C b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelIO.C index b8953f20e4..b00de5bba5 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelIO.C +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelIO.C @@ -197,7 +197,7 @@ void Foam::SprayParcel::readFields c.checkFieldIOobject(c, user); label i = 0; - forAllIter(typename Cloud>, c, iter) + forAllIter(typename CloudType, c, iter) { SprayParcel& p = iter(); p.d0_ = d0[i]; @@ -265,7 +265,7 @@ void Foam::SprayParcel::writeFields IOField user(c.fieldIOobject("user", IOobject::NO_READ), np); label i = 0; - forAllConstIter(typename Cloud>, c, iter) + forAllConstIter(typename CloudType, c, iter) { const SprayParcel& p = iter(); d0[i] = p.d0_; diff --git a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelIO.C b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelIO.C index cc8e4413a4..5b172c655a 100644 --- a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelIO.C +++ b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelIO.C @@ -91,7 +91,7 @@ void Foam::ThermoParcel::readFields(CloudType& c) label i = 0; - forAllIter(typename Cloud>, c, iter) + forAllIter(typename CloudType, c, iter) { ThermoParcel& p = iter(); @@ -114,7 +114,7 @@ void Foam::ThermoParcel::writeFields(const CloudType& c) IOField Cp(c.fieldIOobject("Cp", IOobject::NO_READ), np); label i = 0; - forAllConstIter(typename Cloud>, c, iter) + forAllConstIter(typename CloudType, c, iter) { const ThermoParcel& p = iter(); diff --git a/src/lagrangian/solidParticle/solidParticle.H b/src/lagrangian/solidParticle/solidParticle.H index bc1d683973..923c3b118c 100644 --- a/src/lagrangian/solidParticle/solidParticle.H +++ b/src/lagrangian/solidParticle/solidParticle.H @@ -39,6 +39,7 @@ SourceFiles #define solidParticle_H #include "particle.H" +#include "Cloud.H" #include "IOstream.H" #include "autoPtr.H" #include "interpolationCellPoint.H" diff --git a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H index 0ef436a792..b973362d07 100644 --- a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H +++ b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,7 @@ SourceFiles #define trackedParticle_H #include "particle.H" +#include "Cloud.H" #include "autoPtr.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 8c32b1bba1ab681f135893e878282fbc951a4fb4 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 14 Aug 2020 19:09:42 +0100 Subject: [PATCH 2/3] lagrangian: Removal of unused construction by component --- .../CollidingParcel/CollidingParcel.H | 19 ------ .../CollidingParcel/CollidingParcelI.H | 40 ------------ .../Templates/MPPICParcel/MPPICParcel.H | 17 ----- .../Templates/MPPICParcel/MPPICParcelI.H | 35 ----------- .../Templates/MomentumParcel/MomentumParcel.H | 16 ----- .../MomentumParcel/MomentumParcelI.H | 30 --------- .../ReactingMultiphaseParcel.H | 23 ------- .../ReactingMultiphaseParcelI.H | 48 -------------- .../Templates/ReactingParcel/ReactingParcel.H | 20 ------ .../ReactingParcel/ReactingParcelI.H | 45 ------------- .../Templates/SprayParcel/SprayParcel.H | 29 --------- .../Templates/SprayParcel/SprayParcelI.H | 63 ------------------- .../Templates/ThermoParcel/ThermoParcel.H | 19 ------ .../Templates/ThermoParcel/ThermoParcelI.H | 41 ------------ 14 files changed, 445 deletions(-) diff --git a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.H b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.H index 89095451ef..3f41cb55d5 100644 --- a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.H @@ -231,25 +231,6 @@ public: const label celli ); - //- Construct from components - inline CollidingParcel - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const typename ParcelType::constantProperties& constProps - ); - //- Construct from Istream CollidingParcel ( diff --git a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcelI.H b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcelI.H index 05ba260f72..96854e9b33 100644 --- a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcelI.H @@ -93,46 +93,6 @@ inline Foam::CollidingParcel::CollidingParcel {} -template -inline Foam::CollidingParcel::CollidingParcel -( - const polyMesh& owner, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const typename ParcelType::constantProperties& constProps -) -: - ParcelType - ( - owner, - coordinates, - celli, - tetFacei, - tetPti, - typeId, - nParticle0, - d0, - dTarget0, - U0, - constProps - ), - f_(f0), - angularMomentum_(angularMomentum0), - torque_(torque0), - collisionRecords_() -{} - - // * * * * * * * * * constantProperties Member Functions * * * * * * * * * * // template diff --git a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.H b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.H index 91a17b7ff5..edeb820194 100644 --- a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.H @@ -203,23 +203,6 @@ public: const label celli ); - //- Construct from components - inline MPPICParcel - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& UCorrect0, - const typename ParcelType::constantProperties& constProps - ); - //- Construct from Istream MPPICParcel ( diff --git a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcelI.H b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcelI.H index 2b12233c88..a2af743f8a 100644 --- a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcelI.H @@ -53,41 +53,6 @@ inline Foam::MPPICParcel::MPPICParcel {} -template -inline Foam::MPPICParcel::MPPICParcel -( - const polyMesh& owner, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& UCorrect0, - const typename ParcelType::constantProperties& constProps -) -: - ParcelType - ( - owner, - coordinates, - celli, - tetFacei, - tetPti, - typeId, - nParticle0, - d0, - dTarget0, - U0, - constProps - ), - UCorrect_(UCorrect0) -{} - - // * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // template diff --git a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.H b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.H index 810ddc5452..8924011582 100644 --- a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.H @@ -335,22 +335,6 @@ public: const label celli ); - //- Construct from components - inline MomentumParcel - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const constantProperties& constProps - ); - //- Construct from Istream MomentumParcel ( diff --git a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelI.H b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelI.H index 9c7b28cc9f..28bd961757 100644 --- a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelI.H @@ -115,36 +115,6 @@ inline Foam::MomentumParcel::MomentumParcel {} -template -inline Foam::MomentumParcel::MomentumParcel -( - const polyMesh& owner, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const constantProperties& constProps -) -: - ParcelType(owner, coordinates, celli, tetFacei, tetPti), - active_(true), - typeId_(typeId), - nParticle_(nParticle0), - d_(d0), - dTarget_(dTarget0), - U_(U0), - rho_(constProps.rho0()), - age_(0.0), - tTurb_(0.0), - UTurb_(Zero) -{} - - // * * * * * * * * * constantProperties Member Functions * * * * * * * * * * // template diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index 9262ab84d5..94f0b6102e 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -303,29 +303,6 @@ public: const label celli ); - //- Construct from components - inline ReactingMultiphaseParcel - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const scalarField& Y0, - const scalarField& YGas0, - const scalarField& YLiquid0, - const scalarField& YSolid0, - const constantProperties& constProps - ); - //- Construct from Istream ReactingMultiphaseParcel ( diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H index 1a3faf8c0f..7edc0c4c2e 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H @@ -98,54 +98,6 @@ inline Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel {} -template -inline Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel -( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const scalarField& Y0, - const scalarField& YGas0, - const scalarField& YLiquid0, - const scalarField& YSolid0, - const constantProperties& constProps -) -: - ParcelType - ( - mesh, - coordinates, - celli, - tetFacei, - tetPti, - typeId, - nParticle0, - d0, - dTarget0, - U0, - f0, - angularMomentum0, - torque0, - Y0, - constProps - ), - YGas_(YGas0), - YLiquid_(YLiquid0), - YSolid_(YSolid0), - canCombust_(0) -{} - - // * * * * * * * * * constantProperties Member Functions * * * * * * * * * * // template diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H index 0f01739092..40cf3118fc 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -248,26 +248,6 @@ public: const label celli ); - //- Construct from components - inline ReactingParcel - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const scalarField& Y0, - const constantProperties& constProps - ); - //- Construct from Istream ReactingParcel ( diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H index 143ca04547..34cd370276 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H @@ -89,51 +89,6 @@ inline Foam::ReactingParcel::ReactingParcel {} -template -inline Foam::ReactingParcel::ReactingParcel -( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const scalarField& Y0, - const constantProperties& constProps -) -: - ParcelType - ( - mesh, - coordinates, - celli, - tetFacei, - tetPti, - typeId, - nParticle0, - d0, - dTarget0, - U0, - f0, - angularMomentum0, - torque0, - constProps - ), - mass0_(0.0), - Y_(Y0) -{ - // Set initial parcel mass - mass0_ = this->mass(); -} - - // * * * * * * * * * constantProperties Member Functions * * * * * * * * * * // template diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H index e9186529e9..32ff64d58c 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H @@ -211,35 +211,6 @@ public: const label celli ); - //- Construct from components - inline SprayParcel - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const scalarField& Y0, - const scalar liquidCore, - const scalar KHindex, - const scalar y, - const scalar yDot, - const scalar tc, - const scalar ms, - const scalar injector, - const scalar tMom, - const scalar user, - const typename ParcelType::constantProperties& constProps - ); - //- Construct from Istream SprayParcel ( diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H index 758ba6fa65..b554b176d3 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H @@ -155,69 +155,6 @@ inline Foam::SprayParcel::SprayParcel {} -template -inline Foam::SprayParcel::SprayParcel -( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const scalarField& Y0, - const scalar liquidCore, - const scalar KHindex, - const scalar y, - const scalar yDot, - const scalar tc, - const scalar ms, - const scalar injector, - const scalar tMom, - const scalar user, - const typename ParcelType::constantProperties& constProps -) -: - ParcelType - ( - mesh, - coordinates, - celli, - tetFacei, - tetPti, - typeId, - nParticle0, - d0, - dTarget0, - U0, - f0, - angularMomentum0, - torque0, - Y0, - constProps - ), - d0_(d0), - position0_(this->position()), - sigma_(constProps.sigma0()), - mu_(constProps.mu0()), - liquidCore_(liquidCore), - KHindex_(KHindex), - y_(y), - yDot_(yDot), - tc_(tc), - ms_(ms), - injector_(injector), - tMom_(tMom), - user_(user) -{} - - // * * * * * * * * * constantProperties Member Functions * * * * * * * * * * // template diff --git a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcel.H index 67de440721..6774a6f0bb 100644 --- a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -310,25 +310,6 @@ public: const label celli ); - //- Construct from components - inline ThermoParcel - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const constantProperties& constProps - ); - //- Construct from Istream ThermoParcel ( diff --git a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelI.H b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelI.H index 0c9946ee35..d83e3d5d2b 100644 --- a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelI.H @@ -100,47 +100,6 @@ inline Foam::ThermoParcel::ThermoParcel {} -template -inline Foam::ThermoParcel::ThermoParcel -( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label typeId, - const scalar nParticle0, - const scalar d0, - const scalar dTarget0, - const vector& U0, - const vector& f0, - const vector& angularMomentum0, - const vector& torque0, - const constantProperties& constProps -) -: - ParcelType - ( - mesh, - coordinates, - celli, - tetFacei, - tetPti, - typeId, - nParticle0, - d0, - dTarget0, - U0, - f0, - angularMomentum0, - torque0, - constProps - ), - T_(constProps.T0()), - Cp_(constProps.Cp0()) -{} - - // * * * * * * * * * constantProperties Member Functions * * * * * * * * * * // template From 2df733ef991d3fbf604ac81a7789ae71f58e8837 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 18 Aug 2020 10:34:25 +0100 Subject: [PATCH 3/3] lagrangian: Corrected reading of constant/clouds in parallel --- src/OpenFOAM/Make/files | 1 + .../IOobjects/GlobalIOField/GlobalIOFields.C | 40 +++------- .../IOobjects/GlobalIOField/GlobalIOFields.H | 74 +++++++++++++++++++ .../{globalIOLists.C => GlobalIOLists.C} | 5 +- .../{globalIOLists.H => GlobalIOLists.H} | 17 +++-- .../parcel/parcelCloudList/parcelCloudList.C | 5 +- 6 files changed, 102 insertions(+), 40 deletions(-) create mode 100644 src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOFields.H rename src/OpenFOAM/db/IOobjects/GlobalIOList/{globalIOLists.C => GlobalIOLists.C} (91%) rename src/OpenFOAM/db/IOobjects/GlobalIOList/{globalIOLists.H => GlobalIOLists.H} (88%) diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index e52877be3e..062219b4ac 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -242,6 +242,7 @@ $(IOdictionary)/unwatchedIOdictionary.C db/IOobjects/IOMap/IOMapName.C db/IOobjects/decomposedBlockData/decomposedBlockData.C +db/IOobjects/GlobalIOList/GlobalIOLists.C db/IOobjects/GlobalIOField/GlobalIOFields.C diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOFields.C b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOFields.C index fda3f81587..731df82c3e 100644 --- a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOFields.C +++ b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,42 +23,22 @@ License \*---------------------------------------------------------------------------*/ -#include "GlobalIOField.H" +#include "GlobalIOFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - defineTemplateTypeNameAndDebugWithName + defineTemplateTypeNameWithName(labelGlobalIOField, "labelField"); + defineTemplateTypeNameWithName(scalarGlobalIOField, "scalarField"); + defineTemplateTypeNameWithName(vectorGlobalIOField, "vectorField"); + defineTemplateTypeNameWithName ( - GlobalIOField, - "scalarField", - 0 - ); - defineTemplateTypeNameAndDebugWithName - ( - GlobalIOField, - "vectorField", - 0 - ); - defineTemplateTypeNameAndDebugWithName - ( - GlobalIOField, - "sphericalTensorField", - 0 - ); - defineTemplateTypeNameAndDebugWithName - ( - GlobalIOField, - "symmTensorField", - 0 - ); - defineTemplateTypeNameAndDebugWithName - ( - GlobalIOField, - "tensorField", - 0 + sphericalTensorGlobalIOField, + "sphericalTensorField" ); + defineTemplateTypeNameWithName(symmTensorGlobalIOField, "symmTensorField"); + defineTemplateTypeNameWithName(tensorGlobalIOField, "tensorField"); } diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOFields.H b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOFields.H new file mode 100644 index 0000000000..7ebb5ab13a --- /dev/null +++ b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOFields.H @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "primitiveFields.H" +#include "GlobalIOField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef GlobalIOField