Skip to content

Commit

Permalink
I updated the Daniobot example and added a convergence example.
Browse files Browse the repository at this point in the history
  • Loading branch information
camUrban committed Dec 10, 2024
1 parent f2cbb38 commit 34b3cb4
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 31 deletions.
51 changes: 20 additions & 31 deletions daniobot/daniobot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import math

import pterasoftware as ps

daniobot = ps.geometry.Airplane(
Expand All @@ -14,31 +12,22 @@
y_le=0.0,
z_le=0.0,
symmetric=True,
unit_chordwise_vector=[1 / math.sqrt(2), 0, 1 / math.sqrt(2)],
num_chordwise_panels=16,
chordwise_spacing="uniform",
wing_cross_sections=[
ps.geometry.WingCrossSection(
num_spanwise_panels=8,
num_spanwise_panels=4,
spanwise_spacing="cosine",
chord=7.684e-3,
chord=7e-3,
airfoil=ps.geometry.Airfoil(
name="naca0012",
),
),
ps.geometry.WingCrossSection(
num_spanwise_panels=8,
num_spanwise_panels=4,
spanwise_spacing="cosine",
y_le=1.568e-3,
chord=7.294e-3,
airfoil=ps.geometry.Airfoil(
name="naca0012",
),
),
ps.geometry.WingCrossSection(
x_le=3.601e-3,
y_le=3.128e-3,
chord=2.70e-3,
y_le=3e-3,
chord=7e-3,
airfoil=ps.geometry.Airfoil(
name="naca0012",
),
Expand All @@ -55,34 +44,30 @@
pitching_spacing="sine",
)

tail_mid_wing_cross_section_movement = ps.movement.WingCrossSectionMovement(
base_wing_cross_section=daniobot.wings[0].wing_cross_sections[1],
# pitching_amplitude=15.0,
# pitching_period=1 / 8,
# pitching_spacing="sine",
)

tail_tip_wing_cross_section_movement = ps.movement.WingCrossSectionMovement(
base_wing_cross_section=daniobot.wings[0].wing_cross_sections[2],
# pitching_amplitude=15.0,
# pitching_period=1 / 8,
# pitching_spacing="sine",
base_wing_cross_section=daniobot.wings[0].wing_cross_sections[1],
pitching_amplitude=15.0,
pitching_period=1 / 8,
pitching_spacing="sine",
)

tail_movement = ps.movement.WingMovement(
base_wing=daniobot.wings[0],
wing_cross_sections_movements=[
tail_root_wing_cross_section_movement,
tail_mid_wing_cross_section_movement,
tail_tip_wing_cross_section_movement,
],
)

del tail_root_wing_cross_section_movement
del tail_tip_wing_cross_section_movement

daniobot_movement = ps.movement.AirplaneMovement(
base_airplane=daniobot,
wing_movements=[tail_movement],
)

del daniobot
del tail_movement

operating_point = ps.operating_point.OperatingPoint(
Expand All @@ -100,8 +85,8 @@
movement = ps.movement.Movement(
airplane_movements=[daniobot_movement],
operating_point_movement=operating_point_movement,
delta_time=1 / 8 / 20,
num_cycles=1,
delta_time=1 / 8 / 30,
num_cycles=5,
)

del daniobot_movement
Expand All @@ -120,7 +105,7 @@
del problem

solver.run(
prescribed_wake=True,
prescribed_wake=False,
calculate_streamlines=False,
)

Expand All @@ -145,3 +130,7 @@
show=True,
save=False,
)

ps.output.print_unsteady_results(
unsteady_solver=solver,
)
154 changes: 154 additions & 0 deletions daniobot/daniobot_converge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import pterasoftware as ps

daniobot = ps.geometry.Airplane(
name="Daniobot",
x_ref=0.0,
y_ref=0.0,
z_ref=0.0,
wings=[
ps.geometry.Wing(
name="Tail",
x_le=0.0,
y_le=0.0,
z_le=0.0,
symmetric=True,
num_chordwise_panels=16,
chordwise_spacing="uniform",
wing_cross_sections=[
ps.geometry.WingCrossSection(
num_spanwise_panels=8,
spanwise_spacing="cosine",
chord=7e-3,
airfoil=ps.geometry.Airfoil(
name="naca0012",
),
),
ps.geometry.WingCrossSection(
num_spanwise_panels=8,
spanwise_spacing="cosine",
y_le=3e-3,
chord=7e-3,
airfoil=ps.geometry.Airfoil(
name="naca0012",
),
),
],
),
],
)

tail_root_wing_cross_section_movement = ps.movement.WingCrossSectionMovement(
base_wing_cross_section=daniobot.wings[0].wing_cross_sections[0],
pitching_amplitude=15.0,
pitching_period=1 / 8,
pitching_spacing="sine",
)

tail_tip_wing_cross_section_movement = ps.movement.WingCrossSectionMovement(
base_wing_cross_section=daniobot.wings[0].wing_cross_sections[1],
pitching_amplitude=15.0,
pitching_period=1 / 8,
pitching_spacing="sine",
)

tail_movement = ps.movement.WingMovement(
base_wing=daniobot.wings[0],
wing_cross_sections_movements=[
tail_root_wing_cross_section_movement,
tail_tip_wing_cross_section_movement,
],
)

del tail_root_wing_cross_section_movement
del tail_tip_wing_cross_section_movement

daniobot_movement = ps.movement.AirplaneMovement(
base_airplane=daniobot,
wing_movements=[tail_movement],
)

del daniobot
del tail_movement

operating_point = ps.operating_point.OperatingPoint(
density=997,
beta=0.0,
velocity=10e-3,
alpha=0,
nu=1.00e-6,
)

operating_point_movement = ps.movement.OperatingPointMovement(
base_operating_point=operating_point,
)

movement = ps.movement.Movement(
airplane_movements=[daniobot_movement],
operating_point_movement=operating_point_movement,
delta_time=None,
num_cycles=None,
)

del daniobot_movement
del operating_point_movement

problem = ps.problems.UnsteadyProblem(
movement=movement,
)

ps.convergence.analyze_unsteady_convergence(
ref_problem=problem,
prescribed_wake=True,
free_wake=True,
num_cycles_bounds=(5 - 2, 5 + 2),
panel_aspect_ratio_bounds=(4, 1),
num_chordwise_panels_bounds=(16 - 2, 16 + 2),
convergence_criteria=5,
coefficient_mask=[True, False, False, False, False, False],
)

# INFO:convergence:The analysis found a converged mesh:
# INFO:convergence: Wake type: prescribed
# INFO:convergence: Cycles: 6
# INFO:convergence: Panel aspect ratio: 4
# INFO:convergence: Chordwise panels: 15
# INFO:convergence: Iteration time: 0.207 s

# del movement
#
# solver = ps.unsteady_ring_vortex_lattice_method.UnsteadyRingVortexLatticeMethodSolver(
# unsteady_problem=problem,
# )
#
# del problem
#
# solver.run(
# prescribed_wake=True,
# calculate_streamlines=False,
# )
#
# # ps.output.animate(
# # unsteady_solver=solver,
# # scalar_type="induced drag",
# # show_wake_vortices=True,
# # parallel_projection=True,
# # save=True,
# # )
#
# ps.output.draw(
# solver=solver,
# scalar_type="induced drag",
# show_wake_vortices=True,
# parallel_projection=True,
# save=True,
# )
#
# ps.output.plot_results_versus_time(
# unsteady_solver=solver,
# show=True,
# save=False,
# )
#
# ps.output.print_unsteady_results(
# unsteady_solver=solver,
# )

0 comments on commit 34b3cb4

Please sign in to comment.