multiphaseEulerFoam: Completed support for surface tension and contact angle.
Also improved the efficiency of the handling of the models by evaluating only those specified.
This commit is contained in:
parent
0cc2df494f
commit
23ad7a11fe
@ -118,7 +118,7 @@ public:
|
||||
<
|
||||
interfaceThetaProps,
|
||||
multiphaseSystem::interfacePair,
|
||||
multiphaseSystem::interfacePair::hash
|
||||
multiphaseSystem::interfacePair::symmHash
|
||||
> thetaPropsTable;
|
||||
|
||||
|
||||
|
@ -92,17 +92,22 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
|
||||
if (&phase2 == &phase1) continue;
|
||||
|
||||
surfaceScalarField phic
|
||||
surfaceScalarField phir(phase1.phi() - phase2.phi());
|
||||
|
||||
scalarCoeffSymmTable::const_iterator cAlpha
|
||||
(
|
||||
(mag(phi_) + mag(phase1.phi() - phase2.phi()))/mesh_.magSf()
|
||||
cAlphas_.find(interfacePair(phase1, phase2))
|
||||
);
|
||||
|
||||
surfaceScalarField phir
|
||||
(
|
||||
(phase1.phi() - phase2.phi())
|
||||
+ min(cAlpha(phase1, phase2)*phic, max(phic))
|
||||
*nHatf(phase1, phase2)
|
||||
);
|
||||
if (cAlpha != cAlphas_.end())
|
||||
{
|
||||
surfaceScalarField phic
|
||||
(
|
||||
(mag(phi_) + mag(phase1.phi() - phase2.phi()))/mesh_.magSf()
|
||||
);
|
||||
|
||||
phir += min(cAlpha()*phic, max(phic))*nHatf(phase1, phase2);
|
||||
}
|
||||
|
||||
word phirScheme
|
||||
(
|
||||
@ -189,67 +194,6 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::multiphaseSystem::cAlpha
|
||||
(
|
||||
const phaseModel& phase1,
|
||||
const phaseModel& phase2
|
||||
) const
|
||||
{
|
||||
scalarCoeffTable::const_iterator cAlpha
|
||||
(
|
||||
cAlphas_.find(interfacePair(phase1, phase2))
|
||||
);
|
||||
|
||||
if (cAlpha == cAlphas_.end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"multiphaseSystem::cAlpha"
|
||||
"(const phaseModel& phase1, const phaseModel& phase2) const"
|
||||
) << "Cannot find interface " << interfacePair(phase1, phase2)
|
||||
<< " in list of cAlpha values"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return cAlpha();
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionedScalar Foam::multiphaseSystem::Cvm
|
||||
(
|
||||
const phaseModel& phase1,
|
||||
const phaseModel& phase2
|
||||
) const
|
||||
{
|
||||
scalarCoeffTable::const_iterator Cvm
|
||||
(
|
||||
Cvms_.find(interfacePair(phase1, phase2))
|
||||
);
|
||||
|
||||
if (Cvm != Cvms_.end())
|
||||
{
|
||||
return Cvm()*phase2.rho();
|
||||
}
|
||||
|
||||
Cvm = Cvms_.find(interfacePair(phase2, phase1));
|
||||
|
||||
if (Cvm != Cvms_.end())
|
||||
{
|
||||
return Cvm()*phase1.rho();
|
||||
}
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"multiphaseSystem::Cvm"
|
||||
"(const phaseModel& phase1, const phaseModel& phase2) const"
|
||||
) << "Cannot find interface " << interfacePair(phase1, phase2)
|
||||
<< " in list of Cvm values"
|
||||
<< exit(FatalError);
|
||||
|
||||
return Cvm()*phase2.rho();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceVectorField> Foam::multiphaseSystem::nHatfv
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
@ -545,7 +489,24 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::Cvm
|
||||
|
||||
if (&phase2 != &phase)
|
||||
{
|
||||
tCvm() += Cvm(phase, phase2)*phase2;
|
||||
scalarCoeffTable::const_iterator Cvm
|
||||
(
|
||||
Cvms_.find(interfacePair(phase, phase2))
|
||||
);
|
||||
|
||||
if (Cvm != Cvms_.end())
|
||||
{
|
||||
tCvm() += Cvm()*phase2.rho()*phase2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvm = Cvms_.find(interfacePair(phase2, phase));
|
||||
|
||||
if (Cvm != Cvms_.end())
|
||||
{
|
||||
tCvm() += Cvm()*phase.rho()*phase2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,11 +545,28 @@ Foam::tmp<Foam::volVectorField> Foam::multiphaseSystem::Svm
|
||||
|
||||
if (&phase2 != &phase)
|
||||
{
|
||||
tSvm() += Cvm(phase, phase2)*phase2*phase2.DDtU();
|
||||
scalarCoeffTable::const_iterator Cvm
|
||||
(
|
||||
Cvms_.find(interfacePair(phase, phase2))
|
||||
);
|
||||
|
||||
if (Cvm != Cvms_.end())
|
||||
{
|
||||
tSvm() += Cvm()*phase2.rho()*phase2*phase2.DDtU();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvm = Cvms_.find(interfacePair(phase2, phase));
|
||||
|
||||
if (Cvm != Cvms_.end())
|
||||
{
|
||||
tSvm() += Cvm()*phase.rho()*phase2*phase2.DDtU();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove lift at fixed-flux boundaries
|
||||
// Remove virtual mass at fixed-flux boundaries
|
||||
forAll(phase.phi().boundaryField(), patchi)
|
||||
{
|
||||
if
|
||||
@ -737,7 +715,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseSystem::surfaceTension
|
||||
|
||||
if (&phase2 != &phase1)
|
||||
{
|
||||
scalarCoeffTable::const_iterator sigma
|
||||
scalarCoeffSymmTable::const_iterator sigma
|
||||
(
|
||||
sigmas_.find(interfacePair(phase1, phase2))
|
||||
);
|
||||
|
@ -72,6 +72,21 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
class symmHash
|
||||
:
|
||||
public Hash<interfacePair>
|
||||
{
|
||||
public:
|
||||
|
||||
symmHash()
|
||||
{}
|
||||
|
||||
label operator()(const interfacePair& key) const
|
||||
{
|
||||
return word::hash()(key.first()) + word::hash()(key.second());
|
||||
}
|
||||
};
|
||||
|
||||
class hash
|
||||
:
|
||||
public Hash<interfacePair>
|
||||
@ -83,7 +98,7 @@ public:
|
||||
|
||||
label operator()(const interfacePair& key) const
|
||||
{
|
||||
return word::hash()(key.first()) + word::hash()(key.second());
|
||||
return word::hash()(key.first(), word::hash()(key.second()));
|
||||
}
|
||||
};
|
||||
|
||||
@ -130,10 +145,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
typedef HashPtrTable<dragModel, interfacePair, interfacePair::hash>
|
||||
typedef HashPtrTable<dragModel, interfacePair, interfacePair::symmHash>
|
||||
dragModelTable;
|
||||
|
||||
typedef HashPtrTable<volScalarField, interfacePair, interfacePair::hash>
|
||||
typedef HashPtrTable<volScalarField, interfacePair, interfacePair::symmHash>
|
||||
dragCoeffFields;
|
||||
|
||||
|
||||
@ -168,17 +183,20 @@ private:
|
||||
|
||||
volScalarField alphas_;
|
||||
|
||||
typedef HashTable<scalar, interfacePair, interfacePair::symmHash>
|
||||
scalarCoeffSymmTable;
|
||||
|
||||
typedef HashTable<scalar, interfacePair, interfacePair::hash>
|
||||
scalarCoeffTable;
|
||||
|
||||
scalarCoeffTable sigmas_;
|
||||
scalarCoeffSymmTable sigmas_;
|
||||
dimensionSet dimSigma_;
|
||||
|
||||
scalarCoeffTable cAlphas_;
|
||||
scalarCoeffSymmTable cAlphas_;
|
||||
|
||||
scalarCoeffTable Cvms_;
|
||||
|
||||
typedef HashTable<dictionary, interfacePair, interfacePair::hash>
|
||||
typedef HashTable<dictionary, interfacePair, interfacePair::symmHash>
|
||||
interfaceDictTable;
|
||||
|
||||
dragModelTable dragModels_;
|
||||
@ -196,18 +214,6 @@ private:
|
||||
|
||||
void solveAlphas();
|
||||
|
||||
scalar cAlpha
|
||||
(
|
||||
const phaseModel& phase1,
|
||||
const phaseModel& phase2
|
||||
) const;
|
||||
|
||||
dimensionedScalar Cvm
|
||||
(
|
||||
const phaseModel& phase1,
|
||||
const phaseModel& phase2
|
||||
) const;
|
||||
|
||||
tmp<surfaceVectorField> nHatfv
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
|
@ -58,7 +58,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
phiHbyAName_(ptf.phiHbyAName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
DpName_(ptf.rhoName_),
|
||||
DpName_(ptf.DpName_),
|
||||
adjoint_(ptf.adjoint_)
|
||||
{}
|
||||
|
||||
@ -194,8 +194,11 @@ void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
|
||||
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "Dp", "Dp", rhoName_);
|
||||
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
|
||||
writeEntryIfDifferent<word>(os, "Dp", "Dp", DpName_);
|
||||
if (adjoint_)
|
||||
{
|
||||
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
gradient().writeEntry("gradient", os);
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,10 @@ phases
|
||||
|
||||
sigmas
|
||||
(
|
||||
(air water) 0.07
|
||||
);
|
||||
|
||||
interfaceCompression
|
||||
(
|
||||
(air water) 0
|
||||
);
|
||||
|
||||
virtualMass
|
||||
|
@ -79,9 +79,6 @@ sigmas
|
||||
(air water) 0.07
|
||||
(air oil) 0.07
|
||||
(air mercury) 0.07
|
||||
(water oil) 0
|
||||
(water mercury) 0
|
||||
(oil mercury) 0
|
||||
);
|
||||
|
||||
interfaceCompression
|
||||
@ -89,19 +86,10 @@ interfaceCompression
|
||||
(air water) 1
|
||||
(air oil) 1
|
||||
(air mercury) 1
|
||||
(water oil) 0
|
||||
(water mercury) 0
|
||||
(oil mercury) 0
|
||||
);
|
||||
|
||||
virtualMass
|
||||
(
|
||||
(air water) 0
|
||||
(air oil) 0
|
||||
(air mercury) 0
|
||||
(water oil) 0.5
|
||||
(water mercury) 0.5
|
||||
(oil mercury) 0.5
|
||||
);
|
||||
|
||||
drag
|
||||
|
@ -79,9 +79,6 @@ sigmas
|
||||
(air water) 0.07
|
||||
(air oil) 0.07
|
||||
(air mercury) 0.07
|
||||
(water oil) 0
|
||||
(water mercury) 0
|
||||
(oil mercury) 0
|
||||
);
|
||||
|
||||
interfaceCompression
|
||||
@ -89,19 +86,10 @@ interfaceCompression
|
||||
(air water) 1
|
||||
(air oil) 1
|
||||
(air mercury) 1
|
||||
(water oil) 0
|
||||
(water mercury) 0
|
||||
(oil mercury) 0
|
||||
);
|
||||
|
||||
virtualMass
|
||||
(
|
||||
(air water) 0
|
||||
(air oil) 0
|
||||
(air mercury) 0
|
||||
(water oil) 0.5
|
||||
(water mercury) 0.5
|
||||
(oil mercury) 0.5
|
||||
);
|
||||
|
||||
drag
|
||||
|
Loading…
Reference in New Issue
Block a user