correctFixedFluxBCs.H
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) 2025 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 Namespace
25  Foam
26 
27 Description
28  Function for correcting model coefficients on patches with fixed flux
29  boundary conditions
30 
31 \*---------------------------------------------------------------------------*/
32 
33 #ifndef correctFixedFluxBCs_H
34 #define correctFixedFluxBCs_H
35 
36 #include "phaseInterface.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 template<class Type, class GeoMesh>
48 (
49  const phaseInterface& interface,
51 )
52 {
53  typedef GeometricField<Type, GeoMesh> typeGeoField;
54 
55  typename typeGeoField::Boundary& fieldBf = tfield.ref().boundaryFieldRef();
56 
57  forAll(fieldBf, patchi)
58  {
59  if
60  (
61  (
62  !interface.phase1().stationary()
63  && isA<fixedValueFvsPatchScalarField>
64  (
65  interface.phase1().phi()().boundaryField()[patchi]
66  )
67  )
68  || (
69  !interface.phase2().stationary()
70  && isA<fixedValueFvsPatchScalarField>
71  (
72  interface.phase2().phi()().boundaryField()[patchi]
73  )
74  )
75  )
76  {
77  fieldBf[patchi] = Zero;
78  }
79  }
80 
81  return tfield;
82 }
83 
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 } // End namespace Foam
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 #endif
92 
93 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
const phaseModel & phase1() const
Return phase 1.
const phaseModel & phase2() const
Return phase 2.
virtual bool stationary() const =0
Return whether the phase is stationary.
virtual tmp< surfaceScalarField > phi() const =0
Return the volumetric flux.
A class for managing temporary objects.
Definition: tmp.H:55
label patchi
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
tmp< GeometricField< Type, GeoMesh > > correctFixedFluxBCs(const phaseInterface &interface, tmp< GeometricField< Type, GeoMesh >> tfield)