All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
reconstruct.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "reconstruct.H"
27 #include "fvcReconstruct.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace functionObjects
35 {
37  addToRunTimeSelectionTable(functionObject, reconstruct, dictionary);
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43 
44 template<class Type>
45 bool Foam::functionObjects::reconstruct::calcReconstruction()
46 {
47  typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
48 
49  if (foundObject<SurfaceFieldType>(fieldName_))
50  {
51  return store
52  (
53  resultName_,
54  fvc::reconstruct(lookupObject<SurfaceFieldType>(fieldName_)),
55  mesh_.changing() && mesh_.solution().cache(resultName_)
56  );
57  }
58  else
59  {
60  return false;
61  }
62 }
63 
64 
65 bool Foam::functionObjects::reconstruct::calc()
66 {
67  bool processed = false;
68 
69  processed = processed || calcReconstruction<scalar>();
70  processed = processed || calcReconstruction<vector>();
71 
72  if (!processed)
73  {
74  cannotFindObject(fieldName_);
75  }
76 
77  return processed;
78 }
79 
80 
81 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
82 
84 (
85  const word& name,
86  const Time& runTime,
87  const dictionary& dict
88 )
89 :
90  fieldExpression(name, runTime, dict, typeName)
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
95 
97 {}
98 
99 
100 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Reconstruct volField from a face flux field.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
reconstruct(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: reconstruct.C:84
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Macros for easy insertion into run-time selection tables.
A class for handling words, derived from string.
Definition: word.H:59
virtual ~reconstruct()
Destructor.
Definition: reconstruct.C:96
defineTypeNameAndDebug(Qdot, 0)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Namespace for OpenFOAM.