mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
fvOption: Rationalize read to support re-reading
writeData is not yet completely consistent with read.
This commit is contained in:
@ -190,13 +190,7 @@ public:
|
||||
virtual bool isActive();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the source header information
|
||||
virtual void writeHeader(Ostream&) const;
|
||||
|
||||
//- Write the source footer information
|
||||
virtual void writeFooter(Ostream&) const;
|
||||
// IO
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -27,19 +27,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fv::cellSetOption::writeHeader(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << nl
|
||||
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::cellSetOption::writeFooter(Ostream& os) const
|
||||
{
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::cellSetOption::writeData(Ostream& os) const
|
||||
{
|
||||
option::writeData(os);
|
||||
|
||||
@ -150,14 +150,14 @@ void Foam::fv::fixedTemperatureConstraint::setValue
|
||||
|
||||
void Foam::fv::fixedTemperatureConstraint::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::fixedTemperatureConstraint::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
if (coeffs_.found(Tuniform_->name()))
|
||||
{
|
||||
|
||||
@ -145,7 +145,7 @@ public:
|
||||
virtual void setValue(fvMatrix<scalar>& eqn, const label fieldI);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -127,14 +127,14 @@ void Foam::fv::temperatureLimitsConstraint::correct(volScalarField& he)
|
||||
|
||||
void Foam::fv::temperatureLimitsConstraint::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::temperatureLimitsConstraint::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("Tmin", Tmin_);
|
||||
coeffs_.readIfPresent("Tmax", Tmax_);
|
||||
|
||||
@ -36,9 +36,8 @@ Description
|
||||
maximum 500;
|
||||
}
|
||||
|
||||
|
||||
SourceFiles
|
||||
fvOption.C
|
||||
temperatureLimitsConstraint.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -119,7 +118,7 @@ public:
|
||||
virtual void correct(volScalarField& he);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -111,7 +111,7 @@ public:
|
||||
virtual void setValue(fvMatrix<Type>& eqn, const label fieldI);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
template<class Type>
|
||||
void Foam::fv::ExplicitSetValue<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ void Foam::fv::ExplicitSetValue<Type>::writeData(Ostream& os) const
|
||||
template<class Type>
|
||||
bool Foam::fv::ExplicitSetValue<Type>::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
setFieldData(coeffs_.subDict("injectionRate"));
|
||||
return true;
|
||||
|
||||
@ -414,7 +414,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write the source header information
|
||||
virtual void writeHeader(Ostream&) const;
|
||||
|
||||
@ -175,7 +175,7 @@ public:
|
||||
void constrain(fvMatrix<Type>& eqn);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::fv::interRegionOption
|
||||
|
||||
Description
|
||||
Base class for inter region exchange.
|
||||
Base class for inter-region exchange.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -106,7 +106,7 @@ public:
|
||||
inline const meshToMesh& meshInterp() const;
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -160,14 +160,14 @@ void Foam::fv::actuationDiskSource::addSup
|
||||
|
||||
void Foam::fv::actuationDiskSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::actuationDiskSource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("diskDir", diskDir_);
|
||||
coeffs_.readIfPresent("Cp", Cp_);
|
||||
|
||||
@ -205,7 +205,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -310,14 +310,14 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
||||
|
||||
void Foam::fv::effectivenessHeatExchangerSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
coeffs_.lookup("secondaryMassFlowRate") >> secondaryMassFlowRate_;
|
||||
coeffs_.lookup("secondaryInletT") >> secondaryInletT_;
|
||||
|
||||
@ -276,7 +276,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -125,14 +125,14 @@ void Foam::fv::explicitPorositySource::addSup
|
||||
|
||||
void Foam::fv::explicitPorositySource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
if (coeffs_.found("UNames"))
|
||||
{
|
||||
|
||||
@ -159,7 +159,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -153,7 +153,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -119,12 +119,8 @@ void Foam::fv::radialActuationDiskSource::writeData(Ostream& os) const
|
||||
|
||||
bool Foam::fv::radialActuationDiskSource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (actuationDiskSource::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("diskDir", diskDir_);
|
||||
coeffs_.readIfPresent("Cp", Cp_);
|
||||
coeffs_.readIfPresent("Ct", Ct_);
|
||||
coeffs_.readIfPresent("diskArea", diskArea_);
|
||||
coeffs_.lookup("coeffs") >> radialCoeffs_;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -589,14 +589,14 @@ void Foam::fv::rotorDiskSource::addSup
|
||||
|
||||
void Foam::fv::rotorDiskSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::rotorDiskSource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
coeffs_.lookup("fieldNames") >> fieldNames_;
|
||||
applied_.setSize(fieldNames_.size(), false);
|
||||
|
||||
@ -305,7 +305,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -253,7 +253,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -29,14 +29,14 @@ License
|
||||
|
||||
void Foam::fv::solidificationMeltingSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::solidificationMeltingSource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
coeffs_.lookup("Tmelt") >> Tmelt_;
|
||||
coeffs_.lookup("L") >> L_;
|
||||
|
||||
@ -96,7 +96,7 @@ void Foam::fv::tabulatedAccelerationSource::addSup
|
||||
|
||||
void Foam::fv::tabulatedAccelerationSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
option::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -31,7 +31,7 @@ License
|
||||
template<class Type>
|
||||
void Foam::fv::CodedSource<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ void Foam::fv::CodedSource<Type>::writeData(Ostream& os) const
|
||||
template<class Type>
|
||||
bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
coeffs_.lookup("fieldNames") >> fieldNames_;
|
||||
applied_.setSize(fieldNames_.size(), false);
|
||||
|
||||
@ -200,7 +200,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write the source properties
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
template<class Type>
|
||||
void Foam::fv::SemiImplicitSource<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
cellSetOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ void Foam::fv::SemiImplicitSource<Type>::writeData(Ostream& os) const
|
||||
template<class Type>
|
||||
bool Foam::fv::SemiImplicitSource<Type>::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
volumeMode_ = wordToVolumeModeType(coeffs_.lookup("volumeMode"));
|
||||
setFieldData(coeffs_.subDict("injectionRateSuSp"));
|
||||
|
||||
@ -290,14 +290,14 @@ void Foam::fv::interRegionExplicitPorositySource::addSup
|
||||
|
||||
void Foam::fv::interRegionExplicitPorositySource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
interRegionOption::writeData(os);
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::interRegionExplicitPorositySource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (interRegionOption::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("UName", UName_);
|
||||
coeffs_.readIfPresent("muName", muName_);
|
||||
|
||||
@ -162,7 +162,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -105,27 +105,20 @@ Foam::fv::constantHeatTransfer::~constantHeatTransfer()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fv::constantHeatTransfer::calculateHtc()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fv::constantHeatTransfer::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
interRegionHeatTransferModel::writeData(os);
|
||||
|
||||
os << indent << type() + "Coeffs" << nl;
|
||||
|
||||
coeffs_.write(os);
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::constantHeatTransfer::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (interRegionHeatTransferModel::read(dict))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public:
|
||||
virtual void calculateHtc();
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -186,7 +186,7 @@ public:
|
||||
virtual void calculateHtc() = 0;
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -40,7 +40,7 @@ void Foam::fv::interRegionHeatTransferModel::writeData(Ostream& os) const
|
||||
|
||||
bool Foam::fv::interRegionHeatTransferModel::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (interRegionOption::read(dict))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -135,20 +135,14 @@ void Foam::fv::tabulatedHeatTransfer::calculateHtc()
|
||||
|
||||
void Foam::fv::tabulatedHeatTransfer::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
interRegionHeatTransferModel::writeData(os);
|
||||
|
||||
os << indent << type() + "Coeffs" << nl;
|
||||
|
||||
coeffs_.write(os);
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::tabulatedHeatTransfer::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (interRegionHeatTransferModel::read(dict))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
virtual void calculateHtc();
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
@ -128,21 +128,14 @@ void Foam::fv::variableHeatTransfer::calculateHtc()
|
||||
|
||||
void Foam::fv::variableHeatTransfer::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
|
||||
interRegionHeatTransferModel::writeData(os);
|
||||
|
||||
os << indent << type() + "Coeffs" << nl;
|
||||
|
||||
coeffs_.write(os);
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::variableHeatTransfer::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
if (interRegionHeatTransferModel::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("UNbrName", UNbrName_);
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ public:
|
||||
virtual void calculateHtc();
|
||||
|
||||
|
||||
// I-O
|
||||
// IO
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
Reference in New Issue
Block a user