Skip to content

Commit

Permalink
changed limiter to enum class to fix adjoint species bug (#1550)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
bigfooted authored Mar 15, 2022
1 parent 4783959 commit a288828
Show file tree
Hide file tree
Showing 29 changed files with 237 additions and 340 deletions.
26 changes: 13 additions & 13 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,12 @@ class CConfig {
DIFFUSIVITYMODEL Kind_Diffusivity_Model; /*!< \brief Kind of the mass diffusivity Model */
FREESTREAM_OPTION Kind_FreeStreamOption; /*!< \brief Kind of free stream option to choose if initializing with density or temperature */
MAIN_SOLVER Kind_Solver; /*!< \brief Kind of solver: Euler, NS, Continuous adjoint, etc. */
LIMITER Kind_SlopeLimit, /*!< \brief Global slope limiter. */
Kind_SlopeLimit_Flow, /*!< \brief Slope limiter for flow equations.*/
Kind_SlopeLimit_Turb, /*!< \brief Slope limiter for the turbulence equation.*/
Kind_SlopeLimit_AdjTurb, /*!< \brief Slope limiter for the adjoint turbulent equation.*/
Kind_SlopeLimit_AdjFlow, /*!< \brief Slope limiter for the adjoint equation.*/
Kind_SlopeLimit_Species; /*!< \brief Slope limiter for the species equation.*/
unsigned short Kind_FluidModel, /*!< \brief Kind of the Fluid Model: Ideal, van der Waals, etc. */
Kind_InitOption, /*!< \brief Kind of Init option to choose if initializing with Reynolds number or with thermodynamic conditions */
Kind_GridMovement, /*!< \brief Kind of the static mesh movement. */
Expand All @@ -504,12 +510,6 @@ class CConfig {
Kind_AdjTurb_Linear_Prec, /*!< \brief Preconditioner of the turbulent adjoint linear solver. */
Kind_DiscAdj_Linear_Solver, /*!< \brief Linear solver for the discrete adjoint system. */
Kind_DiscAdj_Linear_Prec, /*!< \brief Preconditioner of the discrete adjoint linear solver. */
Kind_SlopeLimit, /*!< \brief Global slope limiter. */
Kind_SlopeLimit_Flow, /*!< \brief Slope limiter for flow equations.*/
Kind_SlopeLimit_Turb, /*!< \brief Slope limiter for the turbulence equation.*/
Kind_SlopeLimit_AdjTurb, /*!< \brief Slope limiter for the adjoint turbulent equation.*/
Kind_SlopeLimit_AdjFlow, /*!< \brief Slope limiter for the adjoint equation.*/
Kind_SlopeLimit_Species, /*!< \brief Slope limiter for the species equation.*/
Kind_TimeNumScheme, /*!< \brief Global explicit or implicit time integration. */
Kind_TimeIntScheme_Flow, /*!< \brief Time integration for the flow equations. */
Kind_TimeIntScheme_FEM_Flow, /*!< \brief Time integration for the flow equations. */
Expand Down Expand Up @@ -2295,7 +2295,7 @@ class CConfig {
* \param[in] val_kind_fem - If FEM, what kind of FEM discretization.
*/
void SetKind_ConvNumScheme(unsigned short val_kind_convnumscheme, unsigned short val_kind_centered,
unsigned short val_kind_upwind, unsigned short val_kind_slopelimit,
unsigned short val_kind_upwind, LIMITER val_kind_slopelimit,
bool val_muscl, unsigned short val_kind_fem);

/*!
Expand Down Expand Up @@ -4564,37 +4564,37 @@ class CConfig {
* \brief Get the method for limiting the spatial gradients.
* \return Method for limiting the spatial gradients.
*/
unsigned short GetKind_SlopeLimit(void) const { return Kind_SlopeLimit; }
LIMITER GetKind_SlopeLimit(void) const { return Kind_SlopeLimit; }

/*!
* \brief Get the method for limiting the spatial gradients.
* \return Method for limiting the spatial gradients solving the flow equations.
*/
unsigned short GetKind_SlopeLimit_Flow(void) const { return Kind_SlopeLimit_Flow; }
LIMITER GetKind_SlopeLimit_Flow(void) const { return Kind_SlopeLimit_Flow; }

/*!
* \brief Get the method for limiting the spatial gradients.
* \return Method for limiting the spatial gradients solving the turbulent equation.
*/
unsigned short GetKind_SlopeLimit_Turb(void) const { return Kind_SlopeLimit_Turb; }
LIMITER GetKind_SlopeLimit_Turb(void) const { return Kind_SlopeLimit_Turb; }

/*!
* \brief Get the method for limiting the spatial gradients.
* \return Method for limiting the spatial gradients solving the species equation.
*/
unsigned short GetKind_SlopeLimit_Species() const { return Kind_SlopeLimit_Species; }
LIMITER GetKind_SlopeLimit_Species() const { return Kind_SlopeLimit_Species; }

/*!
* \brief Get the method for limiting the spatial gradients.
* \return Method for limiting the spatial gradients solving the adjoint turbulent equation.
*/
unsigned short GetKind_SlopeLimit_AdjTurb(void) const { return Kind_SlopeLimit_AdjTurb; }
LIMITER GetKind_SlopeLimit_AdjTurb(void) const { return Kind_SlopeLimit_AdjTurb; }

/*!
* \brief Get the method for limiting the spatial gradients.
* \return Method for limiting the spatial gradients solving the adjoint flow equation.
*/
unsigned short GetKind_SlopeLimit_AdjFlow(void) const { return Kind_SlopeLimit_AdjFlow; }
LIMITER GetKind_SlopeLimit_AdjFlow(void) const { return Kind_SlopeLimit_AdjFlow; }

/*!
* \brief Value of the calibrated constant for the Lax method (center scheme).
Expand Down
2 changes: 1 addition & 1 deletion Common/include/basic_types/ad_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ namespace AD{
}
}
}

FORCEINLINE void delete_handler(void *handler) {
CheckpointHandler *checkpoint = static_cast<CheckpointHandler*>(handler);
checkpoint->clear();
Expand Down
34 changes: 17 additions & 17 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,23 +887,23 @@ static const MapType<std::string, ENUM_MATRIX_COLORING> MatrixColoring_Map = {
/*!
* \brief Types of slope limiters
*/
enum ENUM_LIMITER {
NO_LIMITER = 0, /*!< \brief No limiter. */
VENKATAKRISHNAN = 1, /*!< \brief Slope limiter using Venkatakrisnan method (stencil formulation). */
VENKATAKRISHNAN_WANG = 2, /*!< \brief Slope limiter using Venkatakrisnan method, eps based on solution (stencil formulation). */
BARTH_JESPERSEN = 3, /*!< \brief Slope limiter using Barth-Jespersen method (stencil formulation). */
VAN_ALBADA_EDGE = 4, /*!< \brief Slope limiter using Van Albada method (edge formulation). */
SHARP_EDGES = 5, /*!< \brief Slope limiter using sharp edges. */
WALL_DISTANCE = 6 /*!< \brief Slope limiter using wall distance. */
};
static const MapType<std::string, ENUM_LIMITER> Limiter_Map = {
MakePair("NONE", NO_LIMITER)
MakePair("VENKATAKRISHNAN", VENKATAKRISHNAN)
MakePair("VENKATAKRISHNAN_WANG", VENKATAKRISHNAN_WANG)
MakePair("BARTH_JESPERSEN", BARTH_JESPERSEN)
MakePair("VAN_ALBADA_EDGE", VAN_ALBADA_EDGE)
MakePair("SHARP_EDGES", SHARP_EDGES)
MakePair("WALL_DISTANCE", WALL_DISTANCE)
enum class LIMITER {
NONE , /*!< \brief No limiter. */
VENKATAKRISHNAN , /*!< \brief Slope limiter using Venkatakrisnan method (stencil formulation). */
VENKATAKRISHNAN_WANG , /*!< \brief Slope limiter using Venkatakrisnan method, eps based on solution (stencil formulation). */
BARTH_JESPERSEN , /*!< \brief Slope limiter using Barth-Jespersen method (stencil formulation). */
VAN_ALBADA_EDGE , /*!< \brief Slope limiter using Van Albada method (edge formulation). */
SHARP_EDGES , /*!< \brief Slope limiter using sharp edges. */
WALL_DISTANCE /*!< \brief Slope limiter using wall distance. */
};
static const MapType<std::string, LIMITER> Limiter_Map = {
MakePair("NONE", LIMITER::NONE)
MakePair("VENKATAKRISHNAN", LIMITER::VENKATAKRISHNAN)
MakePair("VENKATAKRISHNAN_WANG", LIMITER::VENKATAKRISHNAN_WANG)
MakePair("BARTH_JESPERSEN", LIMITER::BARTH_JESPERSEN)
MakePair("VAN_ALBADA_EDGE", LIMITER::VAN_ALBADA_EDGE)
MakePair("SHARP_EDGES", LIMITER::SHARP_EDGES)
MakePair("WALL_DISTANCE", LIMITER::WALL_DISTANCE)
};

/*!
Expand Down
Loading

0 comments on commit a288828

Please sign in to comment.