Files
OpenFOAM-12/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H

231 lines
5.6 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fv::SemiImplicitSource
Description
Semi-implicit source, described using an input dictionary. The injection
rate coefficients are specified as pairs of Su-Sp coefficients, i.e.
\f[
S(x) = S_u + S_p x
\f]
where
\vartable
S(x) | net source for field 'x'
S_u | explicit source contribution
S_p | linearised implicit contribution
\endvartable
Example of the source specification:
\verbatim
<Type>SemiImplicitSourceCoeffs
{
volumeMode absolute; // specific
injectionRateSuSp
{
k (30.7 0);
epsilon (1.5 0);
}
}
\endverbatim
Valid options for the \c volumeMode entry include:
- absolute: values are given as \<quantity\>
- specific: values are given as \<quantity\>/m3
SeeAlso
Foam::fvOption
SourceFiles
SemiImplicitSource.C
\*---------------------------------------------------------------------------*/
#ifndef SemiImplicitSource_H
#define SemiImplicitSource_H
#include "Tuple2.H"
#include "cellSetOption.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
// Forward declaration of classes
template<class Type>
class SemiImplicitSource;
// Forward declaration of friend functions
template<class Type>
Ostream& operator<<
(
Ostream&,
const SemiImplicitSource<Type>&
);
/*---------------------------------------------------------------------------*\
Class SemiImplicitSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class SemiImplicitSource
:
public cellSetOption
{
public:
// Public data
//- Enumeration for volume types
enum volumeModeType
{
vmAbsolute,
vmSpecific
};
//- Word list of volume mode type names
static const wordList volumeModeTypeNames_;
protected:
// Protected data
//- Volume mode
volumeModeType volumeMode_;
//- Volume normalisation
scalar VDash_;
//- Source field values
List<Tuple2<Type, scalar> > injectionRate_;
// Protected functions
//- Helper function to convert from a word to a volumeModeType
volumeModeType wordToVolumeModeType(const word& vtName) const;
//- Helper function to convert from a volumeModeType to a word
word volumeModeTypeToWord(const volumeModeType& vtType) const;
//- Set the local field data
void setFieldData(const dictionary& dict);
public:
//- Runtime type information
TypeName("SemiImplicitSource");
// Constructors
//- Construct from components
SemiImplicitSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
// Member Functions
// Access
//- Return const access to the volume mode
inline const volumeModeType& volumeMode() const;
//- Return const access to the source field values
inline const List<Tuple2<Type, scalar> >& injectionRate() const;
// Edit
//- Return access to the volume mode
inline volumeModeType& volumeMode();
//- Return access to the source field values
inline List<Tuple2<Type, scalar> >& injectionRate();
// Evaluation
//- Add explicit contribution to equation
virtual void addSup
(
fvMatrix<Type>& eqn,
const label fieldI
);
//- Add explicit contribution to compressible equation
virtual void addSup
(
const volScalarField& rho,
fvMatrix<Type>& eqn,
const label fieldI
);
// IO
//- Read source dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "SemiImplicitSource.C"
# include "SemiImplicitSourceIO.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "SemiImplicitSourceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //