Skip to content

Commit 1d5d240

Browse files
authored
Merge branch 'develop' into chore_catch_ortho_fail
2 parents c11d52b + bd4d182 commit 1d5d240

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
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]

SU2_PY/SU2/run/interface.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838
# Setup
3939
# ------------------------------------------------------------
4040

41-
SU2_RUN = os.environ["SU2_RUN"]
41+
try:
42+
SU2_RUN = os.environ["SU2_RUN"]
43+
except KeyError as exc:
44+
raise RuntimeError(
45+
'Environment variable "SU2_RUN" is not set. Please set SU2_RUN to the SU2 installation bin directory.'
46+
) from exc
47+
4248
sys.path.append(SU2_RUN)
4349
quote = '"' if sys.platform == "win32" else ""
4450

@@ -263,14 +269,17 @@ def run_command(Command):
263269
"""
264270
sys.stdout.flush()
265271

272+
# Avoid potential deadlocks when a child process writes heavily to stderr:
273+
# read stderr via communicate() while streaming stdout to the console.
266274
# Use communicate() to continuously drain stderr and avoid deadlocks if the
267275
# subprocess writes a lot of output to stderr.
268276
proc = subprocess.Popen(
269277
Command, shell=True, stdout=sys.stdout, stderr=subprocess.PIPE
270278
)
271279
_, stderr = proc.communicate()
280+
272281
return_code = proc.returncode
273-
message = stderr.decode(errors="replace")
282+
message = (stderr or b"").decode(errors="replace")
274283

275284
if return_code < 0:
276285
message = "SU2 process was terminated by signal '%s'\n%s" % (

0 commit comments

Comments
 (0)