1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Estimates the error in the solution for a scalar transport equation in the
34 - momentScalarError [OPTIONS]
40 Include the constant directory.
42 @param -time \<time\>\n
43 Apply only to specific time.
46 Only apply to latest time step.
48 @param -case \<dir\>\n
58 Display Doxygen API documentation page for this application.
61 Display Doxygen source documentation page for this application.
63 \*---------------------------------------------------------------------------*/
65 #include <finiteVolume/fvCFD.H>
66 #include <finiteVolume/linear.H>
67 #include <finiteVolume/gaussConvectionScheme.H>
68 #include <finiteVolume/gaussLaplacianScheme.H>
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 int main(int argc, char *argv[])
74 timeSelector::addOptions();
76 # include <OpenFOAM/setRootCase.H>
77 # include <OpenFOAM/createTime.H>
79 instantList timeDirs = timeSelector::select0(runTime, args);
81 # include <OpenFOAM/createMesh.H>
83 Info<< "\nEstimating error in scalar transport equation\n"
84 << "Reading transportProperties\n" << endl;
86 IOdictionary transportProperties
90 "transportProperties",
99 Info<< "Reading diffusivity DT\n" << endl;
103 transportProperties.lookup("DT")
107 forAll(timeDirs, timeI)
109 runTime.setTime(timeDirs[timeI], timeI);
111 Info<< "Time = " << runTime.timeName() << endl;
131 if (THeader.headerOk() && Uheader.headerOk())
133 Info << "Reading T" << endl;
134 volScalarField T(THeader, mesh);
136 Info << "Reading U" << endl;
137 volVectorField U(Uheader, mesh);
139 # include <finiteVolume/createPhi.H>
141 volVectorField gradT = fvc::grad(T);
143 volScalarField TE = 0.5*sqr(T);
150 mesh.time().timeName(),
156 dimensionedScalar("one", dimLength, 1.0)
160 mesh.V()/fvc::surfaceSum(mesh.magSf())().internalField();
162 // Divergence of the error in the T squared
163 volScalarField momError
167 "momErrorL" + T.name(),
168 mesh.time().timeName(),
178 fv::gaussConvectionScheme<scalar>
182 tmp<surfaceInterpolationScheme<scalar> >
184 new linear<scalar>(mesh)
189 fv::gaussLaplacianScheme<scalar, scalar>(mesh)
200 momError.boundaryField() = 0.0;
205 Info<< " No T or U" << endl;
211 Info<< "End\n" << endl;
217 // ************************ vim: set sw=4 sts=4 et: ************************ //