tanhInterpolation.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 Class
28  Foam::tanhInterpolation
29 
30 Description
31  Computes the Brickmann penalization function for topology optimisation,
32  relying on tanh functions and proposed in
33 
34  Reference:
35  \verbatim
36  Wang, F., Lazarov, B., Sigmund, O.(2011).
37  On projection methods, convergence and robust formulations in topO
38  optimization.
39  Structural and Multidisciplinary Optimization 43(6), 767–784.
40  https://doi:10.1007/s00158-010-0602-y
41  \endverbatim
42 
43 SourceFiles
44  tanhInterpolation.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef tanhInterpolation_H
49 #define tanhInterpolation_H
50 
52 #include "Function1.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class tanhInterpolation Declaration
61 \*---------------------------------------------------------------------------*/
62 
64 :
66 {
67 
68 private:
69 
70  // Private Data
71 
72  //- Steepness parameter
73  // High b values lead to more steep interpolations - higher contrasts.
74  // May vary in time
76 
77  //- Length scale parameter
78  // Default to 0.5
79  scalar eta_;
80 
81 
82  // Private Member Functions
83 
84  //- No copy construct
86 
87  //- No copy assignment
88  void operator=(const tanhInterpolation&);
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("tanh");
95 
96 
97  // Constructors
98 
99  //- Construct from components
101  (
102  const fvMesh& mesh,
103  const dictionary& dict
104  );
105 
106 
107  //- Destructor
108  virtual ~tanhInterpolation() = default;
109 
110 
111  // Member Functions
112 
113  //- Interpolate argument and write to result
114  virtual void interpolate
115  (
116  const scalarField& arg,
117  scalarField& res
118  ) const;
119 
120  //- Return of function with respect to the argument field
121  virtual tmp<scalarField> derivative(const scalarField& arg) const;
122 
123  //- Set the parameter determining length scale
124  virtual void setLengthScaleParam(const scalar lengthScale);
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Computes the Brickmann penalization function for topology optimisation, relying on tanh functions and...
TypeName("tanh")
Runtime type information.
dynamicFvMesh & mesh
virtual tmp< scalarField > derivative(const scalarField &arg) const
Return of function with respect to the argument field.
virtual void setLengthScaleParam(const scalar lengthScale)
Set the parameter determining length scale.
virtual ~tanhInterpolation()=default
Destructor.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void interpolate(const scalarField &arg, scalarField &res) const
Interpolate argument and write to result.
Namespace for OpenFOAM.