Skip to content

Commit ebb6806

Browse files
authored
Merge branch 'develop' into develop
2 parents a5b3aa0 + b91b14d commit ebb6806

File tree

15 files changed

+63
-70
lines changed

15 files changed

+63
-70
lines changed

SU2_CFD/include/numerics/CNumerics.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ class CNumerics {
11301130
* \param[in] val_velocity - Pointer to the velocity.
11311131
* \param[in] val_betainc2 - Value of the artificial compresibility factor.
11321132
* \param[in] val_enthalpy - Value of the enthalpy.
1133-
* \param[in] val_dRhodT - Value of the derivative of density w.r.t. temperature.
1133+
* \param[in] val_dRhodh - Value of the derivative of density w.r.t. enthalpy.
11341134
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
11351135
* \param[in] val_scale - Scale of the projection.
11361136
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
@@ -1139,7 +1139,7 @@ class CNumerics {
11391139
const su2double *val_velocity,
11401140
const su2double *val_betainc2,
11411141
const su2double *val_enthalpy,
1142-
const su2double *val_dRhodT,
1142+
const su2double *val_dRhodh,
11431143
const su2double *val_normal,
11441144
su2double val_scale,
11451145
su2double **val_Proj_Jac_Tensor) const;

SU2_CFD/include/variables/CIncEulerVariable.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ class CIncEulerVariable : public CFlowVariable {
7878
* \brief Constructor of the class.
7979
* \param[in] val_pressure - value of the pressure.
8080
* \param[in] velocity - Value of the flow velocity (initialization value).
81-
* \param[in] temperature - Value of the temperature (initialization value).
81+
* \param[in] enthalpy - Value of the enthalpy (initialization value).
8282
* \param[in] npoint - Number of points/nodes/vertices in the domain.
8383
* \param[in] ndim - Number of dimensions of the problem.
8484
* \param[in] nvar - Number of variables of the problem.
8585
* \param[in] config - Definition of the particular problem.
8686
*/
8787

88-
CIncEulerVariable(su2double pressure, const su2double *velocity, su2double temperature,
88+
CIncEulerVariable(su2double pressure, const su2double *velocity, su2double enthalpy,
8989
unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config);
9090

9191
/*!
@@ -125,7 +125,7 @@ class CIncEulerVariable : public CFlowVariable {
125125
}
126126

127127
/*!
128-
* \brief Set the value of the enthalpy for multicomponent incompressible flows with energy equation.
128+
* \brief Set the value of the enthalpy for incompressible flows with energy equation.
129129
* \param[in] iPoint - Point index.
130130
*/
131131
inline void SetEnthalpy(unsigned long iPoint, su2double val_enthalpy) {

SU2_CFD/src/numerics/CNumerics.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2doubl
250250

251251
void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2double *val_velocity,
252252
const su2double *val_betainc2, const su2double *val_enthalpy,
253-
const su2double *val_dRhodT, const su2double *val_normal,
253+
const su2double *val_dRhodh, const su2double *val_normal,
254254
su2double val_scale, su2double **val_Proj_Jac_Tensor) const {
255255
const bool wasActive = AD::BeginPassive();
256256
unsigned short iDim;
@@ -265,54 +265,54 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou
265265
val_Proj_Jac_Tensor[0][0] = val_scale*(proj_vel/(*val_betainc2));
266266
val_Proj_Jac_Tensor[0][1] = val_scale*(val_normal[0]*(*val_density));
267267
val_Proj_Jac_Tensor[0][2] = val_scale*(val_normal[1]*(*val_density));
268-
val_Proj_Jac_Tensor[0][3] = val_scale*((*val_dRhodT)*proj_vel);
268+
val_Proj_Jac_Tensor[0][3] = val_scale*((*val_dRhodh)*proj_vel);
269269

270270
val_Proj_Jac_Tensor[1][0] = val_scale*(val_normal[0] + val_velocity[0]*proj_vel/(*val_betainc2));
271271
val_Proj_Jac_Tensor[1][1] = val_scale*((*val_density)*(val_normal[0]*val_velocity[0] + proj_vel));
272272
val_Proj_Jac_Tensor[1][2] = val_scale*(val_normal[1]*(*val_density)*val_velocity[0]);
273-
val_Proj_Jac_Tensor[1][3] = val_scale*((*val_dRhodT)*val_velocity[0]*proj_vel);
273+
val_Proj_Jac_Tensor[1][3] = val_scale*((*val_dRhodh)*val_velocity[0]*proj_vel);
274274

275275
val_Proj_Jac_Tensor[2][0] = val_scale*(val_normal[1] + val_velocity[1]*proj_vel/(*val_betainc2));
276276
val_Proj_Jac_Tensor[2][1] = val_scale*(val_normal[0]*(*val_density)*val_velocity[1]);
277277
val_Proj_Jac_Tensor[2][2] = val_scale*((*val_density)*(proj_vel + val_normal[1]*val_velocity[1]));
278-
val_Proj_Jac_Tensor[2][3] = val_scale*((*val_dRhodT)*val_velocity[1]*proj_vel);
278+
val_Proj_Jac_Tensor[2][3] = val_scale*((*val_dRhodh)*val_velocity[1]*proj_vel);
279279

280280
val_Proj_Jac_Tensor[3][0] = val_scale*((*val_enthalpy)*proj_vel/(*val_betainc2));
281281
val_Proj_Jac_Tensor[3][1] = val_scale*((*val_enthalpy)*val_normal[0]*(*val_density));
282282
val_Proj_Jac_Tensor[3][2] = val_scale*((*val_enthalpy)*val_normal[1]*(*val_density));
283-
val_Proj_Jac_Tensor[3][3] = val_scale*(((*val_enthalpy)*(*val_dRhodT) + (*val_density))*proj_vel);
283+
val_Proj_Jac_Tensor[3][3] = val_scale*(((*val_enthalpy)*(*val_dRhodh) + (*val_density))*proj_vel);
284284

285285
} else {
286286

287287
val_Proj_Jac_Tensor[0][0] = val_scale*(proj_vel/(*val_betainc2));
288288
val_Proj_Jac_Tensor[0][1] = val_scale*(val_normal[0]*(*val_density));
289289
val_Proj_Jac_Tensor[0][2] = val_scale*(val_normal[1]*(*val_density));
290290
val_Proj_Jac_Tensor[0][3] = val_scale*(val_normal[2]*(*val_density));
291-
val_Proj_Jac_Tensor[0][4] = val_scale*((*val_dRhodT)*proj_vel);
291+
val_Proj_Jac_Tensor[0][4] = val_scale*((*val_dRhodh)*proj_vel);
292292

293293
val_Proj_Jac_Tensor[1][0] = val_scale*(val_normal[0] + val_velocity[0]*proj_vel/(*val_betainc2));
294294
val_Proj_Jac_Tensor[1][1] = val_scale*((*val_density)*(val_normal[0]*val_velocity[0] + proj_vel));
295295
val_Proj_Jac_Tensor[1][2] = val_scale*(val_normal[1]*(*val_density)*val_velocity[0]);
296296
val_Proj_Jac_Tensor[1][3] = val_scale*(val_normal[2]*(*val_density)*val_velocity[0]);
297-
val_Proj_Jac_Tensor[1][4] = val_scale*((*val_dRhodT)*val_velocity[0]*proj_vel);
297+
val_Proj_Jac_Tensor[1][4] = val_scale*((*val_dRhodh)*val_velocity[0]*proj_vel);
298298

299299
val_Proj_Jac_Tensor[2][0] = val_scale*(val_normal[1] + val_velocity[1]*proj_vel/(*val_betainc2));
300300
val_Proj_Jac_Tensor[2][1] = val_scale*(val_normal[0]*(*val_density)*val_velocity[1]);
301301
val_Proj_Jac_Tensor[2][2] = val_scale*((*val_density)*(proj_vel + val_normal[1]*val_velocity[1]));
302302
val_Proj_Jac_Tensor[2][3] = val_scale*(val_normal[2]*(*val_density)*val_velocity[1]);
303-
val_Proj_Jac_Tensor[2][4] = val_scale*((*val_dRhodT)*val_velocity[1]*proj_vel);
303+
val_Proj_Jac_Tensor[2][4] = val_scale*((*val_dRhodh)*val_velocity[1]*proj_vel);
304304

305305
val_Proj_Jac_Tensor[3][0] = val_scale*(val_normal[2] + val_velocity[2]*proj_vel/(*val_betainc2));
306306
val_Proj_Jac_Tensor[3][1] = val_scale*(val_normal[0]*(*val_density)*val_velocity[2]);
307307
val_Proj_Jac_Tensor[3][2] = val_scale*(val_normal[1]*(*val_density)*val_velocity[2]);
308308
val_Proj_Jac_Tensor[3][3] = val_scale*((*val_density)*(proj_vel + val_normal[2]*val_velocity[2]));
309-
val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodT)*val_velocity[2]*proj_vel);
309+
val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodh)*val_velocity[2]*proj_vel);
310310

