RelativeVelocity.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) 2019-2022 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 "RelativeVelocity.H"
27 
28 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
29 
30 template<class CloudType>
32 {
33  IOField<vector> URel
34  (
35  this->owner().fieldIOobject("URel", IOobject::NO_READ),
36  this->owner().size()
37  );
38 
40  (
42  (
43  this->owner().solution().interpolationSchemes(),
44  this->owner().U()
45  )
46  );
47 
48  label i = 0;
49  forAllConstIter(typename CloudType, this->owner(), iter)
50  {
51  URel[i] =
52  iter().U()
53  - UcInterp->interpolate
54  (
55  iter().coordinates(),
56  iter().currentTetIndices(this->owner().mesh())
57  );
58  ++ i;
59  }
60 
61  URel.write(this->owner().size() > 0);
62 }
63 
64 
65 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66 
67 template<class CloudType>
69 (
70  const dictionary& dict,
71  CloudType& owner,
72  const word& modelName
73 )
74 :
75  CloudFunctionObject<CloudType>(dict, owner, modelName, typeName)
76 {}
77 
78 
79 template<class CloudType>
81 (
83 )
84 :
86 {}
87 
88 
89 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
90 
91 template<class CloudType>
93 {}
94 
95 
96 // ************************************************************************* //
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
Templated cloud function object base class.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
A primitive field of type <Type> with automated input and output.
Definition: IOField.H:53
Function object which generates a lagrangian field containing the velocity of each particle relative ...
RelativeVelocity(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual ~RelativeVelocity()
Destructor.
virtual void write()
Write post-processing info.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for interpolation.
Definition: interpolation.H:55
virtual bool write(const bool write=true) const
Write using setting from DB.
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:51
A class for handling words, derived from string.
Definition: word.H:62
U
Definition: pEqn.H:72
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict