cyclicACMIPolyPatchTemplates.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) 2013-2015 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 template<class Type>
30 (
31  const Field<Type>& fldCouple,
32  const Field<Type>& fldNonOverlap
33 ) const
34 {
35  // Note: do not scale AMI field as face areas have already been taken
36  // into account
37 
38  if (owner())
39  {
40  const scalarField& w = AMI().srcWeightsSum();
41 
42  tmp<Field<Type> > interpField(AMI().interpolateToSource(fldCouple));
43 
44  return interpField + (1.0 - w)*fldNonOverlap;
45  }
46  else
47  {
48  const scalarField& w = neighbPatch().AMI().tgtWeightsSum();
49 
50  tmp<Field<Type> > interpField
51  (
52  neighbPatch().AMI().interpolateToTarget(fldCouple)
53  );
54 
55  return interpField + (1.0 - w)*fldNonOverlap;
56  }
57 }
58 
59 
60 template<class Type>
62 (
63  const tmp<Field<Type> >& tFldCouple,
64  const tmp<Field<Type> >& tFldNonOverlap
65 ) const
66 {
67  return interpolate(tFldCouple(), tFldNonOverlap());
68 }
69 
70 
71 template<class Type, class CombineOp>
73 (
74  const UList<Type>& fldCouple,
75  const UList<Type>& fldNonOverlap,
76  const CombineOp& cop,
77  List<Type>& result
78 ) const
79 {
80  // Note: do not scale AMI field as face areas have already been taken
81  // into account
82 
83  if (owner())
84  {
85  const scalarField& w = AMI().srcWeightsSum();
86 
87  AMI().interpolateToSource(fldCouple, cop, result);
88 
89  result = result + (1.0 - w)*fldNonOverlap;
90  }
91  else
92  {
93  const scalarField& w = neighbPatch().AMI().tgtWeightsSum();
94 
95  neighbPatch().AMI().interpolateToTarget(fldCouple, cop, result);
96 
97  result = result + (1.0 - w)*fldNonOverlap;
98  }
99 }
100 
101 
102 // ************************************************************************* //
w
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::MULES::interpolate
tmp< surfaceScalarField > interpolate(const RhoType &rho)
Definition: IMULESTemplates.C:40
Foam::cyclicACMIPolyPatch::interpolate
tmp< Field< Type > > interpolate(const Field< Type > &fldCouple, const Field< Type > &fldNonOverlap) const
Interpolate field.
Foam::Field< Type >
Foam::List< Type >
Foam::UList< Type >