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-2019 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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
30 template<class Type>
32 (
33  const fvPatch& p,
35 )
36 :
37  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
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 coupledFvPatchField<Type>& ptf,
59  const fvPatch& p,
61  const fvPatchFieldMapper& mapper,
62  const bool mappingRequired
63 )
64 :
65  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
66  fvPatchField<Type>(ptf, p, iF, mapper, mappingRequired)
67 {}
68 
69 
70 template<class Type>
72 (
73  const fvPatch& p,
75  const dictionary& dict,
76  const bool valueRequired
77 )
78 :
79  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
80  fvPatchField<Type>(p, iF, dict, valueRequired)
81 {}
82 
83 
84 template<class Type>
86 (
87  const coupledFvPatchField<Type>& ptf
88 )
89 :
90  LduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
92 {}
93 
94 
95 template<class Type>
97 (
98  const coupledFvPatchField<Type>& ptf,
100 )
101 :
102  LduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
103  fvPatchField<Type>(ptf, iF)
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
109 template<class Type>
111 (
112  const scalarField& deltaCoeffs
113 ) const
114 {
115  return
116  deltaCoeffs
117  *(this->patchNeighbourField() - this->patchInternalField());
118 }
119 
120 
121 template<class Type>
123 {
124  if (!this->updated())
125  {
126  this->updateCoeffs();
127  }
128 }
129 
130 
131 template<class Type>
133 {
134  if (!this->updated())
135  {
136  this->updateCoeffs();
137  }
138 
140  (
141  this->patch().weights()*this->patchInternalField()
142  + (1.0 - this->patch().weights())*this->patchNeighbourField()
143  );
144 
146 }
147 
148 
149 template<class Type>
152 (
153  const tmp<scalarField>& w
154 ) const
155 {
156  return Type(pTraits<Type>::one)*w;
157 }
158 
159 
160 template<class Type>
163 (
164  const tmp<scalarField>& w
165 ) const
166 {
167  return Type(pTraits<Type>::one)*(1.0 - w);
168 }
169 
170 
171 template<class Type>
174 (
175  const scalarField& deltaCoeffs
176 ) const
177 {
178  return -Type(pTraits<Type>::one)*deltaCoeffs;
179 }
180 
181 
182 template<class Type>
185 {
187  return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
188 }
189 
190 
191 template<class Type>
194 (
195  const scalarField& deltaCoeffs
196 ) const
197 {
198  return -this->gradientInternalCoeffs(deltaCoeffs);
199 }
200 
201 
202 template<class Type>
205 {
207  return -this->gradientInternalCoeffs();
208 }
209 
210 
211 template<class Type>
213 {
215  writeEntry(os, "value", *this);
216 }
217 
218 
219 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
commsTypes
Types of communications.
Definition: UPstream.H:64
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Traits class for primitives.
Definition: pTraits.H:50
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual void write(Ostream &) const
Write.
Pre-declare SubField and related Field type.
Definition: Field.H:56
Foam::fvPatchFieldMapper.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Abstract base class for coupled patches.
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:325
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
labelList f(nPoints)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.