KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
shape_optimization_application.h
Go to the documentation of this file.
1 // ==============================================================================
2 // KratosShapeOptimizationApplication
3 //
4 // License: BSD License
5 // license: ShapeOptimizationApplication/license.txt
6 //
7 // Main authors: Baumgaertner Daniel, https://github.com/dbaumgaertner
8 // Geiser Armin, https://github.com/armingeiser
9 //
10 // ==============================================================================
11 
12 #if !defined(KRATOS_SHAPEOPTIMIZATION_APPLICATION_H_INCLUDED )
13 #define KRATOS_SHAPEOPTIMIZATION_APPLICATION_H_INCLUDED
14 
15 // ------------------------------------------------------------------------------
16 // System includes
17 // ------------------------------------------------------------------------------
18 
19 #include <string>
20 #include <iostream>
21 
22 // ------------------------------------------------------------------------------
23 // External includes
24 // ------------------------------------------------------------------------------
25 
26 // ------------------------------------------------------------------------------
27 // Project includes
28 // ------------------------------------------------------------------------------
29 #include "includes/define.h"
31 
32 // Variables
33 #include "includes/variables.h"
34 
35 
36 // ==============================================================================
37 
38 namespace Kratos
39 {
40 
43 
44  // Geometry variables
45  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, NORMALIZED_SURFACE_NORMAL);
46 
47  // Optimization variables
48  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DF1DX);
49 
50  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DF1DX_MAPPED);
51 
52  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC1DX);
53  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC2DX);
54  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC3DX);
55  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC4DX);
56  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC5DX);
57  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC6DX);
58  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC7DX);
59  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC8DX);
60  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC9DX);
61 
62  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC1DX_MAPPED);
63  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC2DX_MAPPED);
64  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC3DX_MAPPED);
65  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC4DX_MAPPED);
66  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC5DX_MAPPED);
67  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC6DX_MAPPED);
68  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC7DX_MAPPED);
69  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC8DX_MAPPED);
70  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC9DX_MAPPED);
71 
72  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, SEARCH_DIRECTION);
73  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,INV_HESSIAN);
74  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, CORRECTION);
75  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, PROJECTION);
76  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, CONTROL_POINT_UPDATE);
77  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, CONTROL_POINT_CHANGE);
78  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, SHAPE_UPDATE);
79  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, SHAPE_CHANGE);
80  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, MESH_CHANGE);
81 
82  // For edge damping
83  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DAMPING_FACTOR);
84 
85  // For mapping
86  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, int,MAPPING_ID);
87 
88  // For adaptive filter
89  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,VERTEX_MORPHING_RADIUS);
90  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,VERTEX_MORPHING_RADIUS_RAW);
91  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,GAUSSIAN_CURVATURE);
92  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,MAX_NEIGHBOUR_DISTANCE);
93 
94  // For bead optimization
95  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,ALPHA);
96  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,ALPHA_MAPPED);
97  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,DF1DALPHA);
98  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,DF1DALPHA_MAPPED);
99  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,DPDALPHA);
100  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,DPDALPHA_MAPPED);
101  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,DLDALPHA);
102  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, BEAD_DIRECTION);
103 
104  // For shape fraction optimization
105  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DP1DX);
106  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DPF1DX);
107 
108  // For auxiliary operations
109  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,SCALAR_VARIABLE);
110  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double,SCALAR_VARIABLE_MAPPED);
111  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, VECTOR_VARIABLE);
112  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, VECTOR_VARIABLE_MAPPED);
113 
114  // For in plane mapping operations
115  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, BACKGROUND_COORDINATE);
116  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, BACKGROUND_NORMAL);
117  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, OUT_OF_PLANE_DELTA);
118 
119  // For face angle response
120  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, bool, CONSIDER_FACE_ANGLE);
121 
122  // For sensitivity heatmap
123  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DF1DX);
124  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double, HEATMAP_DF1DALPHA);
125 
126  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC1DX);
127  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC2DX);
128  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC3DX);
129  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC4DX);
130  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC5DX);
131  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC6DX);
132  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC7DX);
133  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC8DX);
134  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, HEATMAP_DC9DX);
135 
136  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double, HEATMAP_MAX);
137  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double, HEATMAP_L2);
138 
139  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DF1DX_WEIGHTED);
140  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double, DF1DALPHA_WEIGHTED);
141 
142  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC1DX_WEIGHTED);
143  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC2DX_WEIGHTED);
144  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC3DX_WEIGHTED);
145  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC4DX_WEIGHTED);
146  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC5DX_WEIGHTED);
147  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC6DX_WEIGHTED);
148  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC7DX_WEIGHTED);
149  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC8DX_WEIGHTED);
150  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC9DX_WEIGHTED);
151 
152  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DF1DX_WEIGHTED_MAPPED);
153  KRATOS_DEFINE_APPLICATION_VARIABLE(SHAPE_OPTIMIZATION_APPLICATION, double, DF1DALPHA_WEIGHTED_MAPPED);
154 
155  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC1DX_WEIGHTED_MAPPED);
156  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC2DX_WEIGHTED_MAPPED);
157  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC3DX_WEIGHTED_MAPPED);
158  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC4DX_WEIGHTED_MAPPED);
159  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC5DX_WEIGHTED_MAPPED);
160  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC6DX_WEIGHTED_MAPPED);
161  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC7DX_WEIGHTED_MAPPED);
162  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC8DX_WEIGHTED_MAPPED);
163  KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(SHAPE_OPTIMIZATION_APPLICATION, DC9DX_WEIGHTED_MAPPED);
164 
168 
172 
176 
180 
182 
184  class KRATOS_API(SHAPE_OPTIMIZATION_APPLICATION) KratosShapeOptimizationApplication : public KratosApplication
185  {
186  public:
189 
190 
193 
197 
200 
203 
204 
208 
209 
213 
214  void Register() override;
215 
216 
217 
221 
222 
226 
227 
231 
233  std::string Info() const override
234  {
235  return "KratosShapeOptimizationApplication";
236  }
237 
239  void PrintInfo(std::ostream& rOStream) const override
240  {
241  rOStream << Info();
242  PrintData(rOStream);
243  }
244 
246  void PrintData(std::ostream& rOStream) const override
247  {
248  KRATOS_WATCH("in my application");
250  rOStream << "Variables:" << std::endl;
252  rOStream << std::endl;
253  rOStream << "Elements:" << std::endl;
254  KratosComponents<Element>().PrintData(rOStream);
255  rOStream << std::endl;
256  rOStream << "Conditions:" << std::endl;
257  KratosComponents<Condition>().PrintData(rOStream);
258  }
259 
260 
264 
265 
267 
268  protected:
271 
272 
276 
277 
281 
282 
286 
287 
291 
292 
296 
297 
301 
302 
304 
305  private:
308 
309 
310 
311  // static const ApplicationCondition msApplicationCondition;
312 
316 
320 
321 
325 
326 
330 
331 
335 
336 
340 
343 
346 
347 
349 
350  }; // Class KratosShapeOptimizationApplication
351 
353 
354 
357 
358 
362 
364 
365 
366 } // namespace Kratos.
367 
368 #endif // KRATOS_SHAPEOPTIMIZATION_APPLICATION_H_INCLUDED defined
369 
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
This class defines the interface with kernel for all applications in Kratos.
Definition: kratos_application.h:91
Definition: kratos_components.h:253
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: kratos_components.h:403
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
Short class definition.
Definition: shape_optimization_application.h:185
~KratosShapeOptimizationApplication() override
Destructor.
Definition: shape_optimization_application.h:202
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: shape_optimization_application.h:239
std::string Info() const override
Turn back information as a string.
Definition: shape_optimization_application.h:233
KRATOS_CLASS_POINTER_DEFINITION(KratosShapeOptimizationApplication)
Pointer definition of KratosShapeOptimizationApplication.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: shape_optimization_application.h:246
#define KRATOS_WATCH(variable)
Definition: define.h:806
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KRATOS_DEFINE_APPLICATION_VARIABLE(CHIMERA_APPLICATION, double, CHIMERA_DISTANCE)
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(CHIMERA_APPLICATION, ROTATION_MESH_DISPLACEMENT)
KRATOS_API_EXTERN template class KratosComponents< Condition >
Definition: condition.h:1191
KRATOS_API_EXTERN template class KratosComponents< Element >
Definition: element.h:1240