Skip to content

[WIP] pywrapper - custom source terms for all solvers #2388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5875625
initial update
bigfooted Nov 25, 2024
cc3dfab
initial working version for buoyant flow
bigfooted Dec 3, 2024
b407a27
small cleanup
bigfooted Dec 3, 2024
ce0b61e
small cleanup of python file
bigfooted Dec 3, 2024
d8d30a4
small cleanup
bigfooted Dec 3, 2024
488efa0
Update SU2_CFD/include/drivers/CDriverBase.hpp
bigfooted Dec 3, 2024
40e1d97
Fix code scanning alert no. 5107: Comparison of narrow type with wide…
bigfooted Dec 3, 2024
b77fd09
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Dec 3, 2024
4904b19
Update SU2_CFD/src/numerics/flow/flow_sources.cpp
bigfooted Dec 3, 2024
d4ac82b
Update SU2_CFD/src/drivers/CDriverBase.cpp
bigfooted Dec 3, 2024
1e64b8d
Merge branch 'develop' into feature_custom_source
bigfooted Dec 9, 2024
3429530
Merge branch 'develop' into feature_custom_source
bigfooted Dec 28, 2024
51b0b44
Merge branch 'develop' into feature_custom_source
bigfooted Jan 2, 2025
ce99e01
Turbulent combustion (TFC)
bigfooted Jan 6, 2025
eb98506
Merge branch 'feature_custom_source' of https://github.com/su2code/su…
bigfooted Jan 6, 2025
11e6c7a
Merge branch 'develop' into feature_custom_source
bigfooted Jan 14, 2025
a845d20
Merge branch 'develop' into feature_custom_source
bigfooted Feb 5, 2025
33603e3
Merge branch 'develop' into feature_custom_source
bigfooted Feb 18, 2025
dd8462d
cleanup, fix AD compile error
bigfooted Feb 22, 2025
a3439f9
cleanup examples
bigfooted Feb 22, 2025
cd581f4
more cleanup of examples
bigfooted Feb 23, 2025
dc65d47
more cleanup of examples
bigfooted Feb 23, 2025
2003b18
add testcases
bigfooted Feb 24, 2025
effe99d
change testcases branch
bigfooted Feb 24, 2025
0b073b0
Merge branch 'develop' into feature_custom_source
bigfooted Mar 8, 2025
e623a4b
Potential fix for code scanning alert no. 5295: Unused local variable
bigfooted Mar 9, 2025
c86a630
Potential fix for code scanning alert no. 5292: Unused local variable
bigfooted Mar 9, 2025
7de32c9
Merge branch 'develop' into feature_custom_source
bigfooted Mar 9, 2025
b8aebc8
update testcases
bigfooted Mar 10, 2025
10a653a
update
bigfooted Apr 9, 2025
82290f8
Merge branch 'develop' into feature_custom_source
bigfooted Apr 9, 2025
c4a0487
cleanup
bigfooted Apr 10, 2025
e711ed0
fix return value
bigfooted Apr 11, 2025
64b3761
move python source up
bigfooted Apr 12, 2025
a5013c6
cleanup
bigfooted Apr 12, 2025
d85d1fd
Merge branch 'develop' into feature_custom_source
bigfooted Apr 20, 2025
efb048a
Merge branch 'develop' into feature_custom_source
bigfooted May 12, 2025
6470580
custom energy source
bigfooted May 20, 2025
fee5e1a
Merge branch 'develop' into feature_custom_source
bigfooted Jun 19, 2025
a1a0d7b
add new boundary conditions
bigfooted Jun 26, 2025
98c7a4c
add testcase
bigfooted Jun 26, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
args: -b ${{github.ref}} -t develop -c feature_custom_source -s ${{matrix.testscript}}
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
Expand Down
47 changes: 47 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@
nMarker_CHTInterface, /*!< \brief Number of conjugate heat transfer interface markers. */
nMarker_ContactResistance, /*!< \brief Number of CHT interfaces with contact resistance. */
nMarker_Inlet, /*!< \brief Number of inlet flow markers. */
nMarker_Wall_Species, /*!< \brief Number of inlet flow markers. */
nMarker_Inlet_Species, /*!< \brief Number of inlet species markers. */
nSpecies_per_Inlet, /*!< \brief Number of species defined per inlet markers. */
nSpecies_per_Wall, /*!< \brief Number of species defined per inlet markers. */
nMarker_Inlet_Turb, /*!< \brief Number of inlet turbulent markers. */
nTurb_Properties, /*!< \brief Number of turbulent properties per inlet markers. */
nMarker_Riemann, /*!< \brief Number of Riemann flow markers. */
Expand Down Expand Up @@ -250,6 +252,7 @@
*Marker_ActDiskBemInlet_Axis, /*!< \brief Actuator disk BEM inlet markers passed to MARKER_ACTDISK_BEM_AXIS. */
*Marker_ActDiskBemOutlet_Axis, /*!< \brief Actuator disk BEM outlet markers passed to MARKER_ACTDISK_BEM_AXIS. */
*Marker_Inlet, /*!< \brief Inlet flow markers. */
*Marker_Wall_Species, /*!< \brief Inlet flow markers. */
*Marker_Inlet_Species, /*!< \brief Inlet species markers. */
*Marker_Inlet_Turb, /*!< \brief Inlet turbulent markers. */
*Marker_Riemann, /*!< \brief Riemann markers. */
Expand Down Expand Up @@ -289,6 +292,7 @@
su2double *Inlet_Pressure; /*!< \brief Specified static pressures for supersonic inlet boundaries. */
su2double **Inlet_Velocity; /*!< \brief Specified flow velocity vectors for supersonic inlet boundaries. */
su2double **Inlet_SpeciesVal; /*!< \brief Specified species vector for inlet boundaries. */
su2double **Wall_SpeciesVal; /*!< \brief Specified species vector for wall boundaries. */
su2double **Inlet_TurbVal; /*!< \brief Specified turbulent intensity and viscosity ratio for inlet boundaries. */
su2double *EngineInflow_Target; /*!< \brief Specified fan face targets for nacelle boundaries. */
su2double *Inflow_Mach; /*!< \brief Specified fan face mach for nacelle boundaries. */
Expand Down Expand Up @@ -615,9 +619,13 @@
*Kind_Data_Giles; /*!< \brief Kind of inlet boundary treatment. */
INLET_TYPE Kind_Inlet;
INLET_TYPE *Kind_Inc_Inlet;

