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