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 IOstreamOption::versionNumber
( (
controlDict_.lookup("writeVersion") controlDict_.get<float>("writeVersion")
) )
); );
} }

View File

@ -1,9 +1,5 @@
cellSetOption/cellSetOption.C cellSetOption/cellSetOption.C
cellSetOption/cellSetOptionIO.C
interRegionOption/interRegionOption.C interRegionOption/interRegionOption.C
interRegionOption/interRegionOptionIO.C
/* Sources */ /* Sources */
@ -14,18 +10,13 @@ $(generalSources)/semiImplicitSource/semiImplicitSource.C
derivedSources=sources/derived derivedSources=sources/derived
$(derivedSources)/acousticDampingSource/acousticDampingSource.C $(derivedSources)/acousticDampingSource/acousticDampingSource.C
$(derivedSources)/actuationDiskSource/actuationDiskSource.C $(derivedSources)/actuationDiskSource/actuationDiskSource.C
$(derivedSources)/buoyancyForce/buoyancyForce.C
$(derivedSources)/buoyancyForce/buoyancyForceIO.C
$(derivedSources)/buoyancyEnergy/buoyancyEnergy.C $(derivedSources)/buoyancyEnergy/buoyancyEnergy.C
$(derivedSources)/buoyancyEnergy/buoyancyEnergyIO.C $(derivedSources)/buoyancyForce/buoyancyForce.C
$(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C $(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C
$(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C
$(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C $(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
$(derivedSources)/explicitPorositySource/explicitPorositySource.C $(derivedSources)/explicitPorositySource/explicitPorositySource.C
$(derivedSources)/jouleHeatingSource/jouleHeatingSource.C $(derivedSources)/jouleHeatingSource/jouleHeatingSource.C
$(derivedSources)/jouleHeatingSource/jouleHeatingSourceIO.C
$(derivedSources)/meanVelocityForce/meanVelocityForce.C $(derivedSources)/meanVelocityForce/meanVelocityForce.C
$(derivedSources)/meanVelocityForce/meanVelocityForceIO.C
$(derivedSources)/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C $(derivedSources)/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C
$(derivedSources)/phaseLimitStabilization/phaseLimitStabilization.C $(derivedSources)/phaseLimitStabilization/phaseLimitStabilization.C
$(derivedSources)/radialActuationDiskSource/radialActuationDiskSource.C $(derivedSources)/radialActuationDiskSource/radialActuationDiskSource.C
@ -40,14 +31,12 @@ $(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModelNew.C
$(derivedSources)/rotorDiskSource/trimModel/fixed/fixedTrim.C $(derivedSources)/rotorDiskSource/trimModel/fixed/fixedTrim.C
$(derivedSources)/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C $(derivedSources)/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
$(derivedSources)/solidificationMeltingSource/solidificationMeltingSource.C $(derivedSources)/solidificationMeltingSource/solidificationMeltingSource.C
$(derivedSources)/solidificationMeltingSource/solidificationMeltingSourceIO.C
$(derivedSources)/tabulatedAccelerationSource/tabulatedAccelerationSource.C $(derivedSources)/tabulatedAccelerationSource/tabulatedAccelerationSource.C
$(derivedSources)/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C $(derivedSources)/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C
$(derivedSources)/viscousDissipation/viscousDissipation.C $(derivedSources)/viscousDissipation/viscousDissipation.C
interRegion = sources/interRegion interRegion = sources/interRegion
$(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C $(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C
$(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModelIO.C
$(interRegion)/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.C $(interRegion)/interRegionHeatTransfer/constantHeatTransfer/constantHeatTransfer.C
$(interRegion)/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C $(interRegion)/interRegionHeatTransfer/tabulatedHeatTransfer/tabulatedHeatTransfer.C
$(interRegion)/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C $(interRegion)/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C

View File

@ -58,17 +58,17 @@ void Foam::fv::cellSetOption::setSelection(const dictionary& dict)
{ {
case smPoints: case smPoints:
{ {
dict.lookup("points") >> points_; dict.readEntry("points", points_);
break; break;
} }
case smCellSet: case smCellSet:
{ {
dict.lookup("cellSet") >> cellSetName_; dict.readEntry("cellSet", cellSetName_);
break; break;
} }
case smCellZone: case smCellZone:
{ {
dict.lookup("cellZone") >> cellSetName_; dict.readEntry("cellZone", cellSetName_);
break; break;
} }
case smAll: case smAll:
@ -90,16 +90,17 @@ void Foam::fv::cellSetOption::setSelection(const dictionary& dict)
void Foam::fv::cellSetOption::setVol() void Foam::fv::cellSetOption::setVol()
{ {
scalar VOld = V_;
// Set volume information // 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 // Convert both volumes to representation using current writeprecision
word VOldName(Time::timeName(VOld, IOstream::defaultPrecision())); word VOldName(Time::timeName(VOld, IOstream::defaultPrecision()));
@ -142,8 +143,7 @@ void Foam::fv::cellSetOption::setCellSet()
} }
cells_ = selectedCells.toc(); cells_ = selectedCells.sortedToc();
break; break;
} }
case smCellSet: case smCellSet:
@ -151,9 +151,7 @@ void Foam::fv::cellSetOption::setCellSet()
Info<< indent Info<< indent
<< "- selecting cells using cellSet " << cellSetName_ << endl; << "- selecting cells using cellSet " << cellSetName_ << endl;
cellSet selectedCells(mesh_, cellSetName_); cells_ = cellSet(mesh_, cellSetName_).sortedToc();
cells_ = selectedCells.toc();
break; break;
} }
case smCellZone: case smCellZone:
@ -169,15 +167,15 @@ void Foam::fv::cellSetOption::setCellSet()
<< "Valid cellZones are " << mesh_.cellZones().names() << "Valid cellZones are " << mesh_.cellZones().names()
<< exit(FatalError); << exit(FatalError);
} }
cells_ = mesh_.cellZones()[zoneID];
cells_ = mesh_.cellZones()[zoneID];
break; break;
} }
case smAll: case smAll:
{ {
Info<< indent << "- selecting all cells" << endl; Info<< indent << "- selecting all cells" << endl;
cells_ = identity(mesh_.nCells());
cells_ = identity(mesh_.nCells());
break; break;
} }
default: default:
@ -222,12 +220,6 @@ Foam::fv::cellSetOption::cellSetOption
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::cellSetOption::~cellSetOption()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::cellSetOption::isActive() bool Foam::fv::cellSetOption::isActive()
@ -255,10 +247,22 @@ bool Foam::fv::cellSetOption::isActive()
return true; 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;
} }

View File

@ -101,7 +101,7 @@ protected:
//- Cell selection mode //- Cell selection mode
selectionModeType selectionMode_; selectionModeType selectionMode_;
//- Name of cell set for "cellSet" and "cellZone" selectionMode //- Name of set/zone for "cellSet" and "cellZone" selectionMode
word cellSetName_; word cellSetName_;
//- List of points for "points" selectionMode //- List of points for "points" selectionMode
@ -145,7 +145,7 @@ public:
//- Destructor //- Destructor
virtual ~cellSetOption(); virtual ~cellSetOption() = default;
// Member Functions // 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,10 +160,8 @@ bool Foam::fv::fixedTemperatureConstraint::read(const dictionary& dict)
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

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

View File

@ -70,7 +70,7 @@ void Foam::fv::velocityDampingConstraint::addDamping(fvMatrix<vector>& eqn)
diag[cellI] += scale*(magU-UMax_); diag[cellI] += scale*(magU-UMax_);
nDamped++; ++nDamped;
} }
} }
@ -104,7 +104,7 @@ Foam::fv::velocityDampingConstraint::velocityDampingConstraint
void Foam::fv::velocityDampingConstraint::constrain void Foam::fv::velocityDampingConstraint::constrain
( (
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
const label fieldI const label fieldi
) )
{ {
addDamping(eqn); addDamping(eqn);
@ -122,7 +122,7 @@ bool Foam::fv::velocityDampingConstraint::read(const dictionary& dict)
{ {
if (cellSetOption::read(dict)) if (cellSetOption::read(dict))
{ {
UMax_ = readScalar(coeffs_.lookup("UMax")); UMax_ = coeffs_.get<scalar>("UMax");
if (!coeffs_.readIfPresent("UNames", fieldNames_)) if (!coeffs_.readIfPresent("UNames", fieldNames_))
{ {

View File

@ -46,7 +46,8 @@ Description
UMax 100; UMax 100;
// Optional: name of velocity field (default: U) // 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 class velocityDampingConstraint
@ -127,13 +128,13 @@ public:
// Set values directly // Set values directly
//- Constrain vector matrix //- Constrain vector matrix
virtual void constrain(fvMatrix<vector>& eqn, const label fieldI); virtual void constrain(fvMatrix<vector>& eqn, const label fieldi);
// I-O // I-O
//- Write data //- Write data
virtual void writeData(Ostream&) const; virtual void writeData(Ostream& os) const;
//- Read dictionary //- Read dictionary
virtual bool read(const dictionary& dict); virtual bool read(const dictionary& dict);

View File

@ -61,18 +61,16 @@ bool Foam::fv::FixedValueConstraint<Type>::read(const dictionary& dict)
forAllConstIter(dictionary, fieldValuesDict, iter) forAllConstIter(dictionary, fieldValuesDict, iter)
{ {
fieldNames_[i] = iter().keyword(); fieldNames_[i] = iter().keyword();
fieldValuesDict.lookup(iter().keyword()) >> fieldValues_[i]; fieldValuesDict.readEntry(iter().keyword(), fieldValues_[i]);
i++; ++i;
} }
applied_.setSize(fieldNames_.size(), false); applied_.setSize(fieldNames_.size(), false);
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

@ -56,8 +56,8 @@ Foam::fv::limitTemperature::limitTemperature
) )
: :
cellSetOption(name, modelType, dict, mesh), cellSetOption(name, modelType, dict, mesh),
Tmin_(readScalar(coeffs_.lookup("min"))), Tmin_(coeffs_.get<scalar>("min")),
Tmax_(readScalar(coeffs_.lookup("max"))), Tmax_(coeffs_.get<scalar>("max")),
phase_(coeffs_.lookupOrDefault<word>("phase", word::null)) phase_(coeffs_.lookupOrDefault<word>("phase", word::null))
{ {
// Set the field name to that of the energy field from which the temperature // 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)) if (cellSetOption::read(dict))
{ {
coeffs_.lookup("min") >> Tmin_; coeffs_.readEntry("min", Tmin_);
coeffs_.lookup("max") >> Tmax_; coeffs_.readEntry("max", Tmax_);
return true; return true;
} }
else
{ return false;
return false;
}
} }
@ -110,7 +108,7 @@ void Foam::fv::limitTemperature::correct(volScalarField& he)
forAll(cells_, i) forAll(cells_, i)
{ {
label celli = cells_[i]; const label celli = cells_[i];
hec[celli]= max(min(hec[celli], heMax[i]), heMin[i]); hec[celli]= max(min(hec[celli], heMax[i]), heMin[i]);
} }

View File

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

View File

@ -56,7 +56,7 @@ Foam::fv::limitVelocity::limitVelocity
: :
cellSetOption(name, modelType, dict, mesh), cellSetOption(name, modelType, dict, mesh),
UName_(coeffs_.lookupOrDefault<word>("U", "U")), UName_(coeffs_.lookupOrDefault<word>("U", "U")),
max_(readScalar(coeffs_.lookup("max"))) max_(coeffs_.get<scalar>("max"))
{ {
fieldNames_.setSize(1, UName_); fieldNames_.setSize(1, UName_);
applied_.setSize(1, false); applied_.setSize(1, false);
@ -69,14 +69,12 @@ bool Foam::fv::limitVelocity::read(const dictionary& dict)
{ {
if (cellSetOption::read(dict)) if (cellSetOption::read(dict))
{ {
coeffs_.lookup("max") >> max_; coeffs_.readEntry("max", max_);
return true; return true;
} }
else
{ return false;
return false;
}
} }
@ -86,10 +84,8 @@ void Foam::fv::limitVelocity::correct(volVectorField& U)
vectorField& Uif = U.primitiveFieldRef(); vectorField& Uif = U.primitiveFieldRef();
forAll(cells_, i) for (const label celli : cells_)
{ {
const label celli = cells_[i];
const scalar magSqrUi = magSqr(Uif[celli]); const scalar magSqrUi = magSqr(Uif[celli]);
if (magSqrUi > maxSqrU) if (magSqrUi > maxSqrU)

View File

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

View File

@ -110,7 +110,7 @@ Foam::fv::interRegionOption::interRegionOption
mesh mesh
), ),
master_(coeffs_.lookupOrDefault("master", true)), master_(coeffs_.lookupOrDefault("master", true)),
nbrRegionName_(coeffs_.lookup("nbrRegion")), nbrRegionName_(coeffs_.get<word>("nbrRegion")),
meshInterpPtr_() meshInterpPtr_()
{ {
if (active()) 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); applied_.setSize(fieldNames_.size(), false);
coeffs_.lookup("frequency") >> frequency_.value(); coeffs_.readEntry("frequency", frequency_.value());
coeffs_.lookup("URef") >> URefName_; coeffs_.readEntry("URef", URefName_);
coeffs_.lookup("centre") >> x0_; coeffs_.readEntry("centre", x0_);
coeffs_.lookup("radius1") >> r1_; coeffs_.readEntry("radius1", r1_);
coeffs_.lookup("radius2") >> r2_; coeffs_.readEntry("radius2", r2_);
if (coeffs_.readIfPresent("w", w_)) if (coeffs_.readIfPresent("w", w_))
{ {

View File

@ -137,37 +137,33 @@ public:
// Member Functions // Member Functions
// Add explicit and implicit contributions //- Add implicit contribution to momentum equation
virtual void addSup
(
fvMatrix<vector>& eqn,
const label fieldI
);
//- Add implicit contribution to momentum equation //- Add implicit contribution to compressible momentum equation
virtual void addSup virtual void addSup
( (
fvMatrix<vector>& eqn, const volScalarField& rho,
const label fieldI fvMatrix<vector>& eqn,
); const label fieldI
);
//- Add implicit contribution to compressible momentum equation //- Add implicit contribution to phase momentum equation
virtual void addSup virtual void addSup
( (
const volScalarField& rho, const volScalarField& alpha,
fvMatrix<vector>& eqn, const volScalarField& rho,
const label fieldI fvMatrix<vector>& eqn,
); const label fieldI
);
//- Add implicit contribution to phase momentum equation
virtual void addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldI
);
// IO //- Read dictionary
virtual bool read(const dictionary& dict);
//- Read dictionary
virtual bool read(const dictionary& dict);
}; };

View File

@ -88,14 +88,14 @@ Foam::fv::actuationDiskSource::actuationDiskSource
) )
: :
cellSetOption(name, modelType, dict, mesh), cellSetOption(name, modelType, dict, mesh),
diskDir_(coeffs_.lookup("diskDir")), diskDir_(coeffs_.get<vector>("diskDir")),
Cp_(readScalar(coeffs_.lookup("Cp"))), Cp_(coeffs_.get<scalar>("Cp")),
Ct_(readScalar(coeffs_.lookup("Ct"))), Ct_(coeffs_.get<scalar>("Ct")),
diskArea_(readScalar(coeffs_.lookup("diskArea"))), diskArea_(coeffs_.get<scalar>("diskArea")),
upstreamPoint_(coeffs_.lookup("upstreamPoint")), upstreamPoint_(coeffs_.get<point>("upstreamPoint")),
upstreamCellId_(-1) upstreamCellId_(-1)
{ {
coeffs_.lookup("fields") >> fieldNames_; coeffs_.readEntry("fields", fieldNames_);
applied_.setSize(fieldNames_.size(), false); applied_.setSize(fieldNames_.size(), false);
Info<< " - creating actuation disk zone: " Info<< " - creating actuation disk zone: "
@ -171,10 +171,8 @@ bool Foam::fv::actuationDiskSource::read(const dictionary& dict)
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

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

View File

@ -57,9 +57,9 @@ void Foam::fv::actuationDiskSource::addActuationDiskAxialInertialResistance
scalar T = 2.0*upRho*diskArea_*mag(upU)*a*(1 - a); 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), option(sourceName, modelType, dict, mesh),
UName_(coeffs_.lookupOrDefault<word>("U", "U")) UName_(coeffs_.lookupOrDefault<word>("U", "U"))
{ {
coeffs_.lookup("fields") >> fieldNames_; coeffs_.readEntry("fields", fieldNames_);
if (fieldNames_.size() != 1) 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

@ -56,7 +56,7 @@ namespace fv
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class buoyancyEnergy Declaration Class buoyancyEnergy Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class buoyancyEnergy class buoyancyEnergy
@ -98,21 +98,17 @@ public:
// Member Functions // Member Functions
// Evaluate //- Add explicit contribution to compressible momentum equation
virtual void addSup
//- Add explicit contribution to compressible momentum equation (
virtual void addSup const volScalarField& rho,
( fvMatrix<scalar>& eqn,
const volScalarField& rho, const label fieldi
fvMatrix<scalar>& eqn, );
const label fieldi
);
// IO //- Read source dictionary
virtual bool read(const dictionary& dict);
//- 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) 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

@ -56,7 +56,7 @@ namespace fv
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class buoyancyForce Declaration Class buoyancyForce Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class buoyancyForce class buoyancyForce
@ -97,28 +97,24 @@ public:
// Member Functions // Member Functions
// Evaluate //- Add explicit contribution to incompressible momentum equation
virtual void addSup
(
fvMatrix<vector>& eqn,
const label fieldi
);
//- Add explicit contribution to incompressible momentum equation //- Add explicit contribution to compressible momentum equation
virtual void addSup virtual void addSup
( (
fvMatrix<vector>& eqn, const volScalarField& rho,
const label fieldi fvMatrix<vector>& eqn,
); const label fieldi
);
//- Add explicit contribution to compressible momentum equation
virtual void addSup
(
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldi
);
// IO //- Read source dictionary
virtual bool read(const dictionary& dict);
//- 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), gradP0_(cells_.size(), Zero),
dGradP_(cells_.size(), Zero), dGradP_(cells_.size(), Zero),
gradPporous_(cells_.size(), Zero), gradPporous_(cells_.size(), Zero),
flowDir_(coeffs_.lookup("flowDir")), flowDir_(coeffs_.get<vector>("flowDir")),
invAPtr_(nullptr), invAPtr_(nullptr),
D_(0), D_(0),
I_(0), I_(0),
length_(0), length_(0),
pressureDrop_(0), pressureDrop_(0),
flowRate_(), flowRate_(),
faceZoneName_(coeffs_.lookup("faceZone")), faceZoneName_(coeffs_.get<word>("faceZone")),
zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)), zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)),
faceId_(), faceId_(),
facePatchId_(), facePatchId_(),
relaxationFactor_(coeffs_.lookupOrDefault<scalar>("relaxationFactor",0.3)), relaxationFactor_(coeffs_.lookupOrDefault<scalar>("relaxationFactor",0.3)),
cellFaceMap_(cells_.size(), -1) cellFaceMap_(cells_.size(), -1)
{ {
coeffs_.lookup("fields") >> fieldNames_; coeffs_.readEntry("fields", fieldNames_);
flowDir_ /= mag(flowDir_); flowDir_.normalise();
if (fieldNames_.size() != 1) if (fieldNames_.size() != 1)
{ {
@ -210,13 +210,13 @@ directionalPressureGradientExplicitSource
} }
else if (model_ == pConstant) else if (model_ == pConstant)
{ {
coeffs_.lookup("pressureDrop") >> pressureDrop_; coeffs_.readEntry("pressureDrop", pressureDrop_);
} }
else if (model_ == pDarcyForchheimer) else if (model_ == pDarcyForchheimer)
{ {
coeffs_.lookup("D") >> D_; coeffs_.readEntry("D", D_);
coeffs_.lookup("I") >> I_; coeffs_.readEntry("I", I_);
coeffs_.lookup("length") >> length_; coeffs_.readEntry("length", length_);
} }
else else
{ {
@ -240,7 +240,7 @@ directionalPressureGradientExplicitSource
{ {
Info<< " Reading pressure gradient from file" << endl; Info<< " Reading pressure gradient from file" << endl;
dictionary propsDict(dictionary::null, propsFile); dictionary propsDict(dictionary::null, propsFile);
propsDict.lookup("gradient") >> gradP0_; propsDict.readEntry("gradient", gradP0_);
} }
Info<< " Initial pressure gradient = " << gradP0_ << nl << endl; 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

@ -167,7 +167,7 @@ private:
//- Id for the face zone //- Id for the face zone
label zoneID_; label zoneID_;
//- Local list of face IDs //- Local list of face IDs
labelList faceId_; labelList faceId_;
//- Local list of patch ID per face //- Local list of patch ID per face
@ -255,7 +255,7 @@ public:
// I-O // I-O
//- Write the source properties //- Write the source properties
virtual void writeData(Ostream&) const; virtual void writeData(Ostream& os) const;
//- Read source dictionary //- Read source dictionary
virtual bool read(const dictionary& dict); 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"); UName_ = coeffs_.lookupOrDefault<word>("U", "U");
TName_ = coeffs_.lookupOrDefault<word>("T", "T"); TName_ = coeffs_.lookupOrDefault<word>("T", "T");
phiName_ = coeffs_.lookupOrDefault<word>("phi", "phi"); phiName_ = coeffs_.lookupOrDefault<word>("phi", "phi");
coeffs_.lookup("faceZone") >> faceZoneName_; coeffs_.readEntry("faceZone", faceZoneName_);
coeffs_.lookup("secondaryMassFlowRate") >> secondaryMassFlowRate_; coeffs_.readEntry("secondaryMassFlowRate", secondaryMassFlowRate_);
coeffs_.lookup("secondaryInletT") >> secondaryInletT_; coeffs_.readEntry("secondaryInletT", secondaryInletT_);
if (coeffs_.readIfPresent("primaryInletT", primaryInletT_)) if (coeffs_.readIfPresent("primaryInletT", primaryInletT_))
{ {
userPrimaryInletT_ = true;
Info<< type() << " " << this->name() << ": " << indent << nl Info<< type() << " " << this->name() << ": " << indent << nl
<< "employing user-specified primary flow inlet temperature: " << "employing user-specified primary flow inlet temperature: "
<< primaryInletT_ << endl; << primaryInletT_ << endl;
userPrimaryInletT_ = true;
} }
else else
{ {
@ -360,10 +359,8 @@ bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

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

View File

@ -89,7 +89,6 @@ class explicitPorositySource
: :
public cellSetOption public cellSetOption
{ {
protected: protected:
// Protected data // Protected data
@ -128,48 +127,45 @@ public:
//- Destructor //- Destructor
virtual ~explicitPorositySource() virtual ~explicitPorositySource() = default;
{}
// Member Functions // Member Functions
//- Access to the porosityModel
const porosityModel& model() const const porosityModel& model() const
{ {
return porosityPtr_(); return *porosityPtr_;
} }
// Add explicit and implicit contributions
//- Add implicit contribution to momentum equation //- Add implicit contribution to momentum equation
virtual void addSup virtual void addSup
( (
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
const label fieldi const label fieldi
); );
//- Add implicit contribution to compressible momentum equation //- Add implicit contribution to compressible momentum equation
virtual void addSup virtual void addSup
( (
const volScalarField& rho, const volScalarField& rho,
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
const label fieldi const label fieldi
); );
//- Add implicit contribution to phase momentum equation //- Add implicit contribution to phase momentum equation
virtual void addSup virtual void addSup
( (
const volScalarField& alpha, const volScalarField& alpha,
const volScalarField& rho, const volScalarField& rho,
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
const label fieldi const label fieldi
); );
// IO //- Read dictionary
virtual bool read(const dictionary& dict);
//- 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"); const Foam::word Foam::fv::jouleHeatingSource::sigmaName(typeName + ":sigma");
@ -73,26 +72,24 @@ Foam::fv::jouleHeatingSource::transformSigma
const volVectorField& sigmaLocal const volVectorField& sigmaLocal
) const ) const
{ {
tmp<volSymmTensorField> tsigma auto tsigma = tmp<volSymmTensorField>::New
( (
new volSymmTensorField IOobject
( (
IOobject sigmaName,
( mesh_.time().timeName(),
sigmaName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_, mesh_,
dimensionedSymmTensor(sigmaLocal.dimensions(), Zero), IOobject::NO_READ,
zeroGradientFvPatchField<symmTensor>::typeName IOobject::NO_WRITE,
) false
),
mesh_,
dimensionedSymmTensor(sigmaLocal.dimensions(), Zero),
zeroGradientFvPatchField<symmTensor>::typeName
); );
volSymmTensorField& sigma = tsigma.ref(); auto& sigma = tsigma.ref();
sigma.primitiveFieldRef() = coordSys().R().transformVector(sigmaLocal); sigma.primitiveFieldRef() = coordSys().R().transformVector(sigmaLocal);
sigma.correctBoundaryConditions(); 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,21 +39,18 @@ void Foam::fv::jouleHeatingSource::initialiseSigma
// Sigma to be defined using a Function1 type // Sigma to be defined using a Function1 type
sigmaVsTPtr = Function1<Type>::New("sigma", dict); sigmaVsTPtr = Function1<Type>::New("sigma", dict);
tmp<VolFieldType> tsigma auto tsigma = tmp<VolFieldType>::New
( (
new VolFieldType IOobject
( (
IOobject typeName + ":sigma",
( mesh_.time().timeName(),
typeName + ":sigma",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_, mesh_,
dimensioned<Type>(sqr(dimCurrent)/dimPower/dimLength, Zero) IOobject::NO_READ,
) IOobject::AUTO_WRITE
),
mesh_,
dimensioned<Type>(sqr(dimCurrent)/dimPower/dimLength, Zero)
); );
mesh_.objectRegistry::store(tsigma.ptr()); mesh_.objectRegistry::store(tsigma.ptr());
@ -64,20 +61,17 @@ void Foam::fv::jouleHeatingSource::initialiseSigma
else else
{ {
// Sigma to be defined by user input // Sigma to be defined by user input
tmp<VolFieldType> tsigma auto tsigma = tmp<VolFieldType>::New
( (
new VolFieldType IOobject
( (
IOobject typeName + ":sigma",
( mesh_.time().timeName(),
typeName + ":sigma", mesh_,
mesh_.time().timeName(), IOobject::MUST_READ,
mesh_, IOobject::AUTO_WRITE
IOobject::MUST_READ, ),
IOobject::AUTO_WRITE mesh_
),
mesh_
)
); );
mesh_.objectRegistry::store(tsigma.ptr()); mesh_.objectRegistry::store(tsigma.ptr());
@ -97,10 +91,7 @@ Foam::fv::jouleHeatingSource::updateSigma
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
VolFieldType& sigma = VolFieldType& sigma =
const_cast<VolFieldType&> mesh_.lookupObjectRef<VolFieldType>(typeName + ":sigma");
(
mesh_.lookupObject<VolFieldType>(typeName + ":sigma")
);
if (!sigmaVsTPtr.valid()) if (!sigmaVsTPtr.valid())
{ {

View File

@ -86,14 +86,14 @@ Foam::fv::meanVelocityForce::meanVelocityForce
) )
: :
cellSetOption(sourceName, modelType, dict, mesh), cellSetOption(sourceName, modelType, dict, mesh),
Ubar_(coeffs_.lookup("Ubar")), Ubar_(coeffs_.get<vector>("Ubar")),
gradP0_(0.0), gradP0_(0.0),
dGradP_(0.0), dGradP_(0.0),
flowDir_(Ubar_/mag(Ubar_)), flowDir_(Ubar_/mag(Ubar_)),
relaxation_(coeffs_.lookupOrDefault<scalar>("relaxation", 1.0)), relaxation_(coeffs_.lookupOrDefault<scalar>("relaxation", 1.0)),
rAPtr_(nullptr) rAPtr_(nullptr)
{ {
coeffs_.lookup("fields") >> fieldNames_; coeffs_.readEntry("fields", fieldNames_);
if (fieldNames_.size() != 1) if (fieldNames_.size() != 1)
{ {
@ -113,7 +113,7 @@ Foam::fv::meanVelocityForce::meanVelocityForce
{ {
Info<< " Reading pressure gradient from file" << endl; Info<< " Reading pressure gradient from file" << endl;
dictionary propsDict(dictionary::null, propsFile); dictionary propsDict(dictionary::null, propsFile);
propsDict.lookup("gradient") >> gradP0_; propsDict.readEntry("gradient", gradP0_);
} }
Info<< " Initial pressure gradient = " << gradP0_ << nl << endl; 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), meanVelocityForce(sourceName, modelType, dict, mesh),
patch_(coeffs_.lookup("patch")), patch_(coeffs_.get<word>("patch")),
patchi_(mesh.boundaryMesh().findPatchID(patch_)) patchi_(mesh.boundaryMesh().findPatchID(patch_))
{ {
if (patchi_ < 0) if (patchi_ < 0)

View File

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

View File

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

View File

@ -115,13 +115,11 @@ bool Foam::fv::radialActuationDiskSource::read(const dictionary& dict)
{ {
if (actuationDiskSource::read(dict)) if (actuationDiskSource::read(dict))
{ {
coeffs_.lookup("coeffs") >> radialCoeffs_; coeffs_.readEntry("coeffs", radialCoeffs_);
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

@ -138,8 +138,7 @@ public:
//- Destructor //- Destructor
virtual ~radialActuationDiskSource() virtual ~radialActuationDiskSource() = default;
{}
// Member Functions // Member Functions
@ -160,8 +159,6 @@ public:
); );
// IO
//- Read dictionary //- Read dictionary
virtual bool read(const dictionary& dict); virtual bool read(const dictionary& dict);
}; };

View File

@ -103,10 +103,10 @@ Foam::bladeModel::bladeModel(const dictionary& dict)
} }
else else
{ {
dict.lookup("data") >> data; dict.readEntry("data", data);
} }
if (data.size() > 0) if (data.size())
{ {
profileName_.setSize(data.size()); profileName_.setSize(data.size());
profileID_.setSize(data.size()); profileID_.setSize(data.size());
@ -130,11 +130,6 @@ Foam::bladeModel::bladeModel(const dictionary& dict)
} }
} }
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::bladeModel::~bladeModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

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

View File

@ -50,7 +50,7 @@ void Foam::lookupProfile::interpolateWeights
) const ) const
{ {
i2 = 0; i2 = 0;
label nElem = values.size(); const label nElem = values.size();
if (nElem == 1) if (nElem == 1)
{ {
@ -108,10 +108,10 @@ Foam::lookupProfile::lookupProfile
} }
else else
{ {
dict.lookup("data") >> data; dict.readEntry("data", data);
} }
if (data.size() > 0) if (data.size())
{ {
AOA_.setSize(data.size()); AOA_.setSize(data.size());
Cd_.setSize(data.size()); Cd_.setSize(data.size());

View File

@ -67,7 +67,6 @@ class lookupProfile
: :
public profileModel public profileModel
{ {
protected: protected:
// Protected data // Protected data
@ -103,13 +102,14 @@ public:
//- Constructor //- Constructor
lookupProfile(const dictionary& dict, const word& modelName); 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 //- Return the Cd and Cl for a given angle-of-attack
virtual void Cdl(const scalar alpha, scalar& Cd, scalar& Cl) const; 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), dict_(dict),
name_(name), name_(name),
fName_(fileName::null) fName_(dict.lookupOrDefault<fileName>("file", fileName::null))
{
dict.readIfPresent("file", fName_);
}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::profileModel::~profileModel()
{} {}
@ -75,7 +68,7 @@ Foam::autoPtr<Foam::profileModel> Foam::profileModel::New
{ {
const word& modelName = dict.dictName(); const word& modelName = dict.dictName();
const word modelType(dict.lookup("type")); const word modelType(dict.get<word>("type"));
Info<< " - creating " << modelType << " profile " << modelName << endl; Info<< " - creating " << modelType << " profile " << modelName << endl;

View File

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

View File

@ -42,7 +42,7 @@ Foam::profileModelList::profileModelList
Info<< " Constructing blade profiles:" << endl; Info<< " Constructing blade profiles:" << endl;
if (modelNames.size() > 0) if (modelNames.size())
{ {
this->setSize(modelNames.size()); this->setSize(modelNames.size());
@ -65,12 +65,6 @@ Foam::profileModelList::profileModelList
} }
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::profileModelList::~profileModelList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::profileModelList::connectBlades void Foam::profileModelList::connectBlades

View File

@ -44,14 +44,13 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class profileModelList Declaration Class profileModelList Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class profileModelList class profileModelList
: :
public PtrList<profileModel> public PtrList<profileModel>
{ {
protected: protected:
// Protected data // Protected data
@ -66,7 +65,7 @@ public:
profileModelList(const dictionary& dict, const bool readFields = true); profileModelList(const dictionary& dict, const bool readFields = true);
//- Destructor //- Destructor
~profileModelList(); ~profileModelList() = default;
// Member Functions // Member Functions

View File

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

View File

@ -65,7 +65,6 @@ class seriesProfile
: :
public profileModel public profileModel
{ {
protected: protected:
// Protected data // Protected data
@ -104,13 +103,14 @@ public:
//- Constructor //- Constructor
seriesProfile(const dictionary& dict, const word& modelName); seriesProfile(const dictionary& dict, const word& modelName);
//- Destructor
~seriesProfile() = default;
// Member functions // 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;
}; };

View File

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

View File

@ -199,7 +199,7 @@ protected:
//- Rotor local cylindrical coordinate system (r, theta, z) //- Rotor local cylindrical coordinate system (r, theta, z)
cylindricalCS coordSys_; cylindricalCS coordSys_;
//- Rotor transformation co-ordinate system //- Rotor transformation coordinate system
autoPtr<cylindrical> cylindrical_; autoPtr<cylindrical> cylindrical_;
//- Maximum radius //- Maximum radius

View File

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

View File

@ -49,27 +49,21 @@ Foam::fixedTrim::fixedTrim
) )
: :
trimModel(rotor, dict, typeName), trimModel(rotor, dict, typeName),
thetag_(rotor.cells().size(), 0.0) thetag_(rotor.cells().size(), Zero)
{ {
read(dict); read(dict);
} }
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::fixedTrim::~fixedTrim()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fixedTrim::read(const dictionary& dict) void Foam::fixedTrim::read(const dictionary& dict)
{ {
trimModel::read(dict); trimModel::read(dict);
scalar theta0 = degToRad(readScalar(coeffs_.lookup("theta0"))); const scalar theta0 = degToRad(coeffs_.get<scalar>("theta0"));
scalar theta1c = degToRad(readScalar(coeffs_.lookup("theta1c"))); const scalar theta1c = degToRad(coeffs_.get<scalar>("theta1c"));
scalar theta1s = degToRad(readScalar(coeffs_.lookup("theta1s"))); const scalar theta1s = degToRad(coeffs_.get<scalar>("theta1s"));
const List<point>& x = rotor_.x(); const List<point>& x = rotor_.x();
forAll(thetag_, i) forAll(thetag_, i)
@ -98,7 +92,8 @@ void Foam::fixedTrim::correct
( (
const volScalarField rho, const volScalarField rho,
const vectorField& U, const vectorField& U,
vectorField& force) vectorField& force
)
{} {}

View File

@ -50,7 +50,6 @@ class fixedTrim
: :
public trimModel public trimModel
{ {
protected: protected:
// Protected data // Protected data
@ -68,7 +67,7 @@ public:
fixedTrim(const fv::rotorDiskSource& rotor, const dictionary& dict); fixedTrim(const fv::rotorDiskSource& rotor, const dictionary& dict);
//- Destructor //- Destructor
virtual ~fixedTrim(); virtual ~fixedTrim() = default;
// Member functions // Member functions

View File

@ -211,12 +211,6 @@ Foam::targetCoeffTrim::targetCoeffTrim
} }
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::targetCoeffTrim::~targetCoeffTrim()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::targetCoeffTrim::read(const dictionary& dict) void Foam::targetCoeffTrim::read(const dictionary& dict)
@ -231,16 +225,16 @@ void Foam::targetCoeffTrim::read(const dictionary& dict)
ext = "Coeff"; ext = "Coeff";
} }
target_[0] = readScalar(targetDict.lookup("thrust" + ext)); target_[0] = targetDict.get<scalar>("thrust" + ext);
target_[1] = readScalar(targetDict.lookup("pitch" + ext)); target_[1] = targetDict.get<scalar>("pitch" + ext);
target_[2] = readScalar(targetDict.lookup("roll" + ext)); target_[2] = targetDict.get<scalar>("roll" + ext);
const dictionary& pitchAngleDict(coeffs_.subDict("pitchAngles")); const dictionary& pitchAngleDict(coeffs_.subDict("pitchAngles"));
theta_[0] = degToRad(readScalar(pitchAngleDict.lookup("theta0Ini"))); theta_[0] = degToRad(pitchAngleDict.get<scalar>("theta0Ini"));
theta_[1] = degToRad(readScalar(pitchAngleDict.lookup("theta1cIni"))); theta_[1] = degToRad(pitchAngleDict.get<scalar>("theta1cIni"));
theta_[2] = degToRad(readScalar(pitchAngleDict.lookup("theta1sIni"))); theta_[2] = degToRad(pitchAngleDict.get<scalar>("theta1sIni"));
coeffs_.lookup("calcFrequency") >> calcFrequency_; coeffs_.readEntry("calcFrequency", calcFrequency_);
coeffs_.readIfPresent("nIter", nIter_); coeffs_.readIfPresent("nIter", nIter_);
coeffs_.readIfPresent("tol", tol_); coeffs_.readIfPresent("tol", tol_);
@ -251,7 +245,7 @@ void Foam::targetCoeffTrim::read(const dictionary& dict)
dTheta_ = degToRad(dTheta_); 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(); const List<vector>& x = rotor_.x();
tmp<scalarField> ttheta(new scalarField(x.size())); auto ttheta = tmp<scalarField>::New(x.size());
scalarField& t = ttheta.ref(); auto& t = ttheta.ref();
forAll(t, i) forAll(t, i)
{ {

View File

@ -89,7 +89,6 @@ class targetCoeffTrim
: :
public trimModel public trimModel
{ {
protected: protected:
// Protected data // Protected data
@ -153,10 +152,10 @@ public:
targetCoeffTrim(const fv::rotorDiskSource& rotor, const dictionary& dict); targetCoeffTrim(const fv::rotorDiskSource& rotor, const dictionary& dict);
//- Destructor //- Destructor
virtual ~targetCoeffTrim(); virtual ~targetCoeffTrim() = default;
// Member functions // Member Functions
//- Read //- Read
void read(const dictionary& dict); void read(const dictionary& dict);

View File

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

View File

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

View File

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

View File

@ -79,7 +79,7 @@ Foam::fv::solidificationMeltingSource::Cp() const
{ {
if (CpName_ == "CpRef") if (CpName_ == "CpRef")
{ {
scalar CpRef = readScalar(coeffs_.lookup("CpRef")); scalar CpRef = coeffs_.get<scalar>("CpRef");
return tmp<volScalarField>::New return tmp<volScalarField>::New
( (
@ -129,7 +129,7 @@ Foam::vector Foam::fv::solidificationMeltingSource::g() const
return value.value(); 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), cellSetOption(sourceName, modelType, dict, mesh),
Tmelt_(readScalar(coeffs_.lookup("Tmelt"))), Tmelt_(coeffs_.get<scalar>("Tmelt")),
L_(readScalar(coeffs_.lookup("L"))), L_(coeffs_.get<scalar>("L")),
relax_(coeffs_.lookupOrDefault("relax", 0.9)), relax_(coeffs_.lookupOrDefault("relax", 0.9)),
mode_(thermoModeTypeNames_.lookup("thermoMode", coeffs_)), mode_(thermoModeTypeNames_.lookup("thermoMode", coeffs_)),
rhoRef_(readScalar(coeffs_.lookup("rhoRef"))), rhoRef_(coeffs_.get<scalar>("rhoRef")),
TName_(coeffs_.lookupOrDefault<word>("T", "T")), TName_(coeffs_.lookupOrDefault<word>("T", "T")),
CpName_(coeffs_.lookupOrDefault<word>("Cp", "Cp")), CpName_(coeffs_.lookupOrDefault<word>("Cp", "Cp")),
UName_(coeffs_.lookupOrDefault<word>("U", "U")), UName_(coeffs_.lookupOrDefault<word>("U", "U")),
phiName_(coeffs_.lookupOrDefault<word>("phi", "phi")), phiName_(coeffs_.lookupOrDefault<word>("phi", "phi")),
Cu_(coeffs_.lookupOrDefault<scalar>("Cu", 100000)), Cu_(coeffs_.lookupOrDefault<scalar>("Cu", 100000)),
q_(coeffs_.lookupOrDefault("q", 0.001)), q_(coeffs_.lookupOrDefault("q", 0.001)),
beta_(readScalar(coeffs_.lookup("beta"))), beta_(coeffs_.get<scalar>("beta")),
alpha1_ alpha1_
( (
IOobject 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,40 +218,38 @@ public:
); );
//- Destructor
~solidificationMeltingSource() = default;
// Member Functions // Member Functions
// Add explicit and implicit contributions //- Add explicit contribution to enthalpy equation
virtual void addSup(fvMatrix<scalar>& eqn, const label fieldi);
//- Add explicit contribution to enthalpy equation //- Add implicit contribution to momentum equation
virtual void addSup(fvMatrix<scalar>& eqn, const label fieldi); virtual void addSup(fvMatrix<vector>& eqn, const label fieldi);
//- Add implicit contribution to momentum equation
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
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldi
);
//- Add explicit contribution to compressible enthalpy equation //- Add implicit contribution to compressible momentum equation
virtual void addSup virtual void addSup
( (
const volScalarField& rho, const volScalarField& rho,
fvMatrix<scalar>& eqn, fvMatrix<vector>& eqn,
const label fieldi const label fieldi
); );
//- Add implicit contribution to compressible momentum equation
virtual void addSup
(
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldi
);
// IO //- Read source dictionary
virtual bool read(const dictionary& dict);
//- 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 * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tabulated6DoFAcceleration::accelerationVectors Foam::tabulated6DoFAcceleration::accelerationVectors
@ -106,7 +100,7 @@ bool Foam::tabulated6DoFAcceleration::read
fileName newTimeDataFileName fileName newTimeDataFileName
( (
fileName(accelerationCoeffs_.lookup("timeDataFileName")).expand() accelerationCoeffs_.get<fileName>("timeDataFileName").expand()
); );
if (newTimeDataFileName != timeDataFileName_) if (newTimeDataFileName != timeDataFileName_)

View File

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

View File

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

View File

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

View File

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

View File

@ -51,21 +51,18 @@ namespace fv
Foam::tmp<Foam::volScalarField> Foam::fv::viscousDissipation::rho() const Foam::tmp<Foam::volScalarField> Foam::fv::viscousDissipation::rho() const
{ {
tmp<volScalarField> trho auto trho = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "trho",
( mesh_.time().timeName(),
"trho",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_, mesh_,
rho_ IOobject::NO_READ,
) IOobject::NO_WRITE
),
mesh_,
rho_
); );
if (rho_.value() > 0) if (rho_.value() > 0)
@ -118,7 +115,7 @@ Foam::fv::viscousDissipation::viscousDissipation
if (fieldNames_.empty()) if (fieldNames_.empty())
{ {
coeffs_.lookup("fields") >> fieldNames_; coeffs_.readEntry("fields", fieldNames_);
} }
if (fieldNames_.size() != 1) if (fieldNames_.size() != 1)
@ -138,10 +135,11 @@ Foam::fv::viscousDissipation::devRhoReff() const
{ {
// Incompressible // Incompressible
{ {
typedef incompressible::turbulenceModel turbType; const auto* turbPtr =
mesh_.lookupObjectPtr<incompressible::turbulenceModel>
const turbType* turbPtr = (
mesh_.lookupObjectPtr<turbType>(turbulenceModel::propertiesName); turbulenceModel::propertiesName
);
if (turbPtr) if (turbPtr)
{ {
@ -151,10 +149,11 @@ Foam::fv::viscousDissipation::devRhoReff() const
// Compressible // Compressible
{ {
typedef compressible::turbulenceModel turbType; const auto* turbPtr =
mesh_.lookupObjectPtr<compressible::turbulenceModel>
const turbType* turbPtr = (
mesh_.lookupObjectPtr<turbType>(turbulenceModel::propertiesName); turbulenceModel::propertiesName
);
if (turbPtr) if (turbPtr)
{ {
@ -180,23 +179,20 @@ void Foam::fv::viscousDissipation::addSup
typedef typename outerProduct<vector, vector>::type GradType; typedef typename outerProduct<vector, vector>::type GradType;
typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType; typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
word gradUName("grad(" + UName_ + ')'); const word gradUName("grad(" + UName_ + ')');
tmp<GradFieldType> tgradU auto tgradU = tmp<GradFieldType>::New
( (
new GradFieldType IOobject
( (
IOobject "gradU",
( mesh_.time().timeName(),
"gradU", mesh_.time(),
mesh_.time().timeName(), IOobject::NO_READ,
mesh_.time(), IOobject::NO_WRITE
IOobject::NO_READ, ),
IOobject::NO_WRITE mesh_,
), dimensionedTensor(inv(dimTime), Zero)
mesh_,
dimensionedTensor(inv(dimTime), Zero)
)
); );
// Cached? // Cached?

View File

@ -115,25 +115,19 @@ public:
// Member Functions // Member Functions
// Evaluate //- Add explicit contribution to compressible energy equation
virtual void addSup
//- Add explicit contribution to compressible energy equation (
virtual void addSup const volScalarField& rho,
( fvMatrix<scalar>& eqn,
const volScalarField& rho, const label fieldi
fvMatrix<scalar>& eqn, );
const label fieldi
);
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict)
{
return true;
}
//- 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 dynamicCodeContext& context
) const ) const
{ {
word sourceType(pTraits<Type>::typeName); const word sourceType(pTraits<Type>::typeName);
// Set additional rewrite rules // Set additional rewrite rules
dynCode.setFilterVariable("typeName", name_); dynCode.setFilterVariable("typeName", name_);

View File

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

View File

@ -92,8 +92,8 @@ void Foam::fv::SemiImplicitSource<Type>::setFieldData(const dictionary& dict)
forAllConstIter(dictionary, dict, iter) forAllConstIter(dictionary, dict, iter)
{ {
fieldNames_[i] = iter().keyword(); fieldNames_[i] = iter().keyword();
dict.lookup(iter().keyword()) >> injectionRate_[i]; dict.readEntry(iter().keyword(), injectionRate_[i]);
i++; ++i;
} }
// Set volume normalisation // 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 namespace fv
{ {
// Forward declaration of classes // Forward declarations
template<class Type> class SemiImplicitSource;
template<class Type>
class SemiImplicitSource;
// Forward declaration of friend functions
template<class Type> template<class Type>
Ostream& operator<< Ostream& operator<<
@ -216,7 +211,6 @@ public:
#ifdef NoRepository #ifdef NoRepository
#include "SemiImplicitSource.C" #include "SemiImplicitSource.C"
#include "SemiImplicitSourceIO.C"
#endif #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,10 +296,8 @@ bool Foam::fv::interRegionExplicitPorositySource::read(const dictionary& dict)
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

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

View File

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

View File

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

View File

@ -119,9 +119,10 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
dict, dict,
mesh mesh
), ),
nbrModelName_(coeffs_.lookup("nbrModel")), nbrModelName_(coeffs_.get<word>("nbrModel")),
nbrModel_(nullptr), nbrModel_(nullptr),
firstIter_(true), firstIter_(true),
semiImplicit_(false),
timeIndex_(-1), timeIndex_(-1),
htc_ htc_
( (
@ -137,26 +138,19 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
dimensionedScalar(dimEnergy/dimTime/dimTemperature/dimVolume, Zero), dimensionedScalar(dimEnergy/dimTime/dimTemperature/dimVolume, Zero),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
), ),
semiImplicit_(false),
TName_(coeffs_.lookupOrDefault<word>("T", "T")), TName_(coeffs_.lookupOrDefault<word>("T", "T")),
TNbrName_(coeffs_.lookupOrDefault<word>("TNbr", "T")) TNbrName_(coeffs_.lookupOrDefault<word>("TNbr", "T"))
{ {
if (active()) if (active())
{ {
coeffs_.lookup("fields") >> fieldNames_; coeffs_.readEntry("fields", fieldNames_);
applied_.setSize(fieldNames_.size(), false); applied_.setSize(fieldNames_.size(), false);
coeffs_.lookup("semiImplicit") >> semiImplicit_; coeffs_.readEntry("semiImplicit", semiImplicit_);
} }
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::interRegionHeatTransferModel::~interRegionHeatTransferModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::interRegionHeatTransferModel::addSup void Foam::fv::interRegionHeatTransferModel::addSup
@ -173,23 +167,20 @@ void Foam::fv::interRegionHeatTransferModel::addSup
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_); const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
tmp<volScalarField> tTmapped auto tTmapped = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject type() + ":Tmapped",
( mesh_.time().timeName(),
type() + ":Tmapped", mesh_,
mesh_.time().timeName(), IOobject::NO_READ,
mesh_, IOobject::NO_WRITE
IOobject::NO_READ, ),
IOobject::NO_WRITE T
),
T
)
); );
volScalarField& Tmapped = tTmapped.ref(); auto& Tmapped = tTmapped.ref();
const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_); 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 //- First iteration
bool firstIter_; bool firstIter_;
//- Flag to activate semi-implicit coupling
bool semiImplicit_;
//- Time index - used for updating htc //- Time index - used for updating htc
label timeIndex_; label timeIndex_;
//- Heat transfer coefficient [W/m2/k] times area/volume [1/m] //- Heat transfer coefficient [W/m2/k] times area/volume [1/m]
volScalarField htc_; volScalarField htc_;
//- Flag to activate semi-implicit coupling
bool semiImplicit_;
//- Name of temperature field; default = "T" //- Name of temperature field; default = "T"
word TName_; word TName_;
@ -151,7 +151,7 @@ public:
//- Destructor //- Destructor
virtual ~interRegionHeatTransferModel(); virtual ~interRegionHeatTransferModel() = default;
// Member Functions // 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,10 +139,8 @@ bool Foam::fv::tabulatedHeatTransfer::read(const dictionary& dict)
{ {
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -91,8 +91,8 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry()
{ {
geometryMode_ = geometryModelNames_.lookup("geometryMode", coeffs_); geometryMode_ = geometryModelNames_.lookup("geometryMode", coeffs_);
Info<< "Region " << mesh_.name() << " " << type() << " " << name_ << " " Info<< "Region " << mesh_.name() << " " << type() << " " << name_
<< geometryModelNames_[geometryMode_] << " geometry:" << nl; << " " << geometryModelNames_[geometryMode_] << " geometry:" << nl;
switch (geometryMode_) switch (geometryMode_)
{ {
@ -101,8 +101,8 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry()
const fvMesh& nbrMesh = const fvMesh& nbrMesh =
mesh_.time().lookupObject<fvMesh>(nbrRegionName()); mesh_.time().lookupObject<fvMesh>(nbrRegionName());
word inletPatchName(coeffs_.lookup("inletPatch")); word inletPatchName(coeffs_.get<word>("inletPatch"));
word inletPatchNbrName(coeffs_.lookup("inletPatchNbr")); word inletPatchNbrName(coeffs_.get<word>("inletPatchNbr"));
Info<< " Inlet patch : " << inletPatchName << nl Info<< " Inlet patch : " << inletPatchName << nl
<< " Inlet patch neighbour : " << inletPatchNbrName << " Inlet patch neighbour : " << inletPatchNbrName
@ -112,9 +112,9 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry()
label patchINbr = label patchINbr =
nbrMesh.boundary().findPatchID(inletPatchNbrName); 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 FatalErrorInFunction
<< "Inlet patch blockage ratio must be between 0 and 1" << "Inlet patch blockage ratio must be between 0 and 1"
@ -122,12 +122,9 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry()
<< abort(FatalError); << abort(FatalError);
} }
scalar alphaNbr scalar alphaNbr(coeffs_.get<scalar>("inletBlockageRatioNbr"));
(
readScalar(coeffs_.lookup("inletBlockageRatioNbr"))
);
if ((alphaNbr < 0) || (alphaNbr > 1)) if (alphaNbr < 0 || alphaNbr > 1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Inlet patch neighbour blockage ratio must be " << "Inlet patch neighbour blockage ratio must be "
@ -147,9 +144,9 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry()
(scalar(1) - alphaNbr) (scalar(1) - alphaNbr)
*gSum(nbrMesh.magSf().boundaryField()[patchINbr]); *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 FatalErrorInFunction
<< "Core volume blockage ratio must be between 0 and 1" << "Core volume blockage ratio must be between 0 and 1"
@ -165,8 +162,8 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry()
} }
case gmUser: case gmUser:
{ {
coeffs_.lookup("Ain") >> Ain_; coeffs_.readEntry("Ain", Ain_);
coeffs_.lookup("AinNbr") >> AinNbr_; coeffs_.readEntry("AinNbr", AinNbr_);
if (!coeffs_.readIfPresent("Vcore", Vcore_)) if (!coeffs_.readIfPresent("Vcore", Vcore_))
{ {
@ -281,10 +278,8 @@ bool Foam::fv::tabulatedNTUHeatTransfer::read(const dictionary& dict)
return true; return true;
} }
else
{ return false;
return false;
}
} }

View File

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

View File

@ -65,11 +65,11 @@ Foam::fv::variableHeatTransfer::variableHeatTransfer
{ {
if (master_) if (master_)
{ {
a_ = readScalar(coeffs_.lookup("a")); a_ = coeffs_.get<scalar>("a");
b_ = readScalar(coeffs_.lookup("b")); b_ = coeffs_.get<scalar>("b");
c_ = readScalar(coeffs_.lookup("c")); c_ = coeffs_.get<scalar>("c");
ds_ = readScalar(coeffs_.lookup("ds")); ds_ = coeffs_.get<scalar>("ds");
Pr_ = readScalar(coeffs_.lookup("Pr")); Pr_ = coeffs_.get<scalar>("Pr");
AoV_.reset AoV_.reset
( (
new volScalarField new volScalarField
@ -134,10 +134,8 @@ bool Foam::fv::variableHeatTransfer::read(const dictionary& dict)
return true; return true;
} }
else
{ return false;
return false;
}
} }