periodic.H
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) 2025 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 Class
25  Foam::zoneGenerators::periodic
26 
27 Description
28  A zoneGenerator which activates the zoneSet returned by the given
29  zoneGenerator for a given period with optional repetition.
30 
31 Usage
32  \table
33  Property | Description | Required | Default value
34  type | Type: periodic | yes |
35  begin | Begin time for the zones | no | Time::beginTime()
36  end | End time for the zones | no | Time::endTime()
37  repeat | Repetition period | no |
38  deactivate | Invert the activation logic | no | false
39  \endtable
40  These options are followed by a single zoneGenerator specification.
41 
42  Example of the specification for a periodic box cellZone in the
43  constant/zonesGenerator file:
44  \verbatim
45  box1
46  {
47  type periodic;
48 
49  begin 0.001;
50  end 0.002;
51  repeat 0.002;
52 
53  box1
54  {
55  type box;
56  zoneType cell;
57  moveUpdate true;
58 
59  min (-0.0075 0 -1);
60  max (-0.003 0.0025 1);
61  }
62  }
63  \endverbatim
64 
65 SourceFiles
66  periodic.C
67 
68 \*---------------------------------------------------------------------------*/
69 
70 #ifndef periodic_zoneGenerator_H
71 #define periodic_zoneGenerator_H
72 
73 #include "zoneGeneratorList.H"
74 #include "Switch.H"
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 namespace Foam
79 {
80 namespace zoneGenerators
81 {
82 
83 /*---------------------------------------------------------------------------*\
84  Class periodic Declaration
85 \*---------------------------------------------------------------------------*/
86 
87 class periodic
88 :
89  public zoneGenerator
90 {
91  // Private Data
92 
93  autoPtr<zoneGenerator> zoneGenerator_;
94 
95  //- Optional begin time for the zones being active
96  // Defaults to Time::beginTime
97  const scalar begin_;
98 
99  //- Optional end time for the zones being active
100  // Defaults to Time::endTime
101  const scalar end_;
102 
103  //- Optional repetition period for the zones being active
104  // Defaults to no repetition
105  const scalar repeat_;
106 
107  //- Switch to deactivate rather than activate within the time-range
108  const Switch deactivate_;
109 
110  //- Active state
111  mutable bool active_;
112 
113  //- Cached null zoneSet
114  mutable zoneSet nullZoneSet_;
115 
116 
117  // Private Member Functions
118 
119  //- Returns true when the zones should be activated
120  bool activate() const;
121 
122  //- Returns true if the active state of the zones has changed
123  bool stateChanged() const;
124 
125 
126 public:
127 
128  //- Runtime type information
129  TypeName("periodic");
130 
131 
132  // Constructors
133 
134  //- Construct from dictionary
135  periodic
136  (
137  const word& name,
138  const polyMesh& mesh,
139  const dictionary& dict
140  );
141 
142 
143  //- Destructor
144  virtual ~periodic();
145 
146 
147  // Member Functions
148 
149  virtual zoneSet generate() const;
150 
151  virtual zoneSet movePoints() const;
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace zoneGenerators
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A class for handling words, derived from string.
Definition: word.H:62
const word & name() const
virtual ~periodic()
Destructor.
Definition: periodic.C:117
virtual zoneSet generate() const
Generate and return the zoneSet.
Definition: periodic.C:123
periodic(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: periodic.C:79
TypeName("periodic")
Runtime type information.
virtual zoneSet movePoints() const
Regenerate the zoneSet following mesh point motion.
Definition: periodic.C:180
Zone container returned by zoneGenerator::generate.
Definition: zoneSet.H:94
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
dictionary dict