//WALL_SPECIES_TYPE **Wall_SpeciesType;
unsigned short **Wall_SpeciesType;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

To resolve the issue, we need to either remove the commented-out code or reinstate it as active code. Since there is no context indicating that the commented-out line is necessary or relevant, the best approach is to remove it entirely. This will improve code readability and eliminate potential confusion for developers.


Suggested changeset 1
Common/include/CConfig.hpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp
--- a/Common/include/CConfig.hpp
+++ b/Common/include/CConfig.hpp
@@ -623,3 +623,3 @@
 
-  //WALL_SPECIES_TYPE **Wall_SpeciesType;
+  
   unsigned short **Wall_SpeciesType;
EOF
@@ -623,3 +623,3 @@

//WALL_SPECIES_TYPE **Wall_SpeciesType;

unsigned short **Wall_SpeciesType;
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
INC_OUTLET_TYPE *Kind_Inc_Outlet;
unsigned short nWall_Types; /*!< \brief Number of wall treatment types listed. */
unsigned short nInc_Inlet; /*!< \brief Number of inlet boundary treatment types listed. */
unsigned short nSpecies_Wall; /*!< \brief Number of inlet boundary treatment types listed. */
unsigned short nInc_Outlet; /*!< \brief Number of inlet boundary treatment types listed. */
su2double Inc_Inlet_Damping; /*!< \brief Damping factor applied to the iterative updates to the velocity at a pressure inlet in incompressible flow. */
su2double Inc_Outlet_Damping; /*!< \brief Damping factor applied to the iterative updates to the pressure at a mass flow outlet in incompressible flow. */
Expand Down Expand Up @@ -1339,6 +1347,12 @@
void addInletOption(const string& name, unsigned short & nMarker_Inlet, string * & Marker_Inlet,
su2double* & Ttotal, su2double* & Ptotal, su2double** & FlowDir);

