diff --git a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.C b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.C index dd2280f610d5dbc72501cf955d0c063948737913..f694a0760816958060272137e4e12c53580b1310 100644 --- a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.C +++ b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.C @@ -124,28 +124,18 @@ bool Foam::fv::velocityDampingConstraint::read(const dictionary& dict) { UMax_ = readScalar(coeffs_.lookup("UMax")); - if (coeffs_.found("UNames")) + if (!coeffs_.readIfPresent("UNames", fieldNames_)) { - coeffs_.lookup("UNames") >> fieldNames_; - } - else if (coeffs_.found("UName")) - { - word UName(coeffs_.lookup("UName")); - fieldNames_ = wordList(1, UName); - } - else - { - fieldNames_ = wordList(1, "U"); + fieldNames_.resize(1); + fieldNames_.first() = coeffs_.lookupOrDefault<word>("U", "U"); } applied_.setSize(fieldNames_.size(), false); return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H index 3c8fda46727d2813135996e539df9d344024b739..3dafa4151f45affb7a78b824057ff01b5fe93a8e 100644 --- a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H +++ b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H @@ -119,8 +119,7 @@ public: //- Destructor - virtual ~velocityDampingConstraint() - {} + virtual ~velocityDampingConstraint() = default; // Member Functions diff --git a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C index d19ddf7dfe965e6240b918a0c74f84bc041f9aec..9984b38ae2523a3a2b26ab6252bc74d854ff8d05 100644 --- a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C +++ b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C @@ -179,18 +179,10 @@ bool Foam::fv::acousticDampingSource::read(const dictionary& dict) { if (cellSetOption::read(dict)) { - if (coeffs_.found("UNames")) + if (!coeffs_.readIfPresent("UNames", fieldNames_)) { - coeffs_.lookup("UNames") >> fieldNames_; - } - else if (coeffs_.found("UName")) - { - word UName(coeffs_.lookup("UName")); - fieldNames_ = wordList(1, UName); - } - else - { - fieldNames_ = wordList(1, "U"); + fieldNames_.resize(1); + fieldNames_.first() = coeffs_.lookupOrDefault<word>("U", "U"); } applied_.setSize(fieldNames_.size(), false); @@ -210,10 +202,8 @@ bool Foam::fv::acousticDampingSource::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H index 08aaba80894cd05f67fdb191c88fe602c12d2a80..0d1b31d282b7d22a7f3895369f58a9095d1bfeab 100644 --- a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H +++ b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H @@ -132,8 +132,7 @@ public: //- Destructor - virtual ~acousticDampingSource() - {} + virtual ~acousticDampingSource() = default; // Member Functions