Skip to content
Snippets Groups Projects
Commit e8fcd1d3 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: enforce dictionary read length for read UNames/epsilonNames entry

parent 209884d3
Branches
Tags
No related merge requests found
......@@ -119,18 +119,10 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
{
if (coeffs_.found("UNames"))
if (!coeffs_.readIfPresent("UNames", fieldNames_))
{
coeffs_.lookup("UNames") >> fieldNames_;
}
else if (coeffs_.found("U"))
{
word UName(coeffs_.lookup("U"));
fieldNames_ = wordList(1, UName);
}
else
{
fieldNames_ = wordList(1, "U");
fieldNames_.resize(1);
fieldNames_.first() = coeffs_.lookupOrDefault<word>("U", "U");
}
applied_.setSize(fieldNames_.size(), false);
......
......@@ -207,18 +207,10 @@ bool Foam::fv::multiphaseMangrovesSource::read(const dictionary& dict)
{
if (option::read(dict))
{
if (coeffs_.found("UNames"))
if (!coeffs_.readIfPresent("UNames", fieldNames_))
{
coeffs_.lookup("UNames") >> fieldNames_;
}
else if (coeffs_.found("U"))
{
word UName(coeffs_.lookup("U"));
fieldNames_ = wordList(1, UName);
}
else
{
fieldNames_ = wordList(1, "U");
fieldNames_.resize(1);
fieldNames_.first() = coeffs_.lookupOrDefault<word>("U", "U");
}
applied_.setSize(fieldNames_.size(), false);
......
......@@ -205,19 +205,19 @@ void Foam::fv::multiphaseMangrovesTurbulenceModel::addSup
if (eqn.psi().name() == epsilonName_)
{
fvMatrix<scalar> epsilonEqn
(
fvMatrix<scalar> epsilonEqn
(
- fvm::Sp(rho*epsilonCoeff(U), eqn.psi())
);
eqn += epsilonEqn;
}
else if (eqn.psi().name() == kName_)
{
fvMatrix<scalar> kEqn
(
fvMatrix<scalar> kEqn
(
- fvm::Sp(rho*kCoeff(U), eqn.psi())
);
eqn += kEqn;
eqn += kEqn;
}
}
......@@ -226,20 +226,19 @@ bool Foam::fv::multiphaseMangrovesTurbulenceModel::read(const dictionary& dict)
{
if (option::read(dict))
{
if (coeffs_.found("epsilonNames"))
if (!coeffs_.readIfPresent("epsilonNames", fieldNames_))
{
coeffs_.lookup("epsilonNames") >> fieldNames_;
}
else if (coeffs_.found("epsilon"))
{
word UName(coeffs_.lookup("epsilon"));
fieldNames_ = wordList(1, UName);
}
else
{
fieldNames_.setSize(2);
fieldNames_[0] = "epsilon";
fieldNames_[1] = "k";
if (coeffs_.found("epsilon"))
{
fieldNames_.resize(1);
coeffs_.read("epsilon", fieldNames_.first());
}
else
{
fieldNames_.resize(2);
fieldNames_[0] = "epsilon";
fieldNames_[1] = "k";
}
}
applied_.setSize(fieldNames_.size(), false);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment