twoPhaseModels::interfaceProperties: Correct alpha2 after alpha1 contact angle BCs are updated

Resolves bug-report https://bugs.openfoam.org/view.php?id=3594
This commit is contained in:
Henry Weller
2020-11-23 14:53:34 +00:00
parent d7d1221cd4
commit 92c9b112f0
4 changed files with 21 additions and 18 deletions

View File

@ -43,7 +43,7 @@ Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
: :
rhoThermo::composite(U.mesh(), word::null), rhoThermo::composite(U.mesh(), word::null),
twoPhaseMixture(U.mesh(), *this), twoPhaseMixture(U.mesh(), *this),
interfaceProperties(alpha1(), U, *this), interfaceProperties(alpha1(), alpha2(), U, *this),
thermo1_(nullptr), thermo1_(nullptr),
thermo2_(nullptr), thermo2_(nullptr),
Alpha1_ Alpha1_

View File

@ -36,7 +36,7 @@ immiscibleIncompressibleTwoPhaseMixture
) )
: :
incompressibleTwoPhaseMixture(U, phi), incompressibleTwoPhaseMixture(U, phi),
interfaceProperties(alpha1(), U, *this) interfaceProperties(alpha1(), alpha2(), U, *this)
{} {}

View File

@ -43,30 +43,28 @@ void Foam::interfaceProperties::correctContactAngle
( (
surfaceVectorField::Boundary& nHatb, surfaceVectorField::Boundary& nHatb,
const surfaceVectorField::Boundary& gradAlphaf const surfaceVectorField::Boundary& gradAlphaf
) const )
{ {
const fvMesh& mesh = alpha1_.mesh(); const fvMesh& mesh = alpha1_.mesh();
const volScalarField::Boundary& abf = alpha1_.boundaryField(); volScalarField::Boundary& a1bf = alpha1_.boundaryFieldRef();
volScalarField::Boundary& a2bf = alpha2_.boundaryFieldRef();
const fvBoundaryMesh& boundary = mesh.boundary(); const fvBoundaryMesh& boundary = mesh.boundary();
forAll(boundary, patchi) forAll(boundary, patchi)
{ {
if (isA<alphaContactAngleFvPatchScalarField>(abf[patchi])) if (isA<alphaContactAngleFvPatchScalarField>(a1bf[patchi]))
{ {
alphaContactAngleFvPatchScalarField& acap = alphaContactAngleFvPatchScalarField& a1cap =
const_cast<alphaContactAngleFvPatchScalarField&> refCast<alphaContactAngleFvPatchScalarField>
( (
refCast<const alphaContactAngleFvPatchScalarField> a1bf[patchi]
(
abf[patchi]
)
); );
fvsPatchVectorField& nHatp = nHatb[patchi]; fvsPatchVectorField& nHatp = nHatb[patchi];
const scalarField theta const scalarField theta
( (
degToRad(acap.theta(U_.boundaryField()[patchi], nHatp)) degToRad(a1cap.theta(U_.boundaryField()[patchi], nHatp))
); );
const vectorField nf const vectorField nf
@ -93,8 +91,9 @@ void Foam::interfaceProperties::correctContactAngle
nHatp = a*nf + b*nHatp; nHatp = a*nf + b*nHatp;
nHatp /= (mag(nHatp) + deltaN_.value()); nHatp /= (mag(nHatp) + deltaN_.value());
acap.gradient() = (nf & nHatp)*mag(gradAlphaf[patchi]); a1cap.gradient() = (nf & nHatp)*mag(gradAlphaf[patchi]);
acap.evaluate(); a1cap.evaluate();
a2bf[patchi] = 1 - a1cap;
} }
} }
} }
@ -148,7 +147,8 @@ void Foam::interfaceProperties::calculateK()
Foam::interfaceProperties::interfaceProperties Foam::interfaceProperties::interfaceProperties
( (
const volScalarField& alpha1, volScalarField& alpha1,
volScalarField& alpha2,
const volVectorField& U, const volVectorField& U,
const IOdictionary& dict const IOdictionary& dict
) )
@ -164,6 +164,7 @@ Foam::interfaceProperties::interfaceProperties
), ),
alpha1_(alpha1), alpha1_(alpha1),
alpha2_(alpha2),
U_(U), U_(U),
nHatf_ nHatf_

View File

@ -66,7 +66,8 @@ class interfaceProperties
//- Stabilisation for normalisation of the interface normal //- Stabilisation for normalisation of the interface normal
const dimensionedScalar deltaN_; const dimensionedScalar deltaN_;
const volScalarField& alpha1_; volScalarField& alpha1_;
volScalarField& alpha2_;
const volVectorField& U_; const volVectorField& U_;
surfaceScalarField nHatf_; surfaceScalarField nHatf_;
volScalarField K_; volScalarField K_;
@ -81,7 +82,7 @@ class interfaceProperties
( (
surfaceVectorField::Boundary& nHat, surfaceVectorField::Boundary& nHat,
const surfaceVectorField::Boundary& gradAlphaf const surfaceVectorField::Boundary& gradAlphaf
) const; );
//- Re-calculate the interface curvature //- Re-calculate the interface curvature
void calculateK(); void calculateK();
@ -94,7 +95,8 @@ public:
//- Construct from volume fraction field gamma and IOdictionary //- Construct from volume fraction field gamma and IOdictionary
interfaceProperties interfaceProperties
( (
const volScalarField& alpha1, volScalarField& alpha1,
volScalarField& alpha2,
const volVectorField& U, const volVectorField& U,
const IOdictionary& const IOdictionary&
); );