1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 "explicitSetValue.H"
28 #include "volFields.H"
29 #include "addToRunTimeSelectionTable.H"
32 // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(explicitSetValue, 0);
37 addToRunTimeSelectionTable
46 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
48 void Foam::explicitSetValue::setFieldData(const dictionary& dict)
50 scalarFields_.clear();
51 vectorFields_.clear();
53 wordList fieldTypes(dict.toc().size());
54 wordList fieldNames(dict.toc().size());
58 const word& fieldName = dict.toc()[i];
62 this->mesh().time().timeName(),
70 fieldTypes[i] = io.headerClassName();
71 fieldNames[i] = dict.toc()[i];
77 "explicitSetValue::setFieldData"
78 ) << "header not OK " << io.name()
83 addField(scalarFields_, fieldTypes, fieldNames, dict);
84 addField(vectorFields_, fieldTypes, fieldNames, dict);
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
90 Foam::explicitSetValue::explicitSetValue
93 const word& modelType,
94 const dictionary& dict,
98 basicSource(name, modelType, dict, mesh),
99 dict_(dict.subDict(modelType + "Coeffs"))
101 setFieldData(dict_.subDict("fieldData"));
105 void Foam::explicitSetValue::setValue(fvMatrix<scalar>& Eqn)
107 setFieldValue(Eqn, scalarFields_[Eqn.psi().name()]);
111 void Foam::explicitSetValue::setValue(fvMatrix<vector>& Eqn)
113 setFieldValue(Eqn, vectorFields_[Eqn.psi().name()]);
117 // ************************************************************************* //