coupledFvPatchField.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) 2011-2023 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 #include "coupledFvPatchField.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 (
33  const fvPatch& p,
35 )
36 :
37  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
38  fvPatchField<Type>(p, iF)
39 {}
40 
41 
42 template<class Type>
44 (
45  const fvPatch& p,
47  const Field<Type>& f
48 )
49 :
50  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
51  fvPatchField<Type>(p, iF, f)
52 {}
53 
54 
55 template<class Type>
57 (
58  const fvPatch& p,
60  const dictionary& dict,
61  const bool valueRequired
62 )
63 :
64  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
65  fvPatchField<Type>(p, iF, dict, valueRequired)
66 {}
67 
68 
69 template<class Type>
71 (
72  const coupledFvPatchField<Type>& ptf,
73  const fvPatch& p,
75  const fvPatchFieldMapper& mapper,
76  const bool mappingRequired
77 )
78 :
79  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
80  fvPatchField<Type>(ptf, p, iF, mapper, mappingRequired)
81 {}
82 
83 
84 template<class Type>
86 (
87  const coupledFvPatchField<Type>& ptf,
89 )
90 :
91  LduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
92  fvPatchField<Type>(ptf, iF)
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
98 template<class Type>
100 (
101  const scalarField& deltaCoeffs
102 ) const
103 {
104  return
105  deltaCoeffs
106  *(this->patchNeighbourField() - this->patchInternalField());
107 }
108 
109 
110 template<class Type>
112 {
113  if (!this->updated())
114  {
115  this->updateCoeffs();
116  }
117 }
118 
119 
120 template<class Type>
122 {
123  if (!this->updated())
124  {
125  this->updateCoeffs();
126  }
127 
129  (
130  this->patch().weights()*this->patchInternalField()
131  + (1.0 - this->patch().weights())*this->patchNeighbourField()
132  );
133 
135 }
136 
137 
138 template<class Type>
141 (
142  const tmp<scalarField>& w
143 ) const
144 {
145  return Type(pTraits<Type>::one)*w;
146 }
147 
148 
149 template<class Type>
152 (
153  const tmp<scalarField>& w
154 ) const
155 {
156  return Type(pTraits<Type>::one)*(1.0 - w);
157 }
158 
159 
160 template<class Type>
163 (
164  const scalarField& deltaCoeffs
165 ) const
166 {
167  return -Type(pTraits<Type>::one)*deltaCoeffs;
168 }
169 
170 
171 template<class Type>
174 {
176  return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
177 }
178 
179 
180 template<class Type>
183 (
184  const scalarField& deltaCoeffs
185 ) const
186 {
187  return -this->gradientInternalCoeffs(deltaCoeffs);
188 }
189 
190 
191 template<class Type>
194 {
196  return -this->gradientInternalCoeffs();
197 }
198 
199 
200 template<class Type>
202 {
204  writeEntry(os, "value", *this);
205 }
206 
207 
208 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:82
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
commsTypes
Types of communications.
Definition: UPstream.H:65
Abstract base class for coupled patches.
virtual void write(Ostream &) const
Write.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
Definition: fvPatchField.C:211
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:231
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:54
Traits class for primitives.
Definition: pTraits.H:53
A class for managing temporary objects.
Definition: tmp.H:55
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:111
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
labelList f(nPoints)
dictionary dict
volScalarField & p