forceList.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) 2011-2016 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 "forceList.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace regionModels
33 {
34 namespace surfaceFilmModels
35 {
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 :
41  PtrList<force>()
42 {}
43 
44 
46 (
47  surfaceFilmModel& owner,
48  const dictionary& dict
49 )
50 :
52 {
53  const wordList models(dict.lookup("forces"));
54 
55  Info<< " Selecting film force models" << endl;
56  if (models.size() > 0)
57  {
58  this->setSize(models.size());
59 
60  forAll(models, i)
61  {
62  set(i, force::New(owner, dict, models[i]));
63  }
64  }
65  else
66  {
67  Info<< " none" << endl;
68  }
69 }
70 
71 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
72 
74 {}
75 
76 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
77 
79 {
80  tmp<fvVectorMatrix> tResult
81  (
83  );
84  fvVectorMatrix& result = tResult.ref();
85 
86  forAll(*this, i)
87  {
88  result += this->operator[](i).correct(U);
89  }
90 
91  return tResult;
92 }
93 
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 } // End namespace surfaceFilmModels
98 } // End namespace regionModels
99 } // End namespace Foam
100 
101 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
U
Definition: pEqn.H:83
Base class for film (stress-based) force models.
Definition: force.H:55
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
forceList(surfaceFilmModel &owner)
Construct null.
Definition: forceList.C:39
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
tmp< fvVectorMatrix > correct(volVectorField &U)
Return (net) force system.
Definition: forceList.C:78
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:71
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
static autoPtr< force > New(surfaceFilmModel &owner, const dictionary &dict, const word &modelType)
Return a reference to the selected force model.
Definition: forceNew.C:40
const dimensionSet dimForce
const T & operator[](const label) const
Return element const reference.
Definition: UPtrListI.H:103
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:62
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:45
messageStream Info
A class for managing temporary objects.
Definition: PtrList.H:54
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:451