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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2017 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 #include "transformField.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 (
37  const fvPatch& p,
39 )
40 :
42 {}
43 
44 
45 template<class Type>
47 (
49  const fvPatch& p,
51  const fvPatchFieldMapper& mapper
52 )
53 :
54  cyclicAMIFvPatchField<Type>(ptf, p, iF, mapper)
55 {}
56 
57 
58 template<class Type>
60 (
61  const fvPatch& p,
63  const dictionary& dict
64 )
65 :
67 {
68  // Call this evaluation in derived classes
69  //this->evaluate(Pstream::commsTypes::blocking);
70 }
71 
72 
73 template<class Type>
75 (
77 )
78 :
80 {}
81 
82 
83 template<class Type>
85 (
88 )
89 :
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
96 template<class Type>
99 {
100  const Field<Type>& iField = this->primitiveField();
101  const labelUList& nbrFaceCells =
102  this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells();
103 
104  Field<Type> pnf(iField, nbrFaceCells);
105  tmp<Field<Type>> tpnf;
106 
107  if (this->cyclicAMIPatch().applyLowWeightCorrection())
108  {
109  tpnf =
110  this->cyclicAMIPatch().interpolate
111  (
112  pnf,
113  this->patchInternalField()()
114  );
115  }
116  else
117  {
118  tpnf = this->cyclicAMIPatch().interpolate(pnf);
119  }
120 
121  if (this->doTransform())
122  {
123  tpnf = transform(this->forwardT(), tpnf);
124  }
125 
126  tmp<Field<Type>> tjf = jump();
127  if (!this->cyclicAMIPatch().owner())
128  {
129  tjf = -tjf;
130  }
131 
132  return tpnf - tjf;
133 }
134 
135 
136 template<class Type>
138 (
139  solveScalarField& result,
140  const bool add,
141  const lduAddressing& lduAddr,
142  const label patchId,
143  const solveScalarField& psiInternal,
144  const scalarField& coeffs,
145  const direction cmpt,
146  const Pstream::commsTypes
147 ) const
148 {
150 }
151 
152 
153 template<class Type>
155 (
156  Field<Type>& result,
157  const bool add,
158  const lduAddressing& lduAddr,
159  const label patchId,
160  const Field<Type>& psiInternal,
161  const scalarField& coeffs,
162  const Pstream::commsTypes
163 ) const
164 {
165  const labelUList& nbrFaceCells =
166  lduAddr.patchAddr
167  (
168  this->cyclicAMIPatch().neighbPatchID()
169  );
170 
171  Field<Type> pnf(psiInternal, nbrFaceCells);
172 
173  if (this->cyclicAMIPatch().applyLowWeightCorrection())
174  {
175  pnf =
176  this->cyclicAMIPatch().interpolate
177  (
178  pnf,
179  this->patchInternalField()()
180  );
181 
182  }
183  else
184  {
185  pnf = this->cyclicAMIPatch().interpolate(pnf);
186  }
187 
188  // only apply jump to original field
189  if (&psiInternal == &this->primitiveField())
190  {
191  Field<Type> jf(this->jump());
192  if (!this->cyclicAMIPatch().owner())
193  {
194  jf *= -1.0;
195  }
196 
197  pnf -= jf;
198  }
199 
200  // Transform according to the transformation tensors
201  this->transformCoupleField(pnf);
202 
203  const labelUList& faceCells = lduAddr.patchAddr(patchId);
204 
205  // Multiply the field by coefficients and add into the result
206  this->addToInternalField(result, !add,faceCells, coeffs, pnf);
207 }
208 
209 
210 // ************************************************************************* //
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField
jumpCyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: jumpCyclicAMIFvPatchField.C:36
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::jumpCyclicAMIFvPatchField
This boundary condition provides a base class that enforces a cyclic condition with a specified 'jump...
Definition: jumpCyclicAMIFvPatchField.H:61
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
transformField.H
Spatial transformation functions for primitive fields.
jumpCyclicAMIFvPatchField.H
Foam::cyclicAMIFvPatchField
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
Definition: cyclicAMIFvPatchField.H:77
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::jumpCyclicAMIFvPatchField::patchNeighbourField
tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled given internal cell data.
Definition: jumpCyclicAMIFvPatchField.C:98
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::UList< label >
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::lduAddressing::patchAddr
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
patchId
label patchId(-1)
Foam::jumpCyclicAMIFvPatchField::updateInterfaceMatrix
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
Definition: jumpCyclicAMIFvPatchField.C:138
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54