jumpCyclicAMIFvPatchFields.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 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 
28 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 
37 makePatchFieldsTypeName(jumpCyclicAMI);
38 
39 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
40 
41 template<>
43 (
44  scalarField& result,
45  const scalarField& psiInternal,
46  const scalarField& coeffs,
47  const direction cmpt,
49 ) const
50 {
51  const labelUList& nbrFaceCells =
52  this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells();
53 
54  scalarField pnf(psiInternal, nbrFaceCells);
55 
56  pnf = this->cyclicAMIPatch().interpolate(pnf);
57 
58  // only apply jump to original field
59  if (&psiInternal == &this->internalField())
60  {
61  Field<scalar> jf(this->jump());
62 
63  if (!this->cyclicAMIPatch().owner())
64  {
65  jf *= -1.0;
66  }
67 
68  pnf -= jf;
69  }
70 
71  // Transform according to the transformation tensors
72  this->transformCoupleField(pnf, cmpt);
73 
74  // Multiply the field by coefficients and add into the result
75  const labelUList& faceCells = this->cyclicAMIPatch().faceCells();
76  forAll(faceCells, elemI)
77  {
78  result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
79  }
80 }
81 
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 } // End namespace Foam
86 
87 // ************************************************************************* //
unsigned char direction
Definition: direction.H:43
makePatchFieldsTypeName(coupled)
Namespace for OpenFOAM.
commsTypes
Types of communications.
Definition: UPstream.H:64
#define forAll(list, i)
Definition: UList.H:421
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.
Macros for easy insertion into run-time selection tables.
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
conserve internalField()+