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

timeVaryingAlphaContactAngleFvPatchScalarField.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 "timeVaryingAlphaContactAngleFvPatchScalarField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volMesh.H"
00031 #include "Time.H"
00032 
00033 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00034 
00035 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
00036 timeVaryingAlphaContactAngleFvPatchScalarField
00037 (
00038     const fvPatch& p,
00039     const DimensionedField<scalar, volMesh>& iF
00040 )
00041 :
00042     alphaContactAngleFvPatchScalarField(p, iF),
00043     t0_(0.0),
00044     thetaT0_(0.0),
00045     te_(0.0),
00046     thetaTe_(0.0)
00047 {}
00048 
00049 
00050 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
00051 timeVaryingAlphaContactAngleFvPatchScalarField
00052 (
00053     const timeVaryingAlphaContactAngleFvPatchScalarField& gcpsf,
00054     const fvPatch& p,
00055     const DimensionedField<scalar, volMesh>& iF,
00056     const fvPatchFieldMapper& mapper
00057 )
00058 :
00059     alphaContactAngleFvPatchScalarField(gcpsf, p, iF, mapper),
00060     t0_(gcpsf.t0_),
00061     thetaT0_(gcpsf.thetaT0_),
00062     te_(gcpsf.te_),
00063     thetaTe_(gcpsf.te_)
00064 {}
00065 
00066 
00067 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
00068 timeVaryingAlphaContactAngleFvPatchScalarField
00069 (
00070     const fvPatch& p,
00071     const DimensionedField<scalar, volMesh>& iF,
00072     const dictionary& dict
00073 )
00074 :
00075     alphaContactAngleFvPatchScalarField(p, iF),
00076     t0_(readScalar(dict.lookup("t0"))),
00077     thetaT0_(readScalar(dict.lookup("thetaT0"))),
00078     te_(readScalar(dict.lookup("te"))),
00079     thetaTe_(readScalar(dict.lookup("thetaTe")))
00080 {
00081     evaluate();
00082 }
00083 
00084 
00085 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
00086 timeVaryingAlphaContactAngleFvPatchScalarField
00087 (
00088     const timeVaryingAlphaContactAngleFvPatchScalarField& gcpsf,
00089     const DimensionedField<scalar, volMesh>& iF
00090 )
00091 :
00092     alphaContactAngleFvPatchScalarField(gcpsf, iF),
00093     t0_(gcpsf.t0_),
00094     thetaT0_(gcpsf.thetaT0_),
00095     te_(gcpsf.te_),
00096     thetaTe_(gcpsf.thetaTe_)
00097 {}
00098 
00099 
00100 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00101 
00102 Foam::tmp<Foam::scalarField>
00103 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::theta
00104 (
00105     const fvPatchVectorField&,
00106     const fvsPatchVectorField&
00107 ) const
00108 {
00109     scalar t = patch().boundaryMesh().mesh().time().value();
00110     scalar theta0 = thetaT0_;
00111 
00112     if (t < t0_)
00113     {
00114         theta0 = thetaT0_;
00115     }
00116     else if (t > te_)
00117     {
00118         theta0 = thetaTe_;
00119     }
00120     else
00121     {
00122         theta0 = thetaT0_ + (t - t0_)*(thetaTe_ - thetaT0_)/(te_ - t0_);
00123     }
00124 
00125     return tmp<scalarField>(new scalarField(size(), theta0));
00126 }
00127 
00128 
00129 void Foam::timeVaryingAlphaContactAngleFvPatchScalarField::write
00130 (
00131     Ostream& os
00132 ) const
00133 {
00134     fvPatchScalarField::write(os);
00135     os.writeKeyword("t0") << t0_ << token::END_STATEMENT << nl;
00136     os.writeKeyword("thetaT0") << thetaT0_ << token::END_STATEMENT << nl;
00137     os.writeKeyword("te") << te_ << token::END_STATEMENT << nl;
00138     os.writeKeyword("thetaTe") << thetaTe_ << token::END_STATEMENT << nl;
00139     writeEntry("value", os);
00140 }
00141 
00142 
00143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00144 
00145 namespace Foam
00146 {
00147     makePatchTypeField
00148     (
00149         fvPatchScalarField,
00150         timeVaryingAlphaContactAngleFvPatchScalarField
00151     );
00152 }
00153 
00154 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd