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