void addWallSpeciesOption(const string& name, unsigned short & nMarker_Wall_Species, string * & Marker_Wall_Species,
su2double** & wall_species_val, unsigned short & nSpecies_per_Wall);
void addWallSpeciesType(const string& name, unsigned short & nMarker_Wall_Species, string * & Marker_Wall_Species,
// WALL_SPECIES_TYPE** & wall_species_type, unsigned short & nSpecies_per_Wall);
unsigned short** & wall_species_type, unsigned short & nSpecies_per_Wall);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

To resolve the issue, the commented-out code on line 1354 should be removed. This ensures that the codebase remains clean and avoids confusion for developers. Removing the line does not affect functionality because the uncommented version of the code (line 1355) already serves the intended purpose.

Steps to implement the fix:

  1. Locate the commented-out code on line 1354 in the file Common/include/CConfig.hpp.
  2. Remove the line entirely.
  3. Verify that the removal does not affect the functionality of the surrounding code.

Suggested changeset 1
Common/include/CConfig.hpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp
--- a/Common/include/CConfig.hpp
+++ b/Common/include/CConfig.hpp
@@ -1353,3 +1353,2 @@
   void addWallSpeciesType(const string& name, unsigned short & nMarker_Wall_Species, string * & Marker_Wall_Species,
-//                      WALL_SPECIES_TYPE** & wall_species_type, unsigned short & nSpecies_per_Wall);
                       unsigned short** & wall_species_type, unsigned short & nSpecies_per_Wall);
EOF
@@ -1353,3 +1353,2 @@
void addWallSpeciesType(const string& name, unsigned short & nMarker_Wall_Species, string * & Marker_Wall_Species,
// WALL_SPECIES_TYPE** & wall_species_type, unsigned short & nSpecies_per_Wall);
unsigned short** & wall_species_type, unsigned short & nSpecies_per_Wall);
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated

void addInletSpeciesOption(const string& name, unsigned short & nMarker_Inlet_Species, string * & Marker_Inlet_Species,
su2double** & inlet_species_val, unsigned short & nSpecies_per_Inlet);

Expand Down Expand Up @@ -4957,6 +4971,13 @@
*/
INLET_TYPE GetKind_Inc_Inlet(const string& val_marker) const;

/*!
* \brief Get the type of incompressible inlet from the list.
* \return Kind of the incompressible inlet.
*/
// WALL_SPECIES_TYPE* GetKind_Wall_Species(const string& val_marker) const;
//unsigned short* GetKind_Wall_Species(const string& val_marker) const;

Comment on lines +4979 to +4980

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

To fix the issue, we need to either remove the commented-out code or reinstate it as active code if it is still relevant. Since there is no context suggesting that the function is required, the best course of action is to remove the commented-out line entirely. This will improve code readability and maintainability.


Suggested changeset 1
Common/include/CConfig.hpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp
--- a/Common/include/CConfig.hpp
+++ b/Common/include/CConfig.hpp
@@ -4978,3 +4978,2 @@
    */
-// WALL_SPECIES_TYPE* GetKind_Wall_Species(const string& val_marker) const;
  //unsigned short* GetKind_Wall_Species(const string& val_marker) const;
EOF
@@ -4978,3 +4978,2 @@
*/
// WALL_SPECIES_TYPE* GetKind_Wall_Species(const string& val_marker) const;
//unsigned short* GetKind_Wall_Species(const string& val_marker) const;
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
/*!
* \brief Get the total number of types in Kind_Inc_Inlet list
* \return Total number of types in Kind_Inc_Inlet list
Expand Down Expand Up @@ -6828,6 +6849,20 @@
*/
const su2double* GetInlet_SpeciesVal(const string& val_index) const;

