Skip to content

Commit a6a8337

Browse files
committed
Disable mapping kwarg
1 parent 8e28721 commit a6a8337

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/body_aerodynamics.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function Base.setproperty!(obj::BodyAerodynamics, sym::Symbol, val)
114114
end
115115

116116
"""
117-
reinit!(body_aero::BodyAerodynamics; init_aero, va, omega, refine_mesh)
117+
reinit!(body_aero::BodyAerodynamics; init_aero, va, omega, refine_mesh, recompute_mapping)
118118
119119
Initialize a BodyAerodynamics struct in-place by setting up panels and coefficients.
120120
@@ -127,6 +127,8 @@ Initialize a BodyAerodynamics struct in-place by setting up panels and coefficie
127127
- `omega=zeros(3)`: Turn rate in kite body frame x y and z
128128
- `refine_mesh=true`: Whether to refine wing meshes. Set to `false` after
129129
`deform!()` to preserve deformed geometry.
130+
- `recompute_mapping=true`: Whether to recompute the refined panel mapping.
131+
Set to `false` to skip mapping computation when it hasn't changed.
130132
131133
# Returns
132134
nothing
@@ -135,12 +137,13 @@ function reinit!(body_aero::BodyAerodynamics;
135137
init_aero=true,
136138
va=[15.0, 0.0, 0.0],
137139
omega=zeros(MVec3),
138-
refine_mesh=true
140+
refine_mesh=true,
141+
recompute_mapping=true
139142
)
140143
idx = 1
141144
vec = @MVector zeros(3)
142145
for wing in body_aero.wings
143-
reinit!(wing; refine_mesh=refine_mesh)
146+
reinit!(wing; refine_mesh, recompute_mapping)
144147
panel_props = wing.panel_props
145148

146149
# Create panels

src/wing_geometry.jl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,20 @@ function Wing(n_panels::Int;
302302
end
303303

304304
"""
305-
reinit!(wing::AbstractWing; refine_mesh=true)
305+
reinit!(wing::AbstractWing; refine_mesh=true, recompute_mapping=true)
306306
307307
Reinitialize wing geometry and panel properties.
308308
309309
# Keyword Arguments
310310
- `refine_mesh::Bool=true`: Whether to refine the mesh. Set to `false` after
311311
`deform!()` to preserve deformed geometry while updating panel properties.
312+
- `recompute_mapping::Bool=true`: Whether to recompute the refined panel mapping.
313+
Set to `false` to skip mapping computation when it hasn't changed.
312314
"""
313-
function reinit!(wing::AbstractWing; refine_mesh=true)
315+
function reinit!(wing::AbstractWing; refine_mesh=true, recompute_mapping=true)
314316
# Refine mesh unless explicitly disabled (e.g., to preserve deformation)
315317
if refine_mesh
316-
refine_aerodynamic_mesh!(wing)
318+
refine_aerodynamic_mesh!(wing; recompute_mapping)
317319
end
318320

319321
# Calculate panel properties
@@ -587,14 +589,18 @@ function update_non_deformed_sections!(wing::AbstractWing)
587589
end
588590

589591
"""
590-
refine_aerodynamic_mesh!(wing::AbstractWing)
592+
refine_aerodynamic_mesh!(wing::AbstractWing; recompute_mapping=true)
591593
592594
Refine the aerodynamic mesh of the wing based on spanwise panel distribution.
593595
596+
# Keyword Arguments
597+
- `recompute_mapping::Bool=true`: Whether to recompute the refined panel mapping.
598+
Set to `false` to skip mapping computation when it hasn't changed.
599+
594600
Returns:
595601
Vector{Section}: List of refined sections
596602
"""
597-
function refine_aerodynamic_mesh!(wing::AbstractWing)
603+
function refine_aerodynamic_mesh!(wing::AbstractWing; recompute_mapping=true)
598604
sort!(wing.sections, by=s -> s.LE_point[2], rev=true)
599605
n_sections = wing.n_panels + 1
600606
if length(wing.refined_sections) == 0
@@ -631,7 +637,7 @@ function refine_aerodynamic_mesh!(wing::AbstractWing)
631637
for i in eachindex(wing.sections)
632638
reinit!(wing.refined_sections[i], wing.sections[i])
633639
end
634-
compute_refined_panel_mapping!(wing)
640+
recompute_mapping && compute_refined_panel_mapping!(wing)
635641
update_non_deformed_sections!(wing)
636642
return nothing
637643
end
@@ -642,7 +648,7 @@ function refine_aerodynamic_mesh!(wing::AbstractWing)
642648
if n_sections == 2
643649
reinit!(wing.refined_sections[1], LE[1,:], TE[1,:], aero_model[1], aero_data[1])
644650
reinit!(wing.refined_sections[2], LE[end,:], TE[end,:], aero_model[end], aero_data[end])
645-
compute_refined_panel_mapping!(wing)
651+
recompute_mapping && compute_refined_panel_mapping!(wing)
646652
update_non_deformed_sections!(wing)
647653
return nothing
648654
end
@@ -666,7 +672,7 @@ function refine_aerodynamic_mesh!(wing::AbstractWing)
666672
end
667673

668674
# Compute panel mapping by finding closest unrefined panel for each refined panel
669-
compute_refined_panel_mapping!(wing)
675+
recompute_mapping && compute_refined_panel_mapping!(wing)
670676

671677
# Validate REFINE grouping method
672678
if wing.grouping_method == REFINE && wing.n_groups > 0

0 commit comments

Comments
 (0)