1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 temperatureAndPressure.H
28 Accumulates values for temperature and pressure measurement, and
29 calculates and outputs the average values at output times.
30 Requires temperatureAndPressureVariables.H to be declared before the
33 \*---------------------------------------------------------------------------*/
35 accumulatedTotalLinearMomentum += singleStepTotalLinearMomentum;
37 accumulatedTotalMass += singleStepTotalMass;
39 accumulatedTotalLinearKE += singleStepTotalLinearKE;
41 accumulatedTotalAngularKE += singleStepTotalAngularKE;
43 accumulatedTotalPE += singleStepTotalPE;
45 accumulatedTotalrDotfSum += singleStepTotalrDotf;
47 accumulatedNMols += singleStepNMols;
49 accumulatedDOFs += singleStepDOFs;
51 if (runTime.outputTime())
55 Info<< "calculating averages" << endl;
59 2.0/(physicoChemical::k.value()*accumulatedDOFs)
62 accumulatedTotalLinearKE + accumulatedTotalAngularKE
64 0.5*magSqr(accumulatedTotalLinearMomentum)/accumulatedTotalMass
71 (accumulatedNMols/nAveragingSteps)
72 *physicoChemical::k.value()*averageTemperature
73 + accumulatedTotalrDotfSum/(6.0*nAveragingSteps)
79 Info<< "----------------------------------------" << nl
80 << "Averaged properties" << nl
81 << "Average |velocity| = "
82 << mag(accumulatedTotalLinearMomentum)/accumulatedTotalMass << nl
83 << "Average temperature = " << averageTemperature << nl
84 << "Average pressure = " << averagePressure << nl
85 << "----------------------------------------" << endl;
89 Info<< "Not averaging temperature and pressure: "
90 << "no molecules in system" << endl;
93 accumulatedTotalLinearMomentum = vector::zero;
95 accumulatedTotalMass = 0.0;
97 accumulatedTotalLinearKE = 0.0;
99 accumulatedTotalAngularKE = 0.0;
101 accumulatedTotalPE = 0.0;
103 accumulatedTotalrDotfSum = 0.0;
105 accumulatedNMols = 0;
111 // ************************************************************************* //