jumpCyclicAMIFvPatchField.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) 2012-2014 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 
27 #include "transformField.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
34  const fvPatch& p,
36 )
37 :
39 {}
40 
41 
42 template<class Type>
44 (
46  const fvPatch& p,
48  const fvPatchFieldMapper& mapper
49 )
50 :
51  cyclicAMIFvPatchField<Type>(ptf, p, iF, mapper)
52 {}
53 
54 
55 template<class Type>
57 (
58  const fvPatch& p,
60  const dictionary& dict
61 )
62 :
64 {
65  // Call this evaluation in derived classes
66  //this->evaluate(Pstream::blocking);
67 }
68 
69 
70 template<class Type>
72 (
74 )
75 :
77 {}
78 
79 
80 template<class Type>
82 (
85 )
86 :
88 {}
89 
90 
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
93 template<class Type>
96 {
97  const Field<Type>& iField = this->internalField();
98  const labelUList& nbrFaceCells =
99  this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells();
100 
101  Field<Type> pnf(iField, nbrFaceCells);
102  tmp<Field<Type> > tpnf;
103 
104  if (this->cyclicAMIPatch().applyLowWeightCorrection())
105  {
106  tpnf =
107  this->cyclicAMIPatch().interpolate
108  (
109  pnf,
110  this->patchInternalField()()
111  );
112  }
113  else
114  {
115  tpnf = this->cyclicAMIPatch().interpolate(pnf);
116  }
117 
118  if (this->doTransform())
119  {
120  tpnf = transform(this->forwardT(), tpnf);
121  }
122 
123  tmp<Field<Type> > tjf = jump();
124  if (!this->cyclicAMIPatch().owner())
125  {
126  tjf = -tjf;
127  }
128 
129  return tpnf - tjf;
130 }
131 
132 
133 template<class Type>
135 (
136  scalarField& result,
137  const scalarField& psiInternal,
138  const scalarField& coeffs,
139  const direction cmpt,
140  const Pstream::commsTypes
141 ) const
142 {
144  (
145  "void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix"
146  "("
147  "scalarField&, "
148  "const scalarField&, "
149  "const scalarField& coeffs,"
150  "const direction, "
151  "const Pstream::commsTypes"
152  ") const"
153  );
154 }
155 
156 
157 template<class Type>
159 (
160  Field<Type>& result,
161  const Field<Type>& psiInternal,
162  const scalarField& coeffs,
163  const Pstream::commsTypes
164 ) const
165 {
166  const labelUList& nbrFaceCells =
167  this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells();
168 
169  Field<Type> pnf(psiInternal, nbrFaceCells);
170 
171  if (this->cyclicAMIPatch().applyLowWeightCorrection())
172  {
173  pnf =
174  this->cyclicAMIPatch().interpolate
175  (
176  pnf,
177  this->patchInternalField()()
178  );
179 
180  }
181  else
182  {
183  pnf = this->cyclicAMIPatch().interpolate(pnf);
184  }
185 
186  // only apply jump to original field
187  if (&psiInternal == &this->internalField())
188  {
189  Field<Type> jf(this->jump());
190  if (!this->cyclicAMIPatch().owner())
191  {
192  jf *= -1.0;
193  }
194 
195  pnf -= jf;
196  }
197 
198  // Transform according to the transformation tensors
199  this->transformCoupleField(pnf);
200 
201  // Multiply the field by coefficients and add into the result
202  const labelUList& faceCells = this->cyclicAMIPatch().faceCells();
203  forAll(faceCells, elemI)
204  {
205  result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
206  }
207 }
208 
209 
210 // ************************************************************************* //
This boundary condition provides a base class that enforces a cyclic condition with a specified &#39;jump...
unsigned char direction
Definition: direction.H:43
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Foam::fvPatchFieldMapper.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dictionary dict
volScalarField & p
Definition: createFields.H:51
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled given internal cell data.
commsTypes
Types of communications.
Definition: UPstream.H:64
#define forAll(list, i)
Definition: UList.H:421
Spatial transformation functions for primitive fields.
virtual void updateInterfaceMatrix(scalarField &result, const scalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
jumpCyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Pre-declare SubField and related Field type.
Definition: Field.H:57
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
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
A class for managing temporary objects.
Definition: PtrList.H:118
conserve internalField()+