externalFileSource.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) 2019-2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fa::externalFileSource
28 
29 Group
30  grpFaOptionsSources
31 
32 Description
33  Applies sources on a specified field within a specified region
34  by using an external table file for compressible flows.
35 
36 Usage
37  Minimal example by using \c constant/faOptions:
38  \verbatim
39  externalFileSource1
40  {
41  // Mandatory entries (unmodifiable)
42  type externalFileSource;
43  fieldName <fieldName>;
44  tableName <tableFileName.dat>;
45 
46  // Mandatory/Optional (inherited) entries
47  ...
48  }
49  \endverbatim
50 
51  where the entries mean:
52  \table
53  Property | Description | Type | Reqd | Dflt
54  type | Type name: externalFileSource | word | yes | -
55  fieldName | Name of operand field | word | yes | -
56  tableName | Name of operand table file | word | yes | -
57  \endtable
58 
59  The inherited entries are elaborated in:
60  - \link faOption.H \endlink
61  - \link faceSetOption.H \endlink
62 
63 See also
64  - Foam::PatchFunction1Types
65 
66 SourceFiles
67  externalFileSource.C
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #ifndef fa_externalFileSource_H
72 #define fa_externalFileSource_H
73 
74 #include "faOption.H"
75 #include "areaFields.H"
76 #include "faceSetOption.H"
77 #include "MappedFile.H"
78 
79 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 
81 namespace Foam
82 {
83 namespace fa
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class externalFileSource Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class externalFileSource
91 :
92  public fa::faceSetOption
93 {
94  // Private Data
95 
96  //- Name of the field to apply this source
97  word fieldName_;
98 
99  //- Name of the table
100  word tableName_;
101 
102  //- External pressure field
103  areaScalarField pExt_;
104 
105  //- Mapped data from file
106  autoPtr<PatchFunction1Types::MappedFile<scalar>> value_;
107 
108  //- Current time index (used for updating)
109  label curTimeIndex_;
110 
111 
112 public:
113 
114  //- Runtime type information
115  TypeName("externalFileSource");
116 
117 
118  // Constructors
119 
120  //- Construct from explicit source name and mesh
122  (
123  const word& sourceName,
124  const word& modelType,
125  const dictionary& dict,
126  const fvPatch& patch
127  );
128 
129  //- No copy construct
130  externalFileSource(const externalFileSource&) = delete;
131 
132  //- No copy assignment
133  void operator=(const externalFileSource&) = delete;
134 
135 
136  //- Destructor
137  virtual ~externalFileSource() = default;
138 
139 
140  // Member Functions
141 
142  // Evaluation
143 
144  //- Add explicit contribution to compressible momentum equation
145  virtual void addSup
146  (
147  const areaScalarField& rho,
148  faMatrix<scalar>& eqn,
149  const label fieldi
150  );
151 
152 
153  // IO
154 
155  //- Read source dictionary
156  virtual bool read(const dictionary& dict);
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace fa
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
Foam::faMatrix
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition: faMatricesFwd.H:37
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::fa::option::patch
const fvPatch & patch() const noexcept
Definition: faOptionI.H:35
Foam::fa::faceSetOption
Intermediate abstract class for handling face-set options for the derived faOptions.
Definition: faceSetOption.H:130
Foam::fa::externalFileSource::TypeName
TypeName("externalFileSource")
Foam::fa::externalFileSource::addSup
virtual void addSup(const areaScalarField &rho, faMatrix< scalar > &eqn, const label fieldi)
Definition: externalFileSource.C:90
Foam::fa::externalFileSource::read
virtual bool read(const dictionary &dict)
Definition: externalFileSource.C:112
rho
rho
Definition: readInitialConditions.H:88
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::fa::externalFileSource::~externalFileSource
virtual ~externalFileSource()=default
areaFields.H
dict
dictionary dict
Definition: searchingEngine.H:14
faOption.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:119
Foam::fa::externalFileSource::operator=
void operator=(const externalFileSource &)=delete
Foam::fa::externalFileSource
Applies sources on a specified field within a specified region by using an external table file for co...
Definition: externalFileSource.H:109
Foam
Definition: atmBoundaryLayer.C:26
Foam::areaScalarField
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
Definition: areaFieldsFwd.H:49
faceSetOption.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:49
Foam::fa::externalFileSource::externalFileSource
externalFileSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvPatch &patch)
Definition: externalFileSource.C:42
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:49
MappedFile.H