Skip to content

Commit 45aeaeb

Browse files
authored
Improvements to sweep launching template report generation (#934)
* added functionality to sweep template report and reverted the deletion of evtol eaxmple * removed from_cloud project upload * changed cfl plot to be a single one * black * removed forces/moments vs beta * used semi-log scale for CFL chart
1 parent e05cc18 commit 45aeaeb

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed

examples/post_processing/report/sweep_launch_report.py

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
FrontLeftTopCamera,
1111
Inputs,
1212
LeftCamera,
13+
NonlinearResiduals,
1314
PatternCaption,
1415
RearCamera,
1516
RearRightBottomCamera,
1617
Settings,
18+
SubsetLimit,
1719
Summary,
1820
Table,
1921
TopCamera,
@@ -31,6 +33,7 @@ def generate_report(
3133
include_cfl: bool = False,
3234
include_forces_moments_table: bool = False,
3335
include_forces_moments_charts: bool = False,
36+
include_forces_moments_alpha_charts: bool = False,
3437
include_cf_vec: bool = False,
3538
include_cp: bool = False,
3639
include_yplus: bool = False,
@@ -42,8 +45,6 @@ def generate_report(
4245

4346
exclude = freestream_surfaces
4447

45-
SOLVER_VERSION = __solver_version__
46-
4748
top_camera = TopCamera(pan_target=(3.5, 0, -0.5), dimension=15, dimension_dir="height")
4849
bottom_camera = BottomCamera(pan_target=(3.5, 0, -0.5), dimension=15, dimension_dir="height")
4950
front_camera = FrontCamera(pan_target=(3.5, 0, -0.5), dimension=15, dimension_dir="width")
@@ -94,24 +95,20 @@ def generate_report(
9495
avg = Average(fraction=0.1)
9596

9697
force_list = [
97-
"totalCD",
98-
"totalCL",
99-
"totalCFx",
100-
"totalCFy",
101-
"totalCFz",
102-
"totalCMx",
103-
"totalCMy",
104-
"totalCMz",
98+
"CD",
99+
"CL",
100+
"CFx",
101+
"CFy",
102+
"CFz",
103+
"CMx",
104+
"CMy",
105+
"CMz",
105106
]
106107

107-
residuals_list = ["0_cont", "1_momx", "2_momy", "3_momz", "4_energ", "5_nuHat"]
108-
109108
for model in params.models:
110109
if model.type == "Fluid":
111110
turbulence_solver = model.turbulence_model_solver.type_name
112111

113-
cfl_list = ["0_NavierStokes_cfl", f"1_{turbulence_solver}_cfl"]
114-
115112
CD = DataItem(data="surface_forces/totalCD", exclude=exclude, title="CD", operations=avg)
116113
CL = DataItem(data="surface_forces/totalCL", exclude=exclude, title="CL", operations=avg)
117114
CFX = DataItem(data="surface_forces/totalCFx", exclude=exclude, title="CFx", operations=avg)
@@ -158,45 +155,50 @@ def generate_report(
158155
items.append(table)
159156

160157
if include_residuals:
161-
residual_charts = [
162-
Chart2D(
163-
x=f"nonlinear_residuals/{step_type}",
164-
y=f"nonlinear_residuals/{residual}",
165-
force_new_page=True,
166-
section_title="Residuals",
167-
fig_name=f"{residual}_fig",
168-
)
169-
for residual in residuals_list
170-
]
171-
items.extend(residual_charts)
158+
residual_chart = NonlinearResiduals(
159+
force_new_page=True, section_title="Nonlinear residuals", fig_name=f"nonlin-res_fig"
160+
)
161+
items.append(residual_chart)
172162

173163
if include_cfl and params.time_stepping.CFL.type == "adaptive":
174-
cfl_charts = [
175-
Chart2D(
176-
x=f"cfl/{step_type}",
177-
y=f"cfl/{cfl}",
178-
force_new_page=True,
179-
section_title="CFL",
180-
fig_name=f"{cfl}_fig",
181-
)
182-
for cfl in cfl_list
183-
]
184-
items.extend(cfl_charts)
164+
cfl_chart = Chart2D(
165+
x=f"cfl/{step_type}",
166+
y=["cfl/0_NavierStokes_cfl", f"cfl/1_{turbulence_solver}_cfl"],
167+
force_new_page=True,
168+
section_title="CFL",
169+
fig_name="cfl_fig",
170+
y_log=True,
171+
)
172+
items.append(cfl_chart)
185173

186174
if include_forces_moments_charts:
187175
force_charts = [
188176
Chart2D(
189177
x=f"surface_forces/{step_type}",
190-
y=f"surface_forces/{force}",
178+
y=f"surface_forces/total{force}",
191179
force_new_page=True,
192180
section_title="Forces/Moments",
193181
fig_name=f"{force}_fig",
194182
exclude=exclude,
183+
ylim=SubsetLimit(subset=(0.5, 1), offset=0.25),
195184
)
196185
for force in force_list
197186
]
198187
items.extend(force_charts)
199188

189+
if include_forces_moments_alpha_charts:
190+
force_alpha_charts = [
191+
Chart2D(
192+
x=f"params/operating_condition/alpha",
193+
y=f"total_forces/averages/{force}",
194+
force_new_page=True,
195+
section_title="Averaged Forces/Moments against alpha",
196+
fig_name=f"{force}_alpha_fig",
197+
)
198+
for force in force_list
199+
]
200+
items.extend(force_alpha_charts)
201+
200202
if include_yplus:
201203
y_plus_screenshots = [
202204
Chart3D(
@@ -271,7 +273,7 @@ def generate_report(
271273
report = report.create_in_cloud(
272274
"sweep-script-report",
273275
cases,
274-
solver_version=SOLVER_VERSION,
276+
solver_version=__solver_version__,
275277
)
276278

277279
report.wait()

examples/post_processing/report/sweep_launch_template.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ def main():
272272
include_cfl=True,
273273
include_forces_moments_table=True,
274274
include_forces_moments_charts=True,
275+
include_forces_moments_alpha_charts=True,
275276
include_cf_vec=True,
276277
include_cp=True,
277278
include_yplus=True,

flow360/examples/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from .cylinder2D import Cylinder2D
77
from .cylinder3D import Cylinder3D
88
from .drivaer import DrivAer
9+
from .evtol import EVTOL
910
from .monitors import MonitorsAndSlices
1011
from .om6wing import OM6wing
1112
from .quadcopter import Quadcopter
@@ -30,6 +31,7 @@
3031
"Cylinder2D",
3132
"Cylinder3D",
3233
"DrivAer",
34+
"EVTOL",
3335
"MonitorsAndSlices",
3436
"OM6wing",
3537
"RotatingSpheres",

0 commit comments

Comments
 (0)