initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / errorEstimation / errorEstimate / errorEstimate.H
blob58e9a118d63dc66d355e21fdd67a33d9c9c613b8
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::errorEstimate
28 Description
29     Residual error estimation
31 SourceFiles
32     errorEstimate.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef errorEstimate_H
37 #define errorEstimate_H
39 #include "volFields.H"
40 #include "surfaceFields.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                         Class errorEstimate Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class Type>
52 class errorEstimate
54     public refCount
56     // Private data
58         // Reference to GeometricField<Type, fvPatchField, volMesh>
59         const GeometricField<Type, fvPatchField, volMesh>& psi_;
61         //- Dimension set
62         dimensionSet dimensions_;
64         //- Cell residual pointer
65         Field<Type> residual_;
67         //- Normalisation factor
68         scalarField normFactor_;
71     // Private Member Functions
73         //- Return boundary condition types for the error field
74         wordList errorBCTypes() const;
76 public:
78     // Static data members
80     ClassName("errorEstimate");
83     // Constructors
85         //- Construct from components
86         errorEstimate
87         (
88             const GeometricField<Type, fvPatchField, volMesh>& psi,
89             const dimensionSet& ds,
90             const Field<Type>& res,
91             const scalarField& norm
92         );
94         //- Construct as copy
95         errorEstimate(const errorEstimate<Type>&);
98     // Destructor
100         ~errorEstimate();
103     // Member Functions
105         // Access
107             //- Return field
108             const GeometricField<Type, fvPatchField, volMesh>& psi() const
109             {
110                 return psi_;
111             }
113             //- Return residual dimensions
114             const dimensionSet& dimensions() const
115             {
116                 return dimensions_;
117             }
119         // Raw residual (for calculus)
121             Field<Type>& res()
122             {
123                 return residual_;
124             }
126             const Field<Type>& res() const
127             {
128                 return residual_;
129             }
132         // Error Estimate
134             //- Cell residual (volume intensive)
135             tmp<GeometricField<Type, fvPatchField, volMesh> > residual() const;
137             //- Normalisation factor
138             tmp<volScalarField> normFactor() const;
140             //- Error estimate
141             tmp<GeometricField<Type, fvPatchField, volMesh> > error() const;
144     // Member Operators
146         void operator=(const errorEstimate<Type>&);
147         void operator=(const tmp<errorEstimate<Type> >&);
149         void negate();
151         void operator+=(const errorEstimate<Type>&);
152         void operator+=(const tmp<errorEstimate<Type> >&);
154         void operator-=(const errorEstimate<Type>&);
155         void operator-=(const tmp<errorEstimate<Type> >&);
157         void operator+=(const GeometricField<Type,fvPatchField,volMesh>&);
158         void operator+=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
160         void operator-=(const GeometricField<Type,fvPatchField,volMesh>&);
161         void operator-=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
163         void operator+=(const dimensioned<Type>&);
164         void operator-=(const dimensioned<Type>&);
166         void operator*=(const volScalarField&);
167         void operator*=(const tmp<volScalarField>&);
169         void operator*=(const dimensioned<scalar>&);
172     // Friend Functions
174     // Friend Operators
178 // * * * * * * * * * * * * * * * Global functions  * * * * * * * * * * * * * //
180 template<class Type>
181 void checkMethod
183     const errorEstimate<Type>&,
184     const errorEstimate<Type>&,
185     const char*
188 template<class Type>
189 void checkMethod
191     const errorEstimate<Type>&,
192     const GeometricField<Type, fvPatchField, volMesh>&,
193     const char*
196 template<class Type>
197 void checkMethod
199     const errorEstimate<Type>&,
200     const dimensioned<Type>&,
201     const char*
205 // * * * * * * * * * * * * * * * Global operators  * * * * * * * * * * * * * //
207 template<class Type>
208 tmp<errorEstimate<Type> > operator-
210     const errorEstimate<Type>&
213 template<class Type>
214 tmp<errorEstimate<Type> > operator-
216     const tmp<errorEstimate<Type> >&
219 template<class Type>
220 tmp<errorEstimate<Type> > operator+
222     const errorEstimate<Type>&,
223     const errorEstimate<Type>&
226 template<class Type>
227 tmp<errorEstimate<Type> > operator+
229     const tmp<errorEstimate<Type> >&,
230     const errorEstimate<Type>&
233 template<class Type>
234 tmp<errorEstimate<Type> > operator+
236     const errorEstimate<Type>&,
237     const tmp<errorEstimate<Type> >&
240 template<class Type>
241 tmp<errorEstimate<Type> > operator+
243     const tmp<errorEstimate<Type> >&,
244     const tmp<errorEstimate<Type> >&
247 template<class Type>
248 tmp<errorEstimate<Type> > operator-
250     const errorEstimate<Type>&,
251     const errorEstimate<Type>&
254 template<class Type>
255 tmp<errorEstimate<Type> > operator-
257     const tmp<errorEstimate<Type> >&,
258     const errorEstimate<Type>&
261 template<class Type>
262 tmp<errorEstimate<Type> > operator-
264     const errorEstimate<Type>&,
265     const tmp<errorEstimate<Type> >&
268 template<class Type>
269 tmp<errorEstimate<Type> > operator-
271     const tmp<errorEstimate<Type> >&,
272     const tmp<errorEstimate<Type> >&
275 template<class Type>
276 tmp<errorEstimate<Type> > operator==
278     const errorEstimate<Type>&,
279     const errorEstimate<Type>&
282 template<class Type>
283 tmp<errorEstimate<Type> > operator==
285     const tmp<errorEstimate<Type> >&,
286     const errorEstimate<Type>&
289 template<class Type>
290 tmp<errorEstimate<Type> > operator==
292     const errorEstimate<Type>&,
293     const tmp<errorEstimate<Type> >&
296 template<class Type>
297 tmp<errorEstimate<Type> > operator==
299     const tmp<errorEstimate<Type> >&,
300     const tmp<errorEstimate<Type> >&
303 template<class Type>
304 tmp<errorEstimate<Type> > operator+
306     const errorEstimate<Type>&,
307     const GeometricField<Type, fvPatchField, volMesh>&
310 template<class Type>
311 tmp<errorEstimate<Type> > operator+
313     const tmp<errorEstimate<Type> >&,
314     const GeometricField<Type, fvPatchField, volMesh>&
317 template<class Type>
318 tmp<errorEstimate<Type> > operator+
320     const errorEstimate<Type>&,
321     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
324 template<class Type>
325 tmp<errorEstimate<Type> > operator+
327     const tmp<errorEstimate<Type> >&,
328     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
331 template<class Type>
332 tmp<errorEstimate<Type> > operator+
334     const GeometricField<Type, fvPatchField, volMesh>&,
335     const errorEstimate<Type>&
338 template<class Type>
339 tmp<errorEstimate<Type> > operator+
341     const GeometricField<Type, fvPatchField, volMesh>&,
342     const tmp<errorEstimate<Type> >&
345 template<class Type>
346 tmp<errorEstimate<Type> > operator+
348     const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
349     const errorEstimate<Type>&
352 template<class Type>
353 tmp<errorEstimate<Type> > operator+
355     const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
356     const tmp<errorEstimate<Type> >&
359 template<class Type>
360 tmp<errorEstimate<Type> > operator-
362     const errorEstimate<Type>&,
363     const GeometricField<Type, fvPatchField, volMesh>&
366 template<class Type>
367 tmp<errorEstimate<Type> > operator-
369     const tmp<errorEstimate<Type> >&,
370     const GeometricField<Type, fvPatchField, volMesh>&
373 template<class Type>
374 tmp<errorEstimate<Type> > operator-
376     const errorEstimate<Type>&,
377     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
380 template<class Type>
381 tmp<errorEstimate<Type> > operator-
383     const tmp<errorEstimate<Type> >&,
384     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
387 template<class Type>
388 tmp<errorEstimate<Type> > operator-
390     const GeometricField<Type, fvPatchField, volMesh>&,
391     const errorEstimate<Type>&
394 template<class Type>
395 tmp<errorEstimate<Type> > operator-
397     const GeometricField<Type, fvPatchField, volMesh>&,
398     const tmp<errorEstimate<Type> >&
401 template<class Type>
402 tmp<errorEstimate<Type> > operator-
404     const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
405     const errorEstimate<Type>&
408 template<class Type>
409 tmp<errorEstimate<Type> > operator-
411     const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
412     const tmp<errorEstimate<Type> >&
415 template<class Type>
416 tmp<errorEstimate<Type> > operator+
418     const tmp<errorEstimate<Type> >&,
419     const dimensioned<Type>&
422 template<class Type>
423 tmp<errorEstimate<Type> > operator+
425     const dimensioned<Type>&,
426     const tmp<errorEstimate<Type> >&
429 template<class Type>
430 tmp<errorEstimate<Type> > operator-
432     const tmp<errorEstimate<Type> >&,
433     const dimensioned<Type>&
436 template<class Type>
437 tmp<errorEstimate<Type> > operator-
439     const dimensioned<Type>&,
440     const tmp<errorEstimate<Type> >&
443 template<class Type>
444 tmp<errorEstimate<Type> > operator==
446     const errorEstimate<Type>&,
447     const GeometricField<Type, fvPatchField, volMesh>&
450 template<class Type>
451 tmp<errorEstimate<Type> > operator==
453     const tmp<errorEstimate<Type> >&,
454     const GeometricField<Type, fvPatchField, volMesh>&
457 template<class Type>
458 tmp<errorEstimate<Type> > operator==
460     const errorEstimate<Type>&,
461     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
464 template<class Type>
465 tmp<errorEstimate<Type> > operator==
467     const tmp<errorEstimate<Type> >&,
468     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
471 template<class Type>
472 tmp<errorEstimate<Type> > operator==
474     const errorEstimate<Type>&,
475     const dimensioned<Type>&
478 template<class Type>
479 tmp<errorEstimate<Type> > operator==
481     const tmp<errorEstimate<Type> >&,
482     const dimensioned<Type>&
486 template<class Type>
487 tmp<errorEstimate<Type> > operator*
489     const volScalarField&,
490     const errorEstimate<Type>&
493 template<class Type>
494 tmp<errorEstimate<Type> > operator*
496     const volScalarField&,
497     const tmp<errorEstimate<Type> >&
500 template<class Type>
501 tmp<errorEstimate<Type> > operator*
503     const tmp<volScalarField>&,
504     const errorEstimate<Type>&
507 template<class Type>
508 tmp<errorEstimate<Type> > operator*
510     const tmp<volScalarField>&,
511     const tmp<errorEstimate<Type> >&
515 template<class Type>
516 tmp<errorEstimate<Type> > operator*
518     const dimensioned<scalar>&,
519     const errorEstimate<Type>&
522 template<class Type>
523 tmp<errorEstimate<Type> > operator*
525     const dimensioned<scalar>&,
526     const tmp<errorEstimate<Type> >&
530 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
532 } // End namespace Foam
534 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
536 #ifdef NoRepository
537 #   include "errorEstimate.C"
538 #endif
540 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
542 #endif
544 // ************************************************************************* //