Loading...
Searching...
No Matches
fieldRegularisation.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) 2007-2023 PCOpt/NTUA
9 Copyright (C) 2013-2023 FOSS GP
10-------------------------------------------------------------------------------
11License
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
27Class
28 fieldRegularisation
29
30Description
31 Regularises the given field using a PDE smoother and then sharpens
32 (projects) the result using a smoothed Heaviside function. Used in topology
33 optimisation to regularise the designed geometries and obtain 'grid
34 independent' solutions.
35
36 Reference:
37 \verbatim
38 Largely follows the PDE-based smoothing of
39
40 Lazarov, B. S., & Sigmund O. (2010).
41 Filters in topology optimization based on Helmholtz-type
42 differential equations.
43 International Journal for Numerical Methods in Engineering,
44 86(6), 765-781.
45 https://doi.org/10.1002/nme.3072
46 \endverbatim
47
48SourceFiles
49 fieldRegularisation.C
50
51\*---------------------------------------------------------------------------*/
52
53#ifndef fieldRegularisation_H
54#define fieldRegularisation_H
55
56#include "fvMesh.H"
57#include "volFields.H"
58#include "topOZones.H"
59#include "regularisationPDE.H"
62
63
64// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65
66namespace Foam
67{
69/*---------------------------------------------------------------------------*\
70 Class fieldRegularisation Declaration
71\*---------------------------------------------------------------------------*/
72
73class fieldRegularisation
74{
76protected:
77
78 // Protected data
79
82
83 //- Cell zones related to topology optimisation
84 const topOZones& zones_;
85
86 //- Perform regulaisation on alpha before inputing it on beta?
87 bool regularise_;
88
89 //- Perform the projection (sharpening) step?
90 bool project_;
92 //- Smoothing radius
93 // May be isotropic or differ per spatial direction
95
96 //- Alpha field (design variables of topology optimisation)
97 const scalarField& alpha_;
99 //- The regularised alpha field, if regulatisation is performed
101
102 //- Function used to sharpen the field after regularisation
104
105 //- PDE used for the regularisation
107
108 //- Argument of the beta field.
109 // Is either alpha_ (no regularisation)
110 // or alphaTilda_ (with regularisation)
111 const scalarField& betaArg_;
112
113 //- Whether to apply a fixedValue BC or zeroGradient one to alphaTilda,
114 //- when regularisation is performed
115 bool growFromWalls_;
116
117 //- Beta is the field used for all interpolations between fluid and
118 //- solid in topology optimisation
120
121
122private:
123
124 // Private Member Functions
125
126 //- No copy construct
127 fieldRegularisation(const fieldRegularisation&);
128
129 //- No copy assignment
130 void operator=(const fieldRegularisation&);
131
133public:
134
135 //- Runtime type information
136 TypeName("fieldRegularisation");
137
139 // Constructors
140
141 //- Construct from components
142 fieldRegularisation
143 (
144 fvMesh& mesh,
145 const scalarField& alpha,
146 const topOZones& zones,
147 const dictionary& dict
148 );
149
150
151 //- Destructor
152 virtual ~fieldRegularisation() = default;
153
154
155 // Member Functions
156
157 //- Return beta field
158 inline const volScalarField& beta() const
159 {
160 return beta_;
162
163 //- Grow beta from walls
164 inline bool growFromWalls() const
165 {
166 return growFromWalls_;
167 }
168
169 //- Should regularisation be executed
170 inline bool shouldRegularise() const
171 {
172 return regularise_;
173 }
174
175 //- Update the beta field.
176 // Performs regulaisation of alpha_, if necessary
177 virtual void updateBeta();
178
179 //- Regularise an externally provided radius
180 void regularise
182 const scalarField& source,
183 scalarField& result,
184 const bool isTopoField,
185 const regularisationRadius& radius
186 );
187
188 //- Regularise field (or sensitivities) using a Laplace PDE
190 (
191 const scalarField& source,
192 scalarField& result,
193 const bool isTopoField
194 );
195
196 //- Update part of fieldRegularisation to the sensitivitiy derivatives
198};
199
200
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202
203} // End namespace Foam
204
205// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207#endif
208
209// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
bool growFromWalls() const
Grow beta from walls.
bool growFromWalls_
Whether to apply a fixedValue BC or zeroGradient one to alphaTilda, when regularisation is performed.
autoPtr< regularisationRadius > radius_
Smoothing radius.
bool regularise_
Perform regulaisation on alpha before inputing it on beta?
virtual void updateBeta()
Update the beta field.
TypeName("fieldRegularisation")
Runtime type information.
bool project_
Perform the projection (sharpening) step?
volScalarField beta_
Beta is the field used for all interpolations between fluid and solid in topology optimisation.
autoPtr< topOInterpolationFunction > sharpenFunction_
Function used to sharpen the field after regularisation.
void postProcessSens(scalarField &sens)
Update part of fieldRegularisation to the sensitivitiy derivatives.
virtual ~fieldRegularisation()=default
Destructor.
autoPtr< volScalarField > alphaTilda_
The regularised alpha field, if regulatisation is performed.
void regularise(const scalarField &source, scalarField &result, const bool isTopoField, const regularisationRadius &radius)
Regularise an externally provided radius.
const volScalarField & beta() const
Return beta field.
bool shouldRegularise() const
Should regularisation be executed.
autoPtr< regularisationPDE > regularisationPDE_
PDE used for the regularisation.
const topOZones & zones_
Cell zones related to topology optimisation.
const scalarField & betaArg_
Argument of the beta field.
const scalarField & alpha_
Alpha field (design variables of topology optimisation).
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Base class for selecting the regulatisation radius.
dynamicFvMesh & mesh
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
volScalarField & alpha
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68