Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Mor
Nat-1
Nicola Fonzi
Nijso Beishuizen
Nikita Ageev
Ole Burghardt
Patrick Mischke
Paul Urbanczyk
Expand Down
6 changes: 3 additions & 3 deletions SU2_PY/SU2/eval/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def function(func_name, config, state=None):
multipoint(config, state)

# Geometry
elif func_name in su2io.optnames_geo:
elif su2io.is_optname_geo(func_name):
geometry(func_name, config, state)

else:
Expand Down Expand Up @@ -890,8 +890,8 @@ def geometry(func_name, config, state=None):

# return output
funcs = su2util.ordered_bunch()
for key in su2io.optnames_geo:
if key in state["FUNCTIONS"]:
for key in state["FUNCTIONS"]:
if su2io.is_optname_geo(key):
funcs[key] = state["FUNCTIONS"][key]
return funcs

Expand Down
6 changes: 3 additions & 3 deletions SU2_PY/SU2/eval/gradients.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def gradient(func_name, method, config, state=None):
grads = multipoint(func_name, config, state)

# Geometry (actually a finite difference)
elif func_output in su2io.optnames_geo:
elif su2io.is_optname_geo(func_output):
grads = geometry(func_name, config, state)

else:
Expand Down Expand Up @@ -1080,8 +1080,8 @@ def geometry(func_name, config, state=None):

# return output
grads = su2util.ordered_bunch()
for key in su2io.optnames_geo:
if key in state["GRADIENTS"]:
for key in state["GRADIENTS"]:
if su2io.is_optname_geo(key):
grads[key] = state["GRADIENTS"][key]
return grads

Expand Down
39 changes: 25 additions & 14 deletions SU2_PY/SU2/io/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# -------------------------------------------------------------------

import os
import re
import shutil, glob
from SU2.util import ordered_bunch
from .historyMap import history_header_map as historyOutFields
Expand Down Expand Up @@ -271,20 +272,30 @@ def getTurboPerfIndex(nZones=1):
"NACELLE_MAX_TWIST",
]

PerStation = []
for i in range(20):
PerStation.append("STATION" + str(i) + "_AREA")
PerStation.append("STATION" + str(i) + "_LENGTH")
PerStation.append("STATION" + str(i) + "_WIDTH")
PerStation.append("STATION" + str(i) + "_WATERLINE_WIDTH")
PerStation.append("STATION" + str(i) + "_HEIGHT")
PerStation.append("STATION" + str(i) + "_THICKNESS")
PerStation.append("STATION" + str(i) + "_CHORD")
PerStation.append("STATION" + str(i) + "_LE_RADIUS")
PerStation.append("STATION" + str(i) + "_TOC")
PerStation.append("STATION" + str(i) + "_TWIST")

optnames_geo.extend(PerStation)
# SU2_GEO numbers the stations of GEO_LOCATION_STATIONS from 1 (STATION1_*),
# see SU2_GEO.cpp, and does not limit their number.
optnames_geo_station = [
"AREA",
"LENGTH",
"WIDTH",
"WATERLINE_WIDTH",
"HEIGHT",
"THICKNESS",
"CHORD",
"LE_RADIUS",
"TOC",
"TWIST",
]

optnames_geo_station_regex = re.compile(
r"^STATION[1-9][0-9]*_(%s)$" % "|".join(optnames_geo_station)
)


def is_optname_geo(name):
"""Check if name is a geometry function, including STATION#_* for any station."""
return name in optnames_geo or bool(optnames_geo_station_regex.match(name))


#: optnames_geo

Expand Down
4 changes: 2 additions & 2 deletions config_template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2212,7 +2212,7 @@ GEO_DESCRIPTION= AIRFOIL
% Z location of the waterline
GEO_WATERLINE_LOCATION= 0.0
%
% Coordinate of the stations to be analyzed
% Coordinate of the stations to be analyzed (STATION1_* ... STATIONn_* in SU2_GEO output)
GEO_LOCATION_STATIONS= (0.0, 0.5, 1.0)
%
% Definition of the nacelle location (higlite coordinates, tilt angle, toe angle)
Expand Down Expand Up @@ -2735,7 +2735,7 @@ REORIENT_ELEMENTS= YES
% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA,
% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL
% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC,
% STATION#_TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS)
% STATION#_TWIST (where # is the 1-based index of the station defined in GEO_LOCATION_STATIONS)
%
% Available design variables
% 2D Design variables
Expand Down