ENH: avoid raw dictionary lookup in fvOptions (issue #762)

Style changes:
    - use lookupObjectRef instead of using const_cast
    - use tmp::New factory
This commit is contained in:
Mark Olesen
2018-08-04 00:23:18 +02:00
parent de2eed3e7d
commit e7c1d46904
91 changed files with 588 additions and 1083 deletions

View File

@ -461,7 +461,7 @@ void Foam::Time::readDict()
(
IOstreamOption::versionNumber
(
controlDict_.lookup("writeVersion")
controlDict_.get<float>("writeVersion")
)
);
}

View File

@ -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

View File

@ -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>());
scalar sumVol = 0.0;
for (const label celli : cells_)
{
sumVol += mesh_.V()[celli];
}
reduce(sumVol, sumOp<scalar>());
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))
{
if (coeffs_.readIfPresent("timeStart", timeStart_))
{
coeffs_.readEntry("duration", duration_);
}
}
return true;
}

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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;
}
// ************************************************************************* //

View File

@ -160,11 +160,9 @@ bool Foam::fv::fixedTemperatureConstraint::read(const dictionary& dict)
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -78,7 +78,6 @@ class fixedTemperatureConstraint
:
public cellSetOption
{
public:
//- Temperature mode
@ -137,8 +136,7 @@ public:
//- Destructor
virtual ~fixedTemperatureConstraint()
{}
virtual ~fixedTemperatureConstraint() = default;
// Member Functions

View File

@ -70,7 +70,7 @@ void Foam::fv::velocityDampingConstraint::addDamping(fvMatrix<vector>& eqn)
diag[cellI] += scale*(magU-UMax_);
nDamped++;
++nDamped;
}
}
@ -104,7 +104,7 @@ Foam::fv::velocityDampingConstraint::velocityDampingConstraint
void Foam::fv::velocityDampingConstraint::constrain
(
fvMatrix<vector>& 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<scalar>("UMax");
if (!coeffs_.readIfPresent("UNames", fieldNames_))
{

View File

@ -46,7 +46,8 @@ Description
UMax 100;
// Optional: name of velocity field (default: U)
//UName U;
//U U;
//UNames (U);
}
@ -127,13 +128,13 @@ public:
// Set values directly
//- Constrain vector matrix
virtual void constrain(fvMatrix<vector>& eqn, const label fieldI);
virtual void constrain(fvMatrix<vector>& 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);

View File

@ -61,19 +61,17 @@ bool Foam::fv::FixedValueConstraint<Type>::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;
}
}
template<class Type>

View File

@ -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<scalar>("min")),
Tmax_(coeffs_.get<scalar>("max")),
phase_(coeffs_.lookupOrDefault<word>("phase", word::null))
{
// Set the field name to that of the energy field from which the temperature
@ -80,16 +80,14 @@ 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;
}
}
void Foam::fv::limitTemperature::correct(volScalarField& he)
@ -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]);
}

View File

@ -71,7 +71,6 @@ class limitTemperature
:
public cellSetOption
{
protected:
// Protected data
@ -116,8 +115,7 @@ public:
//- Destructor
virtual ~limitTemperature()
{}
virtual ~limitTemperature() = default;
// Member Functions

View File

@ -56,7 +56,7 @@ Foam::fv::limitVelocity::limitVelocity
:
cellSetOption(name, modelType, dict, mesh),
UName_(coeffs_.lookupOrDefault<word>("U", "U")),
max_(readScalar(coeffs_.lookup("max")))
max_(coeffs_.get<scalar>("max"))
{
fieldNames_.setSize(1, UName_);
applied_.setSize(1, false);
@ -69,15 +69,13 @@ 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;
}
}
void Foam::fv::limitVelocity::correct(volVectorField& U)
@ -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)

View File

