@@ -69,6 +69,7 @@ class CFEASolver : public CSolver {
6969 su2double Total_OFVolFrac; /* !< \brief Total Objective Function: Volume fraction (topology optimization). */
7070 su2double Total_OFDiscreteness; /* !< \brief Total Objective Function: Discreteness (topology optimization). */
7171 su2double Total_OFCompliance; /* !< \brief Total Objective Function: Compliance (topology optimization). */
72+ su2double ObjFunc;
7273
7374 su2double Global_OFRefGeom; /* !< \brief Global Objective Function (added over time steps): Reference Geometry. */
7475 su2double Global_OFRefNode; /* !< \brief Global Objective Function (added over time steps): Reference Node. */
@@ -198,6 +199,34 @@ class CFEASolver : public CSolver {
198199 su2double der,
199200 su2double der_avg) const ;
200201
202+ /* !
203+ * \brief Compute the objective function for a reference geometry
204+ * \param[in] geometry - Geometrical definition of the problem.
205+ * \param[in] config - Definition of the particular problem.
206+ */
207+ void Compute_OFRefGeom (CGeometry *geometry, const CConfig *config);
208+
209+ /* !
210+ * \brief Compute the objective function for a reference node
211+ * \param[in] geometry - Geometrical definition of the problem.
212+ * \param[in] config - Definition of the particular problem.
213+ */
214+ void Compute_OFRefNode (CGeometry *geometry, const CConfig *config);
215+
216+ /* !
217+ * \brief Compute the objective function for a volume fraction
218+ * \param[in] geometry - Geometrical definition of the problem.
219+ * \param[in] config - Definition of the particular problem.
220+ */
221+ void Compute_OFVolFrac (CGeometry *geometry, const CConfig *config);
222+
223+ /* !
224+ * \brief Compute the compliance objective function
225+ * \param[in] geometry - Geometrical definition of the problem.
226+ * \param[in] config - Definition of the particular problem.
227+ */
228+ void Compute_OFCompliance (CGeometry *geometry, const CConfig *config);
229+
201230public:
202231 /* !
203232 * \brief Constructor of the class.
@@ -245,20 +274,6 @@ class CFEASolver : public CSolver {
245274 CConfig *config,
246275 unsigned long TimeIter) override ;
247276
248- /* !
249- * \brief Compute the time step for solving the FEM equations.
250- * \param[in] geometry - Geometrical definition of the problem.
251- * \param[in] solver_container - Container vector with all the solutions.
252- * \param[in] config - Definition of the particular problem.
253- * \param[in] iMesh - Index of the mesh in multigrid computations.
254- * \param[in] Iteration - Index of the current iteration.
255- */
256- inline void SetTime_Step (CGeometry *geometry,
257- CSolver **solver_container,
258- CConfig *config,
259- unsigned short iMesh,
260- unsigned long Iteration) override { }
261-
262277 /* !
263278 * \brief Get the value of the reference coordinate to set on the element structure.
264279 * \param[in] geometry - Geometrical definition of the problem.
@@ -508,15 +523,14 @@ class CFEASolver : public CSolver {
508523 /* !
509524 * \brief Postprocessing.
510525 * \param[in] geometry - Geometrical definition of the problem.
511- * \param[in] solver_container - Container vector with all the solutions.
512526 * \param[in] config - Definition of the particular problem.
513- * \param[in] iMesh - Index of the mesh in multigrid computations.
527+ * \param[in] numerics - Implementation of numerical method.
528+ * \param[in] of_comp_mode - Mode to compute just the objective function.
514529 */
515- void Postprocessing (CGeometry *geometry,
516- CSolver **solver_container,
517- CConfig *config,
518- CNumerics **numerics,
519- unsigned short iMesh) final ;
530+ inline void Postprocessing (CGeometry *geometry,
531+ CConfig *config,
532+ CNumerics **numerics,
533+ bool of_comp_mode) final ;
520534
521535 /* !
522536 * \brief Routine to solve the Jacobian-Residual linearized system.
@@ -565,6 +579,36 @@ class CFEASolver : public CSolver {
565579 */
566580 inline su2double GetTotal_OFCompliance (void ) const final { return Total_OFCompliance; }
567581
582+ /* !
583+ * \brief Compute the objective function.
584+ * \param[in] config - Definition of the problem.
585+ */
586+ inline void Evaluate_ObjFunc (const CConfig *config) final {
587+ ObjFunc = 0.0 ;
588+ switch (config->GetKind_ObjFunc ()) {
589+ case REFERENCE_GEOMETRY:
590+ ObjFunc = GetTotal_OFRefGeom ();
591+ break ;
592+ case REFERENCE_NODE:
593+ ObjFunc = GetTotal_OFRefNode ();
594+ break ;
595+ case TOPOL_COMPLIANCE:
596+ ObjFunc = GetTotal_OFCompliance ();
597+ break ;
598+ case VOLUME_FRACTION:
599+ ObjFunc = GetTotal_OFVolFrac ();
600+ break ;
601+ case TOPOL_DISCRETENESS:
602+ ObjFunc = GetTotal_OFDiscreteness ();
603+ break ;
604+ }
605+ }
606+
607+ /* !
608+ * \brief Provide the total "combo" objective (weighted sum of other values).
609+ */
610+ inline su2double GetTotal_ComboObj () const final { return ObjFunc; }
611+
568612 /* !
569613 * \brief Determines whether there is an element-based file or not.
570614 * \return Bool that defines whether the solution has an element-based file or not
@@ -652,43 +696,13 @@ class CFEASolver : public CSolver {
652696 */
653697 void SetAitken_Relaxation (CGeometry *geometry, CConfig *config) final ;
654698
655- /* !
656- * \brief Compute the objective function for a reference geometry
657- * \param[in] geometry - Geometrical definition of the problem.
658- * \param[in] config - Definition of the particular problem.
659- */
660- void Compute_OFRefGeom (CGeometry *geometry, const CConfig *config) final ;
661-
662- /* !
663- * \brief Compute the objective function for a reference node
664- * \param[in] geometry - Geometrical definition of the problem.
665- * \param[in] config - Definition of the particular problem.
666- */
667- void Compute_OFRefNode (CGeometry *geometry, const CConfig *config) final ;
668-
669- /* !
670- * \brief Compute the objective function for a volume fraction
671- * \param[in] geometry - Geometrical definition of the problem.
672- * \param[in] config - Definition of the particular problem.
673- */
674- void Compute_OFVolFrac (CGeometry *geometry, const CConfig *config) final ;
675-
676- /* !
677- * \brief Compute the compliance objective function
678- * \param[in] geometry - Geometrical definition of the problem.
679- * \param[in] config - Definition of the particular problem.
680- */
681- void Compute_OFCompliance (CGeometry *geometry, const CConfig *config) final ;
682-
683699 /* !
684700 * \brief Compute the penalty due to the stiffness increase
685701 * \param[in] geometry - Geometrical definition of the problem.
686- * \param[in] solver_container - Container vector with all the solutions.
687702 * \param[in] numerics - Description of the numerical method.
688703 * \param[in] config - Definition of the particular problem.
689704 */
690705 void Stiffness_Penalty (CGeometry *geometry,
691- CSolver **solver_container,
692706 CNumerics **numerics_container,
693707 CConfig *config);
694708
0 commit comments