/*!
* \brief Get the species values at a wall boundary
* \param[in] val_index - Index corresponding to the wall boundary.
* \return The wall species values.
*/
const su2double* GetWall_SpeciesVal(const string& val_index) const;
/*!
* \brief Get the species values at a wall boundary
* \param[in] val_index - Index corresponding to the wall boundary.
* \return The wall species values.
*/
//const WALL_SPECIES_TYPE* GetWall_SpeciesType(const string& val_index) const;
const unsigned short* GetWall_SpeciesType(const string& val_index) const;

/*!
* \brief Get the turbulent properties values at an inlet boundary
* \param[in] val_index - Index corresponding to the inlet boundary.
Expand Down Expand Up @@ -9315,12 +9350,24 @@
*/
unsigned long GetnInner_Iter(void) const { return nInnerIter; }

/*!
* \brief Set the number of inner iterations
* \return
*/
void SetnInner_Iter(unsigned long val_iter) { nInnerIter = val_iter; }

/*!
* \brief Get the number of outer iterations
* \return Number of outer iterations for the multizone problem
*/
unsigned long GetnOuter_Iter(void) const { return nOuterIter; }

/*!
* \brief Set the number of outer iterations
* \return
*/
void SetnOuter_Iter(unsigned long val_iter) { nOuterIter = val_iter; }

/*!
* \brief Get the number of time iterations
* \return Number of time steps run
Expand Down
16 changes: 15 additions & 1 deletion Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ enum ENUM_FLUIDMODEL {
FLUID_MIXTURE = 9, /*!< \brief Species mixture model. */
COOLPROP = 10, /*!< \brief Thermodynamics library. */
FLUID_FLAMELET = 11, /*!< \brief lookup table (LUT) method for premixed flamelets. */
DATADRIVEN_FLUID = 12, /*!< \brief multi-layer perceptron driven fluid model. */
DATADRIVEN_FLUID = 12, /*!< \brief multi-layer perceptron driven fluid model. */
};
static const MapType<std::string, ENUM_FLUIDMODEL> FluidModel_Map = {
MakePair("STANDARD_AIR", STANDARD_AIR)
Expand Down Expand Up @@ -1961,6 +1961,20 @@ static const MapType<std::string, INLET_TYPE> Inlet_Map = {
MakePair("PRESSURE_INLET", INLET_TYPE::PRESSURE_INLET)
};


/*!
* \brief Types species wall boundary treatments
*/
enum class WALL_SPECIES_TYPE {
FLUX, /*!< \brief User specifies total pressure, total temperature, and flow direction. */
VALUE, /*!< \brief User specifies density and velocity (mass flow). */
};

static const MapType<std::string, WALL_SPECIES_TYPE> Wall_Species_Map = {
MakePair("FLUX", WALL_SPECIES_TYPE::FLUX)
MakePair("VALUE", WALL_SPECIES_TYPE::VALUE)
};

/*!
* \brief Types outlet boundary treatments
*/
Expand Down
115 changes: 91 additions & 24 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,30 @@
option_map.insert(pair<string, COptionBase *>(name, val));
}

void CConfig::addWallSpeciesOption(const string& name, unsigned short & nMarker_Wall_Species,
string * & Marker_Wall_Species, su2double** & wall_species_val,
unsigned short & nSpecies_per_Wall) {
assert(option_map.find(name) == option_map.end());
all_options.insert(pair<string, bool>(name, true));

COptionBase* val = new COptionStringValuesList<su2double*>(name, nMarker_Wall_Species, Marker_Wall_Species,
wall_species_val, nSpecies_per_Wall);
option_map.insert(pair<string, COptionBase *>(name, val));
}

void CConfig::addWallSpeciesType(const string& name, unsigned short & nMarker_Wall_Species,
//string * & Marker_Wall_Species, WALL_SPECIES_TYPE** & wall_species_type,
string * & Marker_Wall_Species, unsigned short** & wall_species_type,
unsigned short & nSpecies_per_Wall) {
assert(option_map.find(name) == option_map.end());
all_options.insert(pair<string, bool>(name, true));

//COptionBase* val = new COptionStringValuesList<<static_cast>(unsigned short)WALL_SPECIES_TYPE*>(name, nMarker_Wall_Species, Marker_Wall_Species,
COptionBase* val = new COptionStringValuesList<unsigned short*>(name, nMarker_Wall_Species, Marker_Wall_Species,
wall_species_type, nSpecies_per_Wall);
option_map.insert(pair<string, COptionBase *>(name, val));
}

