|
|
|
temperatureAndPressure.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Global 00026 temperatureAndPressure.H 00027 00028 Description 00029 Accumulates values for temperature and pressure measurement, and 00030 calculates and outputs the average values at output times. 00031 Requires temperatureAndPressureVariables.H to be declared before the 00032 timeloop. 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 accumulatedTotalLinearMomentum += singleStepTotalLinearMomentum; 00037 00038 accumulatedTotalMass += singleStepTotalMass; 00039 00040 accumulatedTotalLinearKE += singleStepTotalLinearKE; 00041 00042 accumulatedTotalAngularKE += singleStepTotalAngularKE; 00043 00044 accumulatedTotalPE += singleStepTotalPE; 00045 00046 accumulatedTotalrDotfSum += singleStepTotalrDotf; 00047 00048 accumulatedNMols += singleStepNMols; 00049 00050 accumulatedDOFs += singleStepDOFs; 00051 00052 if (runTime.outputTime()) 00053 { 00054 if (accumulatedNMols) 00055 { 00056 Info << "calculating averages" << endl; 00057 00058 averageTemperature = 00059 ( 00060 2.0/(moleculeCloud::kb * accumulatedDOFs) 00061 * 00062 ( 00063 accumulatedTotalLinearKE + accumulatedTotalAngularKE 00064 - 00065 0.5*magSqr(accumulatedTotalLinearMomentum)/accumulatedTotalMass 00066 ) 00067 ); 00068 00069 averagePressure = 00070 ( 00071 ( 00072 (accumulatedNMols/nAveragingSteps) 00073 * 00074 moleculeCloud::kb * averageTemperature 00075 + 00076 accumulatedTotalrDotfSum/(6.0 * nAveragingSteps) 00077 ) 00078 / 00079 meshVolume 00080 ); 00081 00082 Info << "----------------------------------------" << nl 00083 << "Averaged properties" << nl 00084 << "Average |velocity| = " 00085 << mag(accumulatedTotalLinearMomentum)/accumulatedTotalMass << nl 00086 << "Average temperature = " << averageTemperature << nl 00087 << "Average pressure = " << averagePressure << nl 00088 << "----------------------------------------" << endl; 00089 } 00090 else 00091 { 00092 Info<< "Not averaging temperature and pressure: " 00093 << "no molecules in system" << endl; 00094 } 00095 00096 accumulatedTotalLinearMomentum = vector::zero; 00097 00098 accumulatedTotalMass = 0.0; 00099 00100 accumulatedTotalLinearKE = 0.0; 00101 00102 accumulatedTotalAngularKE = 0.0; 00103 00104 accumulatedTotalPE = 0.0; 00105 00106 accumulatedTotalrDotfSum = 0.0; 00107 00108 accumulatedNMols = 0; 00109 00110 accumulatedDOFs = 0; 00111 } 00112 00113 00114 // ************************************************************************* // |