1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 Residual error estimation
34 \*---------------------------------------------------------------------------*/
36 #ifndef errorEstimate_H
37 #define errorEstimate_H
39 #include "volFields.H"
40 #include "surfaceFields.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class errorEstimate Declaration
49 \*---------------------------------------------------------------------------*/
58 // Reference to GeometricField<Type, fvPatchField, volMesh>
59 const GeometricField<Type, fvPatchField, volMesh>& psi_;
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;
78 // Static data members
80 ClassName("errorEstimate");
85 //- Construct from components
88 const GeometricField<Type, fvPatchField, volMesh>& psi,
89 const dimensionSet& ds,
90 const Field<Type>& res,
91 const scalarField& norm
95 errorEstimate(const errorEstimate<Type>&);
108 const GeometricField<Type, fvPatchField, volMesh>& psi() const
113 //- Return residual dimensions
114 const dimensionSet& dimensions() const
119 // Raw residual (for calculus)
126 const Field<Type>& res() const
134 //- Cell residual (volume intensive)
135 tmp<GeometricField<Type, fvPatchField, volMesh> > residual() const;
137 //- Normalisation factor
138 tmp<volScalarField> normFactor() const;
141 tmp<GeometricField<Type, fvPatchField, volMesh> > error() const;
146 void operator=(const errorEstimate<Type>&);
147 void operator=(const tmp<errorEstimate<Type> >&);
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>&);
178 // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
183 const errorEstimate<Type>&,
184 const errorEstimate<Type>&,
191 const errorEstimate<Type>&,
192 const GeometricField<Type, fvPatchField, volMesh>&,
199 const errorEstimate<Type>&,
200 const dimensioned<Type>&,
205 // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
208 tmp<errorEstimate<Type> > operator-
210 const errorEstimate<Type>&
214 tmp<errorEstimate<Type> > operator-
216 const tmp<errorEstimate<Type> >&
220 tmp<errorEstimate<Type> > operator+
222 const errorEstimate<Type>&,
223 const errorEstimate<Type>&
227 tmp<errorEstimate<Type> > operator+
229 const tmp<errorEstimate<Type> >&,
230 const errorEstimate<Type>&
234 tmp<errorEstimate<Type> > operator+
236 const errorEstimate<Type>&,
237 const tmp<errorEstimate<Type> >&
241 tmp<errorEstimate<Type> > operator+
243 const tmp<errorEstimate<Type> >&,
244 const tmp<errorEstimate<Type> >&
248 tmp<errorEstimate<Type> > operator-
250 const errorEstimate<Type>&,
251 const errorEstimate<Type>&
255 tmp<errorEstimate<Type> > operator-
257 const tmp<errorEstimate<Type> >&,
258 const errorEstimate<Type>&
262 tmp<errorEstimate<Type> > operator-
264 const errorEstimate<Type>&,
265 const tmp<errorEstimate<Type> >&
269 tmp<errorEstimate<Type> > operator-
271 const tmp<errorEstimate<Type> >&,
272 const tmp<errorEstimate<Type> >&
276 tmp<errorEstimate<Type> > operator==
278 const errorEstimate<Type>&,
279 const errorEstimate<Type>&
283 tmp<errorEstimate<Type> > operator==
285 const tmp<errorEstimate<Type> >&,
286 const errorEstimate<Type>&
290 tmp<errorEstimate<Type> > operator==
292 const errorEstimate<Type>&,
293 const tmp<errorEstimate<Type> >&
297 tmp<errorEstimate<Type> > operator==
299 const tmp<errorEstimate<Type> >&,
300 const tmp<errorEstimate<Type> >&
304 tmp<errorEstimate<Type> > operator+
306 const errorEstimate<Type>&,
307 const GeometricField<Type, fvPatchField, volMesh>&
311 tmp<errorEstimate<Type> > operator+
313 const tmp<errorEstimate<Type> >&,
314 const GeometricField<Type, fvPatchField, volMesh>&
318 tmp<errorEstimate<Type> > operator+
320 const errorEstimate<Type>&,
321 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
325 tmp<errorEstimate<Type> > operator+
327 const tmp<errorEstimate<Type> >&,
328 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
332 tmp<errorEstimate<Type> > operator+
334 const GeometricField<Type, fvPatchField, volMesh>&,
335 const errorEstimate<Type>&
339 tmp<errorEstimate<Type> > operator+
341 const GeometricField<Type, fvPatchField, volMesh>&,
342 const tmp<errorEstimate<Type> >&
346 tmp<errorEstimate<Type> > operator+
348 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
349 const errorEstimate<Type>&
353 tmp<errorEstimate<Type> > operator+
355 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
356 const tmp<errorEstimate<Type> >&
360 tmp<errorEstimate<Type> > operator-
362 const errorEstimate<Type>&,
363 const GeometricField<Type, fvPatchField, volMesh>&
367 tmp<errorEstimate<Type> > operator-
369 const tmp<errorEstimate<Type> >&,
370 const GeometricField<Type, fvPatchField, volMesh>&
374 tmp<errorEstimate<Type> > operator-
376 const errorEstimate<Type>&,
377 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
381 tmp<errorEstimate<Type> > operator-
383 const tmp<errorEstimate<Type> >&,
384 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
388 tmp<errorEstimate<Type> > operator-
390 const GeometricField<Type, fvPatchField, volMesh>&,
391 const errorEstimate<Type>&
395 tmp<errorEstimate<Type> > operator-
397 const GeometricField<Type, fvPatchField, volMesh>&,
398 const tmp<errorEstimate<Type> >&
402 tmp<errorEstimate<Type> > operator-
404 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
405 const errorEstimate<Type>&
409 tmp<errorEstimate<Type> > operator-
411 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
412 const tmp<errorEstimate<Type> >&
416 tmp<errorEstimate<Type> > operator+
418 const tmp<errorEstimate<Type> >&,
419 const dimensioned<Type>&
423 tmp<errorEstimate<Type> > operator+
425 const dimensioned<Type>&,
426 const tmp<errorEstimate<Type> >&
430 tmp<errorEstimate<Type> > operator-
432 const tmp<errorEstimate<Type> >&,
433 const dimensioned<Type>&
437 tmp<errorEstimate<Type> > operator-
439 const dimensioned<Type>&,
440 const tmp<errorEstimate<Type> >&
444 tmp<errorEstimate<Type> > operator==
446 const errorEstimate<Type>&,
447 const GeometricField<Type, fvPatchField, volMesh>&
451 tmp<errorEstimate<Type> > operator==
453 const tmp<errorEstimate<Type> >&,
454 const GeometricField<Type, fvPatchField, volMesh>&
458 tmp<errorEstimate<Type> > operator==
460 const errorEstimate<Type>&,
461 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
465 tmp<errorEstimate<Type> > operator==
467 const tmp<errorEstimate<Type> >&,
468 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
472 tmp<errorEstimate<Type> > operator==
474 const errorEstimate<Type>&,
475 const dimensioned<Type>&
479 tmp<errorEstimate<Type> > operator==
481 const tmp<errorEstimate<Type> >&,
482 const dimensioned<Type>&
487 tmp<errorEstimate<Type> > operator*
489 const volScalarField&,
490 const errorEstimate<Type>&
494 tmp<errorEstimate<Type> > operator*
496 const volScalarField&,
497 const tmp<errorEstimate<Type> >&
501 tmp<errorEstimate<Type> > operator*
503 const tmp<volScalarField>&,
504 const errorEstimate<Type>&
508 tmp<errorEstimate<Type> > operator*
510 const tmp<volScalarField>&,
511 const tmp<errorEstimate<Type> >&
516 tmp<errorEstimate<Type> > operator*
518 const dimensioned<scalar>&,
519 const errorEstimate<Type>&
523 tmp<errorEstimate<Type> > operator*
525 const dimensioned<scalar>&,
526 const tmp<errorEstimate<Type> >&
530 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
532 } // End namespace Foam
534 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
537 # include "errorEstimate.C"
540 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
544 // ************************************************************************* //