coupledFaPatchField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 Wikki Ltd
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "coupledFaPatchField.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Type>
34 (
35  const faPatch& p,
37 )
38 :
40  faPatchField<Type>(p, iF)
41 {}
42 
43 
44 template<class Type>
46 (
47  const faPatch& p,
49  const Field<Type>& f
50 )
51 :
53  faPatchField<Type>(p, iF, f)
54 {}
55 
56 
57 template<class Type>
59 (
60  const coupledFaPatchField<Type>& ptf,
61  const faPatch& p,
63  const faPatchFieldMapper& mapper
64 )
65 :
67  faPatchField<Type>(ptf, p, iF, mapper)
68 {}
69 
70 
71 template<class Type>
73 (
74  const faPatch& p,
76  const dictionary& dict,
77  IOobjectOption::readOption requireValue
78 )
79 :
81  faPatchField<Type>(p, iF, dict, requireValue)
82 {}
83 
84 
85 template<class Type>
87 (
88  const coupledFaPatchField<Type>& ptf
89 )
90 :
92  faPatchField<Type>(ptf)
93 {}
94 
95 
96 template<class Type>
98 (
99  const coupledFaPatchField<Type>& ptf,
101 )
102 :
104  faPatchField<Type>(ptf, iF)
105 {}
106 
107 
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 
110 template<class Type>
112 {
113  return
114  (patchNeighbourField() - this->patchInternalField())
115  *this->patch().deltaCoeffs();
116 }
117 
118 
119 template<class Type>
121 {
122  if (!this->updated())
123  {
124  this->updateCoeffs();
125  }
126 }
127 
128 
129 template<class Type>
130 void Foam::coupledFaPatchField<Type>::evaluate(const Pstream::commsTypes)
131 {
132  Field<Type>::operator=
133  (
134  lerp
135  (
136  this->patchNeighbourField(),
137  this->patchInternalField(),
138  this->patch().weights()
139  )
140  );
141 }
142 
143 
144 template<class Type>
147 (
148  const tmp<scalarField>& w
149 ) const
150 {
151  return Type(pTraits<Type>::one)*w;
152 }
153 
154 
155 template<class Type>
158 (
159  const tmp<scalarField>& w
160 ) const
161 {
162  return Type(pTraits<Type>::one)*(1.0 - w);
163 }
164 
165 
166 template<class Type>
169 {
170  return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
171 }
172 
173 
174 template<class Type>
177 {
178  return -gradientInternalCoeffs();
179 }
180 
181 
182 template<class Type>
184 {
187 }
188 
189 
190 // ************************************************************************* //
dictionary dict
commsTypes
Communications types.
Definition: UPstream.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
Type & refCast(U &obj)
A dynamic_cast (for references). Generates a FatalError on failed casts and uses the virtual type() m...
Definition: typeInfo.H:159
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:56
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
virtual void write(Ostream &) const
Write.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Generic templated field type.
Definition: Field.H:62
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
OBJstream os(runTime.globalPath()/outputName)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
labelList f(nPoints)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
const std::string patch
OpenFOAM patch number as a std::string.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
Definition: lduInterface.H:53
coupledFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A FieldMapper for finite-area patch fields.
readOption
Enumeration defining read preferences.