Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
932de5d
Adding RMS_ADJ_Species output and variance OF.
TobiKattmann Dec 2, 2021
aa1c48b
Merge remote-tracking branch 'origin/develop' into feature_species
TobiKattmann Dec 2, 2021
d899875
Add DA species regression test
TobiKattmann Dec 2, 2021
402a690
Introduce MVP CAdjFlowOutput.
TobiKattmann Dec 2, 2021
0f0ed14
Create history adj scalar output
TobiKattmann Dec 3, 2021
35d047b
Create volume adj scalar output
TobiKattmann Dec 3, 2021
f1fbd92
Fix BGS output by wrapping in multizone conditional
TobiKattmann Dec 3, 2021
b9152fb
One more multizone BGS fix
TobiKattmann Dec 3, 2021
c2e652a
Make member vars const by using initializer list.
TobiKattmann Dec 3, 2021
5b3f7d3
turb model family
pcarruscag Dec 4, 2021
6949b66
apply to other places
pcarruscag Dec 4, 2021
4899ed6
Fix bug where species MUSCL and limiter were not working at all.
TobiKattmann Dec 5, 2021
6d1d59b
Add inital value for muscl and limiter to fix builds.
TobiKattmann Dec 5, 2021
3b22e92
Update reg test for MUSCL species testcase after recent fix
TobiKattmann Dec 6, 2021
dea0ae4
Move certain Species testcase over to tutorials
TobiKattmann Dec 6, 2021
07b1a8c
Move muscl, limiter and implicit var to scalar class data.
TobiKattmann Dec 6, 2021
f7b8e44
Update links of the tutorial regression tests.
TobiKattmann Dec 6, 2021
31d7a95
Add Avg surf Species_0 OF.
TobiKattmann Dec 6, 2021
54a0c69
Revert implicit class data switch.
TobiKattmann Dec 8, 2021
5fc376e
Use Muscl and limiter from GlobalParams for ScalarSolver
TobiKattmann Dec 8, 2021
04533a5
Additional line break.
TobiKattmann Dec 8, 2021
e93f5c4
Add setGlobalParams in all Preprocessing routines
TobiKattmann Dec 8, 2021
740f19e
Revert unnecessary changes
TobiKattmann Dec 8, 2021
a2cb413
Run update_historyMap.py
TobiKattmann Dec 8, 2021
baa263e
Revert some clang-formatting to please python history parsing.
TobiKattmann Dec 8, 2021
e10bdf9
Better english in comments
TobiKattmann Dec 9, 2021
57a87e5
Remove set globalParam in Preproc from Flow Solvers.
TobiKattmann Dec 9, 2021
fe84c72
Merge remote-tracking branch 'origin/feature_species' into feature_sp…
TobiKattmann Dec 9, 2021
df093ba
Revert indermediate tutorial branch change for reg tests.
TobiKattmann Dec 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ class CConfig {
su2double *Surface_TotalTemperature; /*!< \brief Total temperature at the boundaries. */
su2double *Surface_TotalPressure; /*!< \brief Total pressure at the boundaries. */
su2double *Surface_PressureDrop; /*!< \brief Pressure drop between boundaries. */
su2double* Surface_Species_0; /*!< \brief Average Species_0 at the boundaries. */
su2double* Surface_Species_Variance; /*!< \brief Species Variance at the boundaries. */
su2double *Surface_DC60; /*!< \brief Specified surface DC60 for nacelle boundaries. */
su2double *Surface_IDC; /*!< \brief Specified IDC for nacelle boundaries. */
su2double *Surface_IDC_Mach; /*!< \brief Specified IDC mach for nacelle boundaries. */
Expand Down Expand Up @@ -7580,6 +7582,20 @@ class CConfig {
*/
void SetSurface_PressureDrop(unsigned short val_marker, su2double val_surface_pressuredrop) { Surface_PressureDrop[val_marker] = val_surface_pressuredrop; }

/*!
* \brief Set the average of species_0 at the surface.
* \param[in] val_marker - Index corresponding to boundary.
* \param[in] val_surface_species_0 - Value of avg species_0.
*/
void SetSurface_Species_0(unsigned short val_marker, su2double val_surface_species_0) { Surface_Species_0[val_marker] = val_surface_species_0; }

/*!
* \brief Set the species variance at the surface.
* \param[in] val_marker - Index corresponding to boundary.
* \param[in] val_surface_species_variance - Value of the species variance.
*/
void SetSurface_Species_Variance(unsigned short val_marker, su2double val_surface_species_variance) { Surface_Species_Variance[val_marker] = val_surface_species_variance; }

/*!
* \brief Get the back pressure (static) at an outlet boundary.
* \param[in] val_index - Index corresponding to the outlet boundary.
Expand Down Expand Up @@ -7846,6 +7862,20 @@ class CConfig {
*/
su2double GetSurface_PressureDrop(unsigned short val_marker) const { return Surface_PressureDrop[val_marker]; }

/*!
* \brief Get avg species_0 at a boundary.
* \param[in] val_index - Index corresponding to the boundary.
* \return The avg species_0.
*/
su2double GetSurface_Species_0(unsigned short val_marker) const { return Surface_Species_0[val_marker]; }

/*!
* \brief Get the species variance at a boundary.
* \param[in] val_index - Index corresponding to the boundary.
* \return The species variance.
*/
su2double GetSurface_Species_Variance(unsigned short val_marker) const { return Surface_Species_Variance[val_marker]; }

/*!
* \brief Get the back pressure (static) at an outlet boundary.
* \param[in] val_index - Index corresponding to the outlet boundary.
Expand Down
32 changes: 32 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,34 @@ static const MapType<std::string, TURB_MODEL> Turb_Model_Map = {
MakePair("SST_SUST", TURB_MODEL::SST_SUST)
};

/*!
* \brief Families of turbulence models
*/
enum class TURB_FAMILY {
NONE, /*!< \brief No turbulence model. */
SA, /*!< \brief Spalart-Allmaras variants. */
KW, /*!< \brief k-w models. */
};
/*!
* \brief Associate turb models with their family
*/
inline TURB_FAMILY TurbModelFamily(TURB_MODEL model) {
switch (model) {
case TURB_MODEL::NONE:
return TURB_FAMILY::NONE;
case TURB_MODEL::SA:
case TURB_MODEL::SA_NEG:
case TURB_MODEL::SA_E:
case TURB_MODEL::SA_COMP:
case TURB_MODEL::SA_E_COMP:
return TURB_FAMILY::SA;
case TURB_MODEL::SST:
case TURB_MODEL::SST_SUST:
return TURB_FAMILY::KW;
}
return TURB_FAMILY::NONE;
}

/*!
* \brief Types of transition models
*/
Expand Down Expand Up @@ -1536,6 +1564,8 @@ enum ENUM_OBJECTIVE {
SURFACE_MOM_DISTORTION = 54, /*!< \brief Momentum distortion objective function definition. */
SURFACE_SECOND_OVER_UNIFORM = 55, /*!< \brief Secondary over uniformity (relative secondary strength) objective function definition. */
SURFACE_PRESSURE_DROP = 56, /*!< \brief Pressure drop objective function definition. */
SURFACE_SPECIES_0 = 58, /*!< \brief Surface Avg. Species_0 objective function definition. */
SURFACE_SPECIES_VARIANCE = 59,/*!< \brief Species Variance objective function definition. */
CUSTOM_OBJFUNC = 31, /*!< \brief Custom objective function definition. */
TOTAL_PRESSURE_LOSS = 39,
KINETIC_ENERGY_LOSS = 40,
Expand Down Expand Up @@ -1588,6 +1618,8 @@ static const MapType<std::string, ENUM_OBJECTIVE> Objective_Map = {
MakePair("SURFACE_MOM_DISTORTION", SURFACE_MOM_DISTORTION)
MakePair("SURFACE_SECOND_OVER_UNIFORM", SURFACE_SECOND_OVER_UNIFORM)
MakePair("SURFACE_PRESSURE_DROP", SURFACE_PRESSURE_DROP)
MakePair("SURFACE_SPECIES_0", SURFACE_SPECIES_0)
MakePair("SURFACE_SPECIES_VARIANCE", SURFACE_SPECIES_VARIANCE)
MakePair("CUSTOM_OBJFUNC", CUSTOM_OBJFUNC)
MakePair("TOTAL_EFFICIENCY", TOTAL_EFFICIENCY)
MakePair("TOTAL_STATIC_EFFICIENCY", TOTAL_STATIC_EFFICIENCY)
Expand Down
36 changes: 27 additions & 9 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,8 @@ void CConfig::SetPointersNull(void) {
ActDisk_ReverseMassFlow = nullptr; Surface_MassFlow = nullptr; Surface_Mach = nullptr;
Surface_Temperature = nullptr; Surface_Pressure = nullptr; Surface_Density = nullptr; Surface_Enthalpy = nullptr;
Surface_NormalVelocity = nullptr; Surface_TotalTemperature = nullptr; Surface_TotalPressure = nullptr; Surface_PressureDrop = nullptr;
Surface_DC60 = nullptr; Surface_IDC = nullptr;
Surface_DC60 = nullptr; Surface_IDC = nullptr;
Surface_Species_Variance = nullptr; Surface_Species_0 = nullptr;

Outlet_MassFlow = nullptr; Outlet_Density = nullptr; Outlet_Area = nullptr;

Expand Down Expand Up @@ -3530,14 +3531,17 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
case SURFACE_MOM_DISTORTION:
case SURFACE_SECOND_OVER_UNIFORM:
case SURFACE_PRESSURE_DROP:
case SURFACE_SPECIES_0:
case SURFACE_SPECIES_VARIANCE:
case CUSTOM_OBJFUNC:
if (Kind_ObjFunc[iObj] != Obj_0) {
SU2_MPI::Error(string("The following objectives can only be used for the first surface in a multi-objective \n")+
string("problem or as a single objective applied to multiple monitoring markers:\n")+
string("INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, THRUST_COEFFICIENT, TORQUE_COEFFICIENT\n")+
string("FIGURE_OF_MERIT, SURFACE_TOTAL_PRESSURE, SURFACE_STATIC_PRESSURE, SURFACE_MASSFLOW\n")+
string("SURFACE_UNIFORMITY, SURFACE_SECONDARY, SURFACE_MOM_DISTORTION, SURFACE_SECOND_OVER_UNIFORM\n")+
string("SURFACE_PRESSURE_DROP, SURFACE_STATIC_TEMPERATURE, CUSTOM_OBJFUNC.\n"), CURRENT_FUNCTION);
string("SURFACE_PRESSURE_DROP, SURFACE_STATIC_TEMPERATURE, SURFACE_SPECIES_0\n")+
string("SURFACE_SPECIES_VARIANCE, CUSTOM_OBJFUNC.\n"), CURRENT_FUNCTION);
}
break;
default:
Expand Down Expand Up @@ -5138,13 +5142,12 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
else {monoatomic = false;}

/*--- Set number of Turbulence Variables. ---*/
switch(Kind_Turb_Model) {
case TURB_MODEL::NONE:
switch (TurbModelFamily(Kind_Turb_Model)) {
case TURB_FAMILY::NONE:
nTurbVar = 0; break;
case TURB_MODEL::SA: case TURB_MODEL::SA_COMP: case TURB_MODEL::SA_E_COMP: case TURB_MODEL::SA_E:
case TURB_MODEL::SA_NEG:
case TURB_FAMILY::SA:
nTurbVar = 1; break;
case TURB_MODEL::SST: case TURB_MODEL::SST_SUST:
case TURB_FAMILY::KW:
nTurbVar = 2; break;
}

Expand All @@ -5160,6 +5163,15 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
Kind_Solver != MAIN_SOLVER::DISC_ADJ_RANS)
SU2_MPI::Error("Species transport currently only avaialble for compressible and incompressible flow.", CURRENT_FUNCTION);

/*--- Species specific OF currently can only handle one entry in Marker_Analyze. ---*/
for (unsigned short iObj = 0; iObj < nObj; iObj++) {
if ((Kind_ObjFunc[iObj] == SURFACE_SPECIES_0 ||
Kind_ObjFunc[iObj] == SURFACE_SPECIES_VARIANCE) &&
nMarker_Analyze > 1) {
SU2_MPI::Error("SURFACE_SPECIES_0 and SURFACE_SPECIES_VARIANCE currently can only handle one entry to MARKER_ANALYZE.", CURRENT_FUNCTION);
}
}

// For now, do not allow axisymmetric simulations
if (Axisymmetric) SU2_MPI::Error("Species transport currently not possible with axissymmetric flow.", CURRENT_FUNCTION);

Expand Down Expand Up @@ -5335,6 +5347,8 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) {
Surface_TotalTemperature = new su2double[nMarker_Analyze] ();
Surface_TotalPressure = new su2double[nMarker_Analyze] ();
Surface_PressureDrop = new su2double[nMarker_Analyze] ();
Surface_Species_0 = new su2double[nMarker_Analyze] ();
Surface_Species_Variance = new su2double[nMarker_Analyze] ();
Surface_DC60 = new su2double[nMarker_Analyze] ();
Surface_IDC = new su2double[nMarker_Analyze] ();
Surface_IDC_Mach = new su2double[nMarker_Analyze] ();
Expand Down Expand Up @@ -5862,7 +5876,7 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
break;
case MAIN_SOLVER::MULTIPHYSICS:
cout << "Multiphysics solver" << endl;
break;
break;
default:
SU2_MPI::Error("No valid solver was chosen", CURRENT_FUNCTION);

Expand Down Expand Up @@ -7877,6 +7891,8 @@ CConfig::~CConfig(void) {
delete[] Surface_TotalTemperature;
delete[] Surface_TotalPressure;
delete[] Surface_PressureDrop;
delete[] Surface_Species_0;
delete[] Surface_Species_Variance;
delete[] Surface_DC60;
delete[] Surface_IDC;
delete[] Surface_IDC_Mach;
Expand Down Expand Up @@ -8223,6 +8239,8 @@ string CConfig::GetObjFunc_Extension(string val_filename) const {
case SURFACE_MOM_DISTORTION: AdjExt = "_distort"; break;
case SURFACE_SECOND_OVER_UNIFORM: AdjExt = "_sou"; break;
case SURFACE_PRESSURE_DROP: AdjExt = "_dp"; break;
case SURFACE_SPECIES_0: AdjExt = "_avgspec0"; break;
case SURFACE_SPECIES_VARIANCE: AdjExt = "_specvar"; break;
case SURFACE_MACH: AdjExt = "_mach"; break;
case CUSTOM_OBJFUNC: AdjExt = "_custom"; break;
case KINETIC_ENERGY_LOSS: AdjExt = "_ke"; break;
Expand Down Expand Up @@ -8452,7 +8470,7 @@ void CConfig::SetGlobalParam(MAIN_SOLVER val_solver,
break;

default:
break;
break;
}
}

Expand Down
10 changes: 2 additions & 8 deletions SU2_CFD/include/output/CAdjFlowCompOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,14 @@

#pragma once

#include "COutput.hpp"
#include "CAdjFlowOutput.hpp"

/*! \class CAdjFlowCompOutput
* \brief Output class for compressible flow adjoint problems.
* \author R. Sanchez, T. Albring.
* \date June 5, 2018.
*/
class CAdjFlowCompOutput final: public COutput {
private:

bool cont_adj; /*!< \brief Boolean indicating whether we run a cont. adjoint problem */
bool frozen_visc; /*!< \brief Boolean indicating whether frozen viscosity/turbulence is used. */
TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/

class CAdjFlowCompOutput final: public CAdjFlowOutput {
public:

/*!
Expand Down
7 changes: 2 additions & 5 deletions SU2_CFD/include/output/CAdjFlowIncOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,19 @@

#pragma once

#include "COutput.hpp"
#include "CAdjFlowOutput.hpp"

/*! \class CAdjFlowIncOutput
* \brief Output class for incompressible flow discrete adjoint problems.
* \author R. Sanchez, T. Albring.
* \date June 5, 2018.
*/
class CAdjFlowIncOutput final: public COutput {
class CAdjFlowIncOutput final: public CAdjFlowOutput {
private:

TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/
RADIATION_MODEL rad_model; /*!< \brief The kind of radiation model */
bool heat; /*!< \brief Boolean indicating whether have a heat problem*/
bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/
bool cont_adj; /*!< \brief Boolean indicating whether we run a cont. adjoint problem */
bool frozen_visc; /*!< \brief Boolean indicating whether frozen viscosity/turbulence is used. */

public:

Expand Down
96 changes: 96 additions & 0 deletions SU2_CFD/include/output/CAdjFlowOutput.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*!
* \file CAdjFlowOutput.hpp
* \brief Headers of the adjoint flow output.
* \author T. Kattmann
* \version 7.2.1 "Blackbird"
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2021, SU2 Contributors (cf. AUTHORS.md)
*
* SU2 is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* SU2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "COutput.hpp"

/*! \class CAdjFlowOutput
* \brief Output class for flow discrete adjoint problems.
* \author T. Kattmann
* \date December 3, 2021.
*/
class CAdjFlowOutput : public COutput {
protected:
const TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/
const bool cont_adj; /*!< \brief Boolean indicating whether we run a cont. adjoint problem */
const bool frozen_visc; /*!< \brief Boolean indicating whether frozen viscosity/turbulence is used. */

public:
/*!
* \brief Constructor of the class
* \param[in] config - Definition of the particular problem.
*/
CAdjFlowOutput(CConfig* config, unsigned short nDim);

/*!
* \brief Add scalar (turbulence/species) history fields for the Residual RMS (FVMComp, FVMInc, FVMNEMO).
*/
void AddHistoryOutputFields_AdjScalarRMS_RES(const CConfig* config);

/*!
* \brief Add scalar (turbulence/species) history fields for the max Residual (FVMComp, FVMInc, FVMNEMO).
*/
void AddHistoryOutputFields_AdjScalarMAX_RES(const CConfig* config);

/*!
* \brief Add scalar (turbulence/species) history fields for the BGS Residual (FVMComp, FVMInc, FVMNEMO).
*/
void AddHistoryOutputFields_AdjScalarBGS_RES(const CConfig* config);

/*!
* \brief Add scalar (turbulence/species) history fields for the linear solver (FVMComp, FVMInc, FVMNEMO).
*/
void AddHistoryOutputFields_AdjScalarLinsol(const CConfig* config);

/*!
* \brief Set all scalar (turbulence/species) history field values.
*/
void LoadHistoryData_AdjScalar(const CConfig* config, const CSolver* const* solver);

/*!
* \brief Add scalar (turbulence/species) volume solution fields for a point (FVMComp, FVMInc, FVMNEMO).
* \note The order of fields in restart files is fixed. Therefore the split-up.
* \param[in] config - Definition of the particular problem.
*/
void SetVolumeOutputFields_AdjScalarSolution(const CConfig* config);

/*!
* \brief Add scalar (turbulence/species) volume solution fields for a point (FVMComp, FVMInc, FVMNEMO).
* \note The order of fields in restart files is fixed. Therefore the split-up.
* \param[in] config - Definition of the particular problem.
*/
void SetVolumeOutputFields_AdjScalarResidual(const CConfig* config);

/*!
* \brief Set all scalar (turbulence/species) volume field values for a point.
* \param[in] config - Definition of the particular problem.
* \param[in] solver - The container holding all solution data.
* \param[in] iPoint - Index of the point.
*/
void LoadVolumeData_AdjScalar(const CConfig* config, const CSolver* const* solver, const unsigned long iPoint);
};
6 changes: 3 additions & 3 deletions SU2_CFD/include/output/CFlowOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ class CFlowOutput : public CFVMOutput{
const vector<su2double>& Surface_Area_Total);

/*!
* \brief Add scalar (turbulence/species) history fields for the linear solver (FVMComp, FVMInc, FVMNEMO).
* \brief Add scalar (turbulence/species) history fields for the Residual RMS (FVMComp, FVMInc, FVMNEMO).
*/
void AddHistoryOutputFields_ScalarRMS_RES(const CConfig* config);

/*!
* \brief Add scalar (turbulence/species) history fields for the linear solver (FVMComp, FVMInc, FVMNEMO).
* \brief Add scalar (turbulence/species) history fields for the max Residual (FVMComp, FVMInc, FVMNEMO).
*/
void AddHistoryOutputFields_ScalarMAX_RES(const CConfig* config);

/*!
* \brief Add scalar (turbulence/species) history fields for the linear solver (FVMComp, FVMInc, FVMNEMO).
* \brief Add scalar (turbulence/species) history fields for the BGS Residual (FVMComp, FVMInc, FVMNEMO).
*/
void AddHistoryOutputFields_ScalarBGS_RES(const CConfig* config);

Expand Down
6 changes: 6 additions & 0 deletions SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
Original file line number Diff line number Diff line change
Expand Up @@ -3015,6 +3015,12 @@ su2double CFVMFlowSolverBase<V,R>::EvaluateCommonObjFunc(const CConfig& config)
case SURFACE_PRESSURE_DROP:
objFun += weight * config.GetSurface_PressureDrop(0);
break;
case SURFACE_SPECIES_0:
objFun += weight * config.GetSurface_Species_0(0);
break;
case SURFACE_SPECIES_VARIANCE:
objFun += weight * config.GetSurface_Species_Variance(0);
break;
case CUSTOM_OBJFUNC:
objFun += weight * Total_Custom_ObjFunc;
break;
Expand Down
Loading