meshToMeshAdjustTimeStepFunctionObject.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 
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace functionObjects
34 {
35  defineTypeNameAndDebug(meshToMeshAdjustTimeStepFunctionObject, 0);
36 
38  (
39  functionObject,
40  meshToMeshAdjustTimeStepFunctionObject,
41  dictionary
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
51 (
52  const word& name,
53  const Time& runTime,
54  const dictionary& dict
55 )
56 :
57  fvMeshFunctionObject(name, runTime, dict),
58  meshToMesh_
59  (
60  refCast<const fvMeshTopoChangers::meshToMesh>(mesh_.topoChanger())
61  )
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
66 
69 {}
70 
71 
72 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 
75 (
76  const dictionary& dict
77 )
78 {
80 
81  return true;
82 }
83 
84 
85 Foam::scalar
87 {
88  const scalarList& times = meshToMesh_.times();
89 
90  if (time_.userTimeValue() + meshToMesh_.timeDelta() < times.last())
91  {
92  forAll(times, i)
93  {
94  if (times[i] > time_.userTimeValue() + meshToMesh_.timeDelta())
95  {
96  return time_.userTimeToTime(times[i] - time_.userTimeValue());
97  }
98  }
99  }
100 
101  return vGreat;
102 }
103 
104 
106 {
107  return true;
108 }
109 
110 
112 {
113  return true;
114 }
115 
116 
117 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual bool read(const dictionary &)
Read and reset the timeStep Function1.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
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.
virtual bool read(const dictionary &)
Read optional controls.
A class for handling words, derived from string.
Definition: word.H:59
meshToMeshAdjustTimeStepFunctionObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
defineTypeNameAndDebug(Qdot, 0)
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
T & last()
Return the last element of the list.
Definition: UListI.H:128
Namespace for OpenFOAM.