1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "explicitSource.H"
28 #include "volFields.H"
29 #include "addToRunTimeSelectionTable.H"
32 // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(explicitSource, 0);
37 addToRunTimeSelectionTable
45 // * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
47 template<> const char* NamedEnum
49 explicitSource::volumeModeType,
57 const NamedEnum<explicitSource::volumeModeType, 2>
58 explicitSource::volumeModeTypeNames_;
62 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
64 void Foam::explicitSource::setFieldData(const dictionary& dict)
66 scalarFields_.clear();
67 vectorFields_.clear();
69 wordList fieldTypes(dict.toc().size());
70 wordList fieldNames(dict.toc().size());
74 const word& fieldName = dict.toc()[i];
78 this->mesh().time().timeName(0),
86 fieldTypes[i] = io.headerClassName();
87 fieldNames[i] = dict.toc()[i];
93 "explicitSource::setFieldData"
94 ) << "header not OK " << io.name()
99 addField(scalarFields_, fieldTypes, fieldNames, dict);
100 addField(vectorFields_, fieldTypes, fieldNames, dict);
104 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
106 Foam::explicitSource::explicitSource
109 const dictionary& dict,
113 basicSource(name, dict, mesh),
114 dict_(dict.subDict(typeName + "Coeffs")),
115 volumeMode_(volumeModeTypeNames_.read(dict_.lookup("volumeMode")))
117 setFieldData(dict_.subDict("fieldData"));
121 void Foam::explicitSource::addSu(fvMatrix<scalar>& Eqn)
123 addSource(Eqn, scalarFields_[Eqn.psi().name()]);
127 void Foam::explicitSource::addSu(fvMatrix<vector>& Eqn)
129 addSource(Eqn, vectorFields_[Eqn.psi().name()]);
133 // ************************************************************************* //