Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 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
e94bb0c
remove wall species options again
bigfooted Jul 7, 2025
c77ff59
Merge branch 'develop' into feature_custom_source
bigfooted Jul 7, 2025
6f75564
cleanup
bigfooted Jul 7, 2025
61d6cff
more cleanup
bigfooted Jul 7, 2025
4f87859
fix link to testcase
bigfooted Jul 7, 2025
76c6d6a
cleanup
bigfooted Jul 9, 2025
ea5e99c
precommit
bigfooted Jul 9, 2025
f61c5de
fix typo
bigfooted Jul 9, 2025
64a891f
Update SU2_CFD/src/solvers/CSpeciesSolver.cpp
bigfooted Jul 10, 2025
948d1b3
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp
bigfooted Jul 10, 2025
aa12ebc
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Jul 10, 2025
82360ca
Update SU2_CFD/include/drivers/CDriverBase.hpp
bigfooted Jul 10, 2025
161be5d
cleanup and reviewer suggestions
bigfooted Jul 10, 2025
da794f4
create matrixview
bigfooted Jul 10, 2025
2756cfb
test, place custom_residual in CSolver
bigfooted Jul 11, 2025
f7f2f75
move uds to CSolver
bigfooted Jul 11, 2025
0340922
add species user source to output
bigfooted Jul 11, 2025
1af69b8
fix auto warnings
bigfooted Jul 11, 2025
d91bb62
remove unused variable
bigfooted Jul 11, 2025
a113149
update buoyancy
bigfooted Jul 12, 2025
7ddf9d7
fix regression test residuals
bigfooted Jul 12, 2025
c81183d
clean up
bigfooted Jul 12, 2025
4f3a968
Potential fix for code scanning alert no. 5680: Unused local variable
bigfooted Jul 12, 2025
6a5f28b
Potential fix for code scanning alert no. 5546: Unused local variable
bigfooted Jul 12, 2025
3ca4f27
flamelet now shares python source with species.
bigfooted Jul 12, 2025
c2a856a
Merge branch 'feature_custom_source' of https://github.com/su2code/su…
bigfooted Jul 12, 2025
be73f1f
remove unused setvolume
bigfooted Jul 12, 2025
303424d
remove unused variables
bigfooted Jul 12, 2025
e14aa3e
Apply suggestions from code review
pcarruscag Jul 15, 2025
b209f4c
3D matrix view
pcarruscag Jul 15, 2025
b78afd9
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
bigfooted Jul 15, 2025
fc01bbf
Update SU2_CFD/src/solvers/CSpeciesSolver.cpp
bigfooted Jul 15, 2025
1fa0053
Update SU2_CFD/src/solvers/CTransLMSolver.cpp
bigfooted Jul 15, 2025
ceb3b39
changes from code review
bigfooted Jul 15, 2025
33dc79b
move pywrapper matrix out of loop
bigfooted Jul 16, 2025
a02cfdb
Merge branch 'develop' into feature_custom_source
bigfooted Jul 16, 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 @@ -211,7 +211,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
7 changes: 7 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ class CConfig {
Wrt_Restart_Overwrite, /*!< \brief Overwrite restart files or append iteration number.*/
Wrt_Surface_Overwrite, /*!< \brief Overwrite surface output files or append iteration number.*/
Wrt_Volume_Overwrite, /*!< \brief Overwrite volume output files or append iteration number.*/
PyCustomSource, /*!< \brief Use a user-defined custom source term .*/
Restart_Flow; /*!< \brief Restart flow solution for adjoint and linearized problems. */
unsigned short nMarker_Monitoring, /*!< \brief Number of markers to monitor. */
nMarker_Designing, /*!< \brief Number of markers for the objective function. */
Expand Down Expand Up @@ -3087,6 +3088,12 @@ class CConfig {
*/
unsigned short GetnMarker_PyCustom(void) const { return nMarker_PyCustom; }

/*!
* \brief Get the Python custom source term activation.
* \return Custom source term is active or not.
*/
bool GetPyCustomSource(void) const { return PyCustomSource; }

/*!
* \brief Get the total number of moving markers.
* \return Total number of moving markers.
Expand Down
77 changes: 77 additions & 0 deletions Common/include/containers/CPyWrapperMatrixView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
/*! \brief Gets the value for a (row, column) pair. */ \
passivedouble operator()(unsigned long row, unsigned long col) const { return Get(row, col); } \
\
/*! \brief Gets the values for a row of the matrix. */ \
std::vector<passivedouble> operator()(unsigned long row) const { return Get(row); } \
\
/*! \brief Gets the value for a (row, column) pair. */ \
passivedouble Get(unsigned long row, unsigned long col) const { return SU2_TYPE::GetValue(Access(row, col)); } \
\
Expand Down Expand Up @@ -163,3 +166,77 @@ class CPyWrapperMarkerMatrixView {
/*--- Use the macro to generate the interface. ---*/
PY_WRAPPER_MATRIX_INTERFACE
};

/*!
* \class CPyWrapper3DMatrixView
* \ingroup PySU2
* \brief This class wraps C3DDoubleMatrix for the python wrapper matrix interface.
* It is generaly used to wrap access to solver gradients defined for the entire volume.
*/
class CPyWrapper3DMatrixView {
protected:
static_assert(su2activematrix::IsRowMajor, "");
su2double* data_ = nullptr;
unsigned long rows_ = 0, cols_ = 0, dims_ = 0;
std::string name_;
bool read_only_ = false;

/*--- Define the functions required by the interface macro. ---*/
inline const su2double& Access(unsigned long row, unsigned long col, unsigned long dim) const {
if (row > rows_ || col > cols_ || dim > dims_) SU2_MPI::Error(name_ + " out of bounds", "CPyWrapper3DMatrixView");
return data_[row * (cols_ * dims_) + col * dims_ + dim];
}
inline su2double& Access(unsigned long row, unsigned long col, unsigned long dim) {
if (read_only_) SU2_MPI::Error(name_ + " is read-only", "CPyWrapper3DMatrixView");
const auto& const_me = *this;
return const_cast<su2double&>(const_me.Access(row, col, dim));
}

public:
CPyWrapper3DMatrixView() = default;

/*!
* \brief Construct the view of the matrix.
* \note "name" should be set to the variable name being returned to give better information to users.
* \note "read_only" can be set to true to prevent the data from being modified.
*/
CPyWrapper3DMatrixView(C3DDoubleMatrix& mat, const std::string& name, bool read_only)
: data_(mat.data()),
rows_(mat.length()),
cols_(mat.rows()),
dims_(mat.cols()),
name_(name),
read_only_(read_only) {}

/*! \brief Returns the shape of the matrix. */
std::vector<unsigned long> Shape() const { return {rows_, cols_, dims_}; }

/*! \brief Returns whether the data is read-only [true] or if it can be modified [false]. */
bool IsReadOnly() const { return read_only_; }

/*! \brief Gets the value for a (row, column, dimension) triplet. */
passivedouble operator()(unsigned long row, unsigned long col, unsigned long dim) const { return Get(row, col, dim); }

/*! \brief Gets the values for a row and column of the matrix. */
std::vector<passivedouble> operator()(unsigned long row, unsigned long col) const { return Get(row, col); }

/*! \brief Gets the value for a (row, column, dimension) triplet. */
passivedouble Get(unsigned long row, unsigned long col, unsigned long dim) const {
return SU2_TYPE::GetValue(Access(row, col, dim));
}

/*! \brief Gets the values for a row and column of the matrix. */
std::vector<passivedouble> Get(unsigned long row, unsigned long col) const {
std::vector<passivedouble> vals(dims_);
for (unsigned long j = 0; j < dims_; ++j) vals[j] = Get(row, col, j);
return vals;
}
/*! \brief Sets the value for a (row, column, dimension) triplet. This clears derivative information. */
void Set(unsigned long row, unsigned long col, unsigned long dim, passivedouble val) { Access(row, col, dim) = val; }

/*! \brief Sets the values for a row and column of the matrix. */
void Set(unsigned long row, unsigned long col, std::vector<passivedouble> vals) {
unsigned long j = 0;
for (const auto& val : vals) Set(row, col, j++, val);
}
};
5 changes: 5 additions & 0 deletions Common/include/containers/container_decorators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ class C3DContainerDecorator {
FORCEINLINE StaticContainer get(Int i, Index j = 0) const noexcept {
return m_storage.template get<StaticContainer>(i, j * m_innerSz);
}

/*!
* \brief Raw data access, for Python wrapper.
*/
FORCEINLINE Scalar* data() { return m_storage.data(); }
};

/*!
Expand Down
7 changes: 3 additions & 4 deletions Common/include/geometry/dual_grid/CPoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ class CPoint {
su2activematrix Coord; /*!< \brief vector with the coordinates of the node. */
su2activematrix
Coord_Old; /*!< \brief Old coordinates vector for primal solution reloading for Disc.Adj. with dynamic grid. */
su2activematrix Coord_Sum; /*!< \brief Sum of coordinates vector for geometry smoothing. */
su2activematrix Coord_n; /*!< \brief Coordinates at time n for use with dynamic meshes. */
su2activematrix Coord_n1; /*!< \brief Coordinates at time n-1 for use with dynamic meshes. */
su2activematrix Coord_p1; /*!< \brief Coordinates at time n+1 for use with dynamic meshes. */
su2activematrix Coord_n; /*!< \brief Coordinates at time n for use with dynamic meshes. */
su2activematrix Coord_n1; /*!< \brief Coordinates at time n-1 for use with dynamic meshes. */
su2activematrix Coord_p1; /*!< \brief Coordinates at time n+1 for use with dynamic meshes. */

su2activematrix GridVel; /*!< \brief Velocity of the grid for dynamic mesh cases. */
CVectorOfMatrix GridVel_Grad; /*!< \brief Gradient of the grid velocity for dynamic meshes. */
Expand Down
2 changes: 1 addition & 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
5 changes: 4 additions & 1 deletion Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,9 @@ void CConfig::SetConfig_Options() {
/*!\brief MARKER_PYTHON_CUSTOM\n DESCRIPTION: Python customizable marker(s) \ingroup Config*/
addStringListOption("MARKER_PYTHON_CUSTOM", nMarker_PyCustom, Marker_PyCustom);

/*!\brief PYTHON_CUSTOM_SOURCE\n DESCRIPTION: Python custom source \ingroup Config*/
addBoolOption("PYTHON_CUSTOM_SOURCE", PyCustomSource, false);

/*!\brief MARKER_WALL_FUNCTIONS\n DESCRIPTION: Viscous wall markers for which wall functions must be applied.
Format: (Wall function marker, wall function type, ...) \ingroup Config*/
addWallFunctionOption("MARKER_WALL_FUNCTIONS", nMarker_WallFunctions, Marker_WallFunctions,
Expand Down Expand Up @@ -5600,7 +5603,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
"to be equal to the number of entries of SPECIES_INIT +1",
CURRENT_FUNCTION);

// Helper function that checks scalar variable bounds,
/*--- 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);
Expand Down
13 changes: 13 additions & 0 deletions SU2_CFD/include/drivers/CDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,19 @@ class CDriver : public CDriverBase {
*/
void SetMarkerTranslationRate(unsigned short iMarker, passivedouble vel_x, passivedouble vel_y, passivedouble vel_z);

/*!
* \brief Get the Freestream Density for nondimensionalization
* \return Freestream Density
*/
passivedouble GetDensityFreeStreamND() const;

/*!
* \brief Get the reference Body force for nondimensionalization
* \return reference Body Force
*/
passivedouble GetForceRef() const;


/// \}
};

Expand Down
17 changes: 17 additions & 0 deletions SU2_CFD/include/drivers/CDriverBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,23 @@ class CDriverBase {
return CPyWrapperMatrixView(solver->GetNodes()->GetSolution(), "Solution of " + solver->GetSolverName(), false);
}

/*!
* \brief Get read/write view of the gradients of a solver variable in a point.
*/
inline CPyWrapper3DMatrixView Gradient(unsigned short iSolver) {
auto* solver = GetSolverAndCheckMarker(iSolver);
return CPyWrapper3DMatrixView(solver->GetNodes()->GetGradient(), "Gradient of " + solver->GetSolverName(), false);
}

/*!
* \brief Get a read/write view of the user defined source on all mesh nodes of a solver.
*/
inline CPyWrapperMatrixView UserDefinedSource(unsigned short iSolver) {
auto* solver = GetSolverAndCheckMarker(iSolver);
return CPyWrapperMatrixView(
solver->GetNodes()->GetUserDefinedSource(), "User Defined Source of " + solver->GetSolverName(), false);
}

/*!
* \brief Get a read/write view of the current solution on the mesh nodes of a marker.
*/
Expand Down
20 changes: 19 additions & 1 deletion SU2_CFD/include/solvers/CSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,6 @@ class CSolver {
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver_container - Container vector with all the solutions.
* \param[in] numerics_container - Description of the numerical method.
* \param[in] second_numerics - Description of the second numerical method.
* \param[in] config - Definition of the particular problem.
* \param[in] iMesh - Index of the mesh in multigrid computations.
*/
Expand Down Expand Up @@ -4334,6 +4333,25 @@ class CSolver {
END_SU2_OMP_FOR
}

inline void CustomSourceResidual(CGeometry *geometry, CSolver **solver_container,
CNumerics **numerics_container, CConfig *config, unsigned short iMesh) {

AD::StartNoSharedReading();

SU2_OMP_FOR_STAT(roundUpDiv(nPointDomain,2*omp_get_max_threads()))
for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) {
/*--- Get control volume size. ---*/
su2double Volume = geometry->nodes->GetVolume(iPoint);
/*--- Compute the residual for this control volume and subtract. ---*/
for (auto iVar = 0ul; iVar < nVar; iVar++) {
LinSysRes(iPoint,iVar) -= base_nodes->GetUserDefinedSource()(iPoint, iVar) * Volume;
}
}
END_SU2_OMP_FOR

AD::EndNoSharedReading();
}

protected:
/*!
* \brief Allocate the memory for the verification solution, if necessary.
Expand Down
4 changes: 2 additions & 2 deletions SU2_CFD/include/solvers/CSpeciesSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ class CSpeciesSolver : public CScalarSolver<CSpeciesVariable> {
void Source_Residual(CGeometry* geometry, CSolver** solver_container, CNumerics** numerics_container, CConfig* config,
unsigned short iMesh) override;


/*!
/*!
* \brief Impose the fluid interface boundary condition using tranfer data.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver_container - Container vector with all the solutions.
Expand All @@ -183,4 +182,5 @@ class CSpeciesSolver : public CScalarSolver<CSpeciesVariable> {
},
geometry, solver_container, conv_numerics, visc_numerics, config);
}

};
14 changes: 14 additions & 0 deletions SU2_CFD/include/variables/CVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class CVariable {
MatrixType Solution; /*!< \brief Solution of the problem. */
MatrixType Solution_Old; /*!< \brief Old solution of the problem R-K. */

MatrixType UserDefinedSource; /*!< \brief User Defined Source of the problem. */

MatrixType External; /*!< \brief External (outer) contribution in discrete adjoint multizone problems. */

su2vector<bool> Non_Physical; /*!< \brief Non-physical points in the solution (force first order). */
Expand Down Expand Up @@ -485,6 +487,13 @@ class CVariable {
*/
inline su2double *GetSolution(unsigned long iPoint) { return Solution[iPoint]; }

/*!
* \brief Get the entire User Define Source of the problem.
* \return Reference to the solution matrix.
*/
inline const MatrixType& GetUserDefinedSource() const { return UserDefinedSource; }
inline MatrixType& GetUserDefinedSource() { return UserDefinedSource; }

/*!
* \brief Get the old solution of the problem (Runge-Kutta method)
* \param[in] iPoint - Point index.
Expand Down Expand Up @@ -2168,6 +2177,11 @@ class CVariable {
*/
void RegisterSolution_time_n1();

/*!
* \brief Register the variables in the user defined source array as input/output variable.
*/
void RegisterUserDefinedSource();

/*!
* \brief Set the adjoint values of the solution.
* \param[in] adj_sol - The adjoint values of the solution.
Expand Down
7 changes: 3 additions & 4 deletions SU2_CFD/src/iteration/CFluidIteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ bool CFluidIteration::Monitor(COutput* output, CIntegration**** integration, CGe
output->SetHistoryOutput(geometry[val_iZone][val_iInst][MESH_0], solver[val_iZone][val_iInst][MESH_0],
config[val_iZone], config[val_iZone]->GetTimeIter(), config[val_iZone]->GetOuterIter(),
config[val_iZone]->GetInnerIter());

StopCalc = output->GetConvergence();

/* --- Checking convergence of Fixed CL mode to target CL, and perform finite differencing if needed --*/
Expand Down Expand Up @@ -345,12 +345,12 @@ void CFluidIteration::ComputeTurboPerformance(CSolver***** solver, CGeometry****
bladesPrimitives.push_back(bladePrimitives);
}
TurbomachineryPerformance->ComputeTurbomachineryPerformance(bladesPrimitives);

auto nSpan = config_container[ZONE_0]->GetnSpanWiseSections();
auto InState = TurbomachineryPerformance->GetBladesPerformances().at(ZONE_0).at(nSpan)->GetInletState();
nSpan = config_container[nZone-1]->GetnSpanWiseSections();
auto OutState = TurbomachineryPerformance->GetBladesPerformances().at(nZone-1).at(nSpan)->GetOutletState();

TurbomachineryStagePerformance->ComputePerformanceStage(InState, OutState, config_container[nZone-1]);
}
}
Expand Down Expand Up @@ -658,7 +658,6 @@ void CFluidIteration::SetDualTime_Aeroelastic(CConfig* config) const {
Marker_Tag = config->GetMarker_All_TagBound(iMarker);
if (Marker_Tag == Monitoring_Tag) { owner = 1; break;
} owner = 0;


}
plunge = config->GetAeroelastic_plunge(iMarker_Monitoring);
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/src/numerics/flow/flow_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CNumerics::ResidualType<> CSourceAxisymmetric_Flow::ComputeResidual(const CConfi
sq_vel += Velocity_i *Velocity_i;
}

Pressure_i = (Gamma-1.0)*U_i[0]*(U_i[nDim+1]/U_i[0]-0.5*sq_vel);
Pressure_i = Gamma_Minus_One*U_i[0]*(U_i[nDim+1]/U_i[0]-0.5*sq_vel);
Enthalpy_i = (U_i[nDim+1] + Pressure_i) / U_i[0];

residual[0] = yinv*Volume*U_i[2];
Expand Down
16 changes: 13 additions & 3 deletions SU2_CFD/src/output/CFlowOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,13 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSource(const CConfig* config) {
/*--- Only place outputs of the "SOURCE" group for scalar transport here. ---*/

switch (config->GetKind_Species_Model()) {
case SPECIES_MODEL::SPECIES_TRANSPORT:
if (config->GetPyCustomSource()) {
for (unsigned short iVar = 0; iVar < config->GetnSpecies(); iVar++){
AddVolumeOutput("SPECIES_UDS_" + std::to_string(iVar), "Species_UDS_" + std::to_string(iVar), "SOURCE", "Species User Defined Source " + std::to_string(iVar));
}
}
break;
case SPECIES_MODEL::FLAMELET: {
const auto& flamelet_config_options = config->GetFlameletParsedOptions();
for (auto iCV=0u; iCV < flamelet_config_options.n_control_vars; iCV++) {
Expand All @@ -1444,8 +1451,8 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSource(const CConfig* config) {
const auto& species_name = flamelet_config_options.user_scalar_names[iReactant];
AddVolumeOutput("SOURCE_" + species_name, "Source_" + species_name, "SOURCE", "Source " + species_name);
}
}
break;
}
break;
default:
break;
}
Expand Down Expand Up @@ -1581,12 +1588,15 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con

case SPECIES_MODEL::SPECIES_TRANSPORT: {
const auto Node_Species = solver[SPECIES_SOL]->GetNodes();
for (unsigned short iVar = 0; iVar < config->GetnSpecies(); iVar++) {
for (unsigned long iVar = 0; iVar < config->GetnSpecies(); iVar++) {
SetVolumeOutputValue("SPECIES_" + std::to_string(iVar), iPoint, Node_Species->GetSolution(iPoint, iVar));
SetVolumeOutputValue("RES_SPECIES_" + std::to_string(iVar), iPoint, solver[SPECIES_SOL]->LinSysRes(iPoint, iVar));
SetVolumeOutputValue("DIFFUSIVITY_"+ std::to_string(iVar), iPoint, Node_Species->GetDiffusivity(iPoint,iVar));
if (config->GetKind_SlopeLimit_Species() != LIMITER::NONE)
SetVolumeOutputValue("LIMITER_SPECIES_" + std::to_string(iVar), iPoint, Node_Species->GetLimiter(iPoint, iVar));
if (config->GetPyCustomSource()){
SetVolumeOutputValue("SPECIES_UDS_" + std::to_string(iVar), iPoint, Node_Species->GetUserDefinedSource()(iPoint, iVar));
}
}
break;
}
Expand Down
8 changes: 8 additions & 0 deletions SU2_CFD/src/python_wrapper_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ void CDriver::PreprocessPythonInterface(CConfig** config, CGeometry**** geometry

unsigned long CDriver::GetNumberTimeIter() const { return config_container[selected_zone]->GetnTime_Iter(); }

passivedouble CDriver::GetDensityFreeStreamND() const {
return SU2_TYPE::GetValue(config_container[selected_zone]->GetDensity_FreeStreamND());
}

passivedouble CDriver::GetForceRef() const {
return SU2_TYPE::GetValue(config_container[selected_zone]->GetForce_Ref());
}

unsigned long CDriver::GetTimeIter() const { return TimeIter; }

passivedouble CDriver::GetUnsteadyTimeStep() const {
Expand Down
Loading