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-2024 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  store
50  (
52  fvc::reconstruct(lookupObject<SurfaceField<Type>>(fieldName_)),
54  );
55 
56  return true;
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 // ************************************************************************* //
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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.
const ObjectType & lookupObject(const word &fieldName) const
Lookup object from the objectRegistry.
bool foundObject(const word &fieldName) const
Find field in the objectRegistry.
ObjectType & store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
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:84
virtual ~reconstruct()
Destructor.
Definition: reconstruct.C:96
const fvSolution & solution() const
Return the fvSolution.
Definition: fvMesh.C:1810
bool changing() const
Is mesh changing.
Definition: polyMesh.H:486
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 LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict