coupledFvPatch.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-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 
26 #include "coupledFvPatch.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
37 
39 {}
40 
41 
42 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
43 
45 (
46  scalarField& w,
47  const vectorField& nbrSf,
48  const vectorField& nbrDelta
49 ) const
50 {
52 
53  const scalarField nfDelta(nf() & delta);
54 
55  const scalarField nbrNfDelta((nbrSf/(mag(nbrSf) + vSmall)) & nbrDelta);
56 
57  forAll(delta, facei)
58  {
59  const scalar ndoi = nfDelta[facei];
60  const scalar ndni = nbrNfDelta[facei];
61  const scalar ndi = ndoi + ndni;
62 
63  if (ndni/vGreat < ndi)
64  {
65  w[facei] = ndni/ndi;
66  }
67  else
68  {
69  const scalar doi = mag(delta[facei]);
70  const scalar dni = mag(nbrDelta[facei]);
71  const scalar di = doi + dni;
72 
73  w[facei] = dni/di;
74  }
75  }
76 }
77 
78 
80 (
81  const vectorField& nbrDelta
82 ) const
83 {
84  if (transform().transforms())
85  {
86  return
88  - transform().transform(nbrDelta);
89  }
90  else
91  {
92  return coupledFvPatch::delta() - nbrDelta;
93  }
94 }
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
100 {
101  return Cf() - Cn();
102 }
103 
104 
105 // ************************************************************************* //
scalar delta
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
An abstract base class for patches that couple regions of the computational domain e....
virtual ~coupledFvPatch()
Destructor.
void makeWeights(scalarField &w, const vectorField &nbrSf, const vectorField &nbrDelta) const
Make patch weighting factors.
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
friend dimensionSet transform(const dimensionSet &)
Return the argument; transformations do not change the dimensions.
A class for managing temporary objects.
Definition: tmp.H:55
transformer transforms
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:483
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)