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-2013 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();
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 // ************************************************************************* //
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
const dimensionSet dimForce
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
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:68
messageStream Info
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
Namespace for OpenFOAM.
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:45
dictionary dict
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
#define forAll(list, i)
Definition: UList.H:421
forceList(surfaceFilmModel &owner)
Construct null.
Definition: forceList.C:39
static autoPtr< force > New(surfaceFilmModel &owner, const dictionary &dict, const word &modelType)
Return a reference to the selected force model.
Definition: forceNew.C:40
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:452
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
tmp< fvVectorMatrix > correct(volVectorField &U)
Return (net) force system.
Definition: forceList.C:78
A class for managing temporary objects.
Definition: PtrList.H:118
U
Definition: pEqn.H:82
const force & operator[](const label) const
Return element const reference.