@ -65,7 +65,6 @@ class limitVelocity
:
public cellSetOption
{
protected:
// Protected data
@ -107,8 +106,7 @@ public:
//- Destructor
virtual ~limitVelocity()
{}
virtual ~limitVelocity() = default;
// Member Functions

View File

@ -110,7 +110,7 @@ Foam::fv::interRegionOption::interRegionOption
mesh
),
master_(coeffs_.lookupOrDefault("master", true)),
nbrRegionName_(coeffs_.lookup("nbrRegion")),
nbrRegionName_(coeffs_.get<word>("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;
}
// ************************************************************************* //

View File

@ -46,5 +46,4 @@ Foam::fv::interRegionOption::meshInterp() const
}
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "interRegionOption.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::interRegionOption::read(const dictionary& dict)
{
if (option::read(dict))
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -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_))
{

View File

@ -137,8 +137,6 @@ public:
// Member Functions
// Add explicit and implicit contributions
//- Add implicit contribution to momentum equation
virtual void addSup
(
@ -164,8 +162,6 @@ public:
);
// IO
//- Read dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -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<vector>("diskDir")),
Cp_(coeffs_.get<scalar>("Cp")),
Ct_(coeffs_.get<scalar>("Ct")),
diskArea_(coeffs_.get<scalar>("diskArea")),
upstreamPoint_(coeffs_.get<point>("upstreamPoint")),
upstreamCellId_(-1)
{
coeffs_.lookup("fields") >> fieldNames_;
coeffs_.readEntry("fields", fieldNames_);
applied_.setSize(fieldNames_.size(), false);
Info<< " - creating actuation disk zone: "
@ -171,11 +171,9 @@ bool Foam::fv::actuationDiskSource::read(const dictionary& dict)
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -153,8 +153,7 @@ public:
//- Destructor
virtual ~actuationDiskSource()
{}
virtual ~actuationDiskSource() = default;
// Member Functions

View File

@ -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;
}
}

View File

@ -58,7 +58,7 @@ Foam::fv::buoyancyEnergy::buoyancyEnergy
option(sourceName, modelType, dict, mesh),
UName_(coeffs_.lookupOrDefault<word>("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;
}
// ************************************************************************* //

View File

@ -98,8 +98,6 @@ public:
// Member Functions
// Evaluate
//- Add explicit contribution to compressible momentum equation
virtual void addSup
(
@ -109,8 +107,6 @@ public:
);
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "buoyancyEnergy.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::fv::buoyancyEnergy::read(const dictionary& dict)
{
NotImplemented;
return false;
}
// ************************************************************************* //

View File

@ -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;
}
// ************************************************************************* //

View File

@ -97,8 +97,6 @@ public:
// Member Functions
// Evaluate
//- Add explicit contribution to incompressible momentum equation
virtual void addSup
(
@ -115,8 +113,6 @@ public:
);
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "buoyancyForce.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::fv::buoyancyForce::read(const dictionary& dict)
{
NotImplemented;
return false;
}
// ************************************************************************* //

View File

