Skip to content
Merged

Fix MSW #1166

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
6 changes: 1 addition & 5 deletions SU2_CFD/include/numerics/flow/convection/fvs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,16 @@
class CUpwMSW_Flow final : public CNumerics {
private:
bool implicit;
su2double *Diff_U;
su2double *u_i, *u_j, *ust_i, *ust_j;
su2double *Fc_i, *Fc_j;
su2double *Lambda_i, *Lambda_j;
su2double rhos_i, rhos_j;
su2double *Ust_i, *Ust_j, *Vst_i, *Vst_j, *Velst_i, *Velst_j;
su2double *Vst_i, *Vst_j, *Velst_i, *Velst_j;
su2double **P_Tensor, **invP_Tensor;
unsigned short nPrimVar, nVar, nDim;

su2double** Jacobian_i; /*!< \brief The Jacobian w.r.t. point i after computation. */
su2double** Jacobian_j; /*!< \brief The Jacobian w.r.t. point j after computation. */

public:

/*!
* \brief Constructor of the class.
* \param[in] val_nDim - Number of dimensions of the problem.
Expand Down
5 changes: 2 additions & 3 deletions SU2_CFD/include/variables/CEulerVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,9 @@ class CEulerVariable : public CVariable {
* \param[in] soundspeed2 - Value of soundspeed^2.
*/
bool SetSoundSpeed(unsigned long iPoint, su2double soundspeed2) final {
su2double radical = soundspeed2;
if (radical < 0.0) return true;
if (soundspeed2 < 0.0) return true;
else {
Primitive(iPoint,nDim+4) = sqrt(radical);
Primitive(iPoint,nDim+4) = sqrt(soundspeed2);
return false;
}
}
Expand Down
34 changes: 19 additions & 15 deletions SU2_CFD/src/numerics/flow/convection/fvs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ CUpwMSW_Flow::CUpwMSW_Flow(unsigned short val_nDim, unsigned short val_nVar, con
implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);

/*--- Allocate arrays ---*/
Diff_U = new su2double [nVar];
Fc_i = new su2double [nVar];
Fc_j = new su2double [nVar];
Lambda_i = new su2double [nVar];
Expand All @@ -47,10 +46,8 @@ CUpwMSW_Flow::CUpwMSW_Flow(unsigned short val_nDim, unsigned short val_nVar, con
u_j = new su2double [nDim];
ust_i = new su2double [nDim];
ust_j = new su2double [nDim];
Vst_i = new su2double [nPrimVar];
Vst_j = new su2double [nPrimVar];
Ust_i = new su2double [nVar];
Ust_j = new su2double [nVar];
Vst_i = new su2double [nDim+5];
Vst_j = new su2double [nDim+5];

Velst_i = new su2double [nDim];
Velst_j = new su2double [nDim];
Expand All @@ -70,7 +67,6 @@ CUpwMSW_Flow::CUpwMSW_Flow(unsigned short val_nDim, unsigned short val_nVar, con

CUpwMSW_Flow::~CUpwMSW_Flow(void) {

delete [] Diff_U;
delete [] Fc_i;
delete [] Fc_j;
delete [] Lambda_i;
Expand All @@ -80,9 +76,7 @@ CUpwMSW_Flow::~CUpwMSW_Flow(void) {
delete [] u_j;
delete [] ust_i;
delete [] ust_j;
delete [] Ust_i;
delete [] Vst_i;
delete [] Ust_j;
delete [] Vst_j;
delete [] Velst_i;
delete [] Velst_j;
Expand All @@ -105,7 +99,7 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) {
implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);

unsigned short iDim, iVar, jVar, kVar;
su2double P_i, P_j;
su2double rho_i, rho_j, P_i, P_j, H_i, H_j;
su2double ProjVel_i, ProjVel_j, ProjVelst_i, ProjVelst_j;
su2double sqvel_i, sqvel_j;
su2double alpha, w, dp, onemw;
Expand Down Expand Up @@ -138,14 +132,28 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) {

/*--- Load variables from nodes i & j ---*/

rhos_i = V_i[0];
rhos_j = V_j[0];
for (iDim = 0; iDim < nDim; iDim++) {
u_i[iDim] = V_i[iDim+1];
u_j[iDim] = V_j[iDim+1];
}
P_i = V_i[nDim+1];
P_j = V_j[nDim+1];
rho_i = V_i[nDim+2];
rho_j = V_j[nDim+2];
H_i = V_i[nDim+3];
H_j = V_j[nDim+3];

/*--- Recompute conservatives ---*/

su2double U_i[5] = {0.0}, U_j[5] = {0.0};

U_i[0] = rho_i; U_j[0] = rho_j;
for (iDim = 0; iDim < nDim; iDim++) {
U_i[iDim+1] = rho_i*u_i[iDim];
U_j[iDim+1] = rho_j*u_j[iDim];
}
U_i[nDim+1] = rho_i*H_i - P_i;
U_j[nDim+1] = rho_j*H_j - P_j;

/*--- Calculate supporting quantities ---*/

Expand All @@ -166,10 +174,6 @@ CNumerics::ResidualType<> CUpwMSW_Flow::ComputeResidual(const CConfig* config) {

/*--- Calculate weighted state vector (*) for i & j ---*/

for (iVar = 0; iVar < nVar; iVar++) {
Ust_i[iVar] = onemw*U_i[iVar] + w*U_j[iVar];
Ust_j[iVar] = onemw*U_j[iVar] + w*U_i[iVar];
}
for (iVar = 0; iVar < nDim+5; iVar++) {
Vst_i[iVar] = onemw*V_i[iVar] + w*V_j[iVar];
Vst_j[iVar] = onemw*V_j[iVar] + w*V_i[iVar];
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/src/solvers/CNSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C
CommonPreprocessing(geometry, solver_container, config, iMesh, iRKStep, RunTime_EqSystem, Output);

/*--- Compute gradient for MUSCL reconstruction, for output (i.e. the
turbulence solver) only density and velocity are needed ---*/
turbulence solver, and post) only temperature and velocity are needed ---*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is post referring to post-processing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I did not write "processing" because the 2 lines lined up with just post


const auto nPrimVarGrad_bak = nPrimVarGrad;
if (Output) {
Expand Down