Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 18 additions & 6 deletions Common/include/linear_algebra/CSysMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ class CSysMatrix {
* \param[in] val_block - Block to add to the diagonal of the matrix.
* \param[in] alpha - Scale factor.
*/
template<class OtherType, bool Overwrite = true>
inline void SetBlock2Diag(unsigned long block_i, const OtherType* const* val_block, OtherType alpha = 1.0) {
template<class OtherType, bool Overwrite = true, class T = ScalarType>
inline void SetBlock2Diag(unsigned long block_i, const OtherType& val_block, T alpha = 1.0) {

auto mat_ii = &matrix[dia_ptr[block_i]*nVar*nEqn];

Expand All @@ -723,17 +723,17 @@ class CSysMatrix {
/*!
* \brief Non overwrite version of SetBlock2Diag, also with scaling.
*/
template<class OtherType>
inline void AddBlock2Diag(unsigned long block_i, const OtherType* const* val_block, OtherType alpha = 1.0) {
template<class OtherType, class T = ScalarType>
inline void AddBlock2Diag(unsigned long block_i, const OtherType& val_block, T alpha = 1.0) {
SetBlock2Diag<OtherType,false>(block_i, val_block, alpha);
}

/*!
* \brief Short-hand to AddBlock2Diag with alpha = -1, i.e. subtracts from the current diagonal.
*/
template<class OtherType>
inline void SubtractBlock2Diag(unsigned long block_i, const OtherType* const* val_block) {
AddBlock2Diag(block_i, val_block, OtherType(-1));
inline void SubtractBlock2Diag(unsigned long block_i, const OtherType& val_block) {
AddBlock2Diag(block_i, val_block, -1.0);
}

/*!
Expand All @@ -748,6 +748,18 @@ class CSysMatrix {
matrix[dia_ptr[block_i]*nVar*nVar + iVar*(nVar+1)] += PassiveAssign(val_matrix);
}

/*!
* \brief Adds the specified value to the diagonal of the (i, i) subblock
* of the matrix-by-blocks structure.
* \param[in] block_i - Diagonal index.
* \param[in] iVar - Variable index.
* \param[in] val - Value to add to the diagonal elements of A(i, i).
*/
template<class OtherType>
inline void AddVal2Diag(unsigned long block_i, unsigned long iVar, OtherType val) {
matrix[dia_ptr[block_i]*nVar*nVar + iVar*(nVar+1)] += PassiveAssign(val);
}

/*!
* \brief Sets the specified value to the diagonal of the (i, i) subblock
* of the matrix-by-blocks structure.
Expand Down
51 changes: 11 additions & 40 deletions SU2_CFD/include/solvers/CEulerSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {

vector<CFluidModel*> FluidModel; /*!< \brief fluid model used in the solver. */

unsigned long ErrorCounter = 0; /*!< \brief Counter for number of un-physical states. */

su2double Global_Delta_Time = 0.0, /*!< \brief Time-step for TIME_STEPPING time marching strategy. */
Global_Delta_UnstTimeND = 0.0; /*!< \brief Unsteady time step for the dual time strategy. */

/*--- Turbomachinery Solver Variables ---*/

su2double ***AverageFlux = nullptr,
Expand Down Expand Up @@ -160,12 +155,6 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {

/*--- End of Turbomachinery Solver Variables ---*/

/*!
* \brief Generic implementation of explicit iterations (RK, Classic RK and EULER).
*/
template<ENUM_TIME_INT IntegrationType>
void Explicit_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep);

/*!
* \brief Preprocessing actions common to the Euler and NS solvers.
* \param[in] geometry - Geometrical definition of the problem.
Expand Down Expand Up @@ -239,7 +228,7 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
*/
void SetMax_Eigenvalue(CGeometry *geometry, CConfig *config);
void SetMax_Eigenvalue(CGeometry *geometry, const CConfig *config);

/*!
* \brief Compute the undivided laplacian for the solution.
Expand All @@ -266,11 +255,10 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
* \brief Compute the velocity^2, SoundSpeed, Pressure, Enthalpy, Viscosity.
* \param[in] solver_container - Container vector with all the solutions.
* \param[in] config - Definition of the particular problem.
* \param[in] Output - boolean to determine whether to print output.
* \return - The number of non-physical points.
*/
virtual unsigned long SetPrimitive_Variables(CSolver **solver_container,
CConfig *config, bool Output);
const CConfig *config);

/*!
* \brief Set gradients of coefficients for fixed CL mode
Expand All @@ -285,6 +273,13 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
*/
void InstantiateEdgeNumerics(const CSolver* const* solvers, const CConfig* config) final;

/*!
* \brief Set the solver nondimensionalization.
* \param[in] config - Definition of the particular problem.
* \param[in] iMesh - Index of the mesh in multigrid computations.
*/
void SetNondimensionalization(CConfig *config, unsigned short iMesh);

public:
/*!
* \brief Constructor of the class.
Expand All @@ -305,13 +300,6 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
*/
~CEulerSolver(void) override;

/*!
* \brief Set the solver nondimensionalization.
* \param[in] config - Definition of the particular problem.
* \param[in] iMesh - Index of the mesh in multigrid computations.
*/
void SetNondimensionalization(CConfig *config, unsigned short iMesh) final;

/*!
* \brief Compute the pressure at the infinity.
* \return Value of the pressure at the infinity.
Expand Down Expand Up @@ -459,8 +447,7 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
* \param[in,out] preconditioner - The preconditioner matrix, must be allocated outside.
*/
void SetPreconditioner(const CConfig *config, unsigned long iPoint,
su2double delta, su2double** preconditioner) const;
using CSolver::SetPreconditioner; /*--- Silence warning. ---*/
su2double delta, su2activematrix& preconditioner) const;

/*!
* \brief Parallelization of Undivided Laplacian.
Expand Down Expand Up @@ -1084,22 +1071,6 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
*/
void UpdateCustomBoundaryConditions(CGeometry **geometry_container, CConfig *config) final;

/*!
* \brief Set the total residual adding the term that comes from the Dual Time Strategy.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver_container - Container vector with all the solutions.
* \param[in] config - Definition of the particular problem.
* \param[in] iRKStep - Current step of the Runge-Kutta iteration.
* \param[in] iMesh - Index of the mesh in multigrid computations.
* \param[in] RunTime_EqSystem - System of equations which is going to be solved.
*/
void SetResidual_DualTime(CGeometry *geometry,
CSolver **solver_container,
CConfig *config,
unsigned short iRKStep,
unsigned short iMesh,
unsigned short RunTime_EqSystem) final;

/*!
* \brief Load a solution from a restart file.
* \param[in] geometry - Geometrical definition of the problem.
Expand Down Expand Up @@ -1130,7 +1101,7 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
* \brief Set the solution using the Freestream values.
* \param[in] config - Definition of the particular problem.
*/
void SetFreeStream_Solution(CConfig *config) final;
void SetFreeStream_Solution(const CConfig *config) final;

/*!
* \brief Initilize turbo containers.
Expand Down
1 change: 0 additions & 1 deletion SU2_CFD/include/solvers/CFEM_DG_EulerSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ class CFEM_DG_EulerSolver : public CSolver {
void SetNondimensionalization(CConfig *config,
unsigned short iMesh,
const bool writeOutput);
using CSolver::SetNondimensionalization;

/*!
* \brief Get a pointer to the vector of the solution degrees of freedom.
Expand Down
Loading