dsmcFieldsCalc.C
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 #include "calc.H"
00035 #include "fvc.H"
00036 #include "dsmcCloud.H"
00037 #include "dsmcFields.H"
00038 #include "IOobjectList.H"
00039
00040
00041
00042
00043 namespace Foam
00044 {
00045 template<class Type>
00046 bool addFieldsToList
00047 (
00048 const fvMesh& mesh,
00049 PtrList<GeometricField<Type, fvPatchField, volMesh> >& list,
00050 const wordList& fieldNames
00051 )
00052 {
00053 typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
00054
00055 label index = 0;
00056 forAll(fieldNames, i)
00057 {
00058 IOobject obj
00059 (
00060 fieldNames[i],
00061 mesh.time().timeName(),
00062 mesh,
00063 IOobject::MUST_READ
00064 );
00065
00066 if (obj.headerOk() && obj.headerClassName() == fieldType::typeName)
00067 {
00068 list.set(index++, new fieldType(obj, mesh));
00069 }
00070 else
00071 {
00072 Info<< "Could not find " << fieldNames[i] << endl;
00073
00074 return false;
00075 }
00076 }
00077
00078 return true;
00079 }
00080 }
00081
00082
00083 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
00084 {
00085 bool writeResults = !args.optionFound("noWrite");
00086
00087 wordList extensiveVSFNames
00088 (
00089 IStringStream
00090 (
00091 "( \
00092 rhoNMean \
00093 rhoMMean \
00094 linearKEMean \
00095 internalEMean \
00096 iDofMean \
00097 )"
00098 )()
00099 );
00100
00101 PtrList<volScalarField> extensiveVSFs(extensiveVSFNames.size());
00102
00103 if
00104 (
00105 !addFieldsToList
00106 (
00107 mesh,
00108 extensiveVSFs,
00109 extensiveVSFNames
00110 )
00111 )
00112 {
00113 return;
00114 }
00115
00116 wordList extensiveVVFNames(IStringStream ("(momentumMean)")());
00117
00118 PtrList<volVectorField> extensiveVVFs(extensiveVVFNames.size());
00119
00120 if
00121 (
00122 !addFieldsToList
00123 (
00124 mesh,
00125 extensiveVVFs,
00126 extensiveVVFNames
00127 )
00128 )
00129 {
00130 return;
00131 }
00132
00133 dsmcFields dF
00134 (
00135 "dsmcFieldsUtility",
00136 mesh,
00137 dictionary::null,
00138 false
00139 );
00140
00141 if (writeResults)
00142 {
00143 dF.write();
00144 }
00145 }
00146
00147
Copyright © 2000-2009 OpenCFD Ltd