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-2018 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 )
63 :
64  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
65  fvPatchField<Type>(ptf, p, iF, mapper)
66 {}
67 
68 
69 template<class Type>
71 (
72  const fvPatch& p,
74  const dictionary& dict,
75  const bool valueRequired
76 )
77 :
78  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
79  fvPatchField<Type>(p, iF, dict, valueRequired)
80 {}
81 
82 
83 template<class Type>
85 (
86  const coupledFvPatchField<Type>& ptf
87 )
88 :
89  LduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
91 {}
92 
93 
94 template<class Type>
96 (
97  const coupledFvPatchField<Type>& ptf,
99 )
100 :
101  LduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
102  fvPatchField<Type>(ptf, iF)
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107 
108 template<class Type>
110 (
111  const scalarField& deltaCoeffs
112 ) const
113 {
114  return
115  deltaCoeffs
116  *(this->patchNeighbourField() - this->patchInternalField());
117 }
118 
119 
120 template<class Type>
122 {
123  if (!this->updated())
124  {
125  this->updateCoeffs();
126  }
127 }
128 
129 
130 template<class Type>
132 {
133  if (!this->updated())
134  {
135  this->updateCoeffs();
136  }
137 
139  (
140  this->patch().weights()*this->patchInternalField()
141  + (1.0 - this->patch().weights())*this->patchNeighbourField()
142  );
143 
145 }
146 
147 
148 template<class Type>
151 (
152  const tmp<scalarField>& w
153 ) const
154 {
155  return Type(pTraits<Type>::one)*w;
156 }
157 
158 
159 template<class Type>
162 (
163  const tmp<scalarField>& w
164 ) const
165 {
166  return Type(pTraits<Type>::one)*(1.0 - w);
167 }
168 
169 
170 template<class Type>
173 (
174  const scalarField& deltaCoeffs
175 ) const
176 {
177  return -Type(pTraits<Type>::one)*deltaCoeffs;
178 }
179 
180 
181 template<class Type>
184 {
186  return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
187 }
188 
189 
190 template<class Type>
193 (
194  const scalarField& deltaCoeffs
195 ) const
196 {
197  return -this->gradientInternalCoeffs(deltaCoeffs);
198 }
199 
200 
201 template<class Type>
204 {
206  return -this->gradientInternalCoeffs();
207 }
208 
209 
210 template<class Type>
212 {
214  this->writeEntry("value", os);
215 }
216 
217 
218 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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.
void write(Ostream &, const label, const dictionary &)
Write with dictionary lookup.
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatchFieldMapper.
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:340
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
labelList f(nPoints)
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.