OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

errorEstimate.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::errorEstimate
00027 
00028 Description
00029     Residual error estimation
00030 
00031 SourceFiles
00032     errorEstimate.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef errorEstimate_H
00037 #define errorEstimate_H
00038 
00039 #include "volFields.H"
00040 #include "surfaceFields.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                         Class errorEstimate Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 template<class Type>
00052 class errorEstimate
00053 :
00054     public refCount
00055 {
00056     // Private data
00057 
00058         // Reference to GeometricField<Type, fvPatchField, volMesh>
00059         const GeometricField<Type, fvPatchField, volMesh>& psi_;
00060 
00061         //- Dimension set
00062         dimensionSet dimensions_;
00063 
00064         //- Cell residual pointer
00065         Field<Type> residual_;
00066 
00067         //- Normalisation factor
00068         scalarField normFactor_;
00069 
00070 
00071     // Private Member Functions
00072 
00073         //- Return boundary condition types for the error field
00074         wordList errorBCTypes() const;
00075 
00076 public:
00077 
00078     // Static data members
00079 
00080     ClassName("errorEstimate");
00081 
00082 
00083     // Constructors
00084 
00085         //- Construct from components
00086         errorEstimate
00087         (
00088             const GeometricField<Type, fvPatchField, volMesh>& psi,
00089             const dimensionSet& ds,
00090             const Field<Type>& res,
00091             const scalarField& norm
00092         );
00093 
00094         //- Construct as copy
00095         errorEstimate(const errorEstimate<Type>&);
00096 
00097 
00098     // Destructor
00099 
00100         ~errorEstimate();
00101 
00102 
00103     // Member Functions
00104 
00105         // Access
00106 
00107             //- Return field
00108             const GeometricField<Type, fvPatchField, volMesh>& psi() const
00109             {
00110                 return psi_;
00111             }
00112 
00113             //- Return residual dimensions
00114             const dimensionSet& dimensions() const
00115             {
00116                 return dimensions_;
00117             }
00118 
00119         // Raw residual (for calculus)
00120 
00121             Field<Type>& res()
00122             {
00123                 return residual_;
00124             }
00125 
00126             const Field<Type>& res() const
00127             {
00128                 return residual_;
00129             }
00130 
00131 
00132         // Error Estimate
00133 
00134             //- Cell residual (volume intensive)
00135             tmp<GeometricField<Type, fvPatchField, volMesh> > residual() const;
00136 
00137             //- Normalisation factor
00138             tmp<volScalarField> normFactor() const;
00139 
00140             //- Error estimate
00141             tmp<GeometricField<Type, fvPatchField, volMesh> > error() const;
00142 
00143 
00144     // Member Operators
00145 
00146         void operator=(const errorEstimate<Type>&);
00147         void operator=(const tmp<errorEstimate<Type> >&);
00148 
00149         void negate();
00150 
00151         void operator+=(const errorEstimate<Type>&);
00152         void operator+=(const tmp<errorEstimate<Type> >&);
00153 
00154         void operator-=(const errorEstimate<Type>&);
00155         void operator-=(const tmp<errorEstimate<Type> >&);
00156 
00157         void operator+=(const GeometricField<Type,fvPatchField,volMesh>&);
00158         void operator+=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
00159 
00160         void operator-=(const GeometricField<Type,fvPatchField,volMesh>&);
00161         void operator-=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
00162 
00163         void operator+=(const dimensioned<Type>&);
00164         void operator-=(const dimensioned<Type>&);
00165 
00166         void operator*=(const volScalarField&);
00167         void operator*=(const tmp<volScalarField>&);
00168 
00169         void operator*=(const dimensioned<scalar>&);
00170 
00171 
00172     // Friend Functions
00173 
00174     // Friend Operators
00175 };
00176 
00177 
00178 // * * * * * * * * * * * * * * * Global functions  * * * * * * * * * * * * * //
00179 
00180 template<class Type>
00181 void checkMethod
00182 (
00183     const errorEstimate<Type>&,
00184     const errorEstimate<Type>&,
00185     const char*
00186 );
00187 
00188 template<class Type>
00189 void checkMethod
00190 (
00191     const errorEstimate<Type>&,
00192     const GeometricField<Type, fvPatchField, volMesh>&,
00193     const char*
00194 );
00195 
00196 template<class Type>
00197 void checkMethod
00198 (
00199     const errorEstimate<Type>&,
00200     const dimensioned<Type>&,
00201     const char*
00202 );
00203 
00204 
00205 // * * * * * * * * * * * * * * * Global operators  * * * * * * * * * * * * * //
00206 
00207 template<class Type>
00208 tmp<errorEstimate<Type> > operator-
00209 (
00210     const errorEstimate<Type>&
00211 );
00212 
00213 template<class Type>
00214 tmp<errorEstimate<Type> > operator-
00215 (
00216     const tmp<errorEstimate<Type> >&
00217 );
00218 
00219 template<class Type>
00220 tmp<errorEstimate<Type> > operator+
00221 (
00222     const errorEstimate<Type>&,
00223     const errorEstimate<Type>&
00224 );
00225 
00226 template<class Type>
00227 tmp<errorEstimate<Type> > operator+
00228 (
00229     const tmp<errorEstimate<Type> >&,
00230     const errorEstimate<Type>&
00231 );
00232 
00233 template<class Type>
00234 tmp<errorEstimate<Type> > operator+
00235 (
00236     const errorEstimate<Type>&,
00237     const tmp<errorEstimate<Type> >&
00238 );
00239 
00240 template<class Type>
00241 tmp<errorEstimate<Type> > operator+
00242 (
00243     const tmp<errorEstimate<Type> >&,
00244     const tmp<errorEstimate<Type> >&
00245 );
00246 
00247 template<class Type>
00248 tmp<errorEstimate<Type> > operator-
00249 (
00250     const errorEstimate<Type>&,
00251     const errorEstimate<Type>&
00252 );
00253 
00254 template<class Type>
00255 tmp<errorEstimate<Type> > operator-
00256 (
00257     const tmp<errorEstimate<Type> >&,
00258     const errorEstimate<Type>&
00259 );
00260 
00261 template<class Type>
00262 tmp<errorEstimate<Type> > operator-
00263 (
00264     const errorEstimate<Type>&,
00265     const tmp<errorEstimate<Type> >&
00266 );
00267 
00268 template<class Type>
00269 tmp<errorEstimate<Type> > operator-
00270 (
00271     const tmp<errorEstimate<Type> >&,
00272     const tmp<errorEstimate<Type> >&
00273 );
00274 
00275 template<class Type>
00276 tmp<errorEstimate<Type> > operator==
00277 (
00278     const errorEstimate<Type>&,
00279     const errorEstimate<Type>&
00280 );
00281 
00282 template<class Type>
00283 tmp<errorEstimate<Type> > operator==
00284 (
00285     const tmp<errorEstimate<Type> >&,
00286     const errorEstimate<Type>&
00287 );
00288 
00289 template<class Type>
00290 tmp<errorEstimate<Type> > operator==
00291 (
00292     const errorEstimate<Type>&,
00293     const tmp<errorEstimate<Type> >&
00294 );
00295 
00296 template<class Type>
00297 tmp<errorEstimate<Type> > operator==
00298 (
00299     const tmp<errorEstimate<Type> >&,
00300     const tmp<errorEstimate<Type> >&
00301 );
00302 
00303 template<class Type>
00304 tmp<errorEstimate<Type> > operator+
00305 (
00306     const errorEstimate<Type>&,
00307     const GeometricField<Type, fvPatchField, volMesh>&
00308 );
00309 
00310 template<class Type>
00311 tmp<errorEstimate<Type> > operator+
00312 (
00313     const tmp<errorEstimate<Type> >&,
00314     const GeometricField<Type, fvPatchField, volMesh>&
00315 );
00316 
00317 template<class Type>
00318 tmp<errorEstimate<Type> > operator+
00319 (
00320     const errorEstimate<Type>&,
00321     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00322 );
00323 
00324 template<class Type>
00325 tmp<errorEstimate<Type> > operator+
00326 (
00327     const tmp<errorEstimate<Type> >&,
00328     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00329 );
00330 
00331 template<class Type>
00332 tmp<errorEstimate<Type> > operator+
00333 (
00334     const GeometricField<Type, fvPatchField, volMesh>&,
00335     const errorEstimate<Type>&
00336 );
00337 
00338 template<class Type>
00339 tmp<errorEstimate<Type> > operator+
00340 (
00341     const GeometricField<Type, fvPatchField, volMesh>&,
00342     const tmp<errorEstimate<Type> >&
00343 );
00344 
00345 template<class Type>
00346 tmp<errorEstimate<Type> > operator+
00347 (
00348     const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00349     const errorEstimate<Type>&
00350 );
00351 
00352 template<class Type>
00353 tmp<errorEstimate<Type> > operator+
00354 (
00355     const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00356     const tmp<errorEstimate<Type> >&
00357 );
00358 
00359 template<class Type>
00360 tmp<errorEstimate<Type> > operator-
00361 (
00362     const errorEstimate<Type>&,
00363     const GeometricField<Type, fvPatchField, volMesh>&
00364 );
00365 
00366 template<class Type>
00367 tmp<errorEstimate<Type> > operator-
00368 (
00369     const tmp<errorEstimate<Type> >&,
00370     const GeometricField<Type, fvPatchField, volMesh>&
00371 );
00372 
00373 template<class Type>
00374 tmp<errorEstimate<Type> > operator-
00375 (
00376     const errorEstimate<Type>&,
00377     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00378 );
00379 
00380 template<class Type>
00381 tmp<errorEstimate<Type> > operator-
00382 (
00383     const tmp<errorEstimate<Type> >&,
00384     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00385 );
00386 
00387 template<class Type>
00388 tmp<errorEstimate<Type> > operator-
00389 (
00390     const GeometricField<Type, fvPatchField, volMesh>&,
00391     const errorEstimate<Type>&
00392 );
00393 
00394 template<class Type>
00395 tmp<errorEstimate<Type> > operator-
00396 (
00397     const GeometricField<Type, fvPatchField, volMesh>&,
00398     const tmp<errorEstimate<Type> >&
00399 );
00400 
00401 template<class Type>
00402 tmp<errorEstimate<Type> > operator-
00403 (
00404     const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00405     const errorEstimate<Type>&
00406 );
00407 
00408 template<class Type>
00409 tmp<errorEstimate<Type> > operator-
00410 (
00411     const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00412     const tmp<errorEstimate<Type> >&
00413 );
00414 
00415 template<class Type>
00416 tmp<errorEstimate<Type> > operator+
00417 (
00418     const tmp<errorEstimate<Type> >&,
00419     const dimensioned<Type>&
00420 );
00421 
00422 template<class Type>
00423 tmp<errorEstimate<Type> > operator+
00424 (
00425     const dimensioned<Type>&,
00426     const tmp<errorEstimate<Type> >&
00427 );
00428 
00429 template<class Type>
00430 tmp<errorEstimate<Type> > operator-
00431 (
00432     const tmp<errorEstimate<Type> >&,
00433     const dimensioned<Type>&
00434 );
00435 
00436 template<class Type>
00437 tmp<errorEstimate<Type> > operator-
00438 (
00439     const dimensioned<Type>&,
00440     const tmp<errorEstimate<Type> >&
00441 );
00442 
00443 template<class Type>
00444 tmp<errorEstimate<Type> > operator==
00445 (
00446     const errorEstimate<Type>&,
00447     const GeometricField<Type, fvPatchField, volMesh>&
00448 );
00449 
00450 template<class Type>
00451 tmp<errorEstimate<Type> > operator==
00452 (
00453     const tmp<errorEstimate<Type> >&,
00454     const GeometricField<Type, fvPatchField, volMesh>&
00455 );
00456 
00457 template<class Type>
00458 tmp<errorEstimate<Type> > operator==
00459 (
00460     const errorEstimate<Type>&,
00461     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00462 );
00463 
00464 template<class Type>
00465 tmp<errorEstimate<Type> > operator==
00466 (
00467     const tmp<errorEstimate<Type> >&,
00468     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00469 );
00470 
00471 template<class Type>
00472 tmp<errorEstimate<Type> > operator==
00473 (
00474     const errorEstimate<Type>&,
00475     const dimensioned<Type>&
00476 );
00477 
00478 template<class Type>
00479 tmp<errorEstimate<Type> > operator==
00480 (
00481     const tmp<errorEstimate<Type> >&,
00482     const dimensioned<Type>&
00483 );
00484 
00485 
00486 template<class Type>
00487 tmp<errorEstimate<Type> > operator*
00488 (
00489     const volScalarField&,
00490     const errorEstimate<Type>&
00491 );
00492 
00493 template<class Type>
00494 tmp<errorEstimate<Type> > operator*
00495 (
00496     const volScalarField&,
00497     const tmp<errorEstimate<Type> >&
00498 );
00499 
00500 template<class Type>
00501 tmp<errorEstimate<Type> > operator*
00502 (
00503     const tmp<volScalarField>&,
00504     const errorEstimate<Type>&
00505 );
00506 
00507 template<class Type>
00508 tmp<errorEstimate<Type> > operator*
00509 (
00510     const tmp<volScalarField>&,
00511     const tmp<errorEstimate<Type> >&
00512 );
00513 
00514 
00515 template<class Type>
00516 tmp<errorEstimate<Type> > operator*
00517 (
00518     const dimensioned<scalar>&,
00519     const errorEstimate<Type>&
00520 );
00521 
00522 template<class Type>
00523 tmp<errorEstimate<Type> > operator*
00524 (
00525     const dimensioned<scalar>&,
00526     const tmp<errorEstimate<Type> >&
00527 );
00528 
00529 
00530 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00531 
00532 } // End namespace Foam
00533 
00534 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00535 
00536 #ifdef NoRepository
00537 #   include "errorEstimate.C"
00538 #endif
00539 
00540 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00541 
00542 #endif
00543 
00544 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd