OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

dynamicAlphaContactAngleFvPatchScalarField.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "dynamicAlphaContactAngleFvPatchScalarField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volMesh.H"
00031 
00032 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00033 
00034 Foam::dynamicAlphaContactAngleFvPatchScalarField::
00035 dynamicAlphaContactAngleFvPatchScalarField
00036 (
00037     const fvPatch& p,
00038     const DimensionedField<scalar, volMesh>& iF
00039 )
00040 :
00041     alphaContactAngleFvPatchScalarField(p, iF),
00042     theta0_(0.0),
00043     uTheta_(0.0),
00044     thetaA_(0.0),
00045     thetaR_(0.0)
00046 {}
00047 
00048 
00049 Foam::dynamicAlphaContactAngleFvPatchScalarField::
00050 dynamicAlphaContactAngleFvPatchScalarField
00051 (
00052     const dynamicAlphaContactAngleFvPatchScalarField& gcpsf,
00053     const fvPatch& p,
00054     const DimensionedField<scalar, volMesh>& iF,
00055     const fvPatchFieldMapper& mapper
00056 )
00057 :
00058     alphaContactAngleFvPatchScalarField(gcpsf, p, iF, mapper),
00059     theta0_(gcpsf.theta0_),
00060     uTheta_(gcpsf.uTheta_),
00061     thetaA_(gcpsf.thetaA_),
00062     thetaR_(gcpsf.thetaR_)
00063 {}
00064 
00065 
00066 Foam::dynamicAlphaContactAngleFvPatchScalarField::
00067 dynamicAlphaContactAngleFvPatchScalarField
00068 (
00069     const fvPatch& p,
00070     const DimensionedField<scalar, volMesh>& iF,
00071     const dictionary& dict
00072 )
00073 :
00074     alphaContactAngleFvPatchScalarField(p, iF),
00075     theta0_(readScalar(dict.lookup("theta0"))),
00076     uTheta_(readScalar(dict.lookup("uTheta"))),
00077     thetaA_(readScalar(dict.lookup("thetaA"))),
00078     thetaR_(readScalar(dict.lookup("thetaR")))
00079 {
00080     evaluate();
00081 }
00082 
00083 
00084 Foam::dynamicAlphaContactAngleFvPatchScalarField::
00085 dynamicAlphaContactAngleFvPatchScalarField
00086 (
00087     const dynamicAlphaContactAngleFvPatchScalarField& gcpsf
00088 )
00089 :
00090     alphaContactAngleFvPatchScalarField(gcpsf),
00091     theta0_(gcpsf.theta0_),
00092     uTheta_(gcpsf.uTheta_),
00093     thetaA_(gcpsf.thetaA_),
00094     thetaR_(gcpsf.thetaR_)
00095 {}
00096 
00097 
00098 Foam::dynamicAlphaContactAngleFvPatchScalarField::
00099 dynamicAlphaContactAngleFvPatchScalarField
00100 (
00101     const dynamicAlphaContactAngleFvPatchScalarField& gcpsf,
00102     const DimensionedField<scalar, volMesh>& iF
00103 )
00104 :
00105     alphaContactAngleFvPatchScalarField(gcpsf, iF),
00106     theta0_(gcpsf.theta0_),
00107     uTheta_(gcpsf.uTheta_),
00108     thetaA_(gcpsf.thetaA_),
00109     thetaR_(gcpsf.thetaR_)
00110 {}
00111 
00112 
00113 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00114 
00115 Foam::tmp<Foam::scalarField>
00116 Foam::dynamicAlphaContactAngleFvPatchScalarField::theta
00117 (
00118     const fvPatchVectorField& Up,
00119     const fvsPatchVectorField& nHat
00120 ) const
00121 {
00122     if (uTheta_ < SMALL)
00123     {
00124         return tmp<scalarField>(new scalarField(size(), theta0_));
00125     }
00126 
00127     vectorField nf = patch().nf();
00128 
00129     // Calculated the component of the velocity parallel to the wall
00130     vectorField Uwall = Up.patchInternalField() - Up;
00131     Uwall -= (nf & Uwall)*nf;
00132 
00133     // Find the direction of the interface parallel to the wall
00134     vectorField nWall = nHat - (nf & nHat)*nf;
00135 
00136     // Normalise nWall
00137     nWall /= (mag(nWall) + SMALL);
00138 
00139     // Calculate Uwall resolved normal to the interface parallel to
00140     // the interface
00141     scalarField uwall = nWall & Uwall;
00142 
00143     return theta0_ + (thetaA_ - thetaR_)*tanh(uwall/uTheta_);
00144 }
00145 
00146 
00147 void Foam::dynamicAlphaContactAngleFvPatchScalarField::write(Ostream& os) const
00148 {
00149     fvPatchScalarField::write(os);
00150     os.writeKeyword("theta0") << theta0_ << token::END_STATEMENT << nl;
00151     os.writeKeyword("uTheta") << uTheta_ << token::END_STATEMENT << nl;
00152     os.writeKeyword("thetaA") << thetaA_ << token::END_STATEMENT << nl;
00153     os.writeKeyword("thetaR") << thetaR_ << token::END_STATEMENT << nl;
00154     writeEntry("value", os);
00155 }
00156 
00157 
00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00159 
00160 namespace Foam
00161 {
00162     makePatchTypeField
00163     (
00164         fvPatchScalarField,
00165         dynamicAlphaContactAngleFvPatchScalarField
00166     );
00167 }
00168 
00169 
00170 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd