@东岳 多谢东岳大神回复。之前可能我没表述清楚我的问题:我想同时fix液滴与固体表面的接触线和接触角,即壁面处的volume fraction和theta都始终保持t=0时的值,并不随时间而改变。相当于fixed value和constantAlphaContactAngle两个边界条件的结合。如果边界条件设置为constantAlphaContactAngle(zeroGradient也相当于对应theta0=90的constantAlphaContactAngle边界), 在迭代的过程中会计算当前的curvature, 并通过与设置的theta0比较来更新壁面处的受力情况,从而重新计算边界处的volume fraction, 以使计算的theta趋近于所定义的theta0(如后面摘自interfaceProperties中的代码所示),这并不能保证接触线(即volume fraction)的固定。
我的理解是这样的,不知道对不对:接触角theta与壁面处volume fraction的梯度是相对应的。能否让壁面处的第一层和第二层网格中的volume fraction值都固定,即volume fraction方程在该区域不进行求解而是始终采用t=0时刻的初始值,这样就能实现我前面所说的目的了。不知在openfoam中能否实现。
期待您答复,谢谢!
   forAll(boundary, patchi)
    {
        if (isA<alphaContactAngleFvPatchScalarField>(abf[patchi]))
        {
            alphaContactAngleFvPatchScalarField& acap =
                const_cast<alphaContactAngleFvPatchScalarField&>
                (
                    refCast<const alphaContactAngleFvPatchScalarField>
                    (
                        abf[patchi]
                    )
                );
            fvsPatchVectorField& nHatp = nHatb[patchi];
            const scalarField theta
            (
                convertToRad*acap.theta(U_.boundaryField()[patchi], nHatp)
            );
            const vectorField nf
            (
                boundary[patchi].nf()
            );
            // Reset nHatp to correspond to the contact angle
            const scalarField a12(nHatp & nf);
            const scalarField b1(cos(theta));
            scalarField b2(nHatp.size());
            forAll(b2, facei)
            {
                b2[facei] = cos(acos(a12[facei]) - theta[facei]);
            }
            const scalarField det(1.0 - a12*a12);
            scalarField a((b1 - a12*b2)/det);
            scalarField b((b2 - a12*b1)/det);
            nHatp = a*nf + b*nHatp;
            nHatp /= (mag(nHatp) + deltaN_.value());
            acap.gradient() = (nf & nHatp)*mag(gradAlphaf[patchi]);
            acap.evaluate();
        }
    }