jumpCyclicFvPatchField.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-2024 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 "jumpCyclicFvPatchField.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * /
29 
30 template<class Type>
31 template<class ... Cmpts>
33 (
34  Field<Type>& result,
35  const Field<Type>& psi,
36  const scalarField& coeffs,
37  const Pstream::commsTypes,
38  const Cmpts ... cmpts
39 ) const
40 {
41  const labelUList& faceCells = this->patch().faceCells();
42  const labelUList& nbrFaceCells =
43  this->cyclicPatch().neighbFvPatch().faceCells();
44 
45  Field<Type> nbrPf(psi, nbrFaceCells);
46 
47  // Only apply the jump to the original field
48  if (&psi == &this->primitiveField())
49  {
50  nbrPf += jump();
51  }
52 
53  // Transform according to the transformation tensors
54  this->transformCoupleField(nbrPf, cmpts ...);
55 
56  // Multiply the field by coefficients and add into the result
57  forAll(faceCells, facei)
58  {
59  result[faceCells[facei]] -= coeffs[facei]*nbrPf[facei];
60  }
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65 
66 template<class Type>
68 (
69  const fvPatch& p,
71 )
72 :
73  cyclicFvPatchField<Type>(p, iF)
74 {}
75 
76 
77 template<class Type>
79 (
80  const fvPatch& p,
82  const dictionary& dict
83 )
84 :
85  cyclicFvPatchField<Type>(p, iF, dict)
86 {}
87 
88 
89 template<class Type>
91 (
93  const fvPatch& p,
95  const fieldMapper& mapper
96 )
97 :
98  cyclicFvPatchField<Type>(ptf, p, iF, mapper)
99 {}
100 
101 
102 template<class Type>
104 (
105  const jumpCyclicFvPatchField<Type>& ptf,
107 )
108 :
109  cyclicFvPatchField<Type>(ptf, iF)
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 
115 template<class Type>
118 (
119  const Pstream::commsTypes
120 ) const
121 {
122  const VolField<Type>& vf =
123  static_cast<const VolField<Type>&>(this->internalField());
124 
125  const labelUList& nbrFaceCells =
126  this->cyclicPatch().neighbFvPatch().faceCells();
127 
128  return this->transform().transform(Field<Type>(vf, nbrFaceCells)) + jump();
129 }
130 
131 
132 template<class Type>
134 (
135  scalarField& result,
136  const scalarField& psi,
137  const scalarField& coeffs,
138  const direction cmpt,
139  const Pstream::commsTypes
140 ) const
141 {
143 }
144 
145 
146 template<class Type>
148 (
149  Field<Type>& result,
150  const Field<Type>& psi,
151  const scalarField& coeffs,
152  const Pstream::commsTypes comms
153 ) const
154 {
155  updateInterfaceMatrixCmpts(result, psi, coeffs, comms);
156 }
157 
158 
159 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:83
Generic GeometricField class.
virtual void updateInterfaceMatrix(scalarField &, const scalarField &, const scalarField &, const direction, const Pstream::commsTypes commsType) const=0
Inherit updateInterfaceMatrix from lduInterfaceField.
commsTypes
Types of communications.
Definition: UPstream.H:65
This boundary condition enforces a cyclic condition between a pair of boundaries.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
friend dimensionSet transform(const dimensionSet &)
Abstract base class for field mapping.
Definition: fieldMapper.H:48
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This boundary condition provides a base class for cyclic conditions with a specified "jump" (or offse...
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes) const
Return neighbour coupled given internal cell data.
jumpCyclicFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition: tmp.H:55
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
const volScalarField & psi
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:504
uint8_t direction
Definition: direction.H:45
dictionary dict
volScalarField & p