diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedMean/fixedMeanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedMean/fixedMeanFvPatchField.C index de7f85d1ea..adfdc5299f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedMean/fixedMeanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedMean/fixedMeanFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -114,7 +114,7 @@ void Foam::fixedMeanFvPatchField::updateCoeffs() gSum(this->patch().magSf()*newValues) /gSum(this->patch().magSf()); - if (mag(meanValue) > SMALL && mag(meanValuePsi)/mag(meanValue) > 0.5) + if (mag(meanValue) > SMALL && mag(meanValuePsi) > 0.5*mag(meanValue)) { newValues *= mag(meanValue)/mag(meanValuePsi); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchField.C index 23ecab2d7c..09b86e529f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedMeanOutletInlet/fixedMeanOutletInletFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2018 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -124,7 +124,7 @@ void Foam::fixedMeanOutletInletFvPatchField::updateCoeffs() gSum(this->patch().magSf()*newValues) /gSum(this->patch().magSf()); - if (mag(meanValue) > SMALL && mag(meanValuePsi)/mag(meanValue) > 0.5) + if (mag(meanValue) > SMALL && mag(meanValuePsi) > 0.5*mag(meanValue)) { newValues *= mag(meanValue)/mag(meanValuePsi); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index 5bc42d46c6..d17a7c4cb6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,6 +30,7 @@ License #include "addToRunTimeSelectionTable.H" #include "volFields.H" #include "one.H" +#include "Switch.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -177,7 +178,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateValues const scalar flowRate = flowRate_->value(t); const scalar estimatedFlowRate = -gSum(rho*(this->patch().magSf()*nUp)); - if (estimatedFlowRate/flowRate > 0.5) + if (estimatedFlowRate > 0.5*flowRate) { nUp *= (mag(flowRate)/mag(estimatedFlowRate)); } @@ -249,7 +250,10 @@ void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const os.writeEntryIfDifferent("rho", "rho", rhoName_); os.writeEntryIfDifferent("rhoInlet", -VGREAT, rhoInlet_); } - os.writeEntry("extrapolateProfile", extrapolateProfile_); + if (extrapolateProfile_) + { + os.writeEntry("extrapolateProfile", extrapolateProfile_); + } writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H index cf2a848273..b85605dd3f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H @@ -117,7 +117,7 @@ class flowRateInletVelocityFvPatchVectorField : public fixedValueFvPatchVectorField { - // Private data + // Private Data //- Inlet integral flow rate autoPtr> flowRate_; @@ -135,7 +135,7 @@ class flowRateInletVelocityFvPatchVectorField Switch extrapolateProfile_; - // Private member functions + // Private Member Functions //- Update the patch values given the appropriate density type and value template @@ -211,7 +211,7 @@ public: } - // Member functions + // Member Functions //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C index 126158e7c4..65e665cbd3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateOutletVelocity/flowRateOutletVelocityFvPatchVectorField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -166,7 +166,7 @@ void Foam::flowRateOutletVelocityFvPatchVectorField::updateValues const scalar flowRate = flowRate_->value(t); const scalar estimatedFlowRate = gSum(rho*(this->patch().magSf()*nUp)); - if (estimatedFlowRate/flowRate > 0.5) + if (estimatedFlowRate > 0.5*flowRate) { nUp *= (mag(flowRate)/mag(estimatedFlowRate)); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C index 5fbd999c1f..6fae38223f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C @@ -294,7 +294,7 @@ Foam::PatchFunction1Types::Sampled::value averagePsi = gAverage(newValues); } - if (mag(averagePsi)/mag(average_) > 0.5) + if (mag(averagePsi) > 0.5*mag(average_)) { newValues *= mag(average_)/mag(averagePsi); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C index 596d8d25b4..70a0d0a3f8 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -630,7 +630,7 @@ Foam::mappedPatchFieldBase::mappedField gSum(patchField_.patch().magSf()*newValues) /gSum(patchField_.patch().magSf()); - if (mag(averagePsi)/mag(average_) > 0.5) + if (mag(averagePsi) > 0.5*mag(average_)) { newValues *= mag(average_)/mag(averagePsi); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C index 01da573f77..bd3c912d46 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/matchedFlowRateOutletVelocity/matchedFlowRateOutletVelocityFvPatchVectorField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,7 +56,7 @@ matchedFlowRateOutletVelocityFvPatchVectorField ) : fixedValueFvPatchField(p, iF, dict, false), - inletPatchName_(dict.lookup("inletPatch")), + inletPatchName_(dict.get("inletPatch")), volumetric_(dict.getOrDefault("volumetric", true)) { if (volumetric_) @@ -174,7 +174,7 @@ void Foam::matchedFlowRateOutletVelocityFvPatchVectorField::updateValues // Calculate the extrapolated outlet patch flow rate const scalar estimatedFlowRate = gSum(rhoOutlet*(patch().magSf()*nUp)); - if (estimatedFlowRate/flowRate > 0.5) + if (estimatedFlowRate > 0.5*flowRate) { nUp *= (mag(flowRate)/mag(estimatedFlowRate)); }