eulerianParticle.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015-2016 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "mathematicalConstants.H"
30 
31 using namespace Foam::constant;
32 
33 // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
34 
36 :
37  faceIHit(-1),
38  VC(Zero),
39  VU(Zero),
40  V(0),
41  time(0)
42 {}
43 
44 
45 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
46 
47 Foam::Ostream& Foam::operator<<
48 (
49  Ostream& os,
50  const functionObjects::eulerianParticle& p
51 )
52 {
53  os << p.faceIHit << token::SPACE
54  << p.VC << token::SPACE
55  << p.VU << token::SPACE
56  << p.V << token::SPACE
57  << p.time;
58 
59  return os;
60 }
61 
62 
63 Foam::Istream& Foam::operator>>
64 (
65  Istream& is,
66  functionObjects::eulerianParticle& p
67 )
68 {
69  is >> p.faceIHit
70  >> p.VC
71  >> p.VU
72  >> p.V
73  >> p.time;
74 
75  return is;
76 }
77 
78 
80 {
81  scalar pDiameter = cbrt(6*V/constant::mathematical::pi);
82  vector U = VU/(V + ROOTVSMALL);
83  vector C = VC/(V + ROOTVSMALL);
84 
85  os << time << token::SPACE
86  << faceIHit << token::SPACE
88  << pDiameter << token::SPACE
89  << U << token::SPACE
90  << endl;
91 }
92 
93 
95 {
96  scalar pDiameter = cbrt(6*V/constant::mathematical::pi);
97  vector U = VU/(V + ROOTVSMALL);
98  vector C = VC/(V + ROOTVSMALL);
99 
101  dict.add("time", time);
102  dict.add("meshFace", faceIHit);
103  dict.add("position", C);
104  dict.add("diameter", pDiameter);
105  dict.add("U", U);
106 
107  return dict;
108 }
109 
110 
111 // ************************************************************************* //
Different types of constants.
dictionary dict
Graphite solid properties.
Definition: C.H:46
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
dimensionedScalar cbrt(const dimensionedScalar &ds)
Space [isspace].
Definition: token.H:131
constexpr scalar pi(M_PI)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
U
Definition: pEqn.H:72
volScalarField & p
void write(Ostream &os) const
Write to stream.
Foam::dictionary writeDict() const
Write to dictionary.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127