FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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