estimateScalarError.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 "fvCFD.H"
00035 #include "errorEstimate.H"
00036 #include "resError.H"
00037
00038
00039
00040 int main(int argc, char *argv[])
00041 {
00042 timeSelector::addOptions();
00043
00044 # include "setRootCase.H"
00045 # include "createTime.H"
00046
00047 instantList timeDirs = timeSelector::select0(runTime, args);
00048
00049 # include "createMesh.H"
00050
00051 Info<< "\nEstimating error in scalar transport equation\n"
00052 << "Reading transportProperties\n" << endl;
00053
00054 IOdictionary transportProperties
00055 (
00056 IOobject
00057 (
00058 "transportProperties",
00059 runTime.constant(),
00060 mesh,
00061 IOobject::MUST_READ,
00062 IOobject::NO_WRITE
00063 )
00064 );
00065
00066
00067 Info<< "Reading diffusivity DT\n" << endl;
00068
00069 dimensionedScalar DT
00070 (
00071 transportProperties.lookup("DT")
00072 );
00073
00074
00075 forAll(timeDirs, timeI)
00076 {
00077 runTime.setTime(timeDirs[timeI], timeI);
00078
00079 Info<< "Time = " << runTime.timeName() << endl;
00080
00081 mesh.readUpdate();
00082
00083 IOobject THeader
00084 (
00085 "T",
00086 runTime.timeName(),
00087 mesh,
00088 IOobject::MUST_READ
00089 );
00090
00091 IOobject Uheader
00092 (
00093 "U",
00094 runTime.timeName(),
00095 mesh,
00096 IOobject::MUST_READ
00097 );
00098
00099 if (THeader.headerOk() && Uheader.headerOk())
00100 {
00101 Info << "Reading T" << endl;
00102 volScalarField T(THeader, mesh);
00103
00104 Info << "Reading U" << endl;
00105 volVectorField U(Uheader, mesh);
00106
00107 # include "createPhi.H"
00108
00109 errorEstimate<scalar> ee
00110 (
00111 resError::div(phi, T)
00112 - resError::laplacian(DT, T)
00113 );
00114
00115 ee.residual()().write();
00116 volScalarField e = ee.error();
00117 e.write();
00118 mag(e)().write();
00119 }
00120 else
00121 {
00122 Info<< " No T or U" << endl;
00123 }
00124
00125 Info<< endl;
00126 }
00127
00128 Info<< "End\n" << endl;
00129
00130 return 0;
00131 }
00132
00133
00134
Copyright © 2000-2009 OpenCFD Ltd