temperatureAndPressure.H
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) 2011-2016 OpenFOAM Foundation
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 Global
27  temperatureAndPressure.H
28 
29 Description
30  Accumulates values for temperature and pressure measurement, and
31  calculates and outputs the average values at output times.
32  Requires temperatureAndPressureVariables.H to be declared before the
33  timeloop.
34 
35 \*---------------------------------------------------------------------------*/
36 
38 
40 
42 
44 
46 
48 
50 
52 
53 if (runTime.writeTime())
54 {
55  if (accumulatedNMols)
56  {
57  Info<< "calculating averages" << endl;
58 
60  (
62  *
63  (
65  -
67  )
68  );
69 
71  (
72  (
73  (accumulatedNMols/nAveragingSteps)
75  + accumulatedTotalrDotfSum/(6.0*nAveragingSteps)
76  )
77  /
79  );
80 
81  Info<< "----------------------------------------" << nl
82  << "Averaged properties" << nl
83  << "Average |velocity| = "
85  << "Average temperature = " << averageTemperature << nl
86  << "Average pressure = " << averagePressure << nl
87  << "----------------------------------------" << endl;
88  }
89  else
90  {
91  Info<< "Not averaging temperature and pressure: "
92  << "no molecules in system" << endl;
93  }
94 
96 
98 
100 
102 
103  accumulatedTotalPE = 0.0;
104 
106 
107  accumulatedNMols = 0;
108 
109  accumulatedDOFs = 0;
110 }
111 
112 
113 // ************************************************************************* //
scalar singleStepTotalrDotf
label singleStepNMols
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
scalar averagePressure
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
accumulatedTotalLinearKE
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
accumulatedTotalPE
label k
Boltzmann constant.
scalar singleStepTotalMass
accumulatedTotalLinearMomentum
scalar averageTemperature
accumulatedTotalMass
accumulatedTotalAngularKE
label singleStepDOFs
messageStream Info
Information stream (stdout output on master, null elsewhere)
accumulatedTotalrDotfSum
scalar singleStepTotalLinearKE
vector singleStepTotalLinearMomentum(Zero)
scalar singleStepTotalPE
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
scalar singleStepTotalAngularKE
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127