Skip to content

Fix STATION function names in SU2_PY: SU2_GEO numbers stations from 1 - #2934

Closed
nikita-ageev wants to merge 5 commits into
su2code:developfrom
nikita-ageev:fix/geo-station-names
Closed

nikita-ageev wants to merge 5 commits into
su2code:developfrom
nikita-ageev:fix/geo-station-names

Conversation

@nikita-ageev

@nikita-ageev nikita-ageev commented Sep 28, 2026 •

Copy link
Copy Markdown

Small fix, see the diff.

SU2_GEO writes STATION1_* ... STATIONn_* for the stations in
GEO_LOCATION_STATIONS, while optnames_geo listed STATION0_* ... STATION19_*.
STATION20_* was therefore rejected by SU2.eval.func/grad as an unknown
function name, and STATION0_* is never written.
@joshkellyjak joshkellyjak self-assigned this Oct 9, 2026
Comment thread SU2_PY/SU2/io/tools.py Outdated
# see SU2_GEO.cpp, so the names cover stations 1 to 20.
PerStation = []
for i in range(20):
for i in range(1, 21):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why a 20-cap? Can we remove the cap in SU2_PY?

Address review comment: instead of listing STATION1_* ... STATION20_*,
match the per-station names with a regex (is_optname_geo), since SU2_GEO
does not limit the number of GEO_LOCATION_STATIONS.
bigfooted added a commit that referenced this pull request Oct 10, 2026
…spaces) (#2935)

## Proposed Changes

`SU2_PY/SU2/run/interface.py` builds the command as
`os.path.join(SU2_RUN, "SU2_CFD") + " config_CFD.cfg"` and runs it with
`shell=True`. The executable path is quoted only on Windows (`quote =
'"' if sys.platform == "win32" else ""`), so on Linux/macOS any SU2_PY
script (shape_optimization.py, parallel_computation.py, ...) fails if
`SU2_RUN` contains a space.

This PR moves the quoting into `build_command`: the first word of the
command is joined with `SU2_RUN` and quoted (`shlex.quote` on POSIX,
double quotes on Windows as before), the callers pass plain `"SU2_CFD
config_CFD.cfg"` strings. The quoted path is then inserted into the MPI
template as before (`mpirun -n %i %s`, `srun`, `SU2_MPI_COMMAND`). The
module-level `quote` variable is removed; it was not used outside
`interface.py`.

Reproduction on macOS, `SU2_RUN=".../su2 bin"`, `shape_opt_euler_py`
from serial_regression.py:

```
before:
Command = /.../su2 bin/SU2_CFD config_CFD.cfg
SU2 process returned error '127'
/bin/sh: /.../su2: No such file or directory

after:
Command = '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/.../su2 bin/SU2_CFD' config_CFD.cfg
optimization runs to the end
```

With the change and `SU2_RUN` containing a space, `history_project.csv`
and the optimizer output of `shape_opt_euler_py` are identical to
develop with a `SU2_RUN` without spaces. The MPI path was checked with
`NUMBER_PART=2`: `mpirun -n 2 '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/.../su2 bin/SU2_CFD' config_CFD.cfg`
runs with 2 ranks. The Windows branch produces the same string as
before.

## Related Work

None found. Separate from #2934 (also SU2_PY).

## PR Checklist

- [X] I am submitting my contribution to the develop branch.
- [X] My contribution generates no new compiler warnings (try with
--warnlevel=3 when using meson).
- [X] My contribution is commented and consistent with SU2 style
(https://su2code.github.io/docs_v7/Style-Guide/).
- [X] I used the pre-commit hook to prevent dirty commits and used
`pre-commit run --all` to format old commits.
- [X] I have added a test case that demonstrates my contribution, if
necessary. — Not necessary: the change only affects how the executable
path is quoted; `shape_opt_euler_py` passes unchanged, and the
reproduction above (SU2_RUN with a space) fails before and passes after.
- [X] I have updated appropriate documentation (Tutorials, Docs Page,
config_template.cpp), if necessary. — Not necessary: no user-facing
option changed.

Co-authored-by: Nijso <bigfootedrockmidget@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants