Skip to content
Snippets Groups Projects
Commit 6b2de677 authored by Henry's avatar Henry Committed by Andrew Heather
Browse files

explicitPorositySource: Change field naming to support multiphase

parent 4be6f321
No related merge requests found
...@@ -45,10 +45,22 @@ namespace fv ...@@ -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) if (selectionMode_ != smCellZone)
{ {
FatalErrorIn("void Foam::fv::explicitPorositySource::initialise()") FatalErrorIn("void Foam::fv::explicitPorositySource::initialise()")
...@@ -66,61 +78,48 @@ void Foam::fv::explicitPorositySource::initialise() ...@@ -66,61 +78,48 @@ void Foam::fv::explicitPorositySource::initialise()
coeffs_, coeffs_,
cellSetName_ cellSetName_
).ptr() ).ptr()
), );
fieldNames_.setSize(1, UName_);
applied_.setSize(1, false);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::fv::explicitPorositySource::explicitPorositySource void Foam::fv::explicitPorositySource::addSup
( (
const word& name, fvMatrix<vector>& eqn,
const word& modelType, const label fieldI
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(); fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
porosityPtr_->addResistance(porosityEqn);
eqn -= porosityEqn;
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::explicitPorositySource::addSup void Foam::fv::explicitPorositySource::addSup
( (
const volScalarField& rho,
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
const label fieldI const label fieldI
) )
{ {
fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions()); fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
porosityPtr_->addResistance(porosityEqn); porosityPtr_->addResistance(porosityEqn);
eqn -= porosityEqn; eqn -= porosityEqn;
} }
void Foam::fv::explicitPorositySource::addSup void Foam::fv::explicitPorositySource::addSup
( (
const volScalarField& alpha,
const volScalarField& rho, const volScalarField& rho,
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
const label fieldI const label fieldI
) )
{ {
fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions()); fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
porosityPtr_->addResistance(porosityEqn);
const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName_); eqn -= alpha*porosityEqn;
porosityPtr_->addResistance(porosityEqn, rho, mu);
eqn -= porosityEqn;
} }
...@@ -135,8 +134,21 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict) ...@@ -135,8 +134,21 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
{ {
if (option::read(dict)) if (option::read(dict))
{ {
coeffs_.readIfPresent("UName", UName_); if (coeffs_.found("UNames"))
coeffs_.readIfPresent("muName", muName_); {
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; return true;
} }
......
...@@ -34,6 +34,7 @@ Description ...@@ -34,6 +34,7 @@ Description
explicitPorositySourceCoeffs explicitPorositySourceCoeffs
{ {
type DarcyForchheimer; type DarcyForchheimer;
DarcyForchheimerCoeffs DarcyForchheimerCoeffs
{ {
d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
...@@ -88,22 +89,6 @@ protected: ...@@ -88,22 +89,6 @@ protected:
//- Run-time selectable porosity model //- Run-time selectable porosity model
autoPtr<porosityModel> porosityPtr_; 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: private:
...@@ -158,6 +143,15 @@ public: ...@@ -158,6 +143,15 @@ public:
const label fieldI 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 // I-O
......
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