meanMomentumEnergyAndNMols.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 vector singleStepTotalLinearMomentum(vector::zero);
00036
00037 vector singleStepTotalAngularMomentum(vector::zero);
00038
00039 scalar singleStepMaxVelocityMag = 0.0;
00040
00041 scalar singleStepTotalMass = 0.0;
00042
00043 scalar singleStepTotalLinearKE = 0.0;
00044
00045 scalar singleStepTotalAngularKE = 0.0;
00046
00047 scalar singleStepTotalPE = 0.0;
00048
00049 scalar singleStepTotalrDotf = 0.0;
00050
00051
00052
00053 label singleStepNMols = molecules.size();
00054
00055 label singleStepDOFs = 0;
00056
00057 {
00058 IDLList<molecule>::iterator mol(molecules.begin());
00059
00060 for
00061 (
00062 mol = molecules.begin();
00063 mol != molecules.end();
00064 ++mol
00065 )
00066 {
00067 label molId = mol().id();
00068
00069 scalar molMass(molecules.constProps(molId).mass());
00070
00071 singleStepTotalMass += molMass;
00072
00073
00074 }
00075
00076
00077
00078
00079
00080
00081 for
00082 (
00083 mol = molecules.begin();
00084 mol != molecules.end();
00085 ++mol
00086 )
00087 {
00088 label molId = mol().id();
00089
00090 const molecule::constantProperties cP(molecules.constProps(molId));
00091
00092 scalar molMass(cP.mass());
00093
00094 const diagTensor& molMoI(cP.momentOfInertia());
00095
00096 const vector& molV(mol().v());
00097
00098 const vector& molOmega(inv(molMoI) & mol().pi());
00099
00100 vector molPiGlobal = mol().Q() & mol().pi();
00101
00102 singleStepTotalLinearMomentum += molV * molMass;
00103
00104 singleStepTotalAngularMomentum += molPiGlobal;
00105
00106
00107 if(mag(molV) > singleStepMaxVelocityMag)
00108 {
00109 singleStepMaxVelocityMag = mag(molV);
00110 }
00111
00112 singleStepTotalLinearKE += 0.5*molMass*magSqr(molV);
00113
00114 singleStepTotalAngularKE += 0.5*(molOmega & molMoI & molOmega);
00115
00116 singleStepTotalPE += mol().potentialEnergy();
00117
00118 singleStepTotalrDotf += tr(mol().rf());
00119
00120 singleStepDOFs += cP.degreesOfFreedom();
00121 }
00122 }
00123
00124 if (Pstream::parRun())
00125 {
00126 reduce(singleStepTotalLinearMomentum, sumOp<vector>());
00127
00128 reduce(singleStepTotalAngularMomentum, sumOp<vector>());
00129
00130 reduce(singleStepMaxVelocityMag, maxOp<scalar>());
00131
00132 reduce(singleStepTotalMass, sumOp<scalar>());
00133
00134 reduce(singleStepTotalLinearKE, sumOp<scalar>());
00135
00136 reduce(singleStepTotalAngularKE, sumOp<scalar>());
00137
00138 reduce(singleStepTotalPE, sumOp<scalar>());
00139
00140 reduce(singleStepTotalrDotf, sumOp<scalar>());
00141
00142 reduce(singleStepNMols, sumOp<label>());
00143
00144 reduce(singleStepDOFs, sumOp<label>());
00145 }
00146
00147 if (singleStepNMols)
00148 {
00149 Info<< "Number of molecules in system = "
00150 << singleStepNMols << nl
00151 << "Overall number density = "
00152 << singleStepNMols/meshVolume << nl
00153 << "Overall mass density = "
00154 << singleStepTotalMass/meshVolume << nl
00155 << "Average linear momentum per molecule = "
00156 << singleStepTotalLinearMomentum/singleStepNMols << ' '
00157 << mag(singleStepTotalLinearMomentum)/singleStepNMols << nl
00158 << "Average angular momentum per molecule = "
00159 << singleStepTotalAngularMomentum << ' '
00160 << mag(singleStepTotalAngularMomentum)/singleStepNMols << nl
00161 << "Maximum |velocity| = "
00162 << singleStepMaxVelocityMag << nl
00163 << "Average linear KE per molecule = "
00164 << singleStepTotalLinearKE/singleStepNMols << nl
00165 << "Average angular KE per molecule = "
00166 << singleStepTotalAngularKE/singleStepNMols << nl
00167 << "Average PE per molecule = "
00168 << singleStepTotalPE/singleStepNMols << nl
00169 << "Average TE per molecule = "
00170 <<
00171 (
00172 singleStepTotalLinearKE
00173 + singleStepTotalAngularKE
00174 + singleStepTotalPE
00175 )
00176 /singleStepNMols
00177 << endl;
00178
00179
00180
00181
00182
00183
00184
00185
00186 }
00187 else
00188 {
00189 Info<< "No molecules in system" << endl;
00190 }
00191
00192
00193
Copyright © 2000-2009 OpenCFD Ltd