Skip to content

Commit 8ddd591

Browse files
authored
Merge pull request #2654 from shbhmexe/fix/io-tools-expand-time-list-handling
fix(SU2_PY,SU2_CFD): Fix division-by-zero and logic bugs
2 parents fc3538b + 77e6047 commit 8ddd591

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

SU2_CFD/src/numerics/flow/flow_diffusion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void CAvgGrad_Base::AddTauWall(const su2double *UnitNormal,
163163
GeometryToolbox::TangentProjection(nDim, tau, UnitNormal, TauTangent);
164164

165165
su2double WallShearStress = GeometryToolbox::Norm(nDim, TauTangent);
166-
su2double Scale = TauWall / WallShearStress;
166+
su2double Scale = TauWall / fmax(WallShearStress, EPS);
167167

168168
/*--- Scale the stress tensor by the ratio of the wall shear stress
169169
(from wall functions) to the one computed above. ---*/

SU2_CFD/src/solvers/CRadP1Solver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ void CRadP1Solver::SetTime_Step(CGeometry *geometry, CSolver **solver_container,
575575
su2double Area, Vol, Lambda;
576576
su2double Global_Delta_Time = 1E6, Local_Delta_Time = 0.0, K_v = 0.25;
577577
su2double CFL = config->GetCFL_Rad();
578-
su2double GammaP1 = 1.0 / (3.0*(Absorption_Coeff + Scattering_Coeff));
578+
su2double GammaP1 = 1.0 / (3.0*fmax(Absorption_Coeff + Scattering_Coeff, EPS));
579579
const su2double* Normal;
580580

581581
/*--- Compute spectral radius based on thermal conductivity ---*/

SU2_PY/SU2/eval/gradients.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def adjoint(func_name, config, state=None):
259259
name = files["RESTART_FILE_1"]
260260
name = su2io.expand_part(name, config)
261261
link.extend(name)
262-
if "RESTART_FILE_1" in files: # not the case for 1st order time stepping
262+
if "RESTART_FILE_2" in files: # not the case for 1st order time stepping
263263
name = files["RESTART_FILE_2"]
264264
name = su2io.expand_part(name, config)
265265
link.extend(name)

SU2_PY/SU2/io/tools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,9 +1064,11 @@ def expand_time(name, config):
10641064
name_pat = add_suffix(name, "%05d")
10651065
names = [name_pat % i for i in range(n_start_time, n_time)]
10661066
else:
1067+
names = [] # Initialize empty list before loop
10671068
for n in range(len(name)):
10681069
name_pat = add_suffix(name[n], "%05d")
1069-
names = [name_pat % i for i in range(n_start_time, n_time)]
1070+
# Use extend() to accumulate all filenames (consistent with expand_zones)
1071+
names.extend([name_pat % i for i in range(n_start_time, n_time)])
10701072
else:
10711073
if not isinstance(name, list):
10721074
names = [name]

0 commit comments

Comments
 (0)