void CConfig::addInletTurbOption(const string& name, unsigned short& nMarker_Inlet_Turb, string*& Marker_Inlet_Turb,
su2double**& Turb_Properties_val, unsigned short& nTurb_Properties) {
assert(option_map.find(name) == option_map.end());
Expand Down Expand Up @@ -891,6 +915,7 @@
Inlet_FlowDir = nullptr; Inlet_Temperature = nullptr; Inlet_Pressure = nullptr;
Inlet_Velocity = nullptr;
Outlet_Pressure = nullptr; Inlet_SpeciesVal = nullptr; Inlet_TurbVal = nullptr;
Wall_SpeciesVal = nullptr;

/*--- Engine Boundary Condition settings ---*/

Expand Down Expand Up @@ -982,6 +1007,8 @@
Kind_Inc_Inlet = nullptr;
Kind_Inc_Outlet = nullptr;

Wall_SpeciesType = nullptr;

Kind_ObjFunc = nullptr;

Weight_ObjFunc = nullptr;
Expand Down Expand Up @@ -1571,6 +1598,8 @@
addEnumOption("INLET_TYPE", Kind_Inlet, Inlet_Map, INLET_TYPE::TOTAL_CONDITIONS);
/*!\brief INC_INLET_TYPE \n DESCRIPTION: List of inlet types for incompressible flows. List length must match number of inlet markers. Options: VELOCITY_INLET, PRESSURE_INLET, INPUT_FILE. \ingroup Config*/
addEnumListOption("INC_INLET_TYPE", nInc_Inlet, Kind_Inc_Inlet, Inlet_Map);


addBoolOption("SPECIFIED_INLET_PROFILE", Inlet_From_File, false);
/*!\brief INLET_FILENAME \n DESCRIPTION: Input file for a specified inlet profile (w/ extension) \n DEFAULT: inlet.dat \ingroup Config*/
addStringOption("INLET_FILENAME", Inlet_Filename, string("inlet.dat"));
Expand All @@ -1590,6 +1619,10 @@
/*!\brief MARKER_INLET_SPECIES \n DESCRIPTION: Inlet Species boundary marker(s) with the following format
Inlet Species: (inlet_marker, Species1, Species2, ..., SpeciesN-1, inlet_marker2, Species1, Species2, ...) */
addInletSpeciesOption("MARKER_INLET_SPECIES",nMarker_Inlet_Species, Marker_Inlet_Species, Inlet_SpeciesVal, nSpecies_per_Inlet);
addWallSpeciesOption("MARKER_WALL_SPECIES" ,nMarker_Wall_Species , Marker_Wall_Species , Wall_SpeciesVal , nSpecies_per_Wall);
addWallSpeciesType("WALL_SPECIES_TYPE" ,nMarker_Wall_Species , Marker_Wall_Species , Wall_SpeciesType , nSpecies_per_Wall);


/*!\brief MARKER_INLET_TURBULENT \n DESCRIPTION: Inlet Turbulence boundary marker(s) with the following format
Inlet Turbulent: (inlet_marker, TurbulentIntensity1, ViscosityRatio1, inlet_marker2, TurbulentIntensity2,
ViscosityRatio2, ...) */
Expand Down Expand Up @@ -5578,12 +5611,14 @@
CURRENT_FUNCTION);

// Helper function that checks scalar variable bounds,
auto checkScalarBounds = [&](su2double scalar, const string& name, su2double lowerBound, su2double upperBound) {
if (scalar < lowerBound || scalar > upperBound)
SU2_MPI::Error(string("Variable: ") + name + string(", is out of bounds."), CURRENT_FUNCTION);
};