311311
val_Proj_Jac_Tensor[4][0] = val_scale*((*val_enthalpy)*proj_vel/(*val_betainc2));
312312
val_Proj_Jac_Tensor[4][1] = val_scale*((*val_enthalpy)*val_normal[0]*(*val_density));
313313
val_Proj_Jac_Tensor[4][2] = val_scale*((*val_enthalpy)*val_normal[1]*(*val_density));
314314
val_Proj_Jac_Tensor[4][3] = val_scale*((*val_enthalpy)*val_normal[2]*(*val_density));
315-
val_Proj_Jac_Tensor[4][4] = val_scale*(((*val_enthalpy)*(*val_dRhodT) + (*val_density))*proj_vel);
315+
val_Proj_Jac_Tensor[4][4] = val_scale*(((*val_enthalpy)*(*val_dRhodh) + (*val_density))*proj_vel);
316316

317317
}
318318
AD::EndPassive(wasActive);

SU2_CFD/src/solvers/CIncEulerSolver.cpp

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,18 +2810,17 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28102810
su2double U_time_nM1[MAXNVAR], U_time_n[MAXNVAR], U_time_nP1[MAXNVAR];
28112811
su2double Volume_nM1, Volume_nP1, TimeStep;
28122812
const su2double *Normal = nullptr, *GridVel_i = nullptr, *GridVel_j = nullptr;
2813-
su2double Density, Cp;
2813+
su2double Density;
28142814

