correctUphiBCs.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) 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 #include "CorrectPhi.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
31 (
34 )
35 {
36  const fvMesh& mesh = U.mesh();
37 
38  if (mesh.changing())
39  {
40  forAll(U.boundaryField(), patchi)
41  {
42  if (U.boundaryField()[patchi].fixesValue())
43  {
44  U.boundaryField()[patchi].initEvaluate();
45  }
46  }
47 
48  forAll(U.boundaryField(), patchi)
49  {
50  if (U.boundaryField()[patchi].fixesValue())
51  {
52  U.boundaryField()[patchi].evaluate();
53 
54  phi.boundaryField()[patchi] =
55  U.boundaryField()[patchi]
56  & mesh.Sf().boundaryField()[patchi];
57  }
58  }
59  }
60 }
61 
62 
64 (
65  const volScalarField& rho,
68 )
69 {
70  const fvMesh& mesh = U.mesh();
71 
72  if (mesh.changing())
73  {
74  forAll(U.boundaryField(), patchi)
75  {
76  if (U.boundaryField()[patchi].fixesValue())
77  {
78  U.boundaryField()[patchi].initEvaluate();
79  }
80  }
81 
82  forAll(U.boundaryField(), patchi)
83  {
84  if (U.boundaryField()[patchi].fixesValue())
85  {
86  U.boundaryField()[patchi].evaluate();
87 
88  phi.boundaryField()[patchi] =
89  rho.boundaryField()[patchi]
90  *(
91  U.boundaryField()[patchi]
92  & mesh.Sf().boundaryField()[patchi]
93  );
94  }
95  }
96  }
97 }
98 
99 
100 // ************************************************************************* //
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
U
U
Definition: pEqn.H:46
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::correctUphiBCs
void correctUphiBCs(volVectorField &U, surfaceScalarField &phi)
If the mesh is moving correct the velocity BCs on the moving walls to.
Definition: correctUphiBCs.C:31
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
rho
rho
Definition: pEqn.H:3
patchi
label patchi
Definition: getPatchFieldScalar.H:1
CorrectPhi.H
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52