Loading...
Searching...
No Matches
objectiveTopOVolume.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
27
28Class
29 Foam::objectives::objectiveTopOVolume
30
31Description
32 Objective quantifying the difference between the volume occupied by fluid
33 in topology optimisation and a target percentage; the latter can change
34 throughout the optimisation cycles through a Function1.
35
36SourceFiles
37 objectiveTopOVolume.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef objectiveTopOVolume_H
42#define objectiveTopOVolume_H
43
44#include "objectiveGeometric.H"
45#include "Function1.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52namespace objectives
53{
55/*---------------------------------------------------------------------------*\
56 Class objectiveTopOVolume Declaration
57\*---------------------------------------------------------------------------*/
58
60:
61 public objectiveGeometric
62{
63 // Private data
64
65 autoPtr<Function1<scalar>> targetPercentage_;
66
67 bool percentInDenom_;
68
69
70public:
71
72 //- Runtime type information
73 TypeName("topOVolume");
74
75
76 // Constructors
77
78 //- From components
80 (
81 const fvMesh& mesh,
82 const dictionary& dict,
83 const word& adjointSolverName,
84 const word& primalSolverName
85 );
86
87
88 //- Destructor
89 virtual ~objectiveTopOVolume() = default;
91
92 // Member Functions
93
94 //- Return the objective function value
95 virtual scalar J();
96
97 //- Contribution to field sensitivities
98 virtual void update_dJdb();
99
100 // Helper write functions
101
102 //- Write headers for additional columns
103 virtual void addHeaderColumns() const;
104
105 //- Write information to additional columns
106 virtual void addColumnValues() const;
107};
108
109
110// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111
112} // End namespace objectives
113} // End namespace Foam
114
115// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116
117#endif
118
119// ************************************************************************* //
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
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
const dictionary & dict() const
Return objective dictionary.
Definition objective.C:91
virtual void update_dJdb()
Contribution to field sensitivities.
virtual void addHeaderColumns() const
Write headers for additional columns.
virtual scalar J()
Return the objective function value.
objectiveTopOVolume(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
From components.
TypeName("topOVolume")
Runtime type information.
virtual ~objectiveTopOVolume()=default
Destructor.
virtual void addColumnValues() const
Write information to additional columns.
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68