interfaceProperties.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "interfaceProperties.H"
00028 #include "alphaContactAngleFvPatchScalarField.H"
00029 #include "mathematicalConstants.H"
00030 #include "surfaceInterpolate.H"
00031 #include "fvcDiv.H"
00032 #include "fvcGrad.H"
00033 #include "fvcSnGrad.H"
00034
00035
00036
00037 const Foam::scalar Foam::interfaceProperties::convertToRad =
00038 Foam::mathematicalConstant::pi/180.0;
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 void Foam::interfaceProperties::correctContactAngle
00050 (
00051 surfaceVectorField::GeometricBoundaryField& nHatb
00052 ) const
00053 {
00054 const fvMesh& mesh = alpha1_.mesh();
00055 const volScalarField::GeometricBoundaryField& gbf = alpha1_.boundaryField();
00056
00057 const fvBoundaryMesh& boundary = mesh.boundary();
00058
00059 forAll(boundary, patchi)
00060 {
00061 if (isA<alphaContactAngleFvPatchScalarField>(gbf[patchi]))
00062 {
00063 const alphaContactAngleFvPatchScalarField& gcap =
00064 refCast<const alphaContactAngleFvPatchScalarField>
00065 (gbf[patchi]);
00066
00067 fvsPatchVectorField& nHatp = nHatb[patchi];
00068 scalarField theta =
00069 convertToRad*gcap.theta(U_.boundaryField()[patchi], nHatp);
00070
00071 vectorField nf = boundary[patchi].nf();
00072
00073
00074
00075 scalarField a12 = nHatp & nf;
00076
00077 scalarField b1 = cos(theta);
00078
00079 scalarField b2(nHatp.size());
00080
00081 forAll(b2, facei)
00082 {
00083 b2[facei] = cos(acos(a12[facei]) - theta[facei]);
00084 }
00085
00086 scalarField det = 1.0 - a12*a12;
00087
00088 scalarField a = (b1 - a12*b2)/det;
00089 scalarField b = (b2 - a12*b1)/det;
00090
00091 nHatp = a*nf + b*nHatp;
00092
00093 nHatp /= (mag(nHatp) + deltaN_.value());
00094 }
00095 }
00096 }
00097
00098
00099 void Foam::interfaceProperties::calculateK()
00100 {
00101 const fvMesh& mesh = alpha1_.mesh();
00102 const surfaceVectorField& Sf = mesh.Sf();
00103
00104
00105 volVectorField gradAlpha = fvc::grad(alpha1_);
00106
00107
00108 surfaceVectorField gradAlphaf = fvc::interpolate(gradAlpha);
00109
00110
00111
00112
00113
00114 surfaceVectorField nHatfv = gradAlphaf/(mag(gradAlphaf) + deltaN_);
00115 correctContactAngle(nHatfv.boundaryField());
00116
00117
00118 nHatf_ = nHatfv & Sf;
00119
00120
00121 K_ = -fvc::div(nHatf_);
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 }
00135
00136
00137
00138
00139 Foam::interfaceProperties::interfaceProperties
00140 (
00141 const volScalarField& alpha1,
00142 const volVectorField& U,
00143 const IOdictionary& dict
00144 )
00145 :
00146 transportPropertiesDict_(dict),
00147 cAlpha_
00148 (
00149 readScalar
00150 (
00151 alpha1.mesh().solutionDict().subDict("PISO").lookup("cAlpha")
00152 )
00153 ),
00154 sigma_(dict.lookup("sigma")),
00155
00156 deltaN_
00157 (
00158 "deltaN",
00159 1e-8/pow(average(alpha1.mesh().V()), 1.0/3.0)
00160 ),
00161
00162 alpha1_(alpha1),
00163 U_(U),
00164
00165 nHatf_
00166 (
00167 IOobject
00168 (
00169 "nHatf",
00170 alpha1_.time().timeName(),
00171 alpha1_.mesh()
00172 ),
00173 alpha1_.mesh(),
00174 dimensionedScalar("nHatf", dimArea, 0.0)
00175 ),
00176
00177 K_
00178 (
00179 IOobject
00180 (
00181 "K",
00182 alpha1_.time().timeName(),
00183 alpha1_.mesh()
00184 ),
00185 alpha1_.mesh(),
00186 dimensionedScalar("K", dimless/dimLength, 0.0)
00187 )
00188 {
00189 calculateK();
00190 }
00191
00192
00193
Copyright © 2000-2009 OpenCFD Ltd