34 #include "alphaContactAngleTwoPhaseFvPatchScalarField.H"
35 #include "mathematicalConstants.H"
36 #include "surfaceInterpolate.H"
39 #include "fvcSnGrad.H"
40 #include "unitConversion.H"
50 void Foam::qInterfaceProperties::correctContactAngle
52 surfaceVectorField::Boundary& nHatb,
53 const surfaceVectorField::Boundary& gradAlphaf
56 const fvMesh& mesh = alpha1_.mesh();
57 const volScalarField::Boundary& abf = alpha1_.boundaryField();
59 const fvBoundaryMesh& boundary = mesh.boundary();
63 if (isA<alphaContactAngleTwoPhaseFvPatchScalarField>(abf[patchi]))
65 alphaContactAngleTwoPhaseFvPatchScalarField& acap =
66 const_cast<alphaContactAngleTwoPhaseFvPatchScalarField&
>
68 refCast<const alphaContactAngleTwoPhaseFvPatchScalarField>
74 fvsPatchVectorField& nHatp = nHatb[patchi];
75 const scalarField theta
77 degToRad() * acap.theta(U_.boundaryField()[patchi], nHatp)
87 const scalarField a12(nHatp & nf);
88 const scalarField b1(cos(theta));
90 scalarField b2(nHatp.size());
93 b2[facei] = cos(acos(a12[facei]) - theta[facei]);
96 const scalarField det(1.0 - a12*a12);
98 scalarField a((b1 - a12*b2)/det);
99 scalarField b((b2 - a12*b1)/det);
101 nHatp = a*nf + b*nHatp;
102 nHatp /= (mag(nHatp) + deltaN_.value());
104 acap.gradient() = (nf & nHatp)*mag(gradAlphaf[patchi]);
111 void Foam::qInterfaceProperties::calculateK()
113 const fvMesh& mesh = alpha1_.mesh();
114 const surfaceVectorField& Sf = mesh.Sf();
115 autoPtr<surfaceVectorField> tgradAlphaf;
118 const volVectorField gradAlpha(
fvc::grad(alpha1_,
"nHat"));
121 new surfaceVectorField (linearInterpolate(gradAlpha))
125 surfaceVectorField& gradAlphaf = tgradAlphaf();
132 surfaceVectorField nHatfv(gradAlphaf/(mag(gradAlphaf) + deltaN_));
138 correctContactAngle(nHatfv.boundaryFieldRef(), gradAlphaf.boundaryField());
141 nHatf_ = nHatfv & Sf;
162 Foam::qInterfaceProperties::qInterfaceProperties
164 const volScalarField& alpha1,
165 const volVectorField&
U,
166 const IOdictionary& dict
169 transportPropertiesDict_(dict),
172 alpha1.mesh().solverDict(alpha1.name()).get<scalar>(
"cAlpha")
175 sigmaPtr_(surfaceTensionModel::New(dict, alpha1.mesh())),
180 1
e-8/cbrt(average(alpha1.mesh().V()))
191 alpha1_.time().timeName(),
195 dimensionedScalar(dimArea, Zero)
202 "qInterfaceProperties:K",
203 alpha1_.time().timeName(),
207 dimensionedScalar(dimless/dimLength, Zero)
216 Foam::tmp<Foam::volScalarField>
219 return sigmaPtr_->sigma()*K_;
223 Foam::tmp<Foam::surfaceScalarField>
230 Foam::tmp<Foam::volScalarField>
233 return pos0(alpha1_ - 0.01)*pos0(0.99 - alpha1_);
245 alpha1_.mesh().solverDict(alpha1_.name()).readEntry(
"cAlpha", cAlpha_);
246 sigmaPtr_->readDict(transportPropertiesDict_);
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceScalarField &dir, const word &reconFieldName=word::null)
Interpolate field vf according to direction dir.
volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh)
bool read()
Read transportProperties dictionary.
tmp< surfaceScalarField > surfaceTensionForce() const
tmp< surfaceScalarField > div(const volVectorField &vF)
tmp< volScalarField > sigmaK() const
tmp< surfaceVectorField > grad(const volScalarField &vF)
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.