solidificationMeltingSource: Removed all need for the "alwaysApply" hack

Also removed the underlying structure for "alwaysApply" from fvOption
This commit is contained in:
Henry
2015-06-01 21:53:13 +01:00
parent 940e63c9c4
commit 944e09742c
5 changed files with 31 additions and 93 deletions

View File

@ -38,14 +38,6 @@ namespace Foam
} }
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::fv::option::alwaysApply() const
{
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::option::option Foam::fv::option::option
@ -115,11 +107,6 @@ bool Foam::fv::option::isActive()
Foam::label Foam::fv::option::applyToField(const word& fieldName) const Foam::label Foam::fv::option::applyToField(const word& fieldName) const
{ {
if (alwaysApply())
{
return 0;
}
return findIndex(fieldNames_, fieldName); return findIndex(fieldNames_, fieldName);
} }

View File

@ -94,12 +94,6 @@ protected:
List<bool> applied_; List<bool> applied_;
// Protected functions
//- Flag to bypass the apply flag list checking
virtual bool alwaysApply() const;
public: public:
//- Runtime type information //- Runtime type information

View File

@ -65,51 +65,6 @@ const Foam::NamedEnum<Foam::fv::solidificationMeltingSource::thermoMode, 2>
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::fv::solidificationMeltingSource::solveField
(
const word& fieldName
) const
{
bool result = true;
switch (mode_)
{
case mdThermo:
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
if (fieldName != thermo.he().name())
{
result = false;
}
break;
}
case mdLookup:
{
if (fieldName != TName_)
{
result = false;
}
break;
}
default:
{
FatalErrorIn
(
"bool Foam::fv::solidificationMeltingSource::solveField"
"("
"const word&"
") const"
)
<< "Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
<< abort(FatalError);
}
}
return result;
}
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::fv::solidificationMeltingSource::Cp() const Foam::fv::solidificationMeltingSource::Cp() const
{ {
@ -265,19 +220,40 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource
curTimeIndex_(-1), curTimeIndex_(-1),
deltaT_(cells_.size(), 0) deltaT_(cells_.size(), 0)
{ {
fieldNames_.setSize(1, "source"); fieldNames_.setSize(2);
applied_.setSize(1, false); fieldNames_[0] = UName_;
switch (mode_)
{
case mdThermo:
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
fieldNames_[1] = thermo.he().name();
break;
}
case mdLookup:
{
fieldNames_[1] = TName_;
break;
}
default:
{
FatalErrorIn
(
"fv::solidificationMeltingSource::solidificationMeltingSource"
) << "Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
<< abort(FatalError);
}
}
applied_.setSize(2, false);
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fv::solidificationMeltingSource::alwaysApply() const
{
return true;
}
void Foam::fv::solidificationMeltingSource::addSup void Foam::fv::solidificationMeltingSource::addSup
( (
fvMatrix<scalar>& eqn, fvMatrix<scalar>& eqn,
@ -305,16 +281,9 @@ void Foam::fv::solidificationMeltingSource::addSup
const label fieldI const label fieldI
) )
{ {
const volVectorField& U = eqn.psi();
if (U.name() != UName_)
{
return;
}
if (debug) if (debug)
{ {
Info<< type() << ": applying source to " << UName_ << endl; Info<< type() << ": applying source to " << eqn.psi().name() << endl;
} }
const volScalarField Cp(this->Cp()); const volScalarField Cp(this->Cp());
@ -350,7 +319,7 @@ void Foam::fv::solidificationMeltingSource::addSup
const label fieldI const label fieldI
) )
{ {
// momentum source uses a Boussinesq approximation - redirect // Momentum source uses a Boussinesq approximation - redirect
addSup(eqn, fieldI); addSup(eqn, fieldI);
} }

View File

@ -178,9 +178,6 @@ private:
// Private Member Functions // Private Member Functions
//- Flag to indicate whether to solve for given field
bool solveField(const word& fieldName) const;
//- Return the specific heat capacity field //- Return the specific heat capacity field
tmp<volScalarField> Cp() const; tmp<volScalarField> Cp() const;
@ -221,10 +218,6 @@ public:
// Member Functions // Member Functions
//- Flag to bypass the apply flag list checking
virtual bool alwaysApply() const;
// Add explicit and implicit contributions // Add explicit and implicit contributions
//- Add explicit contribution to enthalpy equation //- Add explicit contribution to enthalpy equation

View File

@ -35,11 +35,6 @@ void Foam::fv::solidificationMeltingSource::apply
fvMatrix<scalar>& eqn fvMatrix<scalar>& eqn
) )
{ {
if (!solveField(eqn.psi().name()))
{
return;
}
if (debug) if (debug)
{ {
Info<< type() << ": applying source to " << eqn.psi().name() << endl; Info<< type() << ": applying source to " << eqn.psi().name() << endl;