lduInterfaceField.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) 2011-2013 OpenFOAM Foundation
9 Copyright (C) 2019 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::lduInterfaceField
29
30Description
31 An abstract base class for implicitly-coupled interface fields
32 e.g. processor and cyclic patch fields.
33
34SourceFiles
35 lduInterfaceField.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef lduInterfaceField_H
40#define lduInterfaceField_H
41
42#include "lduInterface.H"
43#include "primitiveFieldsFwd.H"
44#include "Pstream.H"
45#include "lduAddressing.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// Forward declarations
53class lduMatrix;
54
55/*---------------------------------------------------------------------------*\
56 Class lduInterfaceField Declaration
57\*---------------------------------------------------------------------------*/
60{
61 // Private Data
62
63 //- Reference to the coupled patch this field is defined for
64 const lduInterface& interface_;
65
66 //- Update index used so that updateInterfaceMatrix is called only once
67 // during the construction of the matrix
68 bool updatedMatrix_;
69
70
71 // Private Member Functions
72
73 //- No copy construct
74 lduInterfaceField(const lduInterfaceField&) = delete;
75
76 //- No copy assignment
77 void operator=(const lduInterfaceField&) = delete;
78
79
80public:
81
82 //- Runtime type information
83 TypeName("lduInterfaceField");
84
85
86 // Constructors
87
88 //- Construct given coupled patch
89 explicit lduInterfaceField(const lduInterface& patch)
90 :
91 interface_(patch),
92 updatedMatrix_(false)
93 {}
94
95
96 //- Destructor
97 virtual ~lduInterfaceField() = default;
98
99
100 // Member Functions
101
102 // Access
103
104 //- Return the interface
105 const lduInterface& interface() const
106 {
107 return interface_;
108 }
109
110 //- Return the interface type
111 virtual const word& interfaceFieldType() const
113 return type();
114 }
115
116
117 // Coupled interface matrix update
118
119 //- Whether matrix has been updated
120 bool updatedMatrix() const
121 {
122 return updatedMatrix_;
123 }
124
125 //- Whether matrix has been updated
126 bool& updatedMatrix()
127 {
128 return updatedMatrix_;
129 }
130
131 //- Is all data available
132 virtual bool ready() const
133 {
134 return true;
135 }
136
137 //- Initialise neighbour matrix update.
138 //- Add/subtract coupled contributions to matrix
139 virtual void initInterfaceMatrixUpdate
140 (
141 solveScalarField& result,
142 const bool add,
143 const lduAddressing&,
144 const label interfacei,
145 const solveScalarField& psiInternal,
146 const scalarField& coeffs,
147 const direction cmpt,
148 const Pstream::commsTypes commsType
149 ) const
150 {}
151
152 //- Update result field based on interface functionality.
153 //- Add/subtract coupled contributions to matrix
154 virtual void updateInterfaceMatrix
155 (
156 solveScalarField& result,
157 const bool add,
158 const lduAddressing&,
159 const label interfacei,
160 const solveScalarField& psiInternal,
161 const scalarField& coeffs,
162 const direction cmpt,
163 const Pstream::commsTypes commsType
164 ) const = 0;
165
166 //- Add/subtract weighted contributions to internal field
167 template<class Type>
169 (
170 Field<Type>& result,
171 const bool add,
172 const labelUList& faceCells,
173 const scalarField& coeffs,
174 const Field<Type>& vals
175 ) const;
176};
177
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181} // End namespace Foam
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185#ifdef NoRepository
187#endif
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191#endif
192
193// ************************************************************************* //
commsTypes
Types of communications.
Definition: UPstream.H:67
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:59
The class contains the addressing required by the lduMatrix: upper, lower and losort.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
virtual const word & interfaceFieldType() const
Return the interface type.
virtual ~lduInterfaceField()=default
Destructor.
TypeName("lduInterfaceField")
Runtime type information.
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &, const label interfacei, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const =0
virtual bool ready() const
Is all data available.
lduInterfaceField(const lduInterface &patch)
Construct given coupled patch.
virtual void initInterfaceMatrixUpdate(solveScalarField &result, const bool add, const lduAddressing &, const label interfacei, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
bool & updatedMatrix()
Whether matrix has been updated.
void addToInternalField(Field< Type > &result, const bool add, const labelUList &faceCells, const scalarField &coeffs, const Field< Type > &vals) const
Add/subtract weighted contributions to internal field.
const lduInterface & interface() const
Return the interface.
bool updatedMatrix() const
Whether matrix has been updated.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:58
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
uint8_t direction
Definition: direction.H:56
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73