diff --git a/src/functionObjects/field/pressure/pressure.C b/src/functionObjects/field/pressure/pressure.C index 0f9e78536d..e13bcd6b41 100644 --- a/src/functionObjects/field/pressure/pressure.C +++ b/src/functionObjects/field/pressure/pressure.C @@ -281,10 +281,17 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict) rhoInfInitialised_ = true; } - if (dict.found("calcTotal")) + if (!modeNames.readIfPresent("mode", dict, mode_)) { - // Backwards compatibility - check for the presence of 'calcTotal' - if (dict.getCompat("mode", {{"calcTotal", 1812}})) + // Backwards compatibility + // - check for the presence of 'calcTotal' and 'calcCoeff' + + bool calcTotal = + dict.getOrDefaultCompat("mode", {{"calcTotal", 1812}}, false); + bool calcCoeff = + dict.getOrDefaultCompat("mode", {{"calcCoeff", 1812}}, false); + + if (calcTotal) { mode_ = TOTAL; } @@ -293,15 +300,11 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict) mode_ = STATIC; } - if (dict.getCompat("mode", {{"calcCoeff", 1812}})) + if (calcCoeff) { mode_ = static_cast(COEFF | mode_); } } - else - { - mode_ = modeNames.get("mode", dict); - } pRef_ = dict.lookupOrDefault("pRef", 0); diff --git a/src/functionObjects/field/pressure/pressure.H b/src/functionObjects/field/pressure/pressure.H index 63f3694712..245f82fc01 100644 --- a/src/functionObjects/field/pressure/pressure.H +++ b/src/functionObjects/field/pressure/pressure.H @@ -82,8 +82,7 @@ Usage type pressure; libs ("libfieldFunctionObjects.so"); ... - calcTotal no; - calcCoeff yes; + mode staticCoeff; } \endverbatim