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 {
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43 
44 template<class Type>
45 bool Foam::functionObjects::reconstruct::calcReconstruction()
46 {
47  if (foundObject<SurfaceField<Type>>(fieldName_))
48  {
49  return store
50  (
52  fvc::reconstruct(lookupObject<SurfaceField<Type>>(fieldName_)),
54  );
55  }
56  else
57  {
58  return false;
59  }
60 }
61 
62 
63 bool Foam::functionObjects::reconstruct::calc()
64 {
65  bool processed = false;
66 
67  processed = processed || calcReconstruction<scalar>();
68  processed = processed || calcReconstruction<vector>();
69 
70  if (!processed)
71  {
72  cannotFindObject(fieldName_);
73  }
74 
75  return processed;
76 }
77 
78 
79 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
80 
82 (
83  const word& name,
84  const Time& runTime,
85  const dictionary& dict
86 )
87 :
88  fieldExpression(name, runTime, dict, typeName)
89 {}
90 
91 
92 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
93 
95 {}
96 
97 
98 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base-class for Time/database functionObjects.
word resultName_
Name of result field.
const word fieldName_
Name of field to process.
const fvMesh & mesh_
Reference to the fvMesh.
Calculates the reconstruction of a field; e.g., to construct a cell-centred velocity,...
Definition: reconstruct.H:59
reconstruct(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: reconstruct.C:82
virtual ~reconstruct()
Destructor.
Definition: reconstruct.C:94
const ObjectType & lookupObject(const word &fieldName) const
Lookup object from the objectRegistry.
bool foundObject(const word &fieldName) const
Find field in the objectRegistry.
bool store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
const fvSolution & solution() const
Return the fvSolution.
Definition: fvMesh.C:1762
bool changing() const
Is mesh changing.
Definition: polyMesh.H:489
bool cache(const word &name) const
Return true if the given field should be cached.
Definition: solution.C:216
A class for handling words, derived from string.
Definition: word.H:62
Reconstruct volField from a face flux field.
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
tmp< VolField< typename outerProduct< vector, Type >::type > > reconstruct(const SurfaceField< Type > &ssf)
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
dictionary dict