@@ -434,6 +434,20 @@ class CConfig {
434434 Max_DeltaTime, /* !< \brief Max delta time. */
435435 Unst_CFL; /* !< \brief Unsteady CFL number. */
436436
437+ /* Gradient smoothing options */
438+ su2double SmoothingEps1; /* !< \brief Parameter for the identity part in gradient smoothing. */
439+ su2double SmoothingEps2; /* !< \brief Parameter for the Laplace part in gradient smoothing. */
440+ bool SmoothGradient; /* !< \brief Flag for enabling gradient smoothing. */
441+ bool SmoothSepDim; /* !< \brief Flag for enabling separated calculation for every dimension. */
442+ bool SmoothOnSurface; /* !< \brief Flag for assembling the system only on the surface. */
443+ bool SmoothDirichletSurfaceBound; /* !< \brief Flag for using zero Dirichlet boundary in the surface case. */
444+ ENUM_SOBOLEV_MODUS SmoothNumMode; /* !< \brief The mode in which the Sobolev smoothing solver is applied. */
445+
446+ unsigned short Kind_Grad_Linear_Solver, /* !< Numerical method to smooth the gradient */
447+ Kind_Grad_Linear_Solver_Prec; /* !< \brief Preconditioner of the linear solver. */
448+ su2double Grad_Linear_Solver_Error; /* !< \brief Min error of the linear solver for the gradient smoothing. */
449+ unsigned long Grad_Linear_Solver_Iter; /* !< \brief Max iterations of the linear solver for the gradient smoothing. */
450+
437451 bool ReorientElements; /* !< \brief Flag for enabling element reorientation. */
438452 string CustomObjFunc; /* !< \brief User-defined objective function. */
439453 unsigned short nDV, /* !< \brief Number of design variables. */
@@ -676,7 +690,8 @@ class CConfig {
676690 nMarker_Moving, /* !< \brief Number of markers in motion (DEFORMING, MOVING_WALL). */
677691 nMarker_PyCustom, /* !< \brief Number of markers that are customizable in Python. */
678692 nMarker_DV, /* !< \brief Number of markers affected by the design variables. */
679- nMarker_WallFunctions; /* !< \brief Number of markers for which wall functions must be applied. */
693+ nMarker_WallFunctions, /* !< \brief Number of markers for which wall functions must be applied. */
694+ nMarker_SobolevBC; /* !< \brief Number of markers treaded in the gradient problem. */
680695 string *Marker_Monitoring, /* !< \brief Markers to monitor. */
681696 *Marker_Designing, /* !< \brief Markers to design. */
682697 *Marker_GeoEval, /* !< \brief Markers to evaluate geometry. */
@@ -686,7 +701,8 @@ class CConfig {
686701 *Marker_Moving, /* !< \brief Markers in motion (DEFORMING, MOVING_WALL). */
687702 *Marker_PyCustom, /* !< \brief Markers that are customizable in Python. */
688703 *Marker_DV, /* !< \brief Markers affected by the design variables. */
689- *Marker_WallFunctions; /* !< \brief Markers for which wall functions must be applied. */
704+ *Marker_WallFunctions, /* !< \brief Markers for which wall functions must be applied. */
705+ *Marker_SobolevBC; /* !< \brief Markers in the gradient solver */
690706
691707 unsigned short nConfig_Files; /* !< \brief Number of config files for multiphysics problems. */
692708 string *Config_Filenames; /* !< \brief List of names for configuration files. */
@@ -708,6 +724,7 @@ class CConfig {
708724 *Marker_All_Fluid_Load, /* !< \brief Global index for markers in which the flow load is computed/employed. */
709725 *Marker_All_PyCustom, /* !< \brief Global index for Python customizable surfaces using the grid information. */
710726 *Marker_All_Designing, /* !< \brief Global index for moving using the grid information. */
727+ *Marker_All_SobolevBC, /* !< \brief Global index for boundary condition applied to gradient smoothing. */
711728 *Marker_CfgFile_Monitoring, /* !< \brief Global index for monitoring using the config information. */
712729 *Marker_CfgFile_Designing, /* !< \brief Global index for monitoring using the config information. */
713730 *Marker_CfgFile_GeoEval, /* !< \brief Global index for monitoring using the config information. */
@@ -723,7 +740,8 @@ class CConfig {
723740 *Marker_CfgFile_Fluid_Load, /* !< \brief Global index for markers in which the flow load is computed/employed. */
724741 *Marker_CfgFile_PyCustom, /* !< \brief Global index for Python customizable surfaces using the config information. */
725742 *Marker_CfgFile_DV, /* !< \brief Global index for design variable markers using the config information. */
726- *Marker_CfgFile_PerBound; /* !< \brief Global index for periodic boundaries using the config information. */
743+ *Marker_CfgFile_PerBound, /* !< \brief Global index for periodic boundaries using the config information. */
744+ *Marker_CfgFile_SobolevBC; /* !< \brief Global index for boundary condition applied to gradient smoothing using the config information. */
727745 string *PlaneTag; /* !< \brief Global index for the plane adaptation (upper, lower). */
728746 su2double *nBlades; /* !< \brief number of blades for turbomachinery computation. */
729747 unsigned short Geo_Description; /* !< \brief Description of the geometry. */
@@ -767,7 +785,8 @@ class CConfig {
767785 SurfCoeff_FileName, /* !< \brief Output file with the flow variables on the surface. */
768786 SurfAdjCoeff_FileName, /* !< \brief Output file with the adjoint variables on the surface. */
769787 SurfSens_FileName, /* !< \brief Output file for the sensitivity on the surface (discrete adjoint). */
770- VolSens_FileName; /* !< \brief Output file for the sensitivity in the volume (discrete adjoint). */
788+ VolSens_FileName, /* !< \brief Output file for the sensitivity in the volume (discrete adjoint). */
789+ ObjFunc_Hess_FileName; /* !< \brief Hessian approximation obtained by the Sobolev smoothing solver. */
771790
772791 bool
773792 Wrt_Performance, /* !< \brief Write the performance summary at the end of a calculation. */
@@ -2787,6 +2806,18 @@ class CConfig {
27872806 */
27882807 unsigned short GetnDV_Value (unsigned short iDV) const { return nDV_Value[iDV]; }
27892808
2809+ /* !
2810+ * \brief Get the total number of design variables.
2811+ */
2812+ unsigned short GetnDV_Total (void ) const {
2813+ if (!nDV_Value) return 0 ;
2814+ unsigned short sum = 0 ;
2815+ for (unsigned short iDV = 0 ; iDV < nDV; iDV++) {
2816+ sum += nDV_Value[iDV];
2817+ }
2818+ return sum;
2819+ }
2820+
27902821 /* !
27912822 * \brief Get the number of FFD boxes.
27922823 * \return Number of FFD boxes.
@@ -2967,6 +2998,12 @@ class CConfig {
29672998 */
29682999 unsigned short GetnMarker_Moving (void ) const { return nMarker_Moving; }
29693000
3001+ /* !
3002+ * \brief Get the total number of markers for gradient treatment.
3003+ * \return Total number of markers for gradient treatment.
3004+ */
3005+ unsigned short GetnMarker_SobolevBC (void ) const { return nMarker_SobolevBC; }
3006+
29703007 /* !
29713008 * \brief Get the total number of Python customizable markers.
29723009 * \return Total number of Python customizable markers.
@@ -3329,6 +3366,13 @@ class CConfig {
33293366 */
33303367 void SetMarker_All_Moving (unsigned short val_marker, unsigned short val_moving) { Marker_All_Moving[val_marker] = val_moving; }
33313368
3369+ /* !
3370+ * \brief Set if a marker how <i>val_marker</i> is going to be applied in gradient treatment.
3371+ * \param[in] val_marker - Index of the marker in which we are interested.
3372+ * \param[in] val_sobolev - 0 or 1 depending if the marker is selected.
3373+ */
3374+ void SetMarker_All_SobolevBC (unsigned short val_marker, unsigned short val_sobolev) { Marker_All_SobolevBC[val_marker] = val_sobolev; }
3375+
33323376 /* !
33333377 * \brief Set if a marker <i>val_marker</i> allows deformation at the boundary.
33343378 * \param[in] val_marker - Index of the marker in which we are interested.
@@ -3473,6 +3517,13 @@ class CConfig {
34733517 */
34743518 unsigned short GetMarker_All_Moving (unsigned short val_marker) const { return Marker_All_Moving[val_marker]; }
34753519
3520+ /* !
3521+ * \brief Get the information if gradient treatment uses a marker <i>val_marker</i>.
3522+ * \param[in] val_marker
3523+ * \return 0 or 1 depending if the marker is going to be selected.
3524+ */
3525+ unsigned short GetMarker_All_SobolevBC (unsigned short val_marker) const { return Marker_All_SobolevBC[val_marker]; }
3526+
34763527 /* !
34773528 * \brief Get whether marker <i>val_marker</i> is a DEFORM_MESH marker
34783529 * \param[in] val_marker - 0 or 1 depending if the the marker belongs to the DEFORM_MESH subset.
@@ -4007,18 +4058,6 @@ class CConfig {
40074058 */
40084059 unsigned short GetKind_Deform_Linear_Solver (void ) const { return Kind_Deform_Linear_Solver; }
40094060
4010- /* !
4011- * \brief Set the kind of preconditioner for the implicit solver.
4012- * \return Numerical preconditioner for implicit formulation (solving the linear system).
4013- */
4014- void SetKind_Deform_Linear_Solver_Prec (unsigned short val_kind_prec) { Kind_Deform_Linear_Solver_Prec = val_kind_prec; }
4015-
4016- /* !
4017- * \brief Set the kind of preconditioner for the implicit solver.
4018- * \return Numerical preconditioner for implicit formulation (solving the linear system).
4019- */
4020- void SetKind_Linear_Solver_Prec (unsigned short val_kind_prec) { Kind_Linear_Solver_Prec = val_kind_prec; }
4021-
40224061 /* !
40234062 * \brief Get min error of the linear solver for the implicit formulation.
40244063 * \return Min error of the linear solver for the implicit formulation.
@@ -6131,6 +6170,12 @@ class CConfig {
61316170 */
61326171 unsigned short GetMarker_CfgFile_Moving (string val_marker) const ;
61336172
6173+ /* !
6174+ * \brief Get the gradient boundary information from the config definition for the marker <i>val_marker</i>.
6175+ * \return Gradient boundary information of the boundary in the config information for the marker <i>val_marker</i>.
6176+ */
6177+ unsigned short GetMarker_CfgFile_SobolevBC (string val_marker) const ;
6178+
61346179 /* !
61356180 * \brief Get the DEFORM_MESH information from the config definition for the marker <i>val_marker</i>.
61366181 * \return DEFORM_MESH information of the boundary in the config information for the marker <i>val_marker</i>.
@@ -6470,6 +6515,12 @@ class CConfig {
64706515 */
64716516 unsigned short GetMarker_Fluid_Load (string val_marker) const ;
64726517
6518+ /* !
6519+ * \brief Get the internal index for a gradient boundary condition <i>val_marker</i>.
6520+ * \return Internal index for a gradient boundary condition <i>val_marker</i>.
6521+ */
6522+ unsigned short GetMarker_SobolevBC (string val_marker) const ;
6523+
64736524 /* !
64746525 * \brief Get the name of the surface defined in the geometry file.
64756526 * \param[in] val_marker - Value of the marker in which we are interested.
@@ -9513,4 +9564,77 @@ class CConfig {
95139564 * \return Save frequency for unsteady time steps.
95149565 */
95159566 unsigned short GetRom_SaveFreq (void ) const { return rom_save_freq; }
9567+
9568+ /* !
9569+ * \brief Check if the gradient smoothing is active
9570+ * \return true means that smoothing is applied to the sensitivities
9571+ */
9572+ bool GetSmoothGradient (void ) const {return SmoothGradient; }
9573+
9574+ /* !
9575+ * \brief Gets the factor epsilon in front of the Laplace term
9576+ * \return epsilon
9577+ */
9578+ su2double GetSmoothingEps1 (void ) const { return SmoothingEps1; }
9579+
9580+ /* !
9581+ * \brief Gets the factor zeta in front of the identity term
9582+ * \return zeta
9583+ */
9584+ su2double GetSmoothingEps2 (void ) const { return SmoothingEps2; }
9585+
9586+ /* !
9587+ * \brief Check if we split in the dimensions
9588+ * \return true means that smoothing is for each dimension separate
9589+ */
9590+ bool GetSmoothSepDim (void ) const { return SmoothSepDim; }
9591+
9592+ /* !
9593+ * \brief Check if we assemble the operator on the surface
9594+ * \return true means that smoothing is done on the surface level
9595+ */
9596+ bool GetSmoothOnSurface (void ) const { return SmoothOnSurface; }
9597+
9598+ /* !
9599+ * \brief Check if we use zero Dirichlet boundarys on the bound of the surface
9600+ * \return true means that we use zero Dirichlet boundary
9601+ */
9602+ bool GetDirichletSurfaceBound (void ) const { return SmoothDirichletSurfaceBound; }
9603+
9604+ /* !
9605+ * \brief The modus of operation for the Sobolev solver
9606+ * \return returns on what level we operate
9607+ */
9608+ ENUM_SOBOLEV_MODUS GetSobMode (void ) const { return SmoothNumMode; }
9609+
9610+ /* !
9611+ * \brief Get the name of the file with the hessian of the objective function.
9612+ * \return Name of the file with the hessian of the objective function.
9613+ */
9614+ string GetObjFunc_Hess_FileName (void ) const { return ObjFunc_Hess_FileName; }
9615+
9616+ /* !
9617+ * \brief Get min error of the linear solver for the gradient smoothing.
9618+ * \return Min error of the linear solver for the gradient smoothing.
9619+ */
9620+ su2double GetGrad_Linear_Solver_Error (void ) const { return Grad_Linear_Solver_Error; }
9621+
9622+ /* !
9623+ * \brief Get the kind of solver for the gradient smoothing.
9624+ * \return Numerical solver for the gradient smoothing.
9625+ */
9626+ unsigned short GetKind_Grad_Linear_Solver (void ) const { return Kind_Grad_Linear_Solver; }
9627+
9628+ /* !
9629+ * \brief Get the kind of preconditioner for the gradient smoothing.
9630+ * \return Numerical preconditioner for the gradient smoothing.
9631+ */
9632+ unsigned short GetKind_Grad_Linear_Solver_Prec (void ) const { return Kind_Grad_Linear_Solver_Prec; }
9633+
9634+ /* !
9635+ * \brief Get max number of iterations of the for the gradient smoothing.
9636+ * \return Max number of iterations of the linear solver for the gradient smoothing.
9637+ */
9638+ unsigned long GetGrad_Linear_Solver_Iter (void ) const { return Grad_Linear_Solver_Iter; }
9639+
95169640};
0 commit comments