1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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
32 \*---------------------------------------------------------------------------*/
36 #include "gaussConvectionScheme.H"
37 #include "gaussLaplacianScheme.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 int main(int argc, char *argv[])
44 # include "addTimeOptions.H"
45 # include "setRootCase.H"
47 Info<< "\nEstimating error in scalar transport equation\n" << endl;
49 # include "createTime.H"
52 instantList Times = runTime.times();
54 # include "checkTimeOptions.H"
56 runTime.setTime(Times[startTime], startTime);
58 # include "createMesh.H"
60 Info<< "Reading transportProperties\n" << endl;
62 IOdictionary transportProperties
66 "transportProperties",
75 Info<< "Reading diffusivity DT\n" << endl;
79 transportProperties.lookup("DT")
83 for (label i=startTime; i<endTime; i++)
85 runTime.setTime(Times[i], i);
87 Info<< "Time = " << runTime.timeName() << endl;
107 if (THeader.headerOk() && Uheader.headerOk())
109 Info << "Reading T" << endl;
110 volScalarField T(THeader, mesh);
112 Info << "Reading U" << endl;
113 volVectorField U(Uheader, mesh);
115 # include "createPhi.H"
117 volVectorField gradT = fvc::grad(T);
119 volScalarField TE = 0.5*sqr(T);
126 mesh.time().timeName(),
132 dimensionedScalar("one", dimLength, 1.0)
136 mesh.V()/fvc::surfaceSum(mesh.magSf())().internalField();
138 // Divergence of the error in the T squared
139 volScalarField momError
143 "momErrorL" + T.name(),
144 mesh.time().timeName(),
154 fv::gaussConvectionScheme<scalar>
158 tmp<surfaceInterpolationScheme<scalar> >
160 new linear<scalar>(mesh)
165 fv::gaussLaplacianScheme<scalar, scalar>(mesh)
176 momError.boundaryField() = 0.0;
181 Info<< " No T or U" << endl;
187 Info<< "End\n" << endl;
193 // ************************************************************************* //