kinematicSingleLayerTemplates.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-2019 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 "kinematicSingleLayer.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace regionModels
33 {
34 namespace surfaceFilmModels
35 {
36 
37 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
38 
39 template<class Type>
41 (
42  const tmp<Type>& tfield,
43  const typename Type::cmptType& value
44 )
45 {
46  tmp<Type> tresult(tfield);
47  Type& result = tresult.ref();
48 
49  typename Type::Boundary& fieldBf = result.boundaryFieldRef();
50 
51  forAll(intCoupledPatchIDs_, i)
52  {
53  const label patchi = intCoupledPatchIDs_[i];
54  fieldBf[patchi] = value;
55 
57  << "Constraining " << tfield().name()
58  << " boundary " << tfield().boundaryField()[patchi].patch().name()
59  << " to " << value << endl;
60  }
61 
62  forAll(passivePatchIDs(), i)
63  {
64  const label patchi = passivePatchIDs()[i];
65  fieldBf[patchi] = value;
67  << "Constraining " << tfield().name()
68  << " boundary " << tfield().boundaryField()[patchi].patch().name()
69  << " to " << value << endl;
70  }
71 
72  return tresult;
73 }
74 
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 } // end namespace Foam
79 } // end namespace regionModels
80 } // end namespace surfaceFilmModels
81 
82 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
#define DebugInFunction
Report an information message using Foam::Info.
label patchi
A class for managing temporary objects.
Definition: PtrList.H:53
tmp< Type > constrainFilmField(const tmp< Type > &field, const typename Type::cmptType &value)
Constrain a film region master/slave boundaries of a field to a.
Namespace for OpenFOAM.