@ -170,23 +170,23 @@ directionalPressureGradientExplicitSource
gradP0_(cells_.size(), Zero),
dGradP_(cells_.size(), Zero),
gradPporous_(cells_.size(), Zero),
flowDir_(coeffs_.lookup("flowDir")),
flowDir_(coeffs_.get<vector>("flowDir")),
invAPtr_(nullptr),
D_(0),
I_(0),
length_(0),
pressureDrop_(0),
flowRate_(),
faceZoneName_(coeffs_.lookup("faceZone")),
faceZoneName_(coeffs_.get<word>("faceZone")),
zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)),
faceId_(),
facePatchId_(),
relaxationFactor_(coeffs_.lookupOrDefault<scalar>("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<scalar>("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;
}
// ************************************************************************* //

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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<scalar>("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;
}
// ************************************************************************* //

View File

@ -316,18 +316,17 @@ bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
UName_ = coeffs_.lookupOrDefault<word>("U", "U");
TName_ = coeffs_.lookupOrDefault<word>("T", "T");
phiName_ = coeffs_.lookupOrDefault<word>("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,11 +359,9 @@ bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -129,11 +129,9 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -89,7 +89,6 @@ class explicitPorositySource
:
public cellSetOption
{
protected:
// Protected data
@ -128,18 +127,17 @@ 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
@ -166,8 +164,6 @@ public:
);
// IO
//- Read dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -48,7 +48,6 @@ namespace fv
}
}
const Foam::word Foam::fv::jouleHeatingSource::sigmaName(typeName + ":sigma");
@ -73,9 +72,7 @@ Foam::fv::jouleHeatingSource::transformSigma
const volVectorField& sigmaLocal
) const
{
tmp<volSymmTensorField> tsigma
(
new volSymmTensorField
auto tsigma = tmp<volSymmTensorField>::New
(
IOobject
(
@ -89,10 +86,10 @@ Foam::fv::jouleHeatingSource::transformSigma
mesh_,
dimensionedSymmTensor(sigmaLocal.dimensions(), Zero),
zeroGradientFvPatchField<symmTensor>::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<bool>("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;
}
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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;
}
// ************************************************************************* //

View File

@ -39,9 +39,7 @@ void Foam::fv::jouleHeatingSource::initialiseSigma
// Sigma to be defined using a Function1 type
sigmaVsTPtr = Function1<Type>::New("sigma", dict);
tmp<VolFieldType> tsigma
(
new VolFieldType
auto tsigma = tmp<VolFieldType>::New
(
IOobject
(
@ -53,7 +51,6 @@ void Foam::fv::jouleHeatingSource::initialiseSigma
),
mesh_,
dimensioned<Type>(sqr(dimCurrent)/dimPower/dimLength, Zero)
)
);
mesh_.objectRegistry::store(tsigma.ptr());
@ -64,9 +61,7 @@ void Foam::fv::jouleHeatingSource::initialiseSigma
else
{
// Sigma to be defined by user input
tmp<VolFieldType> tsigma
(
new VolFieldType
auto tsigma = tmp<VolFieldType>::New
(
IOobject
(
@ -77,7 +72,6 @@ void Foam::fv::jouleHeatingSource::initialiseSigma
IOobject::AUTO_WRITE
),
mesh_
)
);
mesh_.objectRegistry::store(tsigma.ptr());
@ -97,10 +91,7 @@ Foam::fv::jouleHeatingSource::updateSigma
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
VolFieldType& sigma =
const_cast<VolFieldType&>
(
mesh_.lookupObject<VolFieldType>(typeName + ":sigma")
);
mesh_.lookupObjectRef<VolFieldType>(typeName + ":sigma");
if (!sigmaVsTPtr.valid())
{

View File

@ -86,14 +86,14 @@ Foam::fv::meanVelocityForce::meanVelocityForce
)
:
cellSetOption(sourceName, modelType, dict, mesh),
Ubar_(coeffs_.lookup("Ubar")),
Ubar_(coeffs_.get<vector>("Ubar")),
gradP0_(0.0),
dGradP_(0.0),
flowDir_(Ubar_/mag(Ubar_)),
relaxation_(coeffs_.lookupOrDefault<scalar>("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;
}
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "meanVelocityForce.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::fv::meanVelocityForce::read(const dictionary& dict)
{
NotImplemented;
return false;
}
// ************************************************************************* //

View File

@ -56,7 +56,7 @@ Foam::fv::patchMeanVelocityForce::patchMeanVelocityForce
)
:
meanVelocityForce(sourceName, modelType, dict, mesh),
patch_(coeffs_.lookup("patch")),
patch_(coeffs_.get<word>("patch")),
patchi_(mesh.boundaryMesh().findPatchID(patch_))
{
if (patchi_ < 0)

View File

@ -110,6 +110,11 @@ public:
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
~patchMeanVelocityForce() = default;
};

View File

@ -40,9 +40,9 @@ Foam::fv::PhaseLimitStabilization<Type>::PhaseLimitStabilization
)
:
option(name, modelType, dict, mesh),
fieldName_(coeffs_.lookup("field")),
rateName_(coeffs_.lookup("rate")),
residualAlpha_(readScalar(coeffs_.lookup("residualAlpha")))
fieldName_(coeffs_.get<word>("field")),
rateName_(coeffs_.get<word>("rate")),
residualAlpha_(coeffs_.get<scalar>("residualAlpha"))
{
fieldNames_.setSize(1, fieldName_);
applied_.setSize(1, false);
@ -74,15 +74,13 @@ bool Foam::fv::PhaseLimitStabilization<Type>::read(const dictionary& dict)
{
if (option::read(dict))
{
coeffs_.lookup("residualAlpha") >> residualAlpha_;
coeffs_.readEntry("residualAlpha", residualAlpha_);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -115,14 +115,12 @@ 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;
}
}
// ************************************************************************* //

View File

@ -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);
};

View File

@ -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 * * * * * * * * * * * * * //

View File

@ -64,7 +64,6 @@ namespace Foam
class bladeModel
{
protected:
// Protected data
@ -111,7 +110,7 @@ public:
//- Destructor
virtual ~bladeModel();
virtual ~bladeModel() = default;
// Member functions

View File

@ -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());

View File

@ -67,7 +67,6 @@ class lookupProfile
:
public profileModel
{
protected:
// Protected data
@ -103,10 +102,11 @@ 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;

View File

@ -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<fileName>("file", fileName::null))
{}
@ -75,7 +68,7 @@ Foam::autoPtr<Foam::profileModel> Foam::profileModel::New
{
const word& modelName = dict.dictName();
const word modelType(dict.lookup("type"));
const word modelType(dict.get<word>("type"));
Info<< " - creating " << modelType << " profile " << modelName << endl;

View File

@ -50,7 +50,6 @@ namespace Foam
class profileModel
{
protected:
// Protected data
@ -102,7 +101,7 @@ public:
//- Destructor
virtual ~profileModel();
virtual ~profileModel() = default;
// Member functions

View File

@ -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

View File

@ -51,7 +51,6 @@ class profileModelList
:
public PtrList<profileModel>
{
protected:
// Protected data
@ -66,7 +65,7 @@ public:
profileModelList(const dictionary& dict, const bool readFields = true);
//- Destructor
~profileModelList();
~profileModelList() = default;
// Member Functions

View File

@ -93,8 +93,8 @@ Foam::seriesProfile::seriesProfile
}
else
{
dict.lookup("CdCoeffs") >> CdCoeffs_;
dict.lookup("ClCoeffs") >> ClCoeffs_;
dict.readEntry("CdCoeffs", CdCoeffs_);
dict.readEntry("ClCoeffs", ClCoeffs_);
}

View File

@ -65,7 +65,6 @@ class seriesProfile
:
public profileModel
{
protected:
// Protected data
@ -104,11 +103,12 @@ 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;
};

View File

@ -318,13 +318,13 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
}
}
reduce(axis, maxMagSqrOp<vector>());
axis /= mag(axis);
axis.normalise();
// Correct the axis direction using a point above the rotor
{
vector pointAbove(coeffs_.get<vector>("pointAbove"));
vector dir = pointAbove - origin;
dir /= mag(dir);
dir.normalise();
if ((dir & axis) < 0)
{
axis *= -1.0;

View File

@ -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> cylindrical_;
//- Maximum radius

View File

@ -165,13 +165,11 @@ void Foam::fv::rotorDiskSource::writeField
const bool writeNow
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
if (mesh_.time().writeTime() || writeNow)
{
tmp<fieldType> tfield
(
new fieldType
auto tfield = tmp<FieldType>::New
(
IOobject
(
@ -183,10 +181,9 @@ void Foam::fv::rotorDiskSource::writeField
),
mesh_,
dimensioned<Type>(dimless, Zero)
)
);
Field<Type>& field = tfield.ref().primitiveFieldRef();
auto& field = tfield.ref().primitiveFieldRef();
if (cells_.size() != values.size())
{

View File

@ -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<scalar>("theta0"));
const scalar theta1c = degToRad(coeffs_.get<scalar>("theta1c"));
const scalar theta1s = degToRad(coeffs_.get<scalar>("theta1s"));
const List<point>& x = rotor_.x();
forAll(thetag_, i)
@ -98,7 +92,8 @@ void Foam::fixedTrim::correct
(
const volScalarField rho,
const vectorField& U,
vectorField& force)
vectorField& force
)
{}

View File

@ -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

View File

@ -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<scalar>("thrust" + ext);
target_[1] = targetDict.get<scalar>("pitch" + ext);
target_[2] = targetDict.get<scalar>("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<scalar>("theta0Ini"));
theta_[1] = degToRad(pitchAngleDict.get<scalar>("theta1cIni"));
theta_[2] = degToRad(pitchAngleDict.get<scalar>("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<scalar>("alpha");
}
@ -259,8 +253,8 @@ Foam::tmp<Foam::scalarField> Foam::targetCoeffTrim::thetag() const
{
const List<vector>& x = rotor_.x();
tmp<scalarField> ttheta(new scalarField(x.size()));
scalarField& t = ttheta.ref();
auto ttheta = tmp<scalarField>::New(x.size());
auto& t = ttheta.ref();
forAll(t, i)
{

View File

@ -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);

View File

@ -50,11 +50,6 @@ Foam::trimModel::trimModel
read(dict);
}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::trimModel::~trimModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -50,7 +50,6 @@ namespace Foam
class trimModel
{
protected:
// Protected data
@ -108,7 +107,7 @@ public:
//- Destructor
virtual ~trimModel();
virtual ~trimModel() = default;
// Member functions

View File

@ -33,7 +33,7 @@ Foam::autoPtr<Foam::trimModel> Foam::trimModel::New
const dictionary& dict
)
{
const word modelType(dict.lookup(typeName));
const word modelType(dict.get<word>(typeName));
Info<< " Selecting " << typeName << " " << modelType << endl;

View File

@ -79,7 +79,7 @@ Foam::fv::solidificationMeltingSource::Cp() const
{
if (CpName_ == "CpRef")
{
scalar CpRef = readScalar(coeffs_.lookup("CpRef"));
scalar CpRef = coeffs_.get<scalar>("CpRef");
return tmp<volScalarField>::New
(
@ -129,7 +129,7 @@ Foam::vector Foam::fv::solidificationMeltingSource::g() const
return value.value();
}
return coeffs_.lookup("g");
return coeffs_.get<vector>("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<scalar>("Tmelt")),
L_(coeffs_.get<scalar>("L")),
relax_(coeffs_.lookupOrDefault("relax", 0.9)),
mode_(thermoModeTypeNames_.lookup("thermoMode", coeffs_)),
rhoRef_(readScalar(coeffs_.lookup("rhoRef"))),
rhoRef_(coeffs_.get<scalar>("rhoRef")),
TName_(coeffs_.lookupOrDefault<word>("T", "T")),
CpName_(coeffs_.lookupOrDefault<word>("Cp", "Cp")),
UName_(coeffs_.lookupOrDefault<word>("U", "U")),
phiName_(coeffs_.lookupOrDefault<word>("phi", "phi")),
Cu_(coeffs_.lookupOrDefault<scalar>("Cu", 100000)),
q_(coeffs_.lookupOrDefault("q", 0.001)),
beta_(readScalar(coeffs_.lookup("beta"))),
beta_(coeffs_.get<scalar>("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;
}
// ************************************************************************* //

View File

@ -218,9 +218,11 @@ public:
);
// Member Functions
//- Destructor
~solidificationMeltingSource() = default;
// Add explicit and implicit contributions
// Member Functions
//- Add explicit contribution to enthalpy equation
virtual void addSup(fvMatrix<scalar>& eqn, const label fieldi);
@ -229,8 +231,6 @@ public:
virtual void addSup(fvMatrix<vector>& eqn, const label fieldi);
// Add explicit and implicit contributions to compressible equation
//- Add explicit contribution to compressible enthalpy equation
virtual void addSup
(
@ -248,8 +248,6 @@ public:
);
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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;
}
// ************************************************************************* //

View File

@ -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<fileName>("timeDataFileName").expand()
);
if (newTimeDataFileName != timeDataFileName_)

View File

@ -98,7 +98,7 @@ public:
//- Destructor
virtual ~tabulated6DoFAcceleration();
virtual ~tabulated6DoFAcceleration() = default;
// Member Functions

View File

@ -100,11 +100,9 @@ bool Foam::fv::tabulatedAccelerationSource::read(const dictionary& dict)
{
return motion_.read(coeffs_);
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -69,7 +69,6 @@ class tabulatedAccelerationSource
:
public option
{
protected:
// Protected data
@ -126,8 +125,7 @@ public:
//- Destructor
virtual ~tabulatedAccelerationSource()
{}
virtual ~tabulatedAccelerationSource() = default;
// Member Functions

View File

@ -44,10 +44,7 @@ void Foam::fv::tabulatedAccelerationSource::addSup
if (mesh_.foundObject<uniformDimensionedVectorField>("g"))
{
uniformDimensionedVectorField& g =
const_cast<uniformDimensionedVectorField&>
(
mesh_.lookupObject<uniformDimensionedVectorField>("g")
);
mesh_.lookupObjectRef<uniformDimensionedVectorField>("g");
const uniformDimensionedScalarField& hRef =
mesh_.lookupObject<uniformDimensionedScalarField>("hRef");
@ -61,15 +58,11 @@ void Foam::fv::tabulatedAccelerationSource::addSup
: dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
);
const_cast<volScalarField&>
(
mesh_.lookupObject<volScalarField>("gh")
) = (g & mesh_.C()) - ghRef;
mesh_.lookupObjectRef<volScalarField>("gh")
= (g & mesh_.C()) - ghRef;
const_cast<surfaceScalarField&>
(
mesh_.lookupObject<surfaceScalarField>("ghf")
) = (g & mesh_.Cf()) - ghRef;
mesh_.lookupObjectRef<surfaceScalarField>("ghf")
= (g & mesh_.Cf()) - ghRef;
}
// ... otherwise include explicitly in the momentum equation
else

View File

@ -51,9 +51,7 @@ namespace fv
Foam::tmp<Foam::volScalarField> Foam::fv::viscousDissipation::rho() const
{
tmp<volScalarField> trho
(
new volScalarField
auto trho = tmp<volScalarField>::New
(
IOobject
(
@ -65,7 +63,6 @@ Foam::tmp<Foam::volScalarField> Foam::fv::viscousDissipation::rho() const
),
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<turbType>(turbulenceModel::propertiesName);
const auto* turbPtr =
mesh_.lookupObjectPtr<incompressible::turbulenceModel>
(
turbulenceModel::propertiesName
);
if (turbPtr)
{
@ -151,10 +149,11 @@ Foam::fv::viscousDissipation::devRhoReff() const
// Compressible
{
typedef compressible::turbulenceModel turbType;
const turbType* turbPtr =
mesh_.lookupObjectPtr<turbType>(turbulenceModel::propertiesName);
const auto* turbPtr =
mesh_.lookupObjectPtr<compressible::turbulenceModel>
(
turbulenceModel::propertiesName
);
if (turbPtr)
{
@ -180,11 +179,9 @@ void Foam::fv::viscousDissipation::addSup
typedef typename outerProduct<vector, vector>::type GradType;
typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
word gradUName("grad(" + UName_ + ')');
const word gradUName("grad(" + UName_ + ')');
tmp<GradFieldType> tgradU
(
new GradFieldType
auto tgradU = tmp<GradFieldType>::New
(
IOobject
(
@ -196,7 +193,6 @@ void Foam::fv::viscousDissipation::addSup
),
mesh_,
dimensionedTensor(inv(dimTime), Zero)
)
);
// Cached?

View File

@ -115,8 +115,6 @@ public:
// Member Functions
// Evaluate
//- Add explicit contribution to compressible energy equation
virtual void addSup
(
@ -125,15 +123,11 @@ public:
const label fieldi
);
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict)
{
return true;
}
};

View File

@ -38,7 +38,7 @@ void Foam::fv::CodedSource<Type>::prepare
const dynamicCodeContext& context
) const
{
word sourceType(pTraits<Type>::typeName);
const word sourceType(pTraits<Type>::typeName);
// Set additional rewrite rules
dynCode.setFilterVariable("typeName", name_);

View File

@ -33,7 +33,7 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
{
coeffs_.lookup("fields") >> fieldNames_;
coeffs_.readEntry("fields", fieldNames_);
applied_.setSize(fieldNames_.size(), false);
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
@ -92,11 +92,9 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -92,8 +92,8 @@ void Foam::fv::SemiImplicitSource<Type>::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<Type>::addSup
}
template<class Type>
bool Foam::fv::SemiImplicitSource<Type>::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
{
volumeMode_ = wordToVolumeModeType(coeffs_.get<word>("volumeMode"));
setFieldData(coeffs_.subDict("injectionRateSuSp"));
return true;
}
return false;
}
// ************************************************************************* //

View File

@ -78,13 +78,8 @@ namespace Foam
namespace fv
{
// Forward declaration of classes
template<class Type>
class SemiImplicitSource;
// Forward declaration of friend functions
// Forward declarations
template<class Type> class SemiImplicitSource;
template<class Type>
Ostream& operator<<
@ -216,7 +211,6 @@ public:
#ifdef NoRepository
#include "SemiImplicitSource.C"
#include "SemiImplicitSourceIO.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SemiImplicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::fv::SemiImplicitSource<Type>::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
{
volumeMode_ = wordToVolumeModeType(coeffs_.lookup("volumeMode"));
setFieldData(coeffs_.subDict("injectionRateSuSp"));
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -296,11 +296,9 @@ bool Foam::fv::interRegionExplicitPorositySource::read(const dictionary& dict)
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -73,6 +73,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
class porosityModel;
namespace fv
@ -87,7 +88,6 @@ class interRegionExplicitPorositySource
:
public interRegionOption
{
protected:
// Protected data

View File

@ -114,11 +114,9 @@ bool Foam::fv::constantHeatTransfer::read(const dictionary& dict)
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -54,8 +54,6 @@ class constantHeatTransfer
:
public interRegionHeatTransferModel
{
private:
// Private data
//- Constant heat transfer coefficient [W/m2/K]
@ -92,9 +90,6 @@ public:
//- Calculate the heat transfer coefficient
virtual void calculateHtc();
// IO
//- Read dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -119,9 +119,10 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
dict,
mesh
),
nbrModelName_(coeffs_.lookup("nbrModel")),
nbrModelName_(coeffs_.get<word>("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<word>("T", "T")),
TNbrName_(coeffs_.lookupOrDefault<word>("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,9 +167,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
tmp<volScalarField> tTmapped
(
new volScalarField
auto tTmapped = tmp<volScalarField>::New
(
IOobject
(
@ -186,10 +178,9 @@ void Foam::fv::interRegionHeatTransferModel::addSup
IOobject::NO_WRITE
),
T
)
);
volScalarField& Tmapped = tTmapped.ref();
auto& Tmapped = tTmapped.ref();
const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(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;
}
// ************************************************************************* //

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "interRegionHeatTransferModel.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::interRegionHeatTransferModel::read(const dictionary& dict)
{
if (interRegionOption::read(dict))
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -139,11 +139,9 @@ bool Foam::fv::tabulatedHeatTransfer::read(const dictionary& dict)
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -109,9 +109,6 @@ public:
//- Calculate the heat transfer coefficient
virtual void calculateHtc();
// IO
//- Read dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -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<fvMesh>(nbrRegionName());
word inletPatchName(coeffs_.lookup("inletPatch"));
word inletPatchNbrName(coeffs_.lookup("inletPatchNbr"));
word inletPatchName(coeffs_.get<word>("inletPatch"));
word inletPatchNbrName(coeffs_.get<word>("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<scalar>("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<scalar>("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<scalar>("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,11 +278,9 @@ bool Foam::fv::tabulatedNTUHeatTransfer::read(const dictionary& dict)
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -209,9 +209,6 @@ public:
//- Calculate the heat transfer coefficient
virtual void calculateHtc();
// I-O
//- Read dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -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<scalar>("a");
b_ = coeffs_.get<scalar>("b");
c_ = coeffs_.get<scalar>("c");
ds_ = coeffs_.get<scalar>("ds");
Pr_ = coeffs_.get<scalar>("Pr");
AoV_.reset
(
new volScalarField
@ -134,11 +134,9 @@ bool Foam::fv::variableHeatTransfer::read(const dictionary& dict)
return true;
}
else
{
return false;
}
}
// ************************************************************************* //