objectiveTopOSolidVolume.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 -------------------------------------------------------------------------------
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::objectives::objectiveTopOSolidVolume
30 
31 Description
32  Objective quantifying the difference between the volume occupied by solid
33  in topology optimisation and a target percentage; the latter can change
34  throughout the optimisation cycles through a Function1.
35 
36 SourceFiles
37  objectiveTopOSolidVolume.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef objectiveTopOSolidVolume_H
42 #define objectiveTopOSolidVolume_H
43 
44 #include "objectiveGeometric.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 namespace objectives
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class objectiveTopOSolidVolume Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public objectiveGeometric
61 {
62  // Private data
63 
64  autoPtr<Function1<scalar>> targetPercentage_;
65 
66  bool percentInDenom_;
67 
68 
69 public:
70 
71  //- Runtime type information
72  TypeName("topOSolidVolume");
73 
74 
75  // Constructors
76 
77  //- from components
79  (
80  const fvMesh& mesh,
81  const dictionary& dict,
82  const word& adjointSolverName,
83  const word& primalSolverName
84  );
85 
86 
87  //- Destructor
88  virtual ~objectiveTopOSolidVolume() = default;
89 
90 
91  // Member Functions
92 
93  //- Return the objective function value
94  virtual scalar J();
95 
96  //- Contribution to field sensitivities
97  virtual void update_dJdb();
98 
99  // Helper write functions
100 
101  //- Write headers for additional columns
102  virtual void addHeaderColumns() const;
103 
104  //- Write information to additional columns
105  virtual void addColumnValues() const;
106 };
107 
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 } // End namespace objectives
112 } // End namespace Foam
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 #endif
117 
118 // ************************************************************************* //
const dictionary & dict() const
Return objective dictionary.
Definition: objective.C:91
virtual ~objectiveTopOSolidVolume()=default
Destructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void addColumnValues() const
Write information to additional columns.
virtual void addHeaderColumns() const
Write headers for additional columns.
virtual scalar J()
Return the objective function value.
virtual void update_dJdb()
Contribution to field sensitivities.
Abstract base class for objective functions that contain only geometric quantities.
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Objective quantifying the difference between the volume occupied by solid in topology optimisation an...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
objectiveTopOSolidVolume(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
from components
Namespace for OpenFOAM.
TypeName("topOSolidVolume")
Runtime type information.