Commit 6cddfdda authored by Henry's avatar Henry
Browse files

fvOptions: Rationalize naming convention for constraints

parent a99fb1de
......@@ -192,9 +192,6 @@ public:
// IO
//- Write the source properties
virtual void writeData(Ostream&) const;
//- Read source dictionary
virtual bool read(const dictionary& dict);
};
......
......@@ -27,50 +27,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::cellSetOption::writeData(Ostream& os) const
{
option::writeData(os);
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
os.writeKeyword("selectionMode")
<< selectionModeTypeNames_[selectionMode_] << nl;
switch (selectionMode_)
{
case smPoints:
{
os.writeKeyword("points") << points_
<< token::END_STATEMENT << nl;
break;
}
case smCellSet:
{
os.writeKeyword("cellSet") << cellSetName_
<< token::END_STATEMENT << nl;
break;
}
case smCellZone:
{
os.writeKeyword("cellZone") << cellSetName_
<< token::END_STATEMENT << nl;
break;
}
case smAll:
{
break;
}
default:
{
FatalErrorIn("option::writeData(Ostream&) const")
<< "Unknown selectionMode "
<< selectionMode_
<< abort(FatalError);
}
}
}
bool Foam::fv::cellSetOption::read(const dictionary& dict)
{
if (option::read(dict))
......
......@@ -107,7 +107,7 @@ bool Foam::fv::fixedTemperatureConstraint::alwaysApply() const
}
void Foam::fv::fixedTemperatureConstraint::setValue
void Foam::fv::fixedTemperatureConstraint::constrain
(
fvMatrix<scalar>& eqn,
const label
......@@ -148,13 +148,6 @@ void Foam::fv::fixedTemperatureConstraint::setValue
}
void Foam::fv::fixedTemperatureConstraint::writeData(Ostream& os) const
{
cellSetOption::writeData(os);
dict_.write(os);
}
bool Foam::fv::fixedTemperatureConstraint::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
......
......@@ -142,14 +142,11 @@ public:
// Set values directly
//- Scalar
virtual void setValue(fvMatrix<scalar>& eqn, const label fieldI);
virtual void constrain(fvMatrix<scalar>& eqn, const label fieldI);
// IO
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
......
......@@ -125,13 +125,6 @@ void Foam::fv::temperatureLimitsConstraint::correct(volScalarField& he)
}
void Foam::fv::temperatureLimitsConstraint::writeData(Ostream& os) const
{
cellSetOption::writeData(os);
dict_.write(os);
}
bool Foam::fv::temperatureLimitsConstraint::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
......
......@@ -120,9 +120,6 @@ public:
// IO
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
......
......@@ -69,7 +69,7 @@ Foam::fv::ExplicitSetValue<Type>::ExplicitSetValue
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::fv::ExplicitSetValue<Type>::setValue
void Foam::fv::ExplicitSetValue<Type>::constrain
(
fvMatrix<Type>& eqn,
const label fieldI
......@@ -78,7 +78,7 @@ void Foam::fv::ExplicitSetValue<Type>::setValue
if (debug)
{
Info<< "ExplicitSetValue<"<< pTraits<Type>::typeName
<< ">::setValue for source " << name_ << endl;
<< ">::constrain for source " << name_ << endl;
}
List<Type> values(cells_.size(), injectionRate_[fieldI]);
......
......@@ -108,14 +108,11 @@ public:
// Evaluation
//- Set value on field
virtual void setValue(fvMatrix<Type>& eqn, const label fieldI);
virtual void constrain(fvMatrix<Type>& eqn, const label fieldI);
// IO
//- Write the source properties
virtual void writeData(Ostream&) const;
//- Read source dictionary
virtual bool read(const dictionary& dict);
};
......
......@@ -27,14 +27,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::fv::ExplicitSetValue<Type>::writeData(Ostream& os) const
{
cellSetOption::writeData(os);
dict_.write(os);
}
template<class Type>
bool Foam::fv::ExplicitSetValue<Type>::read(const dictionary& dict)
{
......
......@@ -61,7 +61,7 @@ Foam::fv::option::option
mesh_(mesh),
dict_(dict),
coeffs_(dict.subDict(modelType + "Coeffs")),
active_(dict_.lookupOrDefault<bool>("active", true)),
active_(dict_.lookupOrDefault<Switch>("active", true)),
fieldNames_(),
applied_()
{
......@@ -304,15 +304,15 @@ void Foam::fv::option::addSup
}
void Foam::fv::option::setValue(fvMatrix<scalar>& eqn, const label fieldI)
void Foam::fv::option::constrain(fvMatrix<scalar>& eqn, const label fieldI)
{}
void Foam::fv::option::setValue(fvMatrix<vector>& eqn, const label fieldI)
void Foam::fv::option::constrain(fvMatrix<vector>& eqn, const label fieldI)
{}
void Foam::fv::option::setValue
void Foam::fv::option::constrain
(
fvMatrix<sphericalTensor>& eqn,
const label fieldI
......@@ -320,7 +320,7 @@ void Foam::fv::option::setValue
{}
void Foam::fv::option::setValue
void Foam::fv::option::constrain
(
fvMatrix<symmTensor>& eqn,
const label fieldI
......@@ -328,7 +328,7 @@ void Foam::fv::option::setValue
{}
void Foam::fv::option::setValue(fvMatrix<tensor>& eqn, const label fieldI)
void Foam::fv::option::constrain(fvMatrix<tensor>& eqn, const label fieldI)
{}
......
......@@ -46,6 +46,7 @@ SourceFiles
#include "fvMatricesFwd.H"
#include "volFieldsFwd.H"
#include "dictionary.H"
#include "Switch.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -84,7 +85,7 @@ protected:
dictionary coeffs_;
//- Source active flag
bool active_;
Switch active_;
//- Field names to apply source to - populated by derived models
wordList fieldNames_;
......@@ -212,7 +213,7 @@ public:
// Edit
//- Return access to the source active flag
inline bool& active();
inline Switch& active();
// Checks
......@@ -376,38 +377,38 @@ public:
);
// Set values directly
// Constraints
//- Scalar
virtual void setValue
virtual void constrain
(
fvMatrix<scalar>& eqn,
const label fieldI
);
//- Vector
virtual void setValue
virtual void constrain
(
fvMatrix<vector>& eqn,
const label fieldI
);
//- Spherical tensor
virtual void setValue
virtual void constrain
(
fvMatrix<sphericalTensor>& eqn,
const label fieldI
);
//- Symmetric tensor
virtual void setValue
virtual void constrain
(
fvMatrix<symmTensor>& eqn,
const label fieldI
);
//- Tensor
virtual void setValue
virtual void constrain
(
fvMatrix<tensor>& eqn,
const label fieldI
......
......@@ -55,7 +55,7 @@ inline void Foam::fv::option::setApplied(const label fieldI)
}
inline bool& Foam::fv::option::active()
inline Foam::Switch& Foam::fv::option::active()
{
return active_;
}
......
......@@ -42,7 +42,11 @@ void Foam::fv::option::writeFooter(Ostream& os) const
void Foam::fv::option::writeData(Ostream& os) const
{
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl << nl;
os << indent << word(type() + "Coeffs");
coeffs_.write(os);
}
......
......@@ -148,7 +148,9 @@ bool Foam::fv::optionList::writeData(Ostream& os) const
forAll(*this, i)
{
os << nl;
this->operator[](i).writeHeader(os);
this->operator[](i).writeData(os);
this->operator[](i).writeFooter(os);
}
// Check state of IOstream
......@@ -158,17 +160,10 @@ bool Foam::fv::optionList::writeData(Ostream& os) const
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
namespace Foam
Foam::Ostream& Foam::operator<<(Ostream& os, const fv::optionList& options)
{
Ostream& operator<<
(
Ostream& os,
const fv::optionList& options
)
{
options.writeData(os);
return os;
}
options.writeData(os);
return os;
}
......
......@@ -44,6 +44,16 @@ SourceFile
namespace Foam
{
// Forward declaration of friend functions and operators
namespace fv
{
class optionList;
}
Ostream& operator<<(Ostream& os, const fv::optionList& options);
namespace fv
{
......@@ -191,6 +201,7 @@ public:
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
......
......@@ -241,7 +241,7 @@ void Foam::fv::optionList::constrain(fvMatrix<Type>& eqn)
<< " to field " << eqn.psi().name() << endl;
}
source.setValue(eqn, fieldI);
source.constrain(eqn, fieldI);
}
}
}
......
......@@ -108,9 +108,6 @@ public:
// IO
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
......
......@@ -27,15 +27,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::interRegionOption::writeData(Ostream& os) const
{
option::writeData(os);
os.writeKeyword("master") << master_ << token::END_STATEMENT << nl;
os.writeKeyword("nbrRegionName") << nbrRegionName_
<< token::END_STATEMENT << nl;
}
bool Foam::fv::interRegionOption::read(const dictionary& dict)
{
if (option::read(dict))
......
......@@ -158,13 +158,6 @@ void Foam::fv::actuationDiskSource::addSup
}
void Foam::fv::actuationDiskSource::writeData(Ostream& os) const
{
cellSetOption::writeData(os);
dict_.write(os);
}
bool Foam::fv::actuationDiskSource::read(const dictionary& dict)
{
if (cellSetOption::read(dict))
......
......@@ -207,9 +207,6 @@ public:
// IO
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
......
Supports Markdown
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