28152815
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
28162816
const bool first_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST);
28172817
const bool second_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND);
28182818
const bool energy = config->GetEnergy_Equation();
28192819

2820-
const int ndim = nDim;
2821-
auto V2U = [ndim](su2double Density, su2double Cp, const su2double* V, su2double* U) {
2820+
const int nvar = nVar;
2821+
auto V2U = [nvar](su2double Density, const su2double* V, su2double* U) {
28222822
U[0] = Density;
2823-
for (int iDim = 0; iDim < ndim; iDim++) U[iDim+1] = Density*V[iDim+1];
2824-
U[ndim+1] = Density*Cp*V[ndim+1];
2823+
for (int iVar = 1; iVar < nvar; ++iVar) U[iVar] = Density * V[iVar];
28252824
};
28262825

28272826
/*--- Store the physical time step ---*/
@@ -2848,16 +2847,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28482847
V_time_n = nodes->GetSolution_time_n(iPoint);
28492848
V_time_nP1 = nodes->GetSolution(iPoint);
28502849

2851-
/*--- Access the density and Cp at this node (constant for now). ---*/
2850+
/*--- Access the density at this node (constant for now). ---*/
28522851

28532852
Density = nodes->GetDensity(iPoint);
2854-
Cp = nodes->GetSpecificHeatCp(iPoint);
28552853

28562854
/*--- Compute the conservative variable vector for all time levels. ---*/
28572855

2858-
V2U(Density, Cp, V_time_nM1, U_time_nM1);
2859-
V2U(Density, Cp, V_time_n, U_time_n);
2860-
V2U(Density, Cp, V_time_nP1, U_time_nP1);
2856+
V2U(Density, V_time_nM1, U_time_nM1);
2857+
V2U(Density, V_time_n, U_time_n);
2858+
V2U(Density, V_time_nP1, U_time_nP1);
28612859

28622860
/*--- CV volume at time n+1. As we are on a static mesh, the volume
28632861
of the CV will remained fixed for all time steps. ---*/
@@ -2878,13 +2876,9 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28782876
/*--- Compute the Jacobian contribution due to the dual time source term. ---*/
28792877

28802878
if (implicit) {
2881-
su2double delta = (second_order? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
2882-
2883-
for (iDim = 0; iDim < nDim; iDim++)
2884-
Jacobian.AddVal2Diag(iPoint, iDim+1, delta);
2879+
su2double delta = (second_order ? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
28852880

2886-
if (energy) delta *= Cp;
2887-
Jacobian.AddVal2Diag(iPoint, nDim+1, delta);
2881+
for (iVar = 1; iVar < nVar; ++iVar) Jacobian.AddVal2Diag(iPoint, iVar, delta);
28882882
}
28892883
}
28902884
END_SU2_OMP_FOR
@@ -2909,8 +2903,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29092903

29102904
V_time_n = nodes->GetSolution_time_n(iPoint);
29112905
Density = nodes->GetDensity(iPoint);
2912-
Cp = nodes->GetSpecificHeatCp(iPoint);
2913-
V2U(Density, Cp, V_time_n, U_time_n);
2906+
V2U(Density, V_time_n, U_time_n);
29142907

29152908
GridVel_i = geometry->nodes->GetGridVel(iPoint);
29162909

@@ -2965,8 +2958,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29652958

29662959
V_time_n = nodes->GetSolution_time_n(iPoint);
29672960
Density = nodes->GetDensity(iPoint);
2968-
Cp = nodes->GetSpecificHeatCp(iPoint);
2969-
V2U(Density, Cp, V_time_n, U_time_n);
2961+
V2U(Density, V_time_n, U_time_n);
29702962

29712963
for (iVar = 0; iVar < nVar-!energy; iVar++)
29722964
LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL;
@@ -2992,16 +2984,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29922984
V_time_n = nodes->GetSolution_time_n(iPoint);
29932985
V_time_nP1 = nodes->GetSolution(iPoint);
29942986

2995-
/*--- Access the density and Cp at this node (constant for now). ---*/
2987+
/*--- Access the density at this node (constant for now). ---*/
29962988

29972989
Density = nodes->GetDensity(iPoint);
2998-
Cp = nodes->GetSpecificHeatCp(iPoint);
29992990

30002991
/*--- Compute the conservative variable vector for all time levels. ---*/
30012992

3002-
V2U(Density, Cp, V_time_nM1, U_time_nM1);
3003-
V2U(Density, Cp, V_time_n, U_time_n);
3004-
V2U(Density, Cp, V_time_nP1, U_time_nP1);
2993+
V2U(Density, V_time_nM1, U_time_nM1);
2994+
V2U(Density, V_time_n, U_time_n);
2995+
V2U(Density, V_time_nP1, U_time_nP1);
30052996

30062997
/*--- CV volume at time n-1 and n+1. In the case of dynamically deforming
30072998
grids, the volumes will change. On rigidly transforming grids, the
@@ -3027,11 +3018,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
30273018
if (implicit) {
30283019
su2double delta = (second_order? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
30293020

3030-
for (iDim = 0; iDim < nDim; iDim++)
3031-
Jacobian.AddVal2Diag(iPoint, iDim+1, delta);
3032-
3033-
if (energy) delta *= Cp;
3034-
Jacobian.AddVal2Diag(iPoint, nDim+1, delta);
3021+
for (iVar = 1; iVar < nVar; ++iVar)
3022+
Jacobian.AddVal2Diag(iPoint, iVar, delta);
30353023
}
30363024
}
30373025
END_SU2_OMP_FOR

SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ void CSpeciesFlameletSolver::BC_Isothermal_Wall_Generic(CGeometry* geometry, CSo
440440
/*--- Check if the node belongs to the domain (i.e., not a halo node). ---*/
441441

442442
if (geometry->nodes->GetDomain(iPoint)) {
443-
if (config->GetMarker_StrongBC(Marker_Tag) == true) {
443+
if (config->GetMarker_StrongBC(Marker_Tag)) {
444444
/*--- Initial guess for enthalpy value. ---*/
445445
enth_wall = nodes->GetSolution(iPoint, I_ENTH);
446446

SU2_CFD/src/variables/CIncNSVariable.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do
124124

125125
SetSpecificHeatCp(iPoint, FluidModel->GetCp());
126126
SetSpecificHeatCv(iPoint, FluidModel->GetCv());
127+
128+
/*--- Set enthalpy ---*/
129+
127130
SetEnthalpy(iPoint, FluidModel->GetEnthalpy());
128131

129132
return physical;

SU2_PY/SU2/io/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def rec2dict(array_in):
359359
value = array_in[key].tolist()[0][0]
360360

361361
# convert string
362-
if isinstance(value[0], unicode):
362+
if isinstance(value[0], str):
363363
value = str(value[0])
364364

365365
# convert array

SU2_PY/SU2/util/bunch.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,13 @@ def __repr__(self):
194194
195195
(*) Invertible so long as collection contents are each repr-invertible.
196196
"""
197-
keys = self.keys()
198-
keys.sort()
197+
keys = sorted(self.keys())
199198
args = ", ".join(["%s=%r" % (key, self[key]) for key in keys])
200199
return "%s(%s)" % (self.__class__.__name__, args)
201200

202201
def __str__(self):
203202
"""String-form of a OrderedBunch."""
204-
keys = self.keys()
205-
keys.sort()
203+
keys = sorted(self.keys())
206204
args = ", ".join(["%s=%r" % (key, self[key]) for key in keys])
207205
return "{%s}" % args
208206

@@ -247,7 +245,7 @@ def bunchify(x):
247245
nb. As dicts are not hashable, they cannot be nested in sets/frozensets.
248246
"""
249247
if isinstance(x, dict):
250-
return Bunch((k, bunchify(v)) for k, v in x.iteritems())
248+
return Bunch((k, bunchify(v)) for k, v in x.items())
251249
elif isinstance(x, (list, tuple)):
252250
return type(x)(bunchify(v) for v in x)
253251
else:
@@ -273,7 +271,7 @@ def unbunchify(x):
273271
nb. As dicts are not hashable, they cannot be nested in sets/frozensets.
274272
"""
275273
if isinstance(x, dict):
276-
return dict((k, unbunchify(v)) for k, v in x.iteritems())
274+
return dict((k, unbunchify(v)) for k, v in x.items())
277275
elif isinstance(x, (list, tuple)):
278276
return type(x)(unbunchify(v) for v in x)
279277
else:

SU2_PY/SU2/util/ordered_bunch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def ordered_bunchify(x):
265265
nb. As dicts are not hashable, they cannot be nested in sets/frozensets.
266266
"""
267267
if isinstance(x, dict):
268-
return OrderedBunch((k, ordered_bunchify(v)) for k, v in x.iteritems())
268+
return OrderedBunch((k, ordered_bunchify(v)) for k, v in x.items())
269269
elif isinstance(x, (list, tuple)):
270270
return type(x)(ordered_bunchify(v) for v in x)
271271
else:
@@ -291,9 +291,9 @@ def ordered_unbunchify(x):
291291
nb. As dicts are not hashable, they cannot be nested in sets/frozensets.
292292
"""
293293
if isinstance(x, OrderedDict):
294-
return OrderedDict((k, ordered_unbunchify(v)) for k, v in x.iteritems())
294+
return OrderedDict((k, ordered_unbunchify(v)) for k, v in x.items())
295295
elif isinstance(x, dict):
296-
return dict((k, ordered_unbunchify(v)) for k, v in x.iteritems())
296+
return dict((k, ordered_unbunchify(v)) for k, v in x.items())
297297
elif isinstance(x, (list, tuple)):
298298
return type(x)(ordered_unbunchify(v) for v in x)
299299
else:

SU2_PY/SU2/util/ordered_dict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __reversed__(self):
8585
def clear(self):
8686
"od.clear() -> None. Remove all items from od."
8787
try:
88-
for node in self.__map.itervalues():
88+
for node in self.__map.values():
8989
del node[:]
9090
root = self.__root
9191
root[:] = [root, root, None]

0 commit comments

Comments
 (0)