cout << "Note: we do not check boudns for scalars anymore." << endl;
// auto checkScalarBounds = [&](su2double scalar, const string& name, su2double lowerBound, su2double upperBound) {
// if (scalar < lowerBound || scalar > upperBound)
// SU2_MPI::Error(string("Variable: ") + name + string(", is out of bounds."), CURRENT_FUNCTION);
// };

/*--- Some options have to provide as many entries as there are additional species equations. ---*/

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
/*--- Fill a vector with the entires and then check if each element is equal to the first one. ---*/
std::vector<unsigned short> nSpecies_options;
nSpecies_options.push_back(nSpecies_Init);
Expand All @@ -5603,25 +5638,26 @@

/*--- Check whether some variables (or their sums) are in physical bounds. [0,1] for species related quantities. ---*/
/*--- Note, only for species transport, not for flamelet model ---*/
if (Kind_Species_Model == SPECIES_MODEL::SPECIES_TRANSPORT) {
su2double Species_Init_Sum = 0.0;
for (unsigned short iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
checkScalarBounds(Species_Init[iSpecies], "SPECIES_INIT individual", 0.0, 1.0);
Species_Init_Sum += Species_Init[iSpecies];
}
checkScalarBounds(Species_Init_Sum, "SPECIES_INIT sum", 0.0, 1.0);

for (iMarker = 0; iMarker < nMarker_Inlet_Species; iMarker++) {
su2double Inlet_SpeciesVal_Sum = 0.0;
for (unsigned short iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
checkScalarBounds(Inlet_SpeciesVal[iMarker][iSpecies], "MARKER_INLET_SPECIES individual", 0.0, 1.0);
Inlet_SpeciesVal_Sum += Inlet_SpeciesVal[iMarker][iSpecies];
}
checkScalarBounds(Inlet_SpeciesVal_Sum, "MARKER_INLET_SPECIES sum", 0.0, 1.0);
}
}
cout << "warning: no bounds checked for species" << endl;
// if (Kind_Species_Model == SPECIES_MODEL::SPECIES_TRANSPORT) {
// su2double Species_Init_Sum = 0.0;
// for (unsigned short iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
// checkScalarBounds(Species_Init[iSpecies], "SPECIES_INIT individual", 0.0, 1.0);
// Species_Init_Sum += Species_Init[iSpecies];
// }
// checkScalarBounds(Species_Init_Sum, "SPECIES_INIT sum", 0.0, 1.0);

// for (iMarker = 0; iMarker < nMarker_Inlet_Species; iMarker++) {
Comment on lines +5644 to +5650

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

To resolve the issue, we will remove the commented-out code entirely. This approach is appropriate because the surrounding comments and cout statements indicate that bounds checking for species-related quantities is no longer performed. If this functionality is needed in the future, it can be reintroduced with proper testing and integration.

Steps to fix:

  1. Remove the commented-out code block starting from line 5644 to line 5660.
  2. Ensure that the removal does not affect the functionality of the remaining code.

Suggested changeset 1
Common/src/CConfig.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp
--- a/Common/src/CConfig.cpp
+++ b/Common/src/CConfig.cpp
@@ -5643,19 +5643,3 @@
 cout << "warning: no bounds checked for species" << endl;
-    // if (Kind_Species_Model == SPECIES_MODEL::SPECIES_TRANSPORT) {
-    //   su2double Species_Init_Sum = 0.0;
-    //   for (unsigned short iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
-    //     checkScalarBounds(Species_Init[iSpecies], "SPECIES_INIT individual", 0.0, 1.0);
-    //     Species_Init_Sum += Species_Init[iSpecies];
-    //   }
-    //   checkScalarBounds(Species_Init_Sum, "SPECIES_INIT sum", 0.0, 1.0);
 
-    //   for (iMarker = 0; iMarker < nMarker_Inlet_Species; iMarker++) {
-    //     su2double Inlet_SpeciesVal_Sum = 0.0;
-    //     for (unsigned short iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
-    //       checkScalarBounds(Inlet_SpeciesVal[iMarker][iSpecies], "MARKER_INLET_SPECIES individual", 0.0, 1.0);
-    //       Inlet_SpeciesVal_Sum += Inlet_SpeciesVal[iMarker][iSpecies];
-    //     }
-    //     checkScalarBounds(Inlet_SpeciesVal_Sum, "MARKER_INLET_SPECIES sum", 0.0, 1.0);
-    //   }
-    // }
 
