Loading...
Searching...
No Matches
blendingFactor.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::functionObjects::blendingFactor
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Computes blending factor as an indicator about which
35 of the schemes is active across the domain.
36
37 Blending factor values mean:
38 \verbatim
39 0 = scheme 0
40 1 = scheme 1
41 0-1 = a blending factor between scheme 0 and scheme 1
42 \endverbatim
43
44 Operands:
45 \table
46 Operand | Type | Location
47 input | - | -
48 output file | dat | postProcessing/<FO>/<time>/file
49 output field | volScalarField | <time>/outputField
50 \endtable
51
52Usage
53 Minimal example by using \c system/controlDict.functions:
54 \verbatim
55 blendingFactorFO
56 {
57 // Mandatory entries
58 type blendingFactor;
59 libs (fieldFunctionObjects);
60 field <field>;
61
62 // Optional entries
63 phi <word>;
64 tolerance <scalar>;
65
66 // Inherited entries
67 ...
68 }
69 \endverbatim
70
71 where the entries mean:
72 \table
73 Property | Description | Type | Reqd | Deflt
74 type | Type name: blendingFactor | word | yes | -
75 libs | Library name: fieldFunctionObjects | word | yes | -
76 field | Name of the operand field | word | yes | -
77 phi | Name of flux field | word | no | phi
78 tolerance | Tolerance for number of blended cells | scalar | no | 0.001
79 \endtable
80
81 The inherited entries are elaborated in:
82 - \link fieldExpression.H \endlink
83 - \link writeFile.H \endlink
84
85Note
86 - The \c blendingFactor function object overwrites the \c DEShybrid:Factor
87 field internally when \c blendedSchemeBase debug flag is active.
88 However, users are allowed to write out the original \c DEShybrid:Factor
89 field by executing the \c writeObjects function object before
90 any \c blendingFactor function object execution.
91
92SourceFiles
93 blendingFactor.C
94 blendingFactorTemplates.C
95
96\*---------------------------------------------------------------------------*/
97
98#ifndef Foam_functionObjects_blendingFactor_H
99#define Foam_functionObjects_blendingFactor_H
100
101#include "fieldExpression.H"
102#include "writeFile.H"
103#include "convectionScheme.H"
104
105// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106
107namespace Foam
108{
109namespace functionObjects
110{
111
112/*---------------------------------------------------------------------------*\
113 Class blendingFactor Declaration
114\*---------------------------------------------------------------------------*/
115
116class blendingFactor
117:
118 public fieldExpression,
119 public writeFile
120{
121 // Private Data
122
123 //- Name of flux field
124 word phiName_;
125
126 //- Tolerance used when calculating the number of blended cells
127 scalar tolerance_;
128
129
130 // Private Member Functions
131
132 //- Calculate the blending factor field
133 template<class Type>
134 void calcBlendingFactor
135 (
136 const GeometricField<Type, fvPatchField, volMesh>& field,
137 const typename fv::convectionScheme<Type>& cs
138 );
139
140 //- Calculate the blending factor field
141 template<class Type>
142 bool calcScheme();
143
144 //- Calculate the blending factor field and return true if successful
145 virtual bool calc();
146
147
148protected:
149
150 // Protected Member Functions
151
152 //- Write the file header
153 virtual void writeFileHeader(Ostream& os) const;
154
155
156public:
157
158 //- Runtime type information
159 TypeName("blendingFactor");
160
161
162 // Constructors
164 //- Construct from name, Time and dictionary
166 (
167 const word& name,
168 const Time& runTime,
169 const dictionary& dict
170 );
171
172 //- No copy construct
173 blendingFactor(const blendingFactor&) = delete;
174
175 //- No copy assignment
176 void operator=(const blendingFactor&) = delete;
177
178
179 //- Destructor
180 virtual ~blendingFactor() = default;
181
182
183 // Member Functions
184
185 //- Read the function-object dictionary
186 virtual bool read(const dictionary& dict);
187
188 //- Write the function-object results
189 virtual bool write();
190};
191
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195} // End namespace functionObjects
196} // End namespace Foam
197
198// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199
200#ifdef NoRepository
202#endif
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206#endif
207
208// ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Computes blending factor as an indicator about which of the schemes is active across the domain.
virtual ~blendingFactor()=default
Destructor.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
void operator=(const blendingFactor &)=delete
No copy assignment.
virtual void writeFileHeader(Ostream &os) const
Write the file header.
blendingFactor(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
blendingFactor(const blendingFactor &)=delete
No copy construct.
TypeName("blendingFactor")
Runtime type information.
virtual bool write()
Write the function-object results.
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
fieldExpression(const word &name, const Time &runTime, const dictionary &dict, const word &fieldName=word::null, const word &resultName=word::null)
Construct from name, Time and dictionary.
virtual bool calc()=0
Calculate the components of the field and return true if successful.
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
Abstract base class for convection schemes.
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68