Loading...
Searching...
No Matches
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-2023 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 Foam_lduInterfaceField_H
40#define Foam_lduInterfaceField_H
41
42#include "lduInterface.H"
43#include "lduAddressing.H"
44#include "primitiveFieldsFwd.H"
45#include "Pstream.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// Forward Declarations
53class lduMatrix;
56/*---------------------------------------------------------------------------*\
57 Class lduInterfaceField Declaration
58\*---------------------------------------------------------------------------*/
59
61{
62 // Private Data
63
64 //- Reference to the coupled patch this field is defined for
65 const lduInterface& interface_;
66
67 //- Update index used so that updateInterfaceMatrix is called only once
68 //- during the construction of the matrix
69 mutable bool updatedMatrix_;
70
71
72public:
73
74 //- Runtime type information
75 TypeName("lduInterfaceField");
77
78 // Generated Methods
79
80 //- No copy construct
81 lduInterfaceField(const lduInterfaceField&) = delete;
82
83 //- No copy assignment
84 void operator=(const lduInterfaceField&) = delete;
85
86
87 // Constructors
88
89 //- Construct given coupled patch
90 explicit lduInterfaceField(const lduInterface& patch)
91 :
92 interface_(patch),
93 updatedMatrix_(false)
94 {}
95
96
97 //- Destructor
98 virtual ~lduInterfaceField() = default;
99
100
101 // Member Functions
102
103 //- Return the interface
104 const lduInterface& interface() const noexcept
105 {
106 return interface_;
108
109 //- Return the interface type
110 virtual const word& interfaceFieldType() const
111 {
112 return type();
113 }
114
116 // Coupled Interface
117
118 //- Are all (receive) data available?
119 virtual bool ready() const
120 {
121 return true;
122 }
124 //- Whether matrix has been updated
125 bool updatedMatrix() const noexcept
126 {
127 return updatedMatrix_;
128 }
129
130 //- Set matrix as update-to-date, return the previous value
131 bool updatedMatrix(bool flag) const noexcept
132 {
133 bool old(updatedMatrix_);
134 updatedMatrix_ = flag;
135 return old;
136 }
137
138
139 // Coupled interface matrix update
140
141 //- Initialise neighbour matrix update.
142 //- Add/subtract coupled contributions to matrix
143 virtual void initInterfaceMatrixUpdate
144 (
145 solveScalarField& result,
146 const bool add,
147 const lduAddressing&,
148 const label interfacei,
149 const solveScalarField& psiInternal,
150 const scalarField& coeffs,
151 const direction cmpt,
152 const Pstream::commsTypes commsType
153 ) const
154 {}
155
156 //- Update result field based on interface functionality.
157 //- Add/subtract coupled contributions to matrix
158 virtual void updateInterfaceMatrix
159 (
160 solveScalarField& result,
161 const bool add,
162 const lduAddressing&,
163 const label interfacei,
164 const solveScalarField& psiInternal,
165 const scalarField& coeffs,
166 const direction cmpt,
167 const Pstream::commsTypes commsType
168 ) const = 0;
169
170 //- Add/subtract weighted contributions to internal field
171 template<class Type>
173 (
174 Field<Type>& result,
175 const bool add,
176 const labelUList& faceCells,
177 const scalarField& coeffs,
178 const Field<Type>& vals
179 ) const;
180
182 // Housekeeping
183
184 //- Adjust whether matrix has been updated.
185 // \deprecated Prefer the updatedMatrix(bool) setter (JAN-2023)
186 bool& updatedMatrix() noexcept
187 {
188 return updatedMatrix_;
189 }
190};
191
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195} // End namespace Foam
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#ifdef NoRepository
201#endif
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205#endif
206
207// ************************************************************************* //
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
commsTypes
Communications types.
Definition UPstream.H:81
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
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.
bool updatedMatrix(bool flag) const noexcept
Set matrix as update-to-date, return the previous value.
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
Update result field based on interface functionality. Add/subtract coupled contributions to matrix.
virtual bool ready() const
Are all (receive) data available?
lduInterfaceField(const lduInterfaceField &)=delete
No copy construct.
lduInterfaceField(const lduInterface &patch)
Construct given coupled patch.
bool updatedMatrix() const noexcept
Whether matrix has been updated.
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
Initialise neighbour matrix update. Add/subtract coupled contributions to matrix.
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.
void operator=(const lduInterfaceField &)=delete
No copy assignment.
const lduInterface & interface() const noexcept
Return the interface.
bool & updatedMatrix() noexcept
Adjust whether matrix has been updated.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition lduMatrix.H:81
A class for handling words, derived from Foam::string.
Definition word.H:66
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 POSIX.C:801
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
Field< solveScalar > solveScalarField
uint8_t direction
Definition direction.H:49
const direction noexcept
Definition scalarImpl.H:265
UList< label > labelUList
A UList of labels.
Definition UList.H:75
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:68