EOF
@@ -5643,19 +5643,3 @@
cout << "warning: no bounds checked for species" << endl;
// if (Kind_Species_Model == SPECIES_MODEL::SPECIES_TRANSPORT) {
// su2double Species_Init_Sum = 0.0;
// for (unsigned short iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
// checkScalarBounds(Species_Init[iSpecies], "SPECIES_INIT individual", 0.0, 1.0);
// Species_Init_Sum += Species_Init[iSpecies];
// }
// checkScalarBounds(Species_Init_Sum, "SPECIES_INIT sum", 0.0, 1.0);

// for (iMarker = 0; iMarker < nMarker_Inlet_Species; iMarker++) {
// su2double Inlet_SpeciesVal_Sum = 0.0;
// for (unsigned short iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
// checkScalarBounds(Inlet_SpeciesVal[iMarker][iSpecies], "MARKER_INLET_SPECIES individual", 0.0, 1.0);
// Inlet_SpeciesVal_Sum += Inlet_SpeciesVal[iMarker][iSpecies];
// }
// checkScalarBounds(Inlet_SpeciesVal_Sum, "MARKER_INLET_SPECIES sum", 0.0, 1.0);
// }
// }

Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
// su2double Inlet_SpeciesVal_Sum = 0.0;
// for (unsigned short iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
// checkScalarBounds(Inlet_SpeciesVal[iMarker][iSpecies], "MARKER_INLET_SPECIES individual", 0.0, 1.0);
// Inlet_SpeciesVal_Sum += Inlet_SpeciesVal[iMarker][iSpecies];
// }
// checkScalarBounds(Inlet_SpeciesVal_Sum, "MARKER_INLET_SPECIES sum", 0.0, 1.0);
// }
// }

} // species transport checks

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

/*--- Define some variables for flamelet model. ---*/
if (Kind_Species_Model == SPECIES_MODEL::FLAMELET) {
Expand All @@ -5644,7 +5680,7 @@
iMarker_FarField, iMarker_SymWall, iMarker_PerBound,
iMarker_NearFieldBound, iMarker_Fluid_InterfaceBound,
iMarker_Inlet, iMarker_Riemann, iMarker_Giles, iMarker_Outlet,
iMarker_Smoluchowski_Maxwell,
iMarker_Smoluchowski_Maxwell, iMarker_Wall,
iMarker_Isothermal,iMarker_HeatFlux,iMarker_HeatTansfer,
iMarker_EngineInflow, iMarker_EngineExhaust, iMarker_Damper,
iMarker_Displacement, iMarker_Load, iMarker_Internal,
Expand Down Expand Up @@ -6206,7 +6242,7 @@

unsigned short iMarker_Euler, iMarker_Custom, iMarker_FarField,
iMarker_SymWall, iMarker_PerBound, iMarker_NearFieldBound,
iMarker_Fluid_InterfaceBound, iMarker_Inlet, iMarker_Riemann,
iMarker_Fluid_InterfaceBound, iMarker_Inlet, iMarker_Riemann, iMarker_Wall,
iMarker_Deform_Mesh, iMarker_Deform_Mesh_Sym_Plane, iMarker_Fluid_Load,
iMarker_Smoluchowski_Maxwell, iWall_Catalytic,
iMarker_Giles, iMarker_Outlet, iMarker_Isothermal, iMarker_HeatFlux, iMarker_HeatTransfer,
Expand Down Expand Up @@ -7537,7 +7573,14 @@
}
BoundaryTable.PrintFooter();
}

if (nMarker_Wall_Species != 0) {
BoundaryTable << "Species Wall boundary";
for (iMarker_Wall = 0; iMarker_Wall < nMarker_Wall_Species; iMarker_Wall++) {
BoundaryTable << Marker_Wall_Species[iMarker_Wall];
if (iMarker_Wall < nMarker_Wall_Species-1) BoundaryTable << " ";
}
BoundaryTable.PrintFooter();
}
if (nMarker_Riemann != 0) {
BoundaryTable << "Riemann boundary";
for (iMarker_Riemann = 0; iMarker_Riemann < nMarker_Riemann; iMarker_Riemann++) {
Expand Down Expand Up @@ -9028,14 +9071,24 @@
return Exhaust_Pressure_Target[iMarker_EngineExhaust];
}


INLET_TYPE CConfig::GetKind_Inc_Inlet(const string& val_marker) const {
unsigned short iMarker_Inlet;
for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++)
if (Marker_Inlet[iMarker_Inlet] == val_marker) break;
return Kind_Inc_Inlet[iMarker_Inlet];
}


//WALL_SPECIES_TYPE* CConfig::GetKind_Wall_Species(const string& val_marker) const {
// unsigned short * CConfig::GetKind_Wall_Species(const string& val_marker) const {
// unsigned short iMarker_Wall_Species;
// for (iMarker_Wall_Species = 0; iMarker_Wall_Species < nMarker_Wall_Species; iMarker_Wall_Species++)
// if (Marker_Wall_Species[iMarker_Wall_Species] == val_marker) break;
// return Wall_SpeciesType[iMarker_Wall_Species];
// }

INC_OUTLET_TYPE CConfig::GetKind_Inc_Outlet(const string& val_marker) const {

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
unsigned short iMarker_Outlet;
for (iMarker_Outlet = 0; iMarker_Outlet < nMarker_Outlet; iMarker_Outlet++)
if (Marker_Outlet[iMarker_Outlet] == val_marker) break;
Expand Down Expand Up @@ -9098,6 +9151,20 @@
return Inlet_SpeciesVal[iMarker_Inlet_Species];
}

const su2double* CConfig::GetWall_SpeciesVal(const string& val_marker) const {
unsigned short iMarker_Wall_Species;
for (iMarker_Wall_Species = 0; iMarker_Wall_Species < nMarker_Wall_Species; iMarker_Wall_Species++)
if (Marker_Wall_Species[iMarker_Wall_Species] == val_marker) break;
return Wall_SpeciesVal[iMarker_Wall_Species];
}
//const WALL_SPECIES_TYPE* CConfig::GetWall_SpeciesType(const string& val_marker) const {
const unsigned short* CConfig::GetWall_SpeciesType(const string& val_marker) const {
unsigned short iMarker_Wall_Species;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

To fix the issue, we should either remove the commented-out code entirely or reinstate it if it is still relevant. In this case, since the function CConfig::GetWall_SpeciesType is already implemented in the following lines (9163–9167), the commented-out version of the function is redundant and should be removed. This will improve code readability and maintainability.

Suggested changeset 1
Common/src/CConfig.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp
--- a/Common/src/CConfig.cpp
+++ b/Common/src/CConfig.cpp
@@ -9161,3 +9161,3 @@
 }
-//const WALL_SPECIES_TYPE* CConfig::GetWall_SpeciesType(const string& val_marker) const {
+
 const unsigned short* CConfig::GetWall_SpeciesType(const string& val_marker) const {
EOF
@@ -9161,3 +9161,3 @@
}
//const WALL_SPECIES_TYPE* CConfig::GetWall_SpeciesType(const string& val_marker) const {

const unsigned short* CConfig::GetWall_SpeciesType(const string& val_marker) const {
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
for (iMarker_Wall_Species = 0; iMarker_Wall_Species < nMarker_Wall_Species; iMarker_Wall_Species++)
if (Marker_Wall_Species[iMarker_Wall_Species] == val_marker) break;
return Wall_SpeciesType[iMarker_Wall_Species];
}

const su2double* CConfig::GetInlet_TurbVal(const string& val_marker) const {
/*--- If Turbulent Inlet is not provided for the marker, return free stream values. ---*/
for (auto iMarker = 0u; iMarker < nMarker_Inlet_Turb; iMarker++) {
Expand Down
Loading
Loading