@@ -302,18 +302,20 @@ function Wing(n_panels::Int;
302302end
303303
304304"""
305- reinit!(wing::AbstractWing; refine_mesh=true)
305+ reinit!(wing::AbstractWing; refine_mesh=true, recompute_mapping=true )
306306
307307Reinitialize 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)
587589end
588590
589591"""
590- refine_aerodynamic_mesh!(wing::AbstractWing)
592+ refine_aerodynamic_mesh!(wing::AbstractWing; recompute_mapping=true )
591593
592594Refine 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+
594600Returns:
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