coupledFvPatchField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2013 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 )
76 :
77  LduInterfaceField<Type>(refCast<const lduInterface>(p)),
79 {}
80 
81 
82 template<class Type>
84 (
85  const coupledFvPatchField<Type>& ptf
86 )
87 :
88  LduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
90 {}
91 
92 
93 template<class Type>
95 (
96  const coupledFvPatchField<Type>& ptf,
98 )
99 :
100  LduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
101  fvPatchField<Type>(ptf, iF)
102 {}
103 
104 
105 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 
107 template<class Type>
109 (
110  const scalarField& deltaCoeffs
111 ) const
112 {
113  return
114  deltaCoeffs
115  *(this->patchNeighbourField() - this->patchInternalField());
116 }
117 
118 
119 template<class Type>
121 {
122  if (!this->updated())
123  {
124  this->updateCoeffs();
125  }
126 }
127 
128 
129 template<class Type>
131 {
132  if (!this->updated())
133  {
134  this->updateCoeffs();
135  }
136 
138  (
139  this->patch().weights()*this->patchInternalField()
140  + (1.0 - this->patch().weights())*this->patchNeighbourField()
141  );
142 
144 }
145 
146 
147 template<class Type>
150 (
151  const tmp<scalarField>& w
152 ) const
153 {
154  return Type(pTraits<Type>::one)*w;
155 }
156 
157 
158 template<class Type>
161 (
162  const tmp<scalarField>& w
163 ) const
164 {
165  return Type(pTraits<Type>::one)*(1.0 - w);
166 }
167 
168 
169 template<class Type>
172 (
173  const scalarField& deltaCoeffs
174 ) const
175 {
176  return -Type(pTraits<Type>::one)*deltaCoeffs;
177 }
178 
179 
180 template<class Type>
183 {
184  notImplemented("coupledFvPatchField<Type>::gradientInternalCoeffs()");
185  return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
186 }
187 
188 
189 template<class Type>
192 (
193  const scalarField& deltaCoeffs
194 ) const
195 {
196  return -this->gradientInternalCoeffs(deltaCoeffs);
197 }
198 
199 
200 template<class Type>
203 {
204  notImplemented("coupledFvPatchField<Type>::gradientBoundaryCoeffs()");
205  return -this->gradientInternalCoeffs();
206 }
207 
208 
209 template<class Type>
211 {
213  this->writeEntry("value", os);
214 }
215 
216 
217 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
labelList f(nPoints)
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
Foam::fvPatchFieldMapper.
virtual void write(Ostream &) const
Write.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
runTime write()
dictionary dict
Abstract base class for coupled patches.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
volScalarField & p
Definition: createFields.H:51
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
commsTypes
Types of communications.
Definition: UPstream.H:64
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Pre-declare SubField and related Field type.
Definition: Field.H:57
Traits class for primitives.
Definition: pTraits.H:50
coupledFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:356
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:300
A class for managing temporary objects.
Definition: PtrList.H:118