From e7c1d46904b38bb92913214b2c4d50f5934f68bc Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Sat, 4 Aug 2018 00:23:18 +0200 Subject: [PATCH] ENH: avoid raw dictionary lookup in fvOptions (issue #762) Style changes: - use lookupObjectRef instead of using const_cast - use tmp::New factory --- src/OpenFOAM/db/Time/TimeIO.C | 2 +- src/fvOptions/Make/files | 13 +--- src/fvOptions/cellSetOption/cellSetOption.C | 56 +++++++++------- src/fvOptions/cellSetOption/cellSetOption.H | 4 +- src/fvOptions/cellSetOption/cellSetOptionIO.C | 44 ------------ .../fixedTemperatureConstraint.C | 6 +- .../fixedTemperatureConstraint.H | 4 +- .../velocityDampingConstraint.C | 6 +- .../velocityDampingConstraint.H | 9 +-- .../FixedValueConstraint.C | 10 ++- .../limitTemperature/limitTemperature.C | 16 ++--- .../limitTemperature/limitTemperature.H | 4 +- .../corrections/limitVelocity/limitVelocity.C | 14 ++-- .../corrections/limitVelocity/limitVelocity.H | 4 +- .../interRegionOption/interRegionOption.C | 15 ++++- .../interRegionOption/interRegionOptionI.H | 1 - .../interRegionOption/interRegionOptionIO.C | 43 ------------ .../acousticDampingSource.C | 10 +-- .../acousticDampingSource.H | 50 +++++++------- .../actuationDiskSource/actuationDiskSource.C | 18 +++-- .../actuationDiskSource/actuationDiskSource.H | 3 +- .../actuationDiskSourceTemplates.C | 4 +- .../derived/buoyancyEnergy/buoyancyEnergy.C | 10 ++- .../derived/buoyancyEnergy/buoyancyEnergy.H | 24 +++---- .../derived/buoyancyEnergy/buoyancyEnergyIO.C | 38 ----------- .../derived/buoyancyForce/buoyancyForce.C | 10 ++- .../derived/buoyancyForce/buoyancyForce.H | 36 +++++----- .../derived/buoyancyForce/buoyancyForceIO.C | 38 ----------- ...irectionalPressureGradientExplicitSource.C | 55 ++++++++++++--- ...irectionalPressureGradientExplicitSource.H | 4 +- ...ectionalPressureGradientExplicitSourceIO.C | 67 ------------------- .../effectivenessHeatExchangerSource.C | 15 ++--- .../explicitPorositySource.C | 6 +- .../explicitPorositySource.H | 56 +++++++--------- .../jouleHeatingSource/jouleHeatingSource.C | 58 +++++++++++----- .../jouleHeatingSource/jouleHeatingSourceIO.C | 59 ---------------- .../jouleHeatingSourceTemplates.C | 47 ++++++------- .../meanVelocityForce/meanVelocityForce.C | 14 +++- .../meanVelocityForce/meanVelocityForceIO.C | 38 ----------- .../patchMeanVelocityForce.C | 2 +- .../patchMeanVelocityForce.H | 5 ++ .../PhaseLimitStabilization.C | 14 ++-- .../radialActuationDiskSource.C | 8 +-- .../radialActuationDiskSource.H | 5 +- .../rotorDiskSource/bladeModel/bladeModel.C | 9 +-- .../rotorDiskSource/bladeModel/bladeModel.H | 3 +- .../profileModel/lookup/lookupProfile.C | 6 +- .../profileModel/lookup/lookupProfile.H | 10 +-- .../profileModel/profileModel.C | 11 +-- .../profileModel/profileModel.H | 3 +- .../profileModel/profileModelList.C | 8 +-- .../profileModel/profileModelList.H | 5 +- .../profileModel/series/seriesProfile.C | 4 +- .../profileModel/series/seriesProfile.H | 10 +-- .../derived/rotorDiskSource/rotorDiskSource.C | 4 +- .../derived/rotorDiskSource/rotorDiskSource.H | 2 +- .../rotorDiskSourceTemplates.C | 25 +++---- .../trimModel/fixed/fixedTrim.C | 17 ++--- .../trimModel/fixed/fixedTrim.H | 3 +- .../trimModel/targetCoeff/targetCoeffTrim.C | 26 +++---- .../trimModel/targetCoeff/targetCoeffTrim.H | 5 +- .../trimModel/trimModel/trimModel.C | 5 -- .../trimModel/trimModel/trimModel.H | 3 +- .../trimModel/trimModel/trimModelNew.C | 2 +- .../solidificationMeltingSource.C | 39 +++++++++-- .../solidificationMeltingSource.H | 50 +++++++------- .../solidificationMeltingSourceIO.C | 61 ----------------- .../tabulated6DoFAcceleration.C | 8 +-- .../tabulated6DoFAcceleration.H | 2 +- .../tabulatedAccelerationSource.C | 6 +- .../tabulatedAccelerationSource.H | 4 +- .../tabulatedAccelerationSourceTemplates.C | 17 ++--- .../viscousDissipation/viscousDissipation.C | 66 +++++++++--------- .../viscousDissipation/viscousDissipation.H | 30 ++++----- .../sources/general/codedSource/CodedSource.C | 2 +- .../general/codedSource/CodedSourceIO.C | 8 +-- .../semiImplicitSource/SemiImplicitSource.C | 20 +++++- .../semiImplicitSource/SemiImplicitSource.H | 10 +-- .../semiImplicitSource/SemiImplicitSourceIO.C | 47 ------------- .../interRegionExplicitPorositySource.C | 6 +- .../interRegionExplicitPorositySource.H | 2 +- .../constantHeatTransfer.C | 6 +- .../constantHeatTransfer.H | 11 +-- .../interRegionHeatTransferModel.C | 48 ++++++------- .../interRegionHeatTransferModel.H | 8 +-- .../interRegionHeatTransferModelIO.C | 43 ------------ .../tabulatedHeatTransfer.C | 6 +- .../tabulatedHeatTransfer.H | 7 +- .../tabulatedNTUHeatTransfer.C | 35 +++++----- .../tabulatedNTUHeatTransfer.H | 7 +- .../variableHeatTransfer.C | 16 ++--- 91 files changed, 588 insertions(+), 1083 deletions(-) delete mode 100644 src/fvOptions/cellSetOption/cellSetOptionIO.C delete mode 100644 src/fvOptions/interRegionOption/interRegionOptionIO.C delete mode 100644 src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergyIO.C delete mode 100644 src/fvOptions/sources/derived/buoyancyForce/buoyancyForceIO.C delete mode 100644 src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C delete mode 100644 src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceIO.C delete mode 100644 src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForceIO.C delete mode 100644 src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSourceIO.C delete mode 100644 src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSourceIO.C delete mode 100644 src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelIO.C diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index e982a92884..9fb3cc0c70 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -461,7 +461,7 @@ void Foam::Time::readDict() ( IOstreamOption::versionNumber ( - controlDict_.lookup("writeVersion") + controlDict_.get("writeVersion") ) ); } diff --git a/src/fvOptions/Make/files b/src/fvOptions/Make/files index 0c34f07779..2e91b07095 100644 --- a/src/fvOptions/Make/files +++ b/src/fvOptions/Make/files @@ -1,9 +1,5 @@ cellSetOption/cellSetOption.C -cellSetOption/cellSetOptionIO.C - interRegionOption/interRegionOption.C -interRegionOption/interRegionOptionIO.C - /* Sources */ @@ -14,18 +10,13 @@ $(generalSources)/semiImplicitSource/semiImplicitSource.C derivedSources=sources/derived $(derivedSources)/acousticDampingSource/acousticDampingSource.C $(derivedSources)/actuationDiskSource/actuationDiskSource.C -$(derivedSources)/buoyancyForce/buoyancyForce.C -$(derivedSources)/buoyancyForce/buoyancyForceIO.C $(derivedSources)/buoyancyEnergy/buoyancyEnergy.C -$(derivedSources)/buoyancyEnergy/buoyancyEnergyIO.C +$(derivedSources)/buoyancyForce/buoyancyForce.C $(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C -$(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C $(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C $(derivedSources)/explicitPorositySource/explicitPorositySource.C $(derivedSources)/jouleHeatingSource/jouleHeatingSource.C -$(derivedSources)/jouleHeatingSource/jouleHeatingSourceIO.C $(derivedSources)/meanVelocityForce/meanVelocityForce.C -$(derivedSources)/meanVelocityForce/meanVelocityForceIO.C $(derivedSources)/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C $(derivedSources)/phaseLimitStabilization/phaseLimitStabilization.C $(derivedSources)/radialActuationDiskSource/radialActuationDiskSource.C @@ -40,14 +31,12 @@ $(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModelNew.C $(derivedSources)/rotorDiskSource/trimModel/fixed/fixedTrim.C $(derivedSources)/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C $(derivedSources)/solidificationMeltingSource/solidificationMeltingSource.C -$(derivedSources)/solidificationMeltingSource/solidificationMeltingSourceIO.C $(derivedSources)/tabulatedAccelerationSource/tabulatedAccelerationSource.C $(derivedSources)/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C $(derivedSources)/viscousDissipation/viscousDissipation.C interRegion = sources/interRegion $(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C -$(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelIO.C $(interRegion)/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.C $(interRegion)/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C $(interRegion)/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C diff --git a/src/fvOptions/cellSetOption/cellSetOption.C b/src/fvOptions/cellSetOption/cellSetOption.C index 28d0586221..6cc034a596 100644 --- a/src/fvOptions/cellSetOption/cellSetOption.C +++ b/src/fvOptions/cellSetOption/cellSetOption.C @@ -58,17 +58,17 @@ void Foam::fv::cellSetOption::setSelection(const dictionary& dict) { case smPoints: { - dict.lookup("points") >> points_; + dict.readEntry("points", points_); break; } case smCellSet: { - dict.lookup("cellSet") >> cellSetName_; + dict.readEntry("cellSet", cellSetName_); break; } case smCellZone: { - dict.lookup("cellZone") >> cellSetName_; + dict.readEntry("cellZone", cellSetName_); break; } case smAll: @@ -90,16 +90,17 @@ void Foam::fv::cellSetOption::setSelection(const dictionary& dict) void Foam::fv::cellSetOption::setVol() { - scalar VOld = V_; - // Set volume information - V_ = 0.0; - forAll(cells_, i) - { - V_ += mesh_.V()[cells_[i]]; - } - reduce(V_, sumOp()); + scalar sumVol = 0.0; + for (const label celli : cells_) + { + sumVol += mesh_.V()[celli]; + } + reduce(sumVol, sumOp()); + + const scalar VOld = V_; + V_ = sumVol; // Convert both volumes to representation using current writeprecision word VOldName(Time::timeName(VOld, IOstream::defaultPrecision())); @@ -142,8 +143,7 @@ void Foam::fv::cellSetOption::setCellSet() } - cells_ = selectedCells.toc(); - + cells_ = selectedCells.sortedToc(); break; } case smCellSet: @@ -151,9 +151,7 @@ void Foam::fv::cellSetOption::setCellSet() Info<< indent << "- selecting cells using cellSet " << cellSetName_ << endl; - cellSet selectedCells(mesh_, cellSetName_); - cells_ = selectedCells.toc(); - + cells_ = cellSet(mesh_, cellSetName_).sortedToc(); break; } case smCellZone: @@ -169,15 +167,15 @@ void Foam::fv::cellSetOption::setCellSet() << "Valid cellZones are " << mesh_.cellZones().names() << exit(FatalError); } - cells_ = mesh_.cellZones()[zoneID]; + cells_ = mesh_.cellZones()[zoneID]; break; } case smAll: { Info<< indent << "- selecting all cells" << endl; - cells_ = identity(mesh_.nCells()); + cells_ = identity(mesh_.nCells()); break; } default: @@ -222,12 +220,6 @@ Foam::fv::cellSetOption::cellSetOption } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::fv::cellSetOption::~cellSetOption() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::fv::cellSetOption::isActive() @@ -255,10 +247,22 @@ bool Foam::fv::cellSetOption::isActive() return true; } - else + + return false; +} + + +bool Foam::fv::cellSetOption::read(const dictionary& dict) +{ + if (option::read(dict)) { - return false; + if (coeffs_.readIfPresent("timeStart", timeStart_)) + { + coeffs_.readEntry("duration", duration_); + } } + + return true; } diff --git a/src/fvOptions/cellSetOption/cellSetOption.H b/src/fvOptions/cellSetOption/cellSetOption.H index 312768a0f4..a5bff0a8bd 100644 --- a/src/fvOptions/cellSetOption/cellSetOption.H +++ b/src/fvOptions/cellSetOption/cellSetOption.H @@ -101,7 +101,7 @@ protected: //- Cell selection mode selectionModeType selectionMode_; - //- Name of cell set for "cellSet" and "cellZone" selectionMode + //- Name of set/zone for "cellSet" and "cellZone" selectionMode word cellSetName_; //- List of points for "points" selectionMode @@ -145,7 +145,7 @@ public: //- Destructor - virtual ~cellSetOption(); + virtual ~cellSetOption() = default; // Member Functions diff --git a/src/fvOptions/cellSetOption/cellSetOptionIO.C b/src/fvOptions/cellSetOption/cellSetOptionIO.C deleted file mode 100644 index 90e30a2217..0000000000 --- a/src/fvOptions/cellSetOption/cellSetOptionIO.C +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 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 "cellSetOption.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::fv::cellSetOption::read(const dictionary& dict) -{ - if (option::read(dict)) - { - if (coeffs_.readIfPresent("timeStart", timeStart_)) - { - coeffs_.lookup("duration") >> duration_; - } - } - - return true; -} - - -// ************************************************************************* // diff --git a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C index 32446b4fb2..cdec55ac52 100644 --- a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C +++ b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C @@ -160,10 +160,8 @@ bool Foam::fv::fixedTemperatureConstraint::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H index 2fde4bda9a..6bf21407b2 100644 --- a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H +++ b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H @@ -78,7 +78,6 @@ class fixedTemperatureConstraint : public cellSetOption { - public: //- Temperature mode @@ -137,8 +136,7 @@ public: //- Destructor - virtual ~fixedTemperatureConstraint() - {} + virtual ~fixedTemperatureConstraint() = default; // Member Functions diff --git a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.C b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.C index f694a07608..4b9835fee0 100644 --- a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.C +++ b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.C @@ -70,7 +70,7 @@ void Foam::fv::velocityDampingConstraint::addDamping(fvMatrix& eqn) diag[cellI] += scale*(magU-UMax_); - nDamped++; + ++nDamped; } } @@ -104,7 +104,7 @@ Foam::fv::velocityDampingConstraint::velocityDampingConstraint void Foam::fv::velocityDampingConstraint::constrain ( fvMatrix& eqn, - const label fieldI + const label fieldi ) { addDamping(eqn); @@ -122,7 +122,7 @@ bool Foam::fv::velocityDampingConstraint::read(const dictionary& dict) { if (cellSetOption::read(dict)) { - UMax_ = readScalar(coeffs_.lookup("UMax")); + UMax_ = coeffs_.get("UMax"); if (!coeffs_.readIfPresent("UNames", fieldNames_)) { diff --git a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H index 3dafa4151f..2b08d495c2 100644 --- a/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H +++ b/src/fvOptions/constraints/derived/velocityDampingConstraint/velocityDampingConstraint.H @@ -46,7 +46,8 @@ Description UMax 100; // Optional: name of velocity field (default: U) - //UName U; + //U U; + //UNames (U); } @@ -68,7 +69,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class velocityDampingConstraint Declaration + Class velocityDampingConstraint Declaration \*---------------------------------------------------------------------------*/ class velocityDampingConstraint @@ -127,13 +128,13 @@ public: // Set values directly //- Constrain vector matrix - virtual void constrain(fvMatrix& eqn, const label fieldI); + virtual void constrain(fvMatrix& eqn, const label fieldi); // I-O //- Write data - virtual void writeData(Ostream&) const; + virtual void writeData(Ostream& os) const; //- Read dictionary virtual bool read(const dictionary& dict); diff --git a/src/fvOptions/constraints/general/fixedValueConstraint/FixedValueConstraint.C b/src/fvOptions/constraints/general/fixedValueConstraint/FixedValueConstraint.C index 68e2ea1203..e6a55fab35 100644 --- a/src/fvOptions/constraints/general/fixedValueConstraint/FixedValueConstraint.C +++ b/src/fvOptions/constraints/general/fixedValueConstraint/FixedValueConstraint.C @@ -61,18 +61,16 @@ bool Foam::fv::FixedValueConstraint::read(const dictionary& dict) forAllConstIter(dictionary, fieldValuesDict, iter) { fieldNames_[i] = iter().keyword(); - fieldValuesDict.lookup(iter().keyword()) >> fieldValues_[i]; - i++; + fieldValuesDict.readEntry(iter().keyword(), fieldValues_[i]); + ++i; } applied_.setSize(fieldNames_.size(), false); return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/corrections/limitTemperature/limitTemperature.C b/src/fvOptions/corrections/limitTemperature/limitTemperature.C index ae17c82c66..0de200dd3f 100644 --- a/src/fvOptions/corrections/limitTemperature/limitTemperature.C +++ b/src/fvOptions/corrections/limitTemperature/limitTemperature.C @@ -56,8 +56,8 @@ Foam::fv::limitTemperature::limitTemperature ) : cellSetOption(name, modelType, dict, mesh), - Tmin_(readScalar(coeffs_.lookup("min"))), - Tmax_(readScalar(coeffs_.lookup("max"))), + Tmin_(coeffs_.get("min")), + Tmax_(coeffs_.get("max")), phase_(coeffs_.lookupOrDefault("phase", word::null)) { // Set the field name to that of the energy field from which the temperature @@ -80,15 +80,13 @@ bool Foam::fv::limitTemperature::read(const dictionary& dict) { if (cellSetOption::read(dict)) { - coeffs_.lookup("min") >> Tmin_; - coeffs_.lookup("max") >> Tmax_; + coeffs_.readEntry("min", Tmin_); + coeffs_.readEntry("max", Tmax_); return true; } - else - { - return false; - } + + return false; } @@ -110,7 +108,7 @@ void Foam::fv::limitTemperature::correct(volScalarField& he) forAll(cells_, i) { - label celli = cells_[i]; + const label celli = cells_[i]; hec[celli]= max(min(hec[celli], heMax[i]), heMin[i]); } diff --git a/src/fvOptions/corrections/limitTemperature/limitTemperature.H b/src/fvOptions/corrections/limitTemperature/limitTemperature.H index e92e89f72c..baeff621bf 100644 --- a/src/fvOptions/corrections/limitTemperature/limitTemperature.H +++ b/src/fvOptions/corrections/limitTemperature/limitTemperature.H @@ -71,7 +71,6 @@ class limitTemperature : public cellSetOption { - protected: // Protected data @@ -116,8 +115,7 @@ public: //- Destructor - virtual ~limitTemperature() - {} + virtual ~limitTemperature() = default; // Member Functions diff --git a/src/fvOptions/corrections/limitVelocity/limitVelocity.C b/src/fvOptions/corrections/limitVelocity/limitVelocity.C index 24eca1387d..3626d501e0 100644 --- a/src/fvOptions/corrections/limitVelocity/limitVelocity.C +++ b/src/fvOptions/corrections/limitVelocity/limitVelocity.C @@ -56,7 +56,7 @@ Foam::fv::limitVelocity::limitVelocity : cellSetOption(name, modelType, dict, mesh), UName_(coeffs_.lookupOrDefault("U", "U")), - max_(readScalar(coeffs_.lookup("max"))) + max_(coeffs_.get("max")) { fieldNames_.setSize(1, UName_); applied_.setSize(1, false); @@ -69,14 +69,12 @@ bool Foam::fv::limitVelocity::read(const dictionary& dict) { if (cellSetOption::read(dict)) { - coeffs_.lookup("max") >> max_; + coeffs_.readEntry("max", max_); return true; } - else - { - return false; - } + + return false; } @@ -86,10 +84,8 @@ void Foam::fv::limitVelocity::correct(volVectorField& U) vectorField& Uif = U.primitiveFieldRef(); - forAll(cells_, i) + for (const label celli : cells_) { - const label celli = cells_[i]; - const scalar magSqrUi = magSqr(Uif[celli]); if (magSqrUi > maxSqrU) diff --git a/src/fvOptions/corrections/limitVelocity/limitVelocity.H b/src/fvOptions/corrections/limitVelocity/limitVelocity.H index b3d192fa8a..cbf12aa0ec 100644 --- a/src/fvOptions/corrections/limitVelocity/limitVelocity.H +++ b/src/fvOptions/corrections/limitVelocity/limitVelocity.H @@ -65,7 +65,6 @@ class limitVelocity : public cellSetOption { - protected: // Protected data @@ -107,8 +106,7 @@ public: //- Destructor - virtual ~limitVelocity() - {} + virtual ~limitVelocity() = default; // Member Functions diff --git a/src/fvOptions/interRegionOption/interRegionOption.C b/src/fvOptions/interRegionOption/interRegionOption.C index bf81ccf383..f4b4ffe037 100644 --- a/src/fvOptions/interRegionOption/interRegionOption.C +++ b/src/fvOptions/interRegionOption/interRegionOption.C @@ -110,7 +110,7 @@ Foam::fv::interRegionOption::interRegionOption mesh ), master_(coeffs_.lookupOrDefault("master", true)), - nbrRegionName_(coeffs_.lookup("nbrRegion")), + nbrRegionName_(coeffs_.get("nbrRegion")), meshInterpPtr_() { if (active()) @@ -126,4 +126,17 @@ Foam::fv::interRegionOption::~interRegionOption() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::fv::interRegionOption::read(const dictionary& dict) +{ + if (option::read(dict)) + { + return true; + } + + return false; +} + + // ************************************************************************* // diff --git a/src/fvOptions/interRegionOption/interRegionOptionI.H b/src/fvOptions/interRegionOption/interRegionOptionI.H index 55d0aa941c..2f5aa3002f 100644 --- a/src/fvOptions/interRegionOption/interRegionOptionI.H +++ b/src/fvOptions/interRegionOption/interRegionOptionI.H @@ -46,5 +46,4 @@ Foam::fv::interRegionOption::meshInterp() const } - // ************************************************************************* // diff --git a/src/fvOptions/interRegionOption/interRegionOptionIO.C b/src/fvOptions/interRegionOption/interRegionOptionIO.C deleted file mode 100644 index 158ffc07ee..0000000000 --- a/src/fvOptions/interRegionOption/interRegionOptionIO.C +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 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 "interRegionOption.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::fv::interRegionOption::read(const dictionary& dict) -{ - if (option::read(dict)) - { - return true; - } - else - { - return false; - } -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C index 9984b38ae2..4e912dc1fb 100644 --- a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C +++ b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C @@ -187,11 +187,11 @@ bool Foam::fv::acousticDampingSource::read(const dictionary& dict) applied_.setSize(fieldNames_.size(), false); - coeffs_.lookup("frequency") >> frequency_.value(); - coeffs_.lookup("URef") >> URefName_; - coeffs_.lookup("centre") >> x0_; - coeffs_.lookup("radius1") >> r1_; - coeffs_.lookup("radius2") >> r2_; + coeffs_.readEntry("frequency", frequency_.value()); + coeffs_.readEntry("URef", URefName_); + coeffs_.readEntry("centre", x0_); + coeffs_.readEntry("radius1", r1_); + coeffs_.readEntry("radius2", r2_); if (coeffs_.readIfPresent("w", w_)) { diff --git a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H index 0d1b31d282..a73f559c60 100644 --- a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H +++ b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H @@ -137,37 +137,33 @@ public: // Member Functions - // Add explicit and implicit contributions + //- Add implicit contribution to momentum equation + virtual void addSup + ( + fvMatrix& eqn, + const label fieldI + ); - //- Add implicit contribution to momentum equation - virtual void addSup - ( - fvMatrix& eqn, - const label fieldI - ); + //- Add implicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldI + ); - //- Add implicit contribution to compressible momentum equation - virtual void addSup - ( - const volScalarField& rho, - fvMatrix& eqn, - const label fieldI - ); - - //- Add implicit contribution to phase momentum equation - virtual void addSup - ( - const volScalarField& alpha, - const volScalarField& rho, - fvMatrix& eqn, - const label fieldI - ); + //- Add implicit contribution to phase momentum equation + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldI + ); - // IO - - //- Read dictionary - virtual bool read(const dictionary& dict); + //- Read dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C index 576189060a..c48c617f19 100644 --- a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C +++ b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C @@ -88,14 +88,14 @@ Foam::fv::actuationDiskSource::actuationDiskSource ) : cellSetOption(name, modelType, dict, mesh), - diskDir_(coeffs_.lookup("diskDir")), - Cp_(readScalar(coeffs_.lookup("Cp"))), - Ct_(readScalar(coeffs_.lookup("Ct"))), - diskArea_(readScalar(coeffs_.lookup("diskArea"))), - upstreamPoint_(coeffs_.lookup("upstreamPoint")), + diskDir_(coeffs_.get("diskDir")), + Cp_(coeffs_.get("Cp")), + Ct_(coeffs_.get("Ct")), + diskArea_(coeffs_.get("diskArea")), + upstreamPoint_(coeffs_.get("upstreamPoint")), upstreamCellId_(-1) { - coeffs_.lookup("fields") >> fieldNames_; + coeffs_.readEntry("fields", fieldNames_); applied_.setSize(fieldNames_.size(), false); Info<< " - creating actuation disk zone: " @@ -171,10 +171,8 @@ bool Foam::fv::actuationDiskSource::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H index 36747410cf..f579f89353 100644 --- a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H +++ b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H @@ -153,8 +153,7 @@ public: //- Destructor - virtual ~actuationDiskSource() - {} + virtual ~actuationDiskSource() = default; // Member Functions diff --git a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C index 78a1572df6..26c3a8243f 100644 --- a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C +++ b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C @@ -57,9 +57,9 @@ void Foam::fv::actuationDiskSource::addActuationDiskAxialInertialResistance scalar T = 2.0*upRho*diskArea_*mag(upU)*a*(1 - a); - forAll(cells, i) + for (const label celli : cells) { - Usource[cells[i]] += ((Vcells[cells[i]]/V())*T*E) & upU; + Usource[celli] += ((Vcells[celli]/V())*T*E) & upU; } } diff --git a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.C b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.C index 41ebb7a955..86236e8995 100644 --- a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.C +++ b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.C @@ -58,7 +58,7 @@ Foam::fv::buoyancyEnergy::buoyancyEnergy option(sourceName, modelType, dict, mesh), UName_(coeffs_.lookupOrDefault("U", "U")) { - coeffs_.lookup("fields") >> fieldNames_; + coeffs_.readEntry("fields", fieldNames_); if (fieldNames_.size() != 1) { @@ -88,4 +88,12 @@ void Foam::fv::buoyancyEnergy::addSup } +bool Foam::fv::buoyancyEnergy::read(const dictionary& dict) +{ + NotImplemented; + + return false; +} + + // ************************************************************************* // diff --git a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H index c7e1d8c933..50f090ad63 100644 --- a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H +++ b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H @@ -56,7 +56,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class buoyancyEnergy Declaration + Class buoyancyEnergy Declaration \*---------------------------------------------------------------------------*/ class buoyancyEnergy @@ -98,21 +98,17 @@ public: // Member Functions - // Evaluate - - //- Add explicit contribution to compressible momentum equation - virtual void addSup - ( - const volScalarField& rho, - fvMatrix& eqn, - const label fieldi - ); + //- Add explicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); - // IO - - //- Read source dictionary - virtual bool read(const dictionary& dict); + //- Read source dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergyIO.C b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergyIO.C deleted file mode 100644 index c5c25d64e2..0000000000 --- a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergyIO.C +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2015 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 "buoyancyEnergy.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -bool Foam::fv::buoyancyEnergy::read(const dictionary& dict) -{ - NotImplemented; - - return false; -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.C b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.C index 6976ee9fba..bb4e098e81 100644 --- a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.C +++ b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.C @@ -68,7 +68,7 @@ Foam::fv::buoyancyForce::buoyancyForce ) ) { - coeffs_.lookup("fields") >> fieldNames_; + coeffs_.readEntry("fields", fieldNames_); if (fieldNames_.size() != 1) { @@ -103,4 +103,12 @@ void Foam::fv::buoyancyForce::addSup } +bool Foam::fv::buoyancyForce::read(const dictionary& dict) +{ + NotImplemented; + + return false; +} + + // ************************************************************************* // diff --git a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H index 679dd49f53..a288c0812a 100644 --- a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H +++ b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H @@ -56,7 +56,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class buoyancyForce Declaration + Class buoyancyForce Declaration \*---------------------------------------------------------------------------*/ class buoyancyForce @@ -97,28 +97,24 @@ public: // Member Functions - // Evaluate + //- Add explicit contribution to incompressible momentum equation + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); - //- Add explicit contribution to incompressible momentum equation - virtual void addSup - ( - fvMatrix& eqn, - const label fieldi - ); - - //- Add explicit contribution to compressible momentum equation - virtual void addSup - ( - const volScalarField& rho, - fvMatrix& eqn, - const label fieldi - ); + //- Add explicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); - // IO - - //- Read source dictionary - virtual bool read(const dictionary& dict); + //- Read source dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForceIO.C b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForceIO.C deleted file mode 100644 index 223d42cfa1..0000000000 --- a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForceIO.C +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2015 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 "buoyancyForce.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -bool Foam::fv::buoyancyForce::read(const dictionary& dict) -{ - NotImplemented; - - return false; -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C index 470070276b..697ff1e72a 100644 --- a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C @@ -170,23 +170,23 @@ directionalPressureGradientExplicitSource gradP0_(cells_.size(), Zero), dGradP_(cells_.size(), Zero), gradPporous_(cells_.size(), Zero), - flowDir_(coeffs_.lookup("flowDir")), + flowDir_(coeffs_.get("flowDir")), invAPtr_(nullptr), D_(0), I_(0), length_(0), pressureDrop_(0), flowRate_(), - faceZoneName_(coeffs_.lookup("faceZone")), + faceZoneName_(coeffs_.get("faceZone")), zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)), faceId_(), facePatchId_(), relaxationFactor_(coeffs_.lookupOrDefault("relaxationFactor",0.3)), cellFaceMap_(cells_.size(), -1) { - coeffs_.lookup("fields") >> fieldNames_; + coeffs_.readEntry("fields", fieldNames_); - flowDir_ /= mag(flowDir_); + flowDir_.normalise(); if (fieldNames_.size() != 1) { @@ -210,13 +210,13 @@ directionalPressureGradientExplicitSource } else if (model_ == pConstant) { - coeffs_.lookup("pressureDrop") >> pressureDrop_; + coeffs_.readEntry("pressureDrop", pressureDrop_); } else if (model_ == pDarcyForchheimer) { - coeffs_.lookup("D") >> D_; - coeffs_.lookup("I") >> I_; - coeffs_.lookup("length") >> length_; + coeffs_.readEntry("D", D_); + coeffs_.readEntry("I", I_); + coeffs_.readEntry("length", length_); } else { @@ -240,7 +240,7 @@ directionalPressureGradientExplicitSource { Info<< " Reading pressure gradient from file" << endl; dictionary propsDict(dictionary::null, propsFile); - propsDict.lookup("gradient") >> gradP0_; + propsDict.readEntry("gradient", gradP0_); } Info<< " Initial pressure gradient = " << gradP0_ << nl << endl; @@ -528,4 +528,41 @@ void Foam::fv::directionalPressureGradientExplicitSource::constrain } +void Foam::fv::directionalPressureGradientExplicitSource::writeData +( + Ostream& os +) const +{ + NotImplemented; +} + + +bool Foam::fv::directionalPressureGradientExplicitSource::read +( + const dictionary& dict +) +{ + const dictionary coeffs(dict.subDict(typeName + "Coeffs")); + + relaxationFactor_ = + coeffs.lookupOrDefault("relaxationFactor", 0.3); + + coeffs.readEntry("flowDir", flowDir_); + flowDir_.normalise(); + + if (model_ == pConstant) + { + coeffs.readEntry("pressureDrop", pressureDrop_); + } + else if (model_ == pDarcyForchheimer) + { + coeffs.readEntry("D", D_); + coeffs.readEntry("I", I_); + coeffs.readEntry("length", length_); + } + + return false; +} + + // ************************************************************************* // diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H index f541089ca9..e5831682df 100644 --- a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H @@ -167,7 +167,7 @@ private: //- Id for the face zone label zoneID_; - //- Local list of face IDs + //- Local list of face IDs labelList faceId_; //- Local list of patch ID per face @@ -255,7 +255,7 @@ public: // I-O //- Write the source properties - virtual void writeData(Ostream&) const; + virtual void writeData(Ostream& os) const; //- Read source dictionary virtual bool read(const dictionary& dict); diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C deleted file mode 100644 index 171b2dce20..0000000000 --- a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenCFD Ltd. - \\/ 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 "directionalPressureGradientExplicitSource.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::fv::directionalPressureGradientExplicitSource::writeData -( - Ostream& os -) const -{ - NotImplemented; -} - - -bool Foam::fv::directionalPressureGradientExplicitSource::read -( - const dictionary& dict -) -{ - const dictionary coeffs(dict.subDict(typeName + "Coeffs")); - - relaxationFactor_ = - coeffs.lookupOrDefault("relaxationFactor", 0.3); - - coeffs.lookup("flowDir") >> flowDir_; - flowDir_ /= mag(flowDir_); - - if (model_ == pConstant) - { - coeffs.lookup("pressureDrop") >> pressureDrop_; - } - else if (model_ == pDarcyForchheimer) - { - coeffs.lookup("D") >> D_; - coeffs.lookup("I") >> I_; - coeffs.lookup("length") >> length_; - } - - return false; -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C index 8b80a02f55..27f4bc0e0c 100644 --- a/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C +++ b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C @@ -316,18 +316,17 @@ bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict) UName_ = coeffs_.lookupOrDefault("U", "U"); TName_ = coeffs_.lookupOrDefault("T", "T"); phiName_ = coeffs_.lookupOrDefault("phi", "phi"); - coeffs_.lookup("faceZone") >> faceZoneName_; + coeffs_.readEntry("faceZone", faceZoneName_); - coeffs_.lookup("secondaryMassFlowRate") >> secondaryMassFlowRate_; - coeffs_.lookup("secondaryInletT") >> secondaryInletT_; + coeffs_.readEntry("secondaryMassFlowRate", secondaryMassFlowRate_); + coeffs_.readEntry("secondaryInletT", secondaryInletT_); if (coeffs_.readIfPresent("primaryInletT", primaryInletT_)) { + userPrimaryInletT_ = true; Info<< type() << " " << this->name() << ": " << indent << nl << "employing user-specified primary flow inlet temperature: " << primaryInletT_ << endl; - - userPrimaryInletT_ = true; } else { @@ -360,10 +359,8 @@ bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C index 3c7cb43b26..8a1cbed2fc 100644 --- a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C +++ b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C @@ -129,10 +129,8 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H index 2efe55db43..4b17b17174 100644 --- a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H +++ b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H @@ -89,7 +89,6 @@ class explicitPorositySource : public cellSetOption { - protected: // Protected data @@ -128,48 +127,45 @@ public: //- Destructor - virtual ~explicitPorositySource() - {} + virtual ~explicitPorositySource() = default; // Member Functions + //- Access to the porosityModel const porosityModel& model() const { - return porosityPtr_(); + return *porosityPtr_; } - // Add explicit and implicit contributions - //- Add implicit contribution to momentum equation - virtual void addSup - ( - fvMatrix& eqn, - const label fieldi - ); + //- Add implicit contribution to momentum equation + virtual void addSup + ( + fvMatrix& eqn, + const label fieldi + ); - //- Add implicit contribution to compressible momentum equation - virtual void addSup - ( - const volScalarField& rho, - fvMatrix& eqn, - const label fieldi - ); + //- Add implicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); - //- Add implicit contribution to phase momentum equation - virtual void addSup - ( - const volScalarField& alpha, - const volScalarField& rho, - fvMatrix& eqn, - const label fieldi - ); + //- Add implicit contribution to phase momentum equation + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); - // IO - - //- Read dictionary - virtual bool read(const dictionary& dict); + //- Read dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C index 39cb29279d..0ecc8d31dd 100644 --- a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C +++ b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C @@ -48,7 +48,6 @@ namespace fv } } - const Foam::word Foam::fv::jouleHeatingSource::sigmaName(typeName + ":sigma"); @@ -73,26 +72,24 @@ Foam::fv::jouleHeatingSource::transformSigma const volVectorField& sigmaLocal ) const { - tmp tsigma + auto tsigma = tmp::New ( - new volSymmTensorField + IOobject ( - IOobject - ( - sigmaName, - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), + sigmaName, + mesh_.time().timeName(), mesh_, - dimensionedSymmTensor(sigmaLocal.dimensions(), Zero), - zeroGradientFvPatchField::typeName - ) + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedSymmTensor(sigmaLocal.dimensions(), Zero), + zeroGradientFvPatchField::typeName ); - volSymmTensorField& sigma = tsigma.ref(); + auto& sigma = tsigma.ref(); + sigma.primitiveFieldRef() = coordSys().R().transformVector(sigmaLocal); sigma.correctBoundaryConditions(); @@ -212,4 +209,33 @@ void Foam::fv::jouleHeatingSource::addSup } +bool Foam::fv::jouleHeatingSource::read(const dictionary& dict) +{ + if (option::read(dict)) + { + coeffs_.readIfPresent("T", TName_); + + anisotropicElectricalConductivity_ = + coeffs_.get("anisotropicElectricalConductivity"); + + if (anisotropicElectricalConductivity_) + { + Info<< " Using vector electrical conductivity" << endl; + + initialiseSigma(coeffs_, vectorSigmaVsTPtr_); + coordSysPtr_ = coordinateSystem::New(mesh_, coeffs_); + } + else + { + Info<< " Using scalar electrical conductivity" << endl; + + initialiseSigma(coeffs_, scalarSigmaVsTPtr_); + } + + return true; + } + + return false; +} + // ************************************************************************* // diff --git a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceIO.C b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceIO.C deleted file mode 100644 index ce4dde6f95..0000000000 --- a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceIO.C +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. - \\/ 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 "jouleHeatingSource.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -bool Foam::fv::jouleHeatingSource::read(const dictionary& dict) -{ - if (option::read(dict)) - { - coeffs_.readIfPresent("T", TName_); - coeffs_.lookup("anisotropicElectricalConductivity") - >> anisotropicElectricalConductivity_; - - if (anisotropicElectricalConductivity_) - { - Info<< " Using vector electrical conductivity" << endl; - - initialiseSigma(coeffs_, vectorSigmaVsTPtr_); - coordSysPtr_ = coordinateSystem::New(mesh_, coeffs_); - } - else - { - Info<< " Using scalar electrical conductivity" << endl; - - initialiseSigma(coeffs_, scalarSigmaVsTPtr_); - } - - return true; - } - - return false; -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C index 87d0434f15..ae9ebf5b28 100644 --- a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C +++ b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C @@ -39,21 +39,18 @@ void Foam::fv::jouleHeatingSource::initialiseSigma // Sigma to be defined using a Function1 type sigmaVsTPtr = Function1::New("sigma", dict); - tmp tsigma + auto tsigma = tmp::New ( - new VolFieldType + IOobject ( - IOobject - ( - typeName + ":sigma", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), + typeName + ":sigma", + mesh_.time().timeName(), mesh_, - dimensioned(sqr(dimCurrent)/dimPower/dimLength, Zero) - ) + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh_, + dimensioned(sqr(dimCurrent)/dimPower/dimLength, Zero) ); mesh_.objectRegistry::store(tsigma.ptr()); @@ -64,20 +61,17 @@ void Foam::fv::jouleHeatingSource::initialiseSigma else { // Sigma to be defined by user input - tmp tsigma + auto tsigma = tmp::New ( - new VolFieldType + IOobject ( - IOobject - ( - typeName + ":sigma", - mesh_.time().timeName(), - mesh_, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh_ - ) + typeName + ":sigma", + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ ); mesh_.objectRegistry::store(tsigma.ptr()); @@ -97,10 +91,7 @@ Foam::fv::jouleHeatingSource::updateSigma typedef GeometricField VolFieldType; VolFieldType& sigma = - const_cast - ( - mesh_.lookupObject(typeName + ":sigma") - ); + mesh_.lookupObjectRef(typeName + ":sigma"); if (!sigmaVsTPtr.valid()) { diff --git a/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.C b/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.C index 48920d1407..699897668a 100644 --- a/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.C +++ b/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForce.C @@ -86,14 +86,14 @@ Foam::fv::meanVelocityForce::meanVelocityForce ) : cellSetOption(sourceName, modelType, dict, mesh), - Ubar_(coeffs_.lookup("Ubar")), + Ubar_(coeffs_.get("Ubar")), gradP0_(0.0), dGradP_(0.0), flowDir_(Ubar_/mag(Ubar_)), relaxation_(coeffs_.lookupOrDefault("relaxation", 1.0)), rAPtr_(nullptr) { - coeffs_.lookup("fields") >> fieldNames_; + coeffs_.readEntry("fields", fieldNames_); if (fieldNames_.size() != 1) { @@ -113,7 +113,7 @@ Foam::fv::meanVelocityForce::meanVelocityForce { Info<< " Reading pressure gradient from file" << endl; dictionary propsDict(dictionary::null, propsFile); - propsDict.lookup("gradient") >> gradP0_; + propsDict.readEntry("gradient", gradP0_); } Info<< " Initial pressure gradient = " << gradP0_ << nl << endl; @@ -260,4 +260,12 @@ void Foam::fv::meanVelocityForce::constrain } +bool Foam::fv::meanVelocityForce::read(const dictionary& dict) +{ + NotImplemented; + + return false; +} + + // ************************************************************************* // diff --git a/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForceIO.C b/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForceIO.C deleted file mode 100644 index cccffc523e..0000000000 --- a/src/fvOptions/sources/derived/meanVelocityForce/meanVelocityForceIO.C +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 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 "meanVelocityForce.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -bool Foam::fv::meanVelocityForce::read(const dictionary& dict) -{ - NotImplemented; - - return false; -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C b/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C index a305326fa5..f89ffa55a2 100644 --- a/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C +++ b/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C @@ -56,7 +56,7 @@ Foam::fv::patchMeanVelocityForce::patchMeanVelocityForce ) : meanVelocityForce(sourceName, modelType, dict, mesh), - patch_(coeffs_.lookup("patch")), + patch_(coeffs_.get("patch")), patchi_(mesh.boundaryMesh().findPatchID(patch_)) { if (patchi_ < 0) diff --git a/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.H b/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.H index a894757066..bb7e725a48 100644 --- a/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.H +++ b/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.H @@ -110,6 +110,11 @@ public: const dictionary& dict, const fvMesh& mesh ); + + + //- Destructor + ~patchMeanVelocityForce() = default; + }; diff --git a/src/fvOptions/sources/derived/phaseLimitStabilization/PhaseLimitStabilization.C b/src/fvOptions/sources/derived/phaseLimitStabilization/PhaseLimitStabilization.C index 2538a4a24c..7d90e9801d 100644 --- a/src/fvOptions/sources/derived/phaseLimitStabilization/PhaseLimitStabilization.C +++ b/src/fvOptions/sources/derived/phaseLimitStabilization/PhaseLimitStabilization.C @@ -40,9 +40,9 @@ Foam::fv::PhaseLimitStabilization::PhaseLimitStabilization ) : option(name, modelType, dict, mesh), - fieldName_(coeffs_.lookup("field")), - rateName_(coeffs_.lookup("rate")), - residualAlpha_(readScalar(coeffs_.lookup("residualAlpha"))) + fieldName_(coeffs_.get("field")), + rateName_(coeffs_.get("rate")), + residualAlpha_(coeffs_.get("residualAlpha")) { fieldNames_.setSize(1, fieldName_); applied_.setSize(1, false); @@ -74,14 +74,12 @@ bool Foam::fv::PhaseLimitStabilization::read(const dictionary& dict) { if (option::read(dict)) { - coeffs_.lookup("residualAlpha") >> residualAlpha_; + coeffs_.readEntry("residualAlpha", residualAlpha_); return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C index e77262715c..389210b665 100644 --- a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C +++ b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C @@ -115,13 +115,11 @@ bool Foam::fv::radialActuationDiskSource::read(const dictionary& dict) { if (actuationDiskSource::read(dict)) { - coeffs_.lookup("coeffs") >> radialCoeffs_; + coeffs_.readEntry("coeffs", radialCoeffs_); return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H index 55e8fa9b4f..024997d991 100644 --- a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H +++ b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H @@ -138,8 +138,7 @@ public: //- Destructor - virtual ~radialActuationDiskSource() - {} + virtual ~radialActuationDiskSource() = default; // Member Functions @@ -160,8 +159,6 @@ public: ); - // IO - //- Read dictionary virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.C b/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.C index 14a8c44de1..ad79440aef 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.C @@ -103,10 +103,10 @@ Foam::bladeModel::bladeModel(const dictionary& dict) } else { - dict.lookup("data") >> data; + dict.readEntry("data", data); } - if (data.size() > 0) + if (data.size()) { profileName_.setSize(data.size()); profileID_.setSize(data.size()); @@ -130,11 +130,6 @@ Foam::bladeModel::bladeModel(const dictionary& dict) } } -// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::bladeModel::~bladeModel() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.H b/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.H index d9269c093d..d6db525e5c 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.H @@ -64,7 +64,6 @@ namespace Foam class bladeModel { - protected: // Protected data @@ -111,7 +110,7 @@ public: //- Destructor - virtual ~bladeModel(); + virtual ~bladeModel() = default; // Member functions diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C index ce355867b1..992598d47a 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C @@ -50,7 +50,7 @@ void Foam::lookupProfile::interpolateWeights ) const { i2 = 0; - label nElem = values.size(); + const label nElem = values.size(); if (nElem == 1) { @@ -108,10 +108,10 @@ Foam::lookupProfile::lookupProfile } else { - dict.lookup("data") >> data; + dict.readEntry("data", data); } - if (data.size() > 0) + if (data.size()) { AOA_.setSize(data.size()); Cd_.setSize(data.size()); diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H index 71d89d30e6..63594f3826 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H @@ -67,7 +67,6 @@ class lookupProfile : public profileModel { - protected: // Protected data @@ -103,13 +102,14 @@ public: //- Constructor lookupProfile(const dictionary& dict, const word& modelName); + //- Destructor + ~lookupProfile() = default; - // Member functions - // Evaluation + // Member Functions - //- Return the Cd and Cl for a given angle-of-attack - virtual void Cdl(const scalar alpha, scalar& Cd, scalar& Cl) const; + //- Return the Cd and Cl for a given angle-of-attack + virtual void Cdl(const scalar alpha, scalar& Cd, scalar& Cl) const; }; diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.C b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.C index 8f4f471567..74134dedcd 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.C @@ -49,14 +49,7 @@ Foam::profileModel::profileModel(const dictionary& dict, const word& name) : dict_(dict), name_(name), - fName_(fileName::null) -{ - dict.readIfPresent("file", fName_); -} - -// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::profileModel::~profileModel() + fName_(dict.lookupOrDefault("file", fileName::null)) {} @@ -75,7 +68,7 @@ Foam::autoPtr Foam::profileModel::New { const word& modelName = dict.dictName(); - const word modelType(dict.lookup("type")); + const word modelType(dict.get("type")); Info<< " - creating " << modelType << " profile " << modelName << endl; diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.H b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.H index d5817f092f..094822267a 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.H @@ -50,7 +50,6 @@ namespace Foam class profileModel { - protected: // Protected data @@ -102,7 +101,7 @@ public: //- Destructor - virtual ~profileModel(); + virtual ~profileModel() = default; // Member functions diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModelList.C b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModelList.C index f39131df6b..7b0220ad75 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModelList.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModelList.C @@ -42,7 +42,7 @@ Foam::profileModelList::profileModelList Info<< " Constructing blade profiles:" << endl; - if (modelNames.size() > 0) + if (modelNames.size()) { this->setSize(modelNames.size()); @@ -65,12 +65,6 @@ Foam::profileModelList::profileModelList } -// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::profileModelList::~profileModelList() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::profileModelList::connectBlades diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModelList.H b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModelList.H index a6e1cd9117..f1b886bcde 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModelList.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModelList.H @@ -44,14 +44,13 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class profileModelList Declaration + Class profileModelList Declaration \*---------------------------------------------------------------------------*/ class profileModelList : public PtrList { - protected: // Protected data @@ -66,7 +65,7 @@ public: profileModelList(const dictionary& dict, const bool readFields = true); //- Destructor - ~profileModelList(); + ~profileModelList() = default; // Member Functions diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.C b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.C index c7f43fa2aa..d1194a0d9e 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.C @@ -93,8 +93,8 @@ Foam::seriesProfile::seriesProfile } else { - dict.lookup("CdCoeffs") >> CdCoeffs_; - dict.lookup("ClCoeffs") >> ClCoeffs_; + dict.readEntry("CdCoeffs", CdCoeffs_); + dict.readEntry("ClCoeffs", ClCoeffs_); } diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.H b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.H index 9af303017a..da3fb7e8b1 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.H @@ -65,7 +65,6 @@ class seriesProfile : public profileModel { - protected: // Protected data @@ -104,13 +103,14 @@ public: //- Constructor seriesProfile(const dictionary& dict, const word& modelName); + //- Destructor + ~seriesProfile() = default; + // Member functions - // Evaluation - - //- Return the Cd and Cl for a given angle-of-attack - virtual void Cdl(const scalar alpha, scalar& Cd, scalar& Cl) const; + //- Return the Cd and Cl for a given angle-of-attack + virtual void Cdl(const scalar alpha, scalar& Cd, scalar& Cl) const; }; diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C index 444b2eabcb..851cc93315 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C @@ -318,13 +318,13 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() } } reduce(axis, maxMagSqrOp()); - axis /= mag(axis); + axis.normalise(); // Correct the axis direction using a point above the rotor { vector pointAbove(coeffs_.get("pointAbove")); vector dir = pointAbove - origin; - dir /= mag(dir); + dir.normalise(); if ((dir & axis) < 0) { axis *= -1.0; diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H index 4799c4705b..611a26b775 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H @@ -199,7 +199,7 @@ protected: //- Rotor local cylindrical coordinate system (r, theta, z) cylindricalCS coordSys_; - //- Rotor transformation co-ordinate system + //- Rotor transformation coordinate system autoPtr cylindrical_; //- Maximum radius diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C index f305281d53..bcec1750a0 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C @@ -165,28 +165,25 @@ void Foam::fv::rotorDiskSource::writeField const bool writeNow ) const { - typedef GeometricField fieldType; + typedef GeometricField FieldType; if (mesh_.time().writeTime() || writeNow) { - tmp tfield + auto tfield = tmp::New ( - new fieldType + IOobject ( - IOobject - ( - name, - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + name, + mesh_.time().timeName(), mesh_, - dimensioned(dimless, Zero) - ) + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensioned(dimless, Zero) ); - Field& field = tfield.ref().primitiveFieldRef(); + auto& field = tfield.ref().primitiveFieldRef(); if (cells_.size() != values.size()) { diff --git a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C index d0b3468d54..f6e978173c 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C @@ -49,27 +49,21 @@ Foam::fixedTrim::fixedTrim ) : trimModel(rotor, dict, typeName), - thetag_(rotor.cells().size(), 0.0) + thetag_(rotor.cells().size(), Zero) { read(dict); } -// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::fixedTrim::~fixedTrim() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::fixedTrim::read(const dictionary& dict) { trimModel::read(dict); - scalar theta0 = degToRad(readScalar(coeffs_.lookup("theta0"))); - scalar theta1c = degToRad(readScalar(coeffs_.lookup("theta1c"))); - scalar theta1s = degToRad(readScalar(coeffs_.lookup("theta1s"))); + const scalar theta0 = degToRad(coeffs_.get("theta0")); + const scalar theta1c = degToRad(coeffs_.get("theta1c")); + const scalar theta1s = degToRad(coeffs_.get("theta1s")); const List& x = rotor_.x(); forAll(thetag_, i) @@ -98,7 +92,8 @@ void Foam::fixedTrim::correct ( const volScalarField rho, const vectorField& U, - vectorField& force) + vectorField& force +) {} diff --git a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H index cd41018074..71c1c0e7ba 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H @@ -50,7 +50,6 @@ class fixedTrim : public trimModel { - protected: // Protected data @@ -68,7 +67,7 @@ public: fixedTrim(const fv::rotorDiskSource& rotor, const dictionary& dict); //- Destructor - virtual ~fixedTrim(); + virtual ~fixedTrim() = default; // Member functions diff --git a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C index 905c7a391e..bfc457b95f 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C @@ -211,12 +211,6 @@ Foam::targetCoeffTrim::targetCoeffTrim } -// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::targetCoeffTrim::~targetCoeffTrim() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::targetCoeffTrim::read(const dictionary& dict) @@ -231,16 +225,16 @@ void Foam::targetCoeffTrim::read(const dictionary& dict) ext = "Coeff"; } - target_[0] = readScalar(targetDict.lookup("thrust" + ext)); - target_[1] = readScalar(targetDict.lookup("pitch" + ext)); - target_[2] = readScalar(targetDict.lookup("roll" + ext)); + target_[0] = targetDict.get("thrust" + ext); + target_[1] = targetDict.get("pitch" + ext); + target_[2] = targetDict.get("roll" + ext); const dictionary& pitchAngleDict(coeffs_.subDict("pitchAngles")); - theta_[0] = degToRad(readScalar(pitchAngleDict.lookup("theta0Ini"))); - theta_[1] = degToRad(readScalar(pitchAngleDict.lookup("theta1cIni"))); - theta_[2] = degToRad(readScalar(pitchAngleDict.lookup("theta1sIni"))); + theta_[0] = degToRad(pitchAngleDict.get("theta0Ini")); + theta_[1] = degToRad(pitchAngleDict.get("theta1cIni")); + theta_[2] = degToRad(pitchAngleDict.get("theta1sIni")); - coeffs_.lookup("calcFrequency") >> calcFrequency_; + coeffs_.readEntry("calcFrequency", calcFrequency_); coeffs_.readIfPresent("nIter", nIter_); coeffs_.readIfPresent("tol", tol_); @@ -251,7 +245,7 @@ void Foam::targetCoeffTrim::read(const dictionary& dict) dTheta_ = degToRad(dTheta_); } - alpha_ = readScalar(coeffs_.lookup("alpha")); + alpha_ = coeffs_.get("alpha"); } @@ -259,8 +253,8 @@ Foam::tmp Foam::targetCoeffTrim::thetag() const { const List& x = rotor_.x(); - tmp ttheta(new scalarField(x.size())); - scalarField& t = ttheta.ref(); + auto ttheta = tmp::New(x.size()); + auto& t = ttheta.ref(); forAll(t, i) { diff --git a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H index 8925e03bea..774dab0da9 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H @@ -89,7 +89,6 @@ class targetCoeffTrim : public trimModel { - protected: // Protected data @@ -153,10 +152,10 @@ public: targetCoeffTrim(const fv::rotorDiskSource& rotor, const dictionary& dict); //- Destructor - virtual ~targetCoeffTrim(); + virtual ~targetCoeffTrim() = default; - // Member functions + // Member Functions //- Read void read(const dictionary& dict); diff --git a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C index bfd9f3d935..668507d8c2 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C @@ -50,11 +50,6 @@ Foam::trimModel::trimModel read(dict); } -// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::trimModel::~trimModel() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H index 6f078d7c98..228cb3877b 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H @@ -50,7 +50,6 @@ namespace Foam class trimModel { - protected: // Protected data @@ -108,7 +107,7 @@ public: //- Destructor - virtual ~trimModel(); + virtual ~trimModel() = default; // Member functions diff --git a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C index 3aef03cc40..58d37dda79 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C @@ -33,7 +33,7 @@ Foam::autoPtr Foam::trimModel::New const dictionary& dict ) { - const word modelType(dict.lookup(typeName)); + const word modelType(dict.get(typeName)); Info<< " Selecting " << typeName << " " << modelType << endl; diff --git a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.C b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.C index 09d2fec8d1..60cbf5b943 100644 --- a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.C +++ b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.C @@ -79,7 +79,7 @@ Foam::fv::solidificationMeltingSource::Cp() const { if (CpName_ == "CpRef") { - scalar CpRef = readScalar(coeffs_.lookup("CpRef")); + scalar CpRef = coeffs_.get("CpRef"); return tmp::New ( @@ -129,7 +129,7 @@ Foam::vector Foam::fv::solidificationMeltingSource::g() const return value.value(); } - return coeffs_.lookup("g"); + return coeffs_.get("g"); } @@ -179,18 +179,18 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource ) : cellSetOption(sourceName, modelType, dict, mesh), - Tmelt_(readScalar(coeffs_.lookup("Tmelt"))), - L_(readScalar(coeffs_.lookup("L"))), + Tmelt_(coeffs_.get("Tmelt")), + L_(coeffs_.get("L")), relax_(coeffs_.lookupOrDefault("relax", 0.9)), mode_(thermoModeTypeNames_.lookup("thermoMode", coeffs_)), - rhoRef_(readScalar(coeffs_.lookup("rhoRef"))), + rhoRef_(coeffs_.get("rhoRef")), TName_(coeffs_.lookupOrDefault("T", "T")), CpName_(coeffs_.lookupOrDefault("Cp", "Cp")), UName_(coeffs_.lookupOrDefault("U", "U")), phiName_(coeffs_.lookupOrDefault("phi", "phi")), Cu_(coeffs_.lookupOrDefault("Cu", 100000)), q_(coeffs_.lookupOrDefault("q", 0.001)), - beta_(readScalar(coeffs_.lookup("beta"))), + beta_(coeffs_.get("beta")), alpha1_ ( IOobject @@ -310,4 +310,31 @@ void Foam::fv::solidificationMeltingSource::addSup } +bool Foam::fv::solidificationMeltingSource::read(const dictionary& dict) +{ + if (cellSetOption::read(dict)) + { + coeffs_.readEntry("Tmelt", Tmelt_); + coeffs_.readEntry("L", L_); + + coeffs_.readIfPresent("relax", relax_); + + mode_ = thermoModeTypeNames_.lookup("thermoMode", coeffs_); + + coeffs_.readEntry("rhoRef", rhoRef_); + coeffs_.readIfPresent("T", TName_); + coeffs_.readIfPresent("U", UName_); + + coeffs_.readIfPresent("Cu", Cu_); + coeffs_.readIfPresent("q", q_); + + coeffs_.readIfPresent("beta", beta_); + + return true; + } + + return false; +} + + // ************************************************************************* // diff --git a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H index 256142c8c1..829e46b655 100644 --- a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H +++ b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H @@ -218,40 +218,38 @@ public: ); + //- Destructor + ~solidificationMeltingSource() = default; + + // Member Functions - // Add explicit and implicit contributions + //- Add explicit contribution to enthalpy equation + virtual void addSup(fvMatrix& eqn, const label fieldi); - //- Add explicit contribution to enthalpy equation - virtual void addSup(fvMatrix& eqn, const label fieldi); - - //- Add implicit contribution to momentum equation - virtual void addSup(fvMatrix& eqn, const label fieldi); + //- Add implicit contribution to momentum equation + virtual void addSup(fvMatrix& eqn, const label fieldi); - // Add explicit and implicit contributions to compressible equation + //- Add explicit contribution to compressible enthalpy equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); - //- Add explicit contribution to compressible enthalpy equation - virtual void addSup - ( - const volScalarField& rho, - fvMatrix& eqn, - const label fieldi - ); - - //- Add implicit contribution to compressible momentum equation - virtual void addSup - ( - const volScalarField& rho, - fvMatrix& eqn, - const label fieldi - ); + //- Add implicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); - // IO - - //- Read source dictionary - virtual bool read(const dictionary& dict); + //- Read source dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSourceIO.C b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSourceIO.C deleted file mode 100644 index baaec14568..0000000000 --- a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSourceIO.C +++ /dev/null @@ -1,61 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2014-2016 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 "solidificationMeltingSource.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -bool Foam::fv::solidificationMeltingSource::read(const dictionary& dict) -{ - if (cellSetOption::read(dict)) - { - coeffs_.lookup("Tmelt") >> Tmelt_; - coeffs_.lookup("L") >> L_; - - coeffs_.readIfPresent("relax", relax_); - - mode_ = thermoModeTypeNames_.lookup("thermoMode", coeffs_); - - coeffs_.lookup("rhoRef") >> rhoRef_; - coeffs_.readIfPresent("T", TName_); - coeffs_.readIfPresent("U", UName_); - - coeffs_.readIfPresent("Cu", Cu_); - coeffs_.readIfPresent("q", q_); - - coeffs_.readIfPresent("beta", beta_); - - return true; - } - else - { - return false; - } - - return false; -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C index a6f0da6abf..e27a199e38 100644 --- a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C +++ b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C @@ -51,12 +51,6 @@ Foam::tabulated6DoFAcceleration::tabulated6DoFAcceleration } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::tabulated6DoFAcceleration::~tabulated6DoFAcceleration() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::tabulated6DoFAcceleration::accelerationVectors @@ -106,7 +100,7 @@ bool Foam::tabulated6DoFAcceleration::read fileName newTimeDataFileName ( - fileName(accelerationCoeffs_.lookup("timeDataFileName")).expand() + accelerationCoeffs_.get("timeDataFileName").expand() ); if (newTimeDataFileName != timeDataFileName_) diff --git a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.H b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.H index af7a4bcc25..ac13b6bb0d 100644 --- a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.H +++ b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.H @@ -98,7 +98,7 @@ public: //- Destructor - virtual ~tabulated6DoFAcceleration(); + virtual ~tabulated6DoFAcceleration() = default; // Member Functions diff --git a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.C b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.C index a56c760282..e8eb54dc16 100644 --- a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.C +++ b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.C @@ -100,10 +100,8 @@ bool Foam::fv::tabulatedAccelerationSource::read(const dictionary& dict) { return motion_.read(coeffs_); } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.H b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.H index 3c8d8b1eb1..54de6d5f63 100644 --- a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.H +++ b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSource.H @@ -69,7 +69,6 @@ class tabulatedAccelerationSource : public option { - protected: // Protected data @@ -126,8 +125,7 @@ public: //- Destructor - virtual ~tabulatedAccelerationSource() - {} + virtual ~tabulatedAccelerationSource() = default; // Member Functions diff --git a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSourceTemplates.C b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSourceTemplates.C index af03ba7ae1..8ef5b614b1 100644 --- a/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSourceTemplates.C +++ b/src/fvOptions/sources/derived/tabulatedAccelerationSource/tabulatedAccelerationSourceTemplates.C @@ -44,10 +44,7 @@ void Foam::fv::tabulatedAccelerationSource::addSup if (mesh_.foundObject("g")) { uniformDimensionedVectorField& g = - const_cast - ( - mesh_.lookupObject("g") - ); + mesh_.lookupObjectRef("g"); const uniformDimensionedScalarField& hRef = mesh_.lookupObject("hRef"); @@ -61,15 +58,11 @@ void Foam::fv::tabulatedAccelerationSource::addSup : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0) ); - const_cast - ( - mesh_.lookupObject("gh") - ) = (g & mesh_.C()) - ghRef; + mesh_.lookupObjectRef("gh") + = (g & mesh_.C()) - ghRef; - const_cast - ( - mesh_.lookupObject("ghf") - ) = (g & mesh_.Cf()) - ghRef; + mesh_.lookupObjectRef("ghf") + = (g & mesh_.Cf()) - ghRef; } // ... otherwise include explicitly in the momentum equation else diff --git a/src/fvOptions/sources/derived/viscousDissipation/viscousDissipation.C b/src/fvOptions/sources/derived/viscousDissipation/viscousDissipation.C index 3a78957d9d..6c0f0b0950 100644 --- a/src/fvOptions/sources/derived/viscousDissipation/viscousDissipation.C +++ b/src/fvOptions/sources/derived/viscousDissipation/viscousDissipation.C @@ -51,21 +51,18 @@ namespace fv Foam::tmp Foam::fv::viscousDissipation::rho() const { - tmp trho + auto trho = tmp::New ( - new volScalarField + IOobject ( - IOobject - ( - "trho", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "trho", + mesh_.time().timeName(), mesh_, - rho_ - ) + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + rho_ ); if (rho_.value() > 0) @@ -118,7 +115,7 @@ Foam::fv::viscousDissipation::viscousDissipation if (fieldNames_.empty()) { - coeffs_.lookup("fields") >> fieldNames_; + coeffs_.readEntry("fields", fieldNames_); } if (fieldNames_.size() != 1) @@ -138,10 +135,11 @@ Foam::fv::viscousDissipation::devRhoReff() const { // Incompressible { - typedef incompressible::turbulenceModel turbType; - - const turbType* turbPtr = - mesh_.lookupObjectPtr(turbulenceModel::propertiesName); + const auto* turbPtr = + mesh_.lookupObjectPtr + ( + turbulenceModel::propertiesName + ); if (turbPtr) { @@ -151,10 +149,11 @@ Foam::fv::viscousDissipation::devRhoReff() const // Compressible { - typedef compressible::turbulenceModel turbType; - - const turbType* turbPtr = - mesh_.lookupObjectPtr(turbulenceModel::propertiesName); + const auto* turbPtr = + mesh_.lookupObjectPtr + ( + turbulenceModel::propertiesName + ); if (turbPtr) { @@ -180,23 +179,20 @@ void Foam::fv::viscousDissipation::addSup typedef typename outerProduct::type GradType; typedef GeometricField GradFieldType; - word gradUName("grad(" + UName_ + ')'); + const word gradUName("grad(" + UName_ + ')'); - tmp tgradU + auto tgradU = tmp::New ( - new GradFieldType + IOobject ( - IOobject - ( - "gradU", - mesh_.time().timeName(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedTensor(inv(dimTime), Zero) - ) + "gradU", + mesh_.time().timeName(), + mesh_.time(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedTensor(inv(dimTime), Zero) ); // Cached? diff --git a/src/fvOptions/sources/derived/viscousDissipation/viscousDissipation.H b/src/fvOptions/sources/derived/viscousDissipation/viscousDissipation.H index ef1497f1a9..9e4976d9bc 100644 --- a/src/fvOptions/sources/derived/viscousDissipation/viscousDissipation.H +++ b/src/fvOptions/sources/derived/viscousDissipation/viscousDissipation.H @@ -115,25 +115,19 @@ public: // Member Functions - // Evaluate - - //- Add explicit contribution to compressible energy equation - virtual void addSup - ( - const volScalarField& rho, - fvMatrix& eqn, - const label fieldi - ); - - - // IO - - //- Read source dictionary - virtual bool read(const dictionary& dict) - { - return true; - } + //- Add explicit contribution to compressible energy equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi + ); + //- Read source dictionary + virtual bool read(const dictionary& dict) + { + return true; + } }; diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.C b/src/fvOptions/sources/general/codedSource/CodedSource.C index 567e7d666e..618bb30f65 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.C +++ b/src/fvOptions/sources/general/codedSource/CodedSource.C @@ -38,7 +38,7 @@ void Foam::fv::CodedSource::prepare const dynamicCodeContext& context ) const { - word sourceType(pTraits::typeName); + const word sourceType(pTraits::typeName); // Set additional rewrite rules dynCode.setFilterVariable("typeName", name_); diff --git a/src/fvOptions/sources/general/codedSource/CodedSourceIO.C b/src/fvOptions/sources/general/codedSource/CodedSourceIO.C index 1c2b661c0f..bf27297e0e 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSourceIO.C +++ b/src/fvOptions/sources/general/codedSource/CodedSourceIO.C @@ -33,7 +33,7 @@ bool Foam::fv::CodedSource::read(const dictionary& dict) { if (cellSetOption::read(dict)) { - coeffs_.lookup("fields") >> fieldNames_; + coeffs_.readEntry("fields", fieldNames_); applied_.setSize(fieldNames_.size(), false); dict.readCompat("name", {{"redirectType", 1706}}, name_); @@ -92,10 +92,8 @@ bool Foam::fv::CodedSource::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.C b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.C index f98c6dbd1a..eb49acd171 100644 --- a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.C +++ b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.C @@ -92,8 +92,8 @@ void Foam::fv::SemiImplicitSource::setFieldData(const dictionary& dict) forAllConstIter(dictionary, dict, iter) { fieldNames_[i] = iter().keyword(); - dict.lookup(iter().keyword()) >> injectionRate_[i]; - i++; + dict.readEntry(iter().keyword(), injectionRate_[i]); + ++i; } // Set volume normalisation @@ -197,4 +197,20 @@ void Foam::fv::SemiImplicitSource::addSup } + +template +bool Foam::fv::SemiImplicitSource::read(const dictionary& dict) +{ + if (cellSetOption::read(dict)) + { + volumeMode_ = wordToVolumeModeType(coeffs_.get("volumeMode")); + setFieldData(coeffs_.subDict("injectionRateSuSp")); + + return true; + } + + return false; +} + + // ************************************************************************* // diff --git a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H index 9b22b05bc6..8adc26adac 100644 --- a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H +++ b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H @@ -78,13 +78,8 @@ namespace Foam namespace fv { -// Forward declaration of classes - -template -class SemiImplicitSource; - - -// Forward declaration of friend functions +// Forward declarations +template class SemiImplicitSource; template Ostream& operator<< @@ -216,7 +211,6 @@ public: #ifdef NoRepository #include "SemiImplicitSource.C" - #include "SemiImplicitSourceIO.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSourceIO.C b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSourceIO.C deleted file mode 100644 index 6d232b85cf..0000000000 --- a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSourceIO.C +++ /dev/null @@ -1,47 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 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 "SemiImplicitSource.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -bool Foam::fv::SemiImplicitSource::read(const dictionary& dict) -{ - if (cellSetOption::read(dict)) - { - volumeMode_ = wordToVolumeModeType(coeffs_.lookup("volumeMode")); - setFieldData(coeffs_.subDict("injectionRateSuSp")); - - return true; - } - else - { - return false; - } -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C index 5824ba316b..b3ce164590 100644 --- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C @@ -296,10 +296,8 @@ bool Foam::fv::interRegionExplicitPorositySource::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H index 9ffc92ddc7..c8d7602a7f 100644 --- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H @@ -73,6 +73,7 @@ SourceFiles namespace Foam { +// Forward declarations class porosityModel; namespace fv @@ -87,7 +88,6 @@ class interRegionExplicitPorositySource : public interRegionOption { - protected: // Protected data diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.C index 7422b11ef5..e2f166d64c 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.C @@ -114,10 +114,8 @@ bool Foam::fv::constantHeatTransfer::read(const dictionary& dict) { return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.H index 1de4154726..db11f2a4e3 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.H @@ -54,8 +54,6 @@ class constantHeatTransfer : public interRegionHeatTransferModel { -private: - // Private data //- Constant heat transfer coefficient [W/m2/K] @@ -68,7 +66,7 @@ private: public: //- Runtime type information - TypeName("constantHeatTransfer"); + TypeName("constantHeatTransfer"); // Constructors @@ -92,11 +90,8 @@ public: //- Calculate the heat transfer coefficient virtual void calculateHtc(); - - // IO - - //- Read dictionary - virtual bool read(const dictionary& dict); + //- Read dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C index 257f3f21de..0c0ee7252d 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C @@ -119,9 +119,10 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel dict, mesh ), - nbrModelName_(coeffs_.lookup("nbrModel")), + nbrModelName_(coeffs_.get("nbrModel")), nbrModel_(nullptr), firstIter_(true), + semiImplicit_(false), timeIndex_(-1), htc_ ( @@ -137,26 +138,19 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel dimensionedScalar(dimEnergy/dimTime/dimTemperature/dimVolume, Zero), zeroGradientFvPatchScalarField::typeName ), - semiImplicit_(false), TName_(coeffs_.lookupOrDefault("T", "T")), TNbrName_(coeffs_.lookupOrDefault("TNbr", "T")) { if (active()) { - coeffs_.lookup("fields") >> fieldNames_; + coeffs_.readEntry("fields", fieldNames_); applied_.setSize(fieldNames_.size(), false); - coeffs_.lookup("semiImplicit") >> semiImplicit_; + coeffs_.readEntry("semiImplicit", semiImplicit_); } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::fv::interRegionHeatTransferModel::~interRegionHeatTransferModel() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::fv::interRegionHeatTransferModel::addSup @@ -173,23 +167,20 @@ void Foam::fv::interRegionHeatTransferModel::addSup const volScalarField& T = mesh_.lookupObject(TName_); - tmp tTmapped + auto tTmapped = tmp::New ( - new volScalarField + IOobject ( - IOobject - ( - type() + ":Tmapped", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - T - ) + type() + ":Tmapped", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + T ); - volScalarField& Tmapped = tTmapped.ref(); + auto& Tmapped = tTmapped.ref(); const fvMesh& nbrMesh = mesh_.time().lookupObject(nbrRegionName_); @@ -267,4 +258,15 @@ void Foam::fv::interRegionHeatTransferModel::addSup } +bool Foam::fv::interRegionHeatTransferModel::read(const dictionary& dict) +{ + if (interRegionOption::read(dict)) + { + return true; + } + + return false; +} + + // ************************************************************************* // diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.H index 6ab2f8c84f..292ed9dbbc 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.H @@ -72,15 +72,15 @@ protected: //- First iteration bool firstIter_; + //- Flag to activate semi-implicit coupling + bool semiImplicit_; + //- Time index - used for updating htc label timeIndex_; //- Heat transfer coefficient [W/m2/k] times area/volume [1/m] volScalarField htc_; - //- Flag to activate semi-implicit coupling - bool semiImplicit_; - //- Name of temperature field; default = "T" word TName_; @@ -151,7 +151,7 @@ public: //- Destructor - virtual ~interRegionHeatTransferModel(); + virtual ~interRegionHeatTransferModel() = default; // Member Functions diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelIO.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelIO.C deleted file mode 100644 index 72283e61a4..0000000000 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelIO.C +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 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 "interRegionHeatTransferModel.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::fv::interRegionHeatTransferModel::read(const dictionary& dict) -{ - if (interRegionOption::read(dict)) - { - return true; - } - else - { - return false; - } -} - - -// ************************************************************************* // diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C index 4362a4065a..1959a25946 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C @@ -139,10 +139,8 @@ bool Foam::fv::tabulatedHeatTransfer::read(const dictionary& dict) { return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.H index a16e94b1b2..4046818dad 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.H @@ -109,11 +109,8 @@ public: //- Calculate the heat transfer coefficient virtual void calculateHtc(); - - // IO - - //- Read dictionary - virtual bool read(const dictionary& dict); + //- Read dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C index 7bb32e152b..90d34365e7 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -91,8 +91,8 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry() { geometryMode_ = geometryModelNames_.lookup("geometryMode", coeffs_); - Info<< "Region " << mesh_.name() << " " << type() << " " << name_ << " " - << geometryModelNames_[geometryMode_] << " geometry:" << nl; + Info<< "Region " << mesh_.name() << " " << type() << " " << name_ + << " " << geometryModelNames_[geometryMode_] << " geometry:" << nl; switch (geometryMode_) { @@ -101,8 +101,8 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry() const fvMesh& nbrMesh = mesh_.time().lookupObject(nbrRegionName()); - word inletPatchName(coeffs_.lookup("inletPatch")); - word inletPatchNbrName(coeffs_.lookup("inletPatchNbr")); + word inletPatchName(coeffs_.get("inletPatch")); + word inletPatchNbrName(coeffs_.get("inletPatchNbr")); Info<< " Inlet patch : " << inletPatchName << nl << " Inlet patch neighbour : " << inletPatchNbrName @@ -112,9 +112,9 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry() label patchINbr = nbrMesh.boundary().findPatchID(inletPatchNbrName); - scalar alpha(readScalar(coeffs_.lookup("inletBlockageRatio"))); + scalar alpha(coeffs_.get("inletBlockageRatio")); - if ((alpha < 0) || (alpha > 1)) + if (alpha < 0 || alpha > 1) { FatalErrorInFunction << "Inlet patch blockage ratio must be between 0 and 1" @@ -122,12 +122,9 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry() << abort(FatalError); } - scalar alphaNbr - ( - readScalar(coeffs_.lookup("inletBlockageRatioNbr")) - ); + scalar alphaNbr(coeffs_.get("inletBlockageRatioNbr")); - if ((alphaNbr < 0) || (alphaNbr > 1)) + if (alphaNbr < 0 || alphaNbr > 1) { FatalErrorInFunction << "Inlet patch neighbour blockage ratio must be " @@ -147,9 +144,9 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry() (scalar(1) - alphaNbr) *gSum(nbrMesh.magSf().boundaryField()[patchINbr]); - scalar beta(readScalar(coeffs_.lookup("coreBlockageRatio"))); + scalar beta(coeffs_.get("coreBlockageRatio")); - if ((beta < 0) || (beta > 1)) + if (beta < 0 || beta > 1) { FatalErrorInFunction << "Core volume blockage ratio must be between 0 and 1" @@ -165,8 +162,8 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry() } case gmUser: { - coeffs_.lookup("Ain") >> Ain_; - coeffs_.lookup("AinNbr") >> AinNbr_; + coeffs_.readEntry("Ain", Ain_); + coeffs_.readEntry("AinNbr", AinNbr_); if (!coeffs_.readIfPresent("Vcore", Vcore_)) { @@ -281,10 +278,8 @@ bool Foam::fv::tabulatedNTUHeatTransfer::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H index 2b39608726..6504b277f7 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H @@ -209,11 +209,8 @@ public: //- Calculate the heat transfer coefficient virtual void calculateHtc(); - - // I-O - - //- Read dictionary - virtual bool read(const dictionary& dict); + //- Read dictionary + virtual bool read(const dictionary& dict); }; diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C index d1d6744174..c74a87ecc8 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/variableHeatTransfer/variableHeatTransfer.C @@ -65,11 +65,11 @@ Foam::fv::variableHeatTransfer::variableHeatTransfer { if (master_) { - a_ = readScalar(coeffs_.lookup("a")); - b_ = readScalar(coeffs_.lookup("b")); - c_ = readScalar(coeffs_.lookup("c")); - ds_ = readScalar(coeffs_.lookup("ds")); - Pr_ = readScalar(coeffs_.lookup("Pr")); + a_ = coeffs_.get("a"); + b_ = coeffs_.get("b"); + c_ = coeffs_.get("c"); + ds_ = coeffs_.get("ds"); + Pr_ = coeffs_.get("Pr"); AoV_.reset ( new volScalarField @@ -134,10 +134,8 @@ bool Foam::fv::variableHeatTransfer::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; }