Skip to content

Commit 4acce6f

Browse files
authored
Merge branch 'develop' into bugfix/preconfigure-download-paths
2 parents 281b10f + b4143f1 commit 4acce6f

File tree

9 files changed

+32
-46
lines changed

9 files changed

+32
-46
lines changed

SU2_CFD/src/solvers/CIncEulerSolver.cpp

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,18 +2799,17 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
27992799
su2double U_time_nM1[MAXNVAR], U_time_n[MAXNVAR], U_time_nP1[MAXNVAR];
28002800
su2double Volume_nM1, Volume_nP1, TimeStep;
28012801
const su2double *Normal = nullptr, *GridVel_i = nullptr, *GridVel_j = nullptr;
2802-
su2double Density, Cp;
2802+
su2double Density;
28032803

28042804
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
28052805
const bool first_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST);
28062806
const bool second_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND);
28072807
const bool energy = config->GetEnergy_Equation();
28082808

2809-
const int ndim = nDim;
2810-
auto V2U = [ndim](su2double Density, su2double Cp, const su2double* V, su2double* U) {
2809+
const int nvar = nVar;
2810+
auto V2U = [nvar](su2double Density, const su2double* V, su2double* U) {
28112811
U[0] = Density;
2812-
for (int iDim = 0; iDim < ndim; iDim++) U[iDim+1] = Density*V[iDim+1];
2813-
U[ndim+1] = Density*Cp*V[ndim+1];
2812+
for (int iVar = 1; iVar < nvar; ++iVar) U[iVar] = Density * V[iVar];
28142813
};
28152814

28162815
/*--- Store the physical time step ---*/
@@ -2837,16 +2836,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28372836
V_time_n = nodes->GetSolution_time_n(iPoint);
28382837
V_time_nP1 = nodes->GetSolution(iPoint);
28392838

2840-
/*--- Access the density and Cp at this node (constant for now). ---*/
2839+
/*--- Access the density at this node (constant for now). ---*/
28412840

28422841
Density = nodes->GetDensity(iPoint);
2843-
Cp = nodes->GetSpecificHeatCp(iPoint);
28442842

28452843
/*--- Compute the conservative variable vector for all time levels. ---*/
28462844

2847-
V2U(Density, Cp, V_time_nM1, U_time_nM1);
2848-
V2U(Density, Cp, V_time_n, U_time_n);
2849-
V2U(Density, Cp, V_time_nP1, U_time_nP1);
2845+
V2U(Density, V_time_nM1, U_time_nM1);
2846+
V2U(Density, V_time_n, U_time_n);
2847+
V2U(Density, V_time_nP1, U_time_nP1);
28502848

28512849
/*--- CV volume at time n+1. As we are on a static mesh, the volume
28522850
of the CV will remained fixed for all time steps. ---*/
@@ -2867,13 +2865,9 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28672865
/*--- Compute the Jacobian contribution due to the dual time source term. ---*/
28682866

28692867
if (implicit) {
2870-
su2double delta = (second_order? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
2871-
2872-
for (iDim = 0; iDim < nDim; iDim++)
2873-
Jacobian.AddVal2Diag(iPoint, iDim+1, delta);
2868+
su2double delta = (second_order ? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
28742869

2875-
if (energy) delta *= Cp;
2876-
Jacobian.AddVal2Diag(iPoint, nDim+1, delta);
2870+
for (iVar = 1; iVar < nVar; ++iVar) Jacobian.AddVal2Diag(iPoint, iVar, delta);
28772871
}
28782872
}
28792873
END_SU2_OMP_FOR
@@ -2898,8 +2892,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28982892

28992893
V_time_n = nodes->GetSolution_time_n(iPoint);
29002894
Density = nodes->GetDensity(iPoint);
2901-
Cp = nodes->GetSpecificHeatCp(iPoint);
2902-
V2U(Density, Cp, V_time_n, U_time_n);
2895+
V2U(Density, V_time_n, U_time_n);
29032896

29042897
GridVel_i = geometry->nodes->GetGridVel(iPoint);
29052898

@@ -2954,8 +2947,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29542947

29552948
V_time_n = nodes->GetSolution_time_n(iPoint);
29562949
Density = nodes->GetDensity(iPoint);
2957-
Cp = nodes->GetSpecificHeatCp(iPoint);
2958-
V2U(Density, Cp, V_time_n, U_time_n);
2950+
V2U(Density, V_time_n, U_time_n);
29592951

29602952
for (iVar = 0; iVar < nVar-!energy; iVar++)
29612953
LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL;
@@ -2981,16 +2973,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29812973
V_time_n = nodes->GetSolution_time_n(iPoint);
29822974
V_time_nP1 = nodes->GetSolution(iPoint);
29832975

2984-
/*--- Access the density and Cp at this node (constant for now). ---*/
2976+
/*--- Access the density at this node (constant for now). ---*/
29852977

29862978
Density = nodes->GetDensity(iPoint);
2987-
Cp = nodes->GetSpecificHeatCp(iPoint);
29882979

29892980
/*--- Compute the conservative variable vector for all time levels. ---*/
29902981

2991-
V2U(Density, Cp, V_time_nM1, U_time_nM1);
2992-
V2U(Density, Cp, V_time_n, U_time_n);
2993-
V2U(Density, Cp, V_time_nP1, U_time_nP1);
2982+
V2U(Density, V_time_nM1, U_time_nM1);
2983+
V2U(Density, V_time_n, U_time_n);
2984+
V2U(Density, V_time_nP1, U_time_nP1);
29942985

29952986
/*--- CV volume at time n-1 and n+1. In the case of dynamically deforming
29962987
grids, the volumes will change. On rigidly transforming grids, the
@@ -3016,11 +3007,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
30163007
if (implicit) {
30173008
su2double delta = (second_order? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
30183009

3019-
for (iDim = 0; iDim < nDim; iDim++)
3020-
Jacobian.AddVal2Diag(iPoint, iDim+1, delta);
3021-
3022-
if (energy) delta *= Cp;
3023-
Jacobian.AddVal2Diag(iPoint, nDim+1, delta);
3010+
for (iVar = 1; iVar < nVar; ++iVar)
3011+
Jacobian.AddVal2Diag(iPoint, iVar, delta);
30243012
}
30253013
}
30263014
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_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]

SU2_PY/SU2/util/switch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, value):
3838
def __iter__(self):
3939
"""Return the match method once, then stop"""
4040
yield self.match
41-
raise StopIteration
41+
return
4242

4343
def match(self, *args):
4444
"""Indicate whether or not to enter a case suite"""

TestCases/parallel_regression_AD.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ def main():
316316
da_unsteadyCHT_cylinder.cfg_dir = "coupled_cht/disc_adj_unsteadyCHT_cylinder"
317317
da_unsteadyCHT_cylinder.cfg_file = "chtMaster.cfg"
318318
da_unsteadyCHT_cylinder.test_iter = 2
319-
da_unsteadyCHT_cylinder.test_vals = [-12.131633, -12.617906, -12.688933, -16.179747, -6.432277, 0.000000, 75.761000, 0.247780]
320-
da_unsteadyCHT_cylinder.test_vals_aarch64 = [-12.131633, -12.617906, -12.688933, -16.179747, -6.432277, 0.000000, 75.761000, 0.247780]
319+
da_unsteadyCHT_cylinder.test_vals = [-8.479629, -9.239920, -9.234868, -15.934511, -13.662012, 0.000000, 89.932000, 0.295190]
320+
da_unsteadyCHT_cylinder.test_vals_aarch64 = [-8.479629, -9.239920, -9.234868, -15.934511, -13.662012, 0.000000, 89.932000, 0.295190]
321321
da_unsteadyCHT_cylinder.unsteady = True
322322
da_unsteadyCHT_cylinder.multizone = True
323323
test_list.append(da_unsteadyCHT_cylinder)

TestCases/tutorials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def main():
4949
cht_incompressible_unsteady.cfg_dir = "../Tutorials/multiphysics/unsteady_cht/"
5050
cht_incompressible_unsteady.cfg_file = "cht_2d_3cylinders.cfg"
5151
cht_incompressible_unsteady.test_iter = 2
52-
cht_incompressible_unsteady.test_vals = [-2.661443, -2.546289, -0.080399, -0.080399, -0.080399, -12.421980, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 238.240000] #last columns
52+
cht_incompressible_unsteady.test_vals = [-2.661440, -2.534489, -0.080399, -0.080399, -0.080399, -12.421979, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 238.240000] #last columns
5353
cht_incompressible_unsteady.multizone = True
5454
cht_incompressible_unsteady.unsteady = True
5555
test_list.append(cht_incompressible_unsteady)

0 commit comments

Comments
 (0)