explicitPorositySource: Change field naming to support multiphase

This commit is contained in:
Henry
2014-05-12 12:23:16 +01:00
committed by Andrew Heather
parent 4be6f321fd
commit 6b2de677d0
2 changed files with 55 additions and 49 deletions

View File

@ -45,10 +45,22 @@ namespace fv
}
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::fv::explicitPorositySource::initialise()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::explicitPorositySource::explicitPorositySource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
porosityPtr_(NULL)
{
read(dict);
if (selectionMode_ != smCellZone)
{
FatalErrorIn("void Foam::fv::explicitPorositySource::initialise()")
@ -66,29 +78,7 @@ void Foam::fv::explicitPorositySource::initialise()
coeffs_,
cellSetName_
).ptr()
),
fieldNames_.setSize(1, UName_);
applied_.setSize(1, false);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::explicitPorositySource::explicitPorositySource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
option(name, modelType, dict, mesh),
porosityPtr_(NULL),
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
muName_(coeffs_.lookupOrDefault<word>("muName", "thermo:mu"))
{
initialise();
);
}
@ -101,9 +91,7 @@ void Foam::fv::explicitPorositySource::addSup
)
{
fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
porosityPtr_->addResistance(porosityEqn);
eqn -= porosityEqn;
}
@ -116,14 +104,25 @@ void Foam::fv::explicitPorositySource::addSup
)
{
fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName_);
porosityPtr_->addResistance(porosityEqn, rho, mu);
porosityPtr_->addResistance(porosityEqn);
eqn -= porosityEqn;
}
void Foam::fv::explicitPorositySource::addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldI
)
{
fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
porosityPtr_->addResistance(porosityEqn);
eqn -= alpha*porosityEqn;
}
void Foam::fv::explicitPorositySource::writeData(Ostream& os) const
{
os << indent << name_ << endl;
@ -135,8 +134,21 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
{
if (option::read(dict))
{
coeffs_.readIfPresent("UName", UName_);
coeffs_.readIfPresent("muName", muName_);
if (coeffs_.found("UNames"))
{
coeffs_.lookup("UNames") >> fieldNames_;
}
else if (coeffs_.found("UName"))
{
word UName(coeffs_.lookup("UName"));
fieldNames_ = wordList(1, UName);
}
else
{
fieldNames_ = wordList(1, "U");
}
applied_.setSize(fieldNames_.size(), false);
return true;
}

View File

@ -34,6 +34,7 @@ Description
explicitPorositySourceCoeffs
{
type DarcyForchheimer;
DarcyForchheimerCoeffs
{
d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
@ -88,22 +89,6 @@ protected:
//- Run-time selectable porosity model
autoPtr<porosityModel> porosityPtr_;
//- Velocity field name, default = U
word UName_;
//- Density field name (compressible case only), default = rho
word rhoName_;
//- Dynamic viscosity field name (compressible case only)
// default = thermo:mu
word muName_;
// Protected Member Functions
//- Initialise
void initialise();
private:
@ -158,6 +143,15 @@ public:
const label fieldI
);
//- Add implicit contribution to phase momentum equation
virtual void addSup
(
const volScalarField& alpha,
const volScalarField& rho,
fvMatrix<vector>& eqn,
const label fieldI
);
// I-O