diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C index 53213bca8b..33d1c05548 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C @@ -292,8 +292,7 @@ updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); // Get the coupling information from the mappedPatchBase const label patchi = patch().index(); @@ -471,10 +470,9 @@ updateCoeffs() << regionTypeNames_ << nl << exit(FatalError); } - mixedFvPatchScalarField::updateCoeffs(); + UPstream::msgType(oldTag); // Restore tag - // Restore tag - UPstream::msgType() = oldTag; + mixedFvPatchScalarField::updateCoeffs(); } diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H index 7d35630177..db489d05d0 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H @@ -918,6 +918,24 @@ public: return msgType_; } + //- Set the message tag for standard messages + // \return the previous value + static int msgType(int val) noexcept + { + int old(msgType_); + msgType_ = val; + return old; + } + + //- Increment the message tag for standard messages + // \return the previous value + static int incrMsgType(int val = 1) noexcept + { + int old(msgType_); + msgType_ += val; + return old; + } + //- Get the communications type of the stream commsTypes commsType() const noexcept { diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C index f3989dc66a..96f76a8a13 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C @@ -210,12 +210,12 @@ int Foam::processorCyclicPolyPatch::tag() const tag_ = string::hasher()(cycPatch.neighbPatch().name()) % 32768u; } - if (tag_ == Pstream::msgType() || tag_ == -1) + if (tag_ == UPstream::msgType() || tag_ == -1) { FatalErrorInFunction << "Tag calculated from cyclic patch name " << tag_ << " is the same as the current message type " - << Pstream::msgType() << " or -1" << nl + << UPstream::msgType() << " or -1" << nl << "Please set a non-conflicting, unique, tag by hand" << " using the 'tag' entry" << exit(FatalError); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C index 144c54aff9..45601fe236 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C @@ -151,8 +151,7 @@ Foam::PatchFunction1Types::Sampled::value // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); const fvMesh& thisMesh = refCast ( @@ -167,9 +166,8 @@ Foam::PatchFunction1Types::Sampled::value if (!haveSampleField()) { - // Restore tag - UPstream::msgType() = oldTag; - newValues.setSize(this->mappedPatchBase::patch_.size()); + UPstream::msgType(oldTag); // Restore tag + newValues.resize_nocopy(this->mappedPatchBase::patch_.size()); newValues = Zero; return this->transform(tnewValues); } @@ -304,8 +302,7 @@ Foam::PatchFunction1Types::Sampled::value } } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return this->transform(tnewValues); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C index cf24ab6fe7..117913ff8e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C @@ -619,8 +619,7 @@ Foam::mappedPatchFieldBase::mappedField // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); const fvMesh& thisMesh = patchField_.patch().boundaryMesh().mesh(); @@ -802,8 +801,7 @@ Foam::mappedPatchFieldBase::mappedField } } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return tnewValues; } @@ -842,13 +840,11 @@ Foam::mappedPatchFieldBase::mappedInternalField() const // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); distribute(fieldName_, nbrIntFld); - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return tnbrIntFld; } @@ -880,13 +876,11 @@ Foam::mappedPatchFieldBase::mappedWeightField() const // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - const int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); distribute(fieldName_ + "_deltaCoeffs", nbrKDelta); - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return tnbrKDelta; } @@ -940,13 +934,11 @@ void Foam::mappedPatchFieldBase::mappedWeightField // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); distribute(fieldName_ + "_weights", nbrWeights.ref()); - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C index 89d6ec1ee4..6af0b3a527 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C @@ -106,8 +106,7 @@ void Foam::mappedFixedInternalValueFvPatchField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); // Retrieve the neighbour values and assign to this patch boundary field mappedFixedValueFvPatchField::updateCoeffs(); @@ -177,8 +176,7 @@ void Foam::mappedFixedInternalValueFvPatchField::updateCoeffs() } } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag // Assign to (this) patch internal field its neighbour values Field& intFld = const_cast&>(this->primitiveField()); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFlowRate/mappedFlowRateFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFlowRate/mappedFlowRateFvPatchVectorField.C index da5c416101..90e7ee7fff 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFlowRate/mappedFlowRateFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFlowRate/mappedFlowRateFvPatchVectorField.C @@ -113,8 +113,7 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); // Get the coupling information from the mappedPatchBase const mappedPatchBase& mpp = refCast @@ -177,8 +176,7 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs() << nl << exit(FatalError); } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag fixedValueFvPatchField::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C index 973d696f24..7ef7cde1c9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C @@ -147,8 +147,7 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); // Get the mappedPatchBase const mappedPatchBase& mpp = refCast @@ -224,8 +223,7 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs() phiField ).boundaryFieldRef()[patch().index()] == newPhiValues; - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag fixedValueFvPatchVectorField::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C index 3f82557b9e..f44176b09e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C @@ -487,8 +487,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::calcOverlappingProcEddies List>& overlappingEddies ) const { - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); List patchBBs(Pstream::nProcs()); patchBBs[Pstream::myProcNo()] = patchBounds_; @@ -546,8 +545,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::calcOverlappingProcEddies } } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag } diff --git a/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/distributedDILUPreconditioner.C b/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/distributedDILUPreconditioner.C index 0d078b0ad9..0128fa3c6a 100644 --- a/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/distributedDILUPreconditioner.C +++ b/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/distributedDILUPreconditioner.C @@ -68,7 +68,7 @@ void Foam::distributedDILUPreconditioner::updateMatrixInterfaces // From lduMatrix::initMatrixInterfaces // Avoid any conflicts with inter-processor comms - UPstream::msgType() += 321; + const int oldTag = UPstream::incrMsgType(321); for (const label interfacei : selectedInterfaces) { @@ -103,7 +103,7 @@ void Foam::distributedDILUPreconditioner::updateMatrixInterfaces ); } - UPstream::msgType() -= 321; + UPstream::msgType(oldTag); // Restore tag } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C index fb60eb8235..9a3f89f7e2 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C @@ -148,9 +148,7 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; - + const int oldTag = UPstream::incrMsgType(); scalarField& Tp = *this; @@ -175,8 +173,7 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs() // Evaluate temperature Tp = alphaFilm*TFilm + (1.0 - alphaFilm)*TPyr; - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag fixedValueFvPatchScalarField::updateCoeffs(); } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C index 8847b50a72..47642607c3 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C @@ -149,9 +149,7 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; - + const int oldTag = UPstream::incrMsgType(); vectorField& Up = *this; @@ -200,8 +198,7 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs() // Evaluate velocity Up = alphaFilm*UFilm + (1.0 - alphaFilm)*UAvePyr*nf; - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag fixedValueFvPatchVectorField::updateCoeffs(); } diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 6f8440339e..4b6fdf629a 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -207,8 +207,7 @@ Foam::regionModels::regionModel::interRegionAMI const polyPatch& p = regionMesh().boundaryMesh()[regionPatchi]; const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchi]; - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); interRegionAMI_[nbrRegionID].set ( @@ -223,7 +222,7 @@ Foam::regionModels::regionModel::interRegionAMI interRegionAMI_[nbrRegionID][regionPatchi].calculate(p, nbrP); - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag } return interRegionAMI_[nbrRegionID][regionPatchi]; @@ -237,7 +236,7 @@ Foam::regionModels::regionModel::interRegionAMI const polyPatch& p = regionMesh().boundaryMesh()[regionPatchi]; const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchi]; - label nPatch = regionMesh().boundaryMesh().size(); + const label nPatch = regionMesh().boundaryMesh().size(); interRegionAMI_.resize(nbrRegionID + 1); @@ -248,8 +247,7 @@ Foam::regionModels::regionModel::interRegionAMI new PtrList(nPatch) ); - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); interRegionAMI_[nbrRegionID].set ( @@ -264,7 +262,7 @@ Foam::regionModels::regionModel::interRegionAMI interRegionAMI_[nbrRegionID][regionPatchi].calculate(p, nbrP); - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return interRegionAMI_[nbrRegionID][regionPatchi]; } diff --git a/src/regionModels/regionModel/regionModel/regionModelTemplates.C b/src/regionModels/regionModel/regionModel/regionModelTemplates.C index 337f2ea720..5062965502 100644 --- a/src/regionModels/regionModel/regionModel/regionModelTemplates.C +++ b/src/regionModels/regionModel/regionModel/regionModelTemplates.C @@ -36,15 +36,14 @@ Foam::regionModels::regionModel::mapRegionPatchField const bool flip ) const { - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); const AMIPatchToPatchInterpolation& ami = interRegionAMI(nbrRegion, regionPatchi, nbrPatchi, flip); tmp> tresult(ami.interpolateToSource(nbrField)); - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return tresult; } @@ -68,8 +67,7 @@ Foam::regionModels::regionModel::mapRegionPatchField { const label nbrPatchi = nbrCoupledPatchID(nbrRegion, regionPatchi); - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); const AMIPatchToPatchInterpolation& ami = interRegionAMI(nbrRegion, regionPatchi, nbrPatchi, flip); @@ -81,7 +79,7 @@ Foam::regionModels::regionModel::mapRegionPatchField tmp> tresult(ami.interpolateToSource(nbrFieldp)); - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return tresult; } @@ -112,8 +110,7 @@ Foam::regionModels::regionModel::mapRegionPatchInternalField { const label nbrPatchi = nbrCoupledPatchID(nbrRegion, regionPatchi); - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; + const int oldTag = UPstream::incrMsgType(); const AMIPatchToPatchInterpolation& ami = interRegionAMI(nbrRegion, regionPatchi, nbrPatchi, flip); @@ -129,7 +126,7 @@ Foam::regionModels::regionModel::mapRegionPatchInternalField ami.interpolateToSource(nbrFieldp.patchInternalField()) ); - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return tresult; } diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C index b0e370a718..db2df9702f 100644 --- a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C @@ -160,8 +160,7 @@ void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); const label patchi = patch().index(); @@ -234,8 +233,7 @@ void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs() alphat[facei] = max(alphaEff - alphaw[facei], scalar(0)); } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag fixedValueFvPatchScalarField::updateCoeffs(); } diff --git a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index b1f38b15cc..6687c4a772 100644 --- a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -339,8 +339,7 @@ void thermalBaffle1DFvPatchScalarField::updateCoeffs() } // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); const mapDistribute& mapDist = this->mappedPatchBase::map(); @@ -416,8 +415,7 @@ void thermalBaffle1DFvPatchScalarField::updateCoeffs() } } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag mixedFvPatchScalarField::updateCoeffs(); } diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C index 379eb0b991..0c782f824c 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C @@ -311,8 +311,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - const int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); // Get the coupling information from the mappedPatchBase const mappedPatchBase& mpp = @@ -400,8 +399,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() << endl; } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag } diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index 28c4b5b9a6..2c10c551c8 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C @@ -454,8 +454,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); // Get the coupling information from the mappedPatchBase const label patchi = patch().index(); @@ -772,8 +771,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs() storeHTCFields(prefix_, htc, htcPatch); } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag } diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C index 141aa4b5f8..369f03cc6c 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C @@ -123,8 +123,7 @@ void Foam::radiation::MarshakRadiationFvPatchScalarField::updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); // Temperature field const auto& Tp = patch().lookupPatchField(TName_); @@ -150,8 +149,7 @@ void Foam::radiation::MarshakRadiationFvPatchScalarField::updateCoeffs() // Set value fraction valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep); - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag mixedFvPatchScalarField::updateCoeffs(); } diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C index 8fe2f6bf45..0c10235f89 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C @@ -147,8 +147,7 @@ updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); // Re-calc reference value refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Trad_); @@ -173,8 +172,7 @@ updateCoeffs() // Set value fraction valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep); - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag mixedFvPatchScalarField::updateCoeffs(); } diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C index cb6dc1b7c7..6bcfb8437f 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C @@ -143,8 +143,7 @@ updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); const auto& Tp = patch().lookupPatchField(TName_); @@ -356,8 +355,7 @@ updateCoeffs() } } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag mixedFvPatchScalarField::updateCoeffs(); } diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C index b6ae35082a..72486e7dbc 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C @@ -128,8 +128,7 @@ updateCoeffs() // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); const radiationModel& radiation = db().lookupObject("radiationProperties"); @@ -288,8 +287,7 @@ updateCoeffs() } } - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag mixedFvPatchScalarField::updateCoeffs(); } diff --git a/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.C b/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.C index ca38b0ae86..5614252d15 100644 --- a/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.C +++ b/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.C @@ -103,8 +103,7 @@ Foam::tmp Foam::radiation::solidAbsorption::a { // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); const fvMesh& nbrMesh = nbrRegion(); @@ -129,8 +128,7 @@ Foam::tmp Foam::radiation::solidAbsorption::a mpp.distribute(absorptivity); - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return tmp::New(std::move(absorptivity)); } @@ -157,8 +155,7 @@ Foam::tmp Foam::radiation::solidAbsorption::e // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; + const int oldTag = UPstream::incrMsgType(); const fvMesh& nbrMesh = nbrRegion(); @@ -183,8 +180,7 @@ Foam::tmp Foam::radiation::solidAbsorption::e mpp.distribute(emissivity); - // Restore tag - UPstream::msgType() = oldTag; + UPstream::msgType(oldTag); // Restore tag return tmp::New(std::move(emissivity)); }