dynamicTopODesignVariables.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020-2023 PCOpt/NTUA
9  Copyright (C) 2020-2023 FOSS GP
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 
28 Class
29  Foam::dynamicTopODesignVariables
30 
31 Description
32  Design variables for topology optimisation problems.
33  Active design variables are added gradually, to help the optimiser from
34  being trapped to a sub-optimal solution track in the first optimisation
35  cycles.
36 
37 SourceFiles
38  dynamicTopODesignVariables.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef dynamicTopODesignVariables_H
43 #define dynamicTopODesignVariables_H
44 
45 #include "topODesignVariables.H"
46 #include "marchingCells.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class dynamicTopODesignVariables Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
59  public topODesignVariables
60 {
61 protected:
62 
63  // Protected data
64 
65  //- Mechanism for gradually activating design variables
67 
68  //- Number of times the design variables have evolved
69  label evolvedCount_;
70 
71 
72  // Protected Member Functions
73 
74  //- Set active design variables
75  virtual void setActiveDesignVariables
76  (
77  const label fluidID = 0,
78  const bool activeIO = false
79  );
80 
81 
82 private:
83 
84  // Private Member Functions
85 
86  //- Disallow default bitwise copy construct
88  (
90  ) = delete;
91 
92  //- Disallow default bitwise assignment
93  void operator=(const dynamicTopODesignVariables&) = delete;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("dynamicTopO");
100 
101 
102  // Constructors
103 
104  //- Construct from dictionary
106  (
107  fvMesh& mesh,
108  const dictionary& dict
109  );
110 
111  //- Construct from dictionary and size
113  (
114  fvMesh& mesh,
115  const dictionary& dict,
116  const label size
117  );
118 
119 
120  // Selectors
121 
122  //- Construct and return the selected design variables
124  (
125  fvMesh& mesh,
126  const dictionary& dict
127  );
128 
129 
130  //- Destructor
131  virtual ~dynamicTopODesignVariables() = default;
132 
133 
134  // Member Functions
135 
136  //- Update the active design variables
137  virtual void evolveNumber();
138 
139  //- The writeData function required by the regIOobject write operation
140  virtual bool writeData(Ostream&) const;
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
virtual void evolveNumber()
Update the active design variables.
dictionary dict
virtual ~dynamicTopODesignVariables()=default
Destructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void setActiveDesignVariables(const label fluidID=0, const bool activeIO=false)
Set active design variables.
virtual bool writeData(Ostream &) const
The writeData function required by the regIOobject write operation.
Design variables for porosity-based topology optimisation (topO) problems.
dynamicFvMesh & mesh
marchingCells marchCells_
Mechanism for gradually activating design variables.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
label size() const noexcept
The number of elements in the container.
Definition: UList.H:671
label evolvedCount_
Number of times the design variables have evolved.
static autoPtr< dynamicTopODesignVariables > New(fvMesh &mesh, const dictionary &dict)
Construct and return the selected design variables.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
TypeName("dynamicTopO")
Runtime type information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Design variables for topology optimisation problems. Active design variables are added gradually...
Namespace for OpenFOAM.