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

timeActivatedExplicitSource.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 "timeActivatedExplicitSource.H"
00028 #include "volFields.H"
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 template<>
00033 const char* Foam::NamedEnum
00034 <
00035     Foam::timeActivatedExplicitSource::volumeType,
00036     2
00037 >::names[] =
00038 {
00039     "specific",
00040     "absolute"
00041 };
00042 
00043 const Foam::NamedEnum<Foam::timeActivatedExplicitSource::volumeType, 2>
00044 Foam::timeActivatedExplicitSource::volumeTypeNames_;
00045 
00046 
00047 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00048 
00049 Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
00050 (
00051     const word& name,
00052     const fvMesh& mesh,
00053     const dimensionSet& dims
00054 )
00055 :
00056     IOdictionary
00057     (
00058         IOobject
00059         (
00060             name + "Properties",
00061             mesh.time().constant(),
00062             mesh,
00063             IOobject::MUST_READ,
00064             IOobject::NO_WRITE
00065         )
00066     ),
00067     mesh_(mesh),
00068     runTime_(mesh.time()),
00069     name_(name),
00070     active_(lookup("active")),
00071     dimensions_(dims),
00072     volumeType_(volumeTypeNames_.read(lookup("volumeType"))),
00073     timeStart_(readScalar(lookup("timeStart"))),
00074     duration_(readScalar(lookup("duration")))
00075 {}
00076 
00077 
00078 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00079 
00080 const Foam::fvMesh& Foam::timeActivatedExplicitSource::mesh() const
00081 {
00082     return mesh_;
00083 }
00084 
00085 
00086 const Foam::Time& Foam::timeActivatedExplicitSource::runTime() const
00087 {
00088     return runTime_;
00089 }
00090 
00091 
00092 const Foam::word& Foam::timeActivatedExplicitSource::name() const
00093 {
00094     return name_;
00095 }
00096 
00097 
00098 const Foam::Switch& Foam::timeActivatedExplicitSource::active() const
00099 {
00100     return active_;
00101 }
00102 
00103 
00104 const Foam::dimensionSet& Foam::timeActivatedExplicitSource::dimensions() const
00105 {
00106     return dimensions_;
00107 }
00108 
00109 
00110 const Foam::timeActivatedExplicitSource::volumeType&
00111 Foam::timeActivatedExplicitSource::volume() const
00112 {
00113     return volumeType_;
00114 }
00115 
00116 
00117 Foam::scalar Foam::timeActivatedExplicitSource::timeStart() const
00118 {
00119     return timeStart_;
00120 }
00121 
00122 
00123 Foam::scalar Foam::timeActivatedExplicitSource::duration() const
00124 {
00125     return duration_;
00126 }
00127 
00128 
00129 bool Foam::timeActivatedExplicitSource::read()
00130 {
00131     if (regIOobject::read())
00132     {
00133         lookup("active") >> active_;
00134         if (active_)
00135         {
00136             volumeType_ = volumeTypeNames_.read(lookup("volumeType"));
00137             lookup("timeStart") >> duration_;
00138             lookup("duration") >> duration_;
00139             return true;
00140         }
00141         else
00142         {
00143             return false;
00144         }
00145     }
00146     else
00147     {
00148         return false;
00149     }
00150 }
00151 
00152 
00153 
00154 
00155 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd