Skip to content

Commit a288828

Browse files
bigfootedTobiKattmannpcarruscag
authored
changed limiter to enum class to fix adjoint species bug (#1550)
* changed limiter to enum class * changed ENUM_LIMITER to LIMITER. also changed implementation of turbulence boundary conditions: limiting the implementation of uniform inlet bc to the actual inlets * fix use of SetGlobalParam for species in fluid iteration Co-authored-by: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com> Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
1 parent 4783959 commit a288828

29 files changed

Lines changed: 237 additions & 340 deletions

Common/include/CConfig.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,12 @@ class CConfig {
489489
DIFFUSIVITYMODEL Kind_Diffusivity_Model; /*!< \brief Kind of the mass diffusivity Model */
490490
FREESTREAM_OPTION Kind_FreeStreamOption; /*!< \brief Kind of free stream option to choose if initializing with density or temperature */
491491
MAIN_SOLVER Kind_Solver; /*!< \brief Kind of solver: Euler, NS, Continuous adjoint, etc. */
492+
LIMITER Kind_SlopeLimit, /*!< \brief Global slope limiter. */
493+
Kind_SlopeLimit_Flow, /*!< \brief Slope limiter for flow equations.*/
494+
Kind_SlopeLimit_Turb, /*!< \brief Slope limiter for the turbulence equation.*/
495+
Kind_SlopeLimit_AdjTurb, /*!< \brief Slope limiter for the adjoint turbulent equation.*/
496+
Kind_SlopeLimit_AdjFlow, /*!< \brief Slope limiter for the adjoint equation.*/
497+
Kind_SlopeLimit_Species; /*!< \brief Slope limiter for the species equation.*/
492498
unsigned short Kind_FluidModel, /*!< \brief Kind of the Fluid Model: Ideal, van der Waals, etc. */
493499
Kind_InitOption, /*!< \brief Kind of Init option to choose if initializing with Reynolds number or with thermodynamic conditions */
494500
Kind_GridMovement, /*!< \brief Kind of the static mesh movement. */
@@ -504,12 +510,6 @@ class CConfig {
504510
Kind_AdjTurb_Linear_Prec, /*!< \brief Preconditioner of the turbulent adjoint linear solver. */
505511
Kind_DiscAdj_Linear_Solver, /*!< \brief Linear solver for the discrete adjoint system. */
506512
Kind_DiscAdj_Linear_Prec, /*!< \brief Preconditioner of the discrete adjoint linear solver. */
507-
Kind_SlopeLimit, /*!< \brief Global slope limiter. */
508-
Kind_SlopeLimit_Flow, /*!< \brief Slope limiter for flow equations.*/
509-
Kind_SlopeLimit_Turb, /*!< \brief Slope limiter for the turbulence equation.*/
510-
Kind_SlopeLimit_AdjTurb, /*!< \brief Slope limiter for the adjoint turbulent equation.*/
511-
Kind_SlopeLimit_AdjFlow, /*!< \brief Slope limiter for the adjoint equation.*/
512-
Kind_SlopeLimit_Species, /*!< \brief Slope limiter for the species equation.*/
513513
Kind_TimeNumScheme, /*!< \brief Global explicit or implicit time integration. */
514514
Kind_TimeIntScheme_Flow, /*!< \brief Time integration for the flow equations. */
515515
Kind_TimeIntScheme_FEM_Flow, /*!< \brief Time integration for the flow equations. */
@@ -2295,7 +2295,7 @@ class CConfig {
22952295
* \param[in] val_kind_fem - If FEM, what kind of FEM discretization.
22962296
*/
22972297
void SetKind_ConvNumScheme(unsigned short val_kind_convnumscheme, unsigned short val_kind_centered,
2298-
unsigned short val_kind_upwind, unsigned short val_kind_slopelimit,
2298+
unsigned short val_kind_upwind, LIMITER val_kind_slopelimit,
22992299
bool val_muscl, unsigned short val_kind_fem);
23002300

23012301
/*!
@@ -4564,37 +4564,37 @@ class CConfig {
45644564
* \brief Get the method for limiting the spatial gradients.
45654565
* \return Method for limiting the spatial gradients.
45664566
*/
4567-
unsigned short GetKind_SlopeLimit(void) const { return Kind_SlopeLimit; }
4567+
LIMITER GetKind_SlopeLimit(void) const { return Kind_SlopeLimit; }
45684568

45694569
/*!
45704570
* \brief Get the method for limiting the spatial gradients.
45714571
* \return Method for limiting the spatial gradients solving the flow equations.
45724572
*/
4573-
unsigned short GetKind_SlopeLimit_Flow(void) const { return Kind_SlopeLimit_Flow; }
4573+
LIMITER GetKind_SlopeLimit_Flow(void) const { return Kind_SlopeLimit_Flow; }
45744574

45754575
/*!
45764576
* \brief Get the method for limiting the spatial gradients.
45774577
* \return Method for limiting the spatial gradients solving the turbulent equation.
45784578
*/
4579-
unsigned short GetKind_SlopeLimit_Turb(void) const { return Kind_SlopeLimit_Turb; }
4579+
LIMITER GetKind_SlopeLimit_Turb(void) const { return Kind_SlopeLimit_Turb; }
45804580

45814581
/*!
45824582
* \brief Get the method for limiting the spatial gradients.
45834583
* \return Method for limiting the spatial gradients solving the species equation.
45844584
*/
4585-
unsigned short GetKind_SlopeLimit_Species() const { return Kind_SlopeLimit_Species; }
4585+
LIMITER GetKind_SlopeLimit_Species() const { return Kind_SlopeLimit_Species; }
45864586

45874587
/*!
45884588
* \brief Get the method for limiting the spatial gradients.
45894589
* \return Method for limiting the spatial gradients solving the adjoint turbulent equation.
45904590
*/
4591-
unsigned short GetKind_SlopeLimit_AdjTurb(void) const { return Kind_SlopeLimit_AdjTurb; }
4591+
LIMITER GetKind_SlopeLimit_AdjTurb(void) const { return Kind_SlopeLimit_AdjTurb; }
45924592

45934593
/*!
45944594
* \brief Get the method for limiting the spatial gradients.
45954595
* \return Method for limiting the spatial gradients solving the adjoint flow equation.
45964596
*/
4597-
unsigned short GetKind_SlopeLimit_AdjFlow(void) const { return Kind_SlopeLimit_AdjFlow; }
4597+
LIMITER GetKind_SlopeLimit_AdjFlow(void) const { return Kind_SlopeLimit_AdjFlow; }
45984598

45994599
/*!
46004600
* \brief Value of the calibrated constant for the Lax method (center scheme).

Common/include/basic_types/ad_structure.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ namespace AD{
538538
}
539539
}
540540
}
541-
541+
542542
FORCEINLINE void delete_handler(void *handler) {
543543
CheckpointHandler *checkpoint = static_cast<CheckpointHandler*>(handler);
544544
checkpoint->clear();

Common/include/option_structure.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -887,23 +887,23 @@ static const MapType<std::string, ENUM_MATRIX_COLORING> MatrixColoring_Map = {
887887
/*!
888888
* \brief Types of slope limiters
889889
*/
890-
enum ENUM_LIMITER {
891-
NO_LIMITER = 0, /*!< \brief No limiter. */
892-
VENKATAKRISHNAN = 1, /*!< \brief Slope limiter using Venkatakrisnan method (stencil formulation). */
893-
VENKATAKRISHNAN_WANG = 2, /*!< \brief Slope limiter using Venkatakrisnan method, eps based on solution (stencil formulation). */
894-
BARTH_JESPERSEN = 3, /*!< \brief Slope limiter using Barth-Jespersen method (stencil formulation). */
895-
VAN_ALBADA_EDGE = 4, /*!< \brief Slope limiter using Van Albada method (edge formulation). */
896-
SHARP_EDGES = 5, /*!< \brief Slope limiter using sharp edges. */
897-
WALL_DISTANCE = 6 /*!< \brief Slope limiter using wall distance. */
898-
};
899-
static const MapType<std::string, ENUM_LIMITER> Limiter_Map = {
900-
MakePair("NONE", NO_LIMITER)
901-
MakePair("VENKATAKRISHNAN", VENKATAKRISHNAN)
902-
MakePair("VENKATAKRISHNAN_WANG", VENKATAKRISHNAN_WANG)
903-
MakePair("BARTH_JESPERSEN", BARTH_JESPERSEN)
904-
MakePair("VAN_ALBADA_EDGE", VAN_ALBADA_EDGE)
905-
MakePair("SHARP_EDGES", SHARP_EDGES)
906-
MakePair("WALL_DISTANCE", WALL_DISTANCE)
890+
enum class LIMITER {
891+
NONE , /*!< \brief No limiter. */
892+
VENKATAKRISHNAN , /*!< \brief Slope limiter using Venkatakrisnan method (stencil formulation). */
893+
VENKATAKRISHNAN_WANG , /*!< \brief Slope limiter using Venkatakrisnan method, eps based on solution (stencil formulation). */
894+
BARTH_JESPERSEN , /*!< \brief Slope limiter using Barth-Jespersen method (stencil formulation). */
895+
VAN_ALBADA_EDGE , /*!< \brief Slope limiter using Van Albada method (edge formulation). */
896+
SHARP_EDGES , /*!< \brief Slope limiter using sharp edges. */
897+
WALL_DISTANCE /*!< \brief Slope limiter using wall distance. */
898+
};
899+
static const MapType<std::string, LIMITER> Limiter_Map = {
900+
MakePair("NONE", LIMITER::NONE)
901+
MakePair("VENKATAKRISHNAN", LIMITER::VENKATAKRISHNAN)
902+
MakePair("VENKATAKRISHNAN_WANG", LIMITER::VENKATAKRISHNAN_WANG)
903+
MakePair("BARTH_JESPERSEN", LIMITER::BARTH_JESPERSEN)
904+
MakePair("VAN_ALBADA_EDGE", LIMITER::VAN_ALBADA_EDGE)
905+
MakePair("SHARP_EDGES", LIMITER::SHARP_EDGES)
906+
MakePair("WALL_DISTANCE", LIMITER::WALL_DISTANCE)
907907
};
908908

909909
/*!

0 commit comments

Comments
 (0)