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

timeVaryingUniformInletOutletFvPatchField.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 "timeVaryingUniformInletOutletFvPatchField.H"
00027 #include <OpenFOAM/Time.H>
00028 
00029 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00030 
00031 template<class Type>
00032 Foam::timeVaryingUniformInletOutletFvPatchField<Type>::
00033 timeVaryingUniformInletOutletFvPatchField
00034 (
00035     const fvPatch& p,
00036     const DimensionedField<Type, volMesh>& iF
00037 )
00038 :
00039     inletOutletFvPatchField<Type>(p, iF),
00040     timeSeries_()
00041 {}
00042 
00043 
00044 template<class Type>
00045 Foam::timeVaryingUniformInletOutletFvPatchField<Type>::
00046 timeVaryingUniformInletOutletFvPatchField
00047 (
00048     const fvPatch& p,
00049     const DimensionedField<Type, volMesh>& iF,
00050     const dictionary& dict
00051 )
00052 :
00053     inletOutletFvPatchField<Type>(p, iF),
00054     timeSeries_(dict)
00055 {
00056     this->refValue() = timeSeries_(this->db().time().timeOutputValue());
00057     this->refGrad() = pTraits<Type>::zero;
00058     this->valueFraction() = 0.0;
00059 
00060     if (dict.found("value"))
00061     {
00062         fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
00063     }
00064     else
00065     {
00066         fvPatchField<Type>::operator=(this->refValue());
00067     }
00068 }
00069 
00070 
00071 template<class Type>
00072 Foam::timeVaryingUniformInletOutletFvPatchField<Type>::
00073 timeVaryingUniformInletOutletFvPatchField
00074 (
00075     const timeVaryingUniformInletOutletFvPatchField<Type>& ptf,
00076     const fvPatch& p,
00077     const DimensionedField<Type, volMesh>& iF,
00078     const fvPatchFieldMapper& mapper
00079 )
00080 :
00081     inletOutletFvPatchField<Type>(ptf, p, iF, mapper),
00082     timeSeries_(ptf.timeSeries_)
00083 {}
00084 
00085 
00086 template<class Type>
00087 Foam::timeVaryingUniformInletOutletFvPatchField<Type>::
00088 timeVaryingUniformInletOutletFvPatchField
00089 (
00090     const timeVaryingUniformInletOutletFvPatchField<Type>& ptf
00091 )
00092 :
00093     inletOutletFvPatchField<Type>(ptf),
00094     timeSeries_(ptf.timeSeries_)
00095 {}
00096 
00097 
00098 template<class Type>
00099 Foam::timeVaryingUniformInletOutletFvPatchField<Type>::
00100 timeVaryingUniformInletOutletFvPatchField
00101 (
00102     const timeVaryingUniformInletOutletFvPatchField<Type>& ptf,
00103     const DimensionedField<Type, volMesh>& iF
00104 )
00105 :
00106     inletOutletFvPatchField<Type>(ptf, iF),
00107     timeSeries_(ptf.timeSeries_)
00108 {}
00109 
00110 
00111 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00112 
00113 template<class Type>
00114 void Foam::timeVaryingUniformInletOutletFvPatchField<Type>::updateCoeffs()
00115 {
00116     if (this->updated())
00117     {
00118         return;
00119     }
00120 
00121     this->refValue() = timeSeries_(this->db().time().timeOutputValue());
00122     inletOutletFvPatchField<Type>::updateCoeffs();
00123 }
00124 
00125 
00126 template<class Type>
00127 void Foam::timeVaryingUniformInletOutletFvPatchField<Type>::write
00128 (
00129     Ostream& os
00130 ) const
00131 {
00132     fvPatchField<Type>::write(os);
00133     timeSeries_.write(os);
00134     this->writeEntry("value", os);
00135 }
00136 
00137 
00138 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines