Commit 944e0974 authored by Henry's avatar Henry
Browse files

solidificationMeltingSource: Removed all need for the "alwaysApply" hack

Also removed the underlying structure for "alwaysApply" from fvOption
parent 940e63c9
......@@ -38,14 +38,6 @@ namespace Foam
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::fv::option::alwaysApply() const
{
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::option::option
......@@ -115,11 +107,6 @@ bool Foam::fv::option::isActive()
Foam::label Foam::fv::option::applyToField(const word& fieldName) const
{
if (alwaysApply())
{
return 0;
}
return findIndex(fieldNames_, fieldName);
}
......
......@@ -94,12 +94,6 @@ protected:
List<bool> applied_;
// Protected functions
//- Flag to bypass the apply flag list checking
virtual bool alwaysApply() const;
public:
//- Runtime type information
......
......@@ -65,51 +65,6 @@ const Foam::NamedEnum<Foam::fv::solidificationMeltingSource::thermoMode, 2>
// * * * * * * * * * * * * * 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::fv::solidificationMeltingSource::Cp() const
{
......@@ -265,19 +220,40 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource
curTimeIndex_(-1),
deltaT_(cells_.size(), 0)
{
fieldNames_.setSize(1, "source");
applied_.setSize(1, false);
}
fieldNames_.setSize(2);
fieldNames_[0] = UName_;
switch (mode_)
{
case mdThermo:
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
fieldNames_[1] = thermo.he().name();
break;
}
case mdLookup:
{
fieldNames_[1] = TName_;
break;
}
default:
{
FatalErrorIn
(
"fv::solidificationMeltingSource::solidificationMeltingSource"
) << "Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
<< abort(FatalError);
}
}
bool Foam::fv::solidificationMeltingSource::alwaysApply() const
{
return true;
applied_.setSize(2, false);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::solidificationMeltingSource::addSup
(
fvMatrix<scalar>& eqn,
......@@ -305,16 +281,9 @@ void Foam::fv::solidificationMeltingSource::addSup
const label fieldI
)
{
const volVectorField& U = eqn.psi();
if (U.name() != UName_)
{
return;
}
if (debug)
{
Info<< type() << ": applying source to " << UName_ << endl;
Info<< type() << ": applying source to " << eqn.psi().name() << endl;
}
const volScalarField Cp(this->Cp());
......@@ -350,7 +319,7 @@ void Foam::fv::solidificationMeltingSource::addSup
const label fieldI
)
{
// momentum source uses a Boussinesq approximation - redirect
// Momentum source uses a Boussinesq approximation - redirect
addSup(eqn, fieldI);
}
......
......@@ -178,9 +178,6 @@ private:
// Private Member Functions
//- Flag to indicate whether to solve for given field
bool solveField(const word& fieldName) const;
//- Return the specific heat capacity field
tmp<volScalarField> Cp() const;
......@@ -221,10 +218,6 @@ public:
// Member Functions
//- Flag to bypass the apply flag list checking
virtual bool alwaysApply() const;
// Add explicit and implicit contributions
//- Add explicit contribution to enthalpy equation
......
......@@ -35,11 +35,6 @@ void Foam::fv::solidificationMeltingSource::apply
fvMatrix<scalar>& eqn
)
{
if (!solveField(eqn.psi().name()))
{
return;
}
if (debug)
{
Info<< type() << ": applying source to " << eqn.psi().name() << endl;
......
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