fvModelTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
27 
28 template<class Type, class AlphaRhoFieldType, class ... AlphaRhoFieldTypes>
30 (
32  const dimensionSet& ds,
33  const AlphaRhoFieldType& alphaRho,
34  const AlphaRhoFieldTypes& ... alphaRhos
35 )
36 {
37  return alphaRho.dimensions()*sourceDims(field, ds, alphaRhos ...);
38 }
39 
40 
41 template<class Type>
43 (
45  const dimensionSet& ds
46 )
47 {
48  return field.dimensions()*ds;
49 }
50 
51 
52 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
53 
54 template<class Type, class ... AlphaRhoFieldTypes>
56 (
58  const word& fieldName,
59  const dimensionSet& ds,
60  const AlphaRhoFieldTypes& ... alphaRhos
61 ) const
62 {
63  tmp<fvMatrix<Type>> tmtx
64  (
65  new fvMatrix<Type>
66  (
67  field,
68  sourceDims(field, ds, alphaRhos ...)
69  )
70  );
71  fvMatrix<Type>& mtx = tmtx.ref();
72 
73  if (addsSupToField(fieldName))
74  {
75  addSup(alphaRhos ..., mtx, fieldName);
76  }
77 
78  return tmtx;
79 }
80 
81 
82 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
83 
84 template<class Type>
86 (
88 ) const
89 {
90  return this->source(field, field.name());
91 }
92 
93 
94 template<class Type>
96 (
98  const word& fieldName
99 ) const
100 {
101  return source(field, fieldName, dimVolume/dimTime);
102 }
103 
104 
105 template<class Type>
107 (
108  const volScalarField& rho,
110 ) const
111 {
112  return this->source(field, field.name());
113 }
114 
115 
116 template<class Type>
118 (
119  const volScalarField& rho,
121  const word& fieldName
122 ) const
123 {
124  return source(field, fieldName, dimVolume/dimTime);
125 }
126 
127 
128 template<class Type>
130 (
131  const volScalarField& alpha,
132  const volScalarField& rho,
134 ) const
135 {
136  return this->source(field, field.name());
137 }
138 
139 
140 template<class Type>
142 (
143  const volScalarField& alpha,
144  const volScalarField& rho,
146  const word& fieldName
147 ) const
148 {
149  return source(field, fieldName, dimVolume/dimTime);
150 }
151 
152 
153 // ************************************************************************* //
const word & name() const
Return name.
Definition: IOobject.H:315
tmp< fvMatrix< Type > > source(const GeometricField< Type, fvPatchField, volMesh > &field, const word &fieldName, const dimensionSet &ds, const AlphaRhoFieldTypes &... alphaRhos) const
Return source for equation with specified name and dimensions.
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
static dimensionSet sourceDims(const GeometricField< Type, fvPatchField, volMesh > &field, const dimensionSet &ds, const AlphaRhoFieldType &alphaRho, const AlphaRhoFieldTypes &... alphaRhos)
Return the dimensions of the matrix of a source term.
Generic GeometricField class.
const dimensionSet dimTime
const dimensionSet & dimensions() const
Return dimensions.
Dimension set for the base types.
Definition: dimensionSet.H:121
A class for handling words, derived from string.
Definition: word.H:59
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
const dimensionSet dimVolume
A class for managing temporary objects.
Definition: PtrList.H:53