nonConformalCoupledFvPatch.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) 2021-2023 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 
29 #include "fvMesh.H"
31 #include "transform.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
38 }
39 
40 
41 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
42 
44 (
45  scalarField& w,
46  const vectorField& nbrSf,
47  const vectorField& nbrDelta
48 ) const
49 {
50  const vectorField delta(patch_.coupledFvPatch::delta());
51 
52  const scalarField nfDelta(patch_.nf() & delta);
53 
54  const scalarField nbrNfDelta((nbrSf/(mag(nbrSf) + vSmall)) & nbrDelta);
55 
56  forAll(delta, facei)
57  {
58  const scalar ndoi = nfDelta[facei];
59  const scalar ndni = nbrNfDelta[facei];
60  const scalar ndi = ndoi + ndni;
61 
62  // !!! Note this is a different form of stabilisation compared to
63  // coupledFvPatch. This is necessary to prevent negative weights on
64  // very small faces. Should this also be the standard form of
65  // stabilisation in coupledFvPatch and in surfaceInterpolation?
66 
67  if (ndoi > vSmall && ndni > vSmall)
68  {
69  w[facei] = ndni/ndi;
70  }
71  else
72  {
73  const scalar doi = mag(delta[facei]);
74  const scalar dni = mag(nbrDelta[facei]);
75  const scalar di = doi + dni;
76 
77  w[facei] = dni/di;
78  }
79  }
80 }
81 
82 
83 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
84 
86 (
87  const fvPatch& patch
88 )
89 :
90  nonConformalFvPatch(patch),
91  patch_(refCast<const coupledFvPatch>(patch)),
92  nonConformalCoupledPolyPatch_
93  (
94  refCast<const nonConformalCoupledPolyPatch>(patch.patch())
95  )
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
100 
102 {}
103 
104 
105 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 
109 {
110  return nonConformalCoupledPolyPatch_;
111 }
112 
113 
115 {
116  return nonConformalCoupledPolyPatch_.owner();
117 }
118 
119 
121 {
122  return nonConformalCoupledPolyPatch_.neighbour();
123 }
124 
125 
127 {
128  return nonConformalCoupledPolyPatch_.transform();
129 }
130 
131 
133 {
134  return nonConformalCoupledPolyPatch_.errorPatchName();
135 }
136 
137 
139 {
140  return nonConformalCoupledPolyPatch_.errorPatchIndex();
141 }
142 
143 
146 {
147  return
148  refCast<const nonConformalErrorFvPatch>
149  (
150  patch_.boundaryMesh()[errorPatchIndex()]
151  );
152 }
153 
154 
156 {
158 }
159 
160 
161 // ************************************************************************* //
scalar delta
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Macros for easy insertion into run-time selection tables.
static const char *const typeName
Definition: Field.H:106
An abstract base class for patches that couple regions of the computational domain e....
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:130
Non-conformal coupled FV patch. As nonConformalFvPatch, but is also coupled to another non-conformal ...
const transformer & transform() const
Return transformation between the coupled patches.
nonConformalCoupledFvPatch(const fvPatch &patch)
Construct from a patch.
bool owner() const
Does this side own the patch?
const nonConformalCoupledPolyPatch & nonConformalCoupledPatch() const
Return the reference to the polyPatch.
virtual word polyFacesType() const
Return the face-poly-faces patch field type.
const nonConformalErrorFvPatch & errorPatch() const
Error patch.
const word & errorPatchName() const
Error patch name.
bool neighbour() const
Does the coupled side own the patch?
label errorPatchIndex() const
Error patch ID.
void makeWeights(scalarField &w, const vectorField &nbrSf, const vectorField &nbrDelta) const
Make patch weighting factors.
Non-conformal coupled poly patch. As nonConformalPolyPatch, but this patch is coupled to another non-...
Non-conformal error FV patch. As nonConformalFvPatch. This patch is a non-coupled non-conformal patch...
Non-conformal FV patch. Provides the necessary interface for a FV patch which does not conform to the...
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Type transform(const Type &) const
Transform the given type.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:129
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
3D tensor transformation operations.