@@ -761,7 +761,7 @@ are no intermediate sections to billow.
761761function copy_sections_to_refined! (
762762 wing:: AbstractWing ; reuse_aero_data:: Bool = false
763763)
764- if wing. spanwise_distribution == BILLOWING &&
764+ if isequal ( wing. spanwise_distribution, BILLOWING) &&
765765 wing. billowing_percentage > 0
766766 @warn " Billowing requested but n_panels " *
767767 " ($(wing. n_panels) ) == n_provided; no " *
@@ -856,7 +856,7 @@ function refine!(wing::AbstractWing; recompute_mapping=true, sort_sections=true)
856856 reuse_aero_data = _can_reuse_prior_refined_polar_data (wing, n_sections)
857857
858858 if length (wing. refined_sections) == 0
859- if wing. spanwise_distribution == UNCHANGED ||
859+ if isequal ( wing. spanwise_distribution, UNCHANGED) ||
860860 length (wing. unrefined_sections) == n_sections
861861 copy_sections_to_refined! (wing; reuse_aero_data)
862862 recompute_mapping && compute_refined_panel_mapping! (wing)
@@ -868,7 +868,8 @@ function refine!(wing::AbstractWing; recompute_mapping=true, sort_sections=true)
868868 end
869869
870870 # Handle special cases
871- if wing. spanwise_distribution == UNCHANGED || length (wing. unrefined_sections) == n_sections
871+ if isequal (wing. spanwise_distribution, UNCHANGED) ||
872+ length (wing. unrefined_sections) == n_sections
872873 copy_sections_to_refined! (wing; reuse_aero_data)
873874 recompute_mapping && compute_refined_panel_mapping! (wing)
874875 update_non_deformed_sections! (wing)
@@ -893,14 +894,15 @@ function refine!(wing::AbstractWing; recompute_mapping=true, sort_sections=true)
893894 end
894895
895896 # Handle different distribution types
896- if wing. spanwise_distribution == SPLIT_PROVIDED
897+ if isequal ( wing. spanwise_distribution, SPLIT_PROVIDED)
897898 refine_mesh_by_splitting_provided_sections! (wing; reuse_aero_data)
898- elseif wing. spanwise_distribution in (LINEAR, COSINE)
899+ elseif isequal (wing. spanwise_distribution, LINEAR) ||
900+ isequal (wing. spanwise_distribution, COSINE)
899901 refine_mesh_for_linear_cosine_distribution! (
900902 wing, 1 , wing. spanwise_distribution,
901903 n_sections, wing. unrefined_sections;
902904 reuse_aero_data)
903- elseif wing. spanwise_distribution == BILLOWING
905+ elseif isequal ( wing. spanwise_distribution, BILLOWING)
904906 refine_mesh_with_billowing! (wing; reuse_aero_data)
905907 else
906908 throw (ArgumentError (" Unsupported spanwise panel distribution: $(wing. spanwise_distribution) " ))
@@ -1023,68 +1025,80 @@ function calculate_new_aero_data(aero_model,
10231025
10241026 model_type = aero_model[section_index]
10251027 model_type_2 = aero_model[section_index+ 1 ]
1026- if ! (model_type == model_type_2)
1028+ if ! (model_type isa AeroModel) || ! (model_type_2 isa AeroModel)
1029+ throw (ArgumentError (" Unsupported aero model type" ))
1030+ end
1031+ if ! isequal (model_type, model_type_2)
10271032 throw (ArgumentError (" Different aero models over the span are not supported" ))
10281033 end
10291034
1030- if model_type == INVISCID
1035+ if isequal ( model_type, INVISCID)
10311036 return nothing
10321037
1033- elseif model_type in (POLAR_VECTORS, POLAR_MATRICES )
1038+ elseif isequal (model_type, POLAR_VECTORS )
10341039 polar_left = aero_data[section_index]
10351040 polar_right = aero_data[section_index + 1 ]
1041+ (polar_left isa Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}}) ||
1042+ throw (ArgumentError (" Provide polar vector data in the correct format." ))
1043+ (polar_right isa Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}}) ||
1044+ throw (ArgumentError (" Provide polar vector data in the correct format." ))
10361045
1037- # Unpack polar data
1038- if model_type == POLAR_VECTORS
1039- alpha_left, CL_left, CD_left, CM_left = polar_left
1040- alpha_right, CL_right, CD_right, CM_right = polar_right
1041-
1042- (
1043- length (alpha_left) == length (alpha_right) &&
1044- all (isapprox .(diff (alpha_left), diff (alpha_right)))
1045- ) || throw (ArgumentError (" Alpha steps must be identical." ))
1046- isa (CL_right, AbstractVector) || throw (ArgumentError (
1047- " Provide polar data in the correct format."
1048- ))
1049-
1050- # Weighted interpolation
1051- CL_data = CL_left .* left_weight .+ CL_right .* right_weight
1052- CD_data = CD_left .* left_weight .+ CD_right .* right_weight
1053- CM_data = CM_left .* left_weight .+ CM_right .* right_weight
1054-
1055- return (alpha_left, CL_data, CD_data, CM_data)
1056-
1057- elseif model_type == POLAR_MATRICES
1058- alpha_left, delta_left, CL_left, CD_left, CM_left = polar_left
1059- alpha_right, delta_right, CL_right, CD_right, CM_right = polar_right
1060-
1061- (
1062- length (alpha_left) == length (alpha_right) &&
1063- all (isapprox .(diff (alpha_left), diff (alpha_right)))
1064- ) || throw (ArgumentError (" Alpha steps must be identical." ))
1065- (
1066- length (delta_left) == length (delta_right) &&
1067- all (isapprox .(diff (delta_left), diff (delta_right)))
1068- ) || throw (ArgumentError (" Delta steps must be identical." ))
1069- isa (CL_right, AbstractMatrix) || throw (ArgumentError (
1070- " Provide polar data in the correct format."
1071- ))
1072-
1073- # Weighted interpolation
1074- CL_data = CL_left .* left_weight .+ CL_right .* right_weight
1075- CD_data = CD_left .* left_weight .+ CD_right .* right_weight
1076- CM_data = CM_left .* left_weight .+ CM_right .* right_weight
1046+ alpha_left, CL_left, CD_left, CM_left = polar_left
1047+ alpha_right, CL_right, CD_right, CM_right = polar_right
1048+
1049+ (
1050+ length (alpha_left) == length (alpha_right) &&
1051+ all (isapprox .(diff (alpha_left), diff (alpha_right)))
1052+ ) || throw (ArgumentError (" Alpha steps must be identical." ))
1053+
1054+ # Weighted interpolation
1055+ CL_data = CL_left .* left_weight .+ CL_right .* right_weight
1056+ CD_data = CD_left .* left_weight .+ CD_right .* right_weight
1057+ CM_data = CM_left .* left_weight .+ CM_right .* right_weight
1058+
1059+ return (alpha_left, CL_data, CD_data, CM_data)
10771060
1078- return (alpha_left, delta_left, CL_data, CD_data, CM_data)
1079- end
1061+ elseif isequal (model_type, POLAR_MATRICES)
1062+ polar_left = aero_data[section_index]
1063+ polar_right = aero_data[section_index + 1 ]
1064+ (polar_left isa Tuple{Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, Matrix{Float64}}) ||
1065+ throw (ArgumentError (" Provide polar matrix data in the correct format." ))
1066+ (polar_right isa Tuple{Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, Matrix{Float64}}) ||
1067+ throw (ArgumentError (" Provide polar matrix data in the correct format." ))
10801068
1081- elseif model_type == LEI_AIRFOIL_BREUKELS
1082- tube_diameter_left = aero_data[section_index][1 ]
1083- tube_diameter_right = aero_data[section_index + 1 ][1 ]
1069+ alpha_left, delta_left, CL_left, CD_left, CM_left = polar_left
1070+ alpha_right, delta_right, CL_right, CD_right, CM_right = polar_right
1071+
1072+ (
1073+ length (alpha_left) == length (alpha_right) &&
1074+ all (isapprox .(diff (alpha_left), diff (alpha_right)))
1075+ ) || throw (ArgumentError (" Alpha steps must be identical." ))
1076+ (
1077+ length (delta_left) == length (delta_right) &&
1078+ all (isapprox .(diff (delta_left), diff (delta_right)))
1079+ ) || throw (ArgumentError (" Delta steps must be identical." ))
1080+
1081+ # Weighted interpolation
1082+ CL_data = CL_left .* left_weight .+ CL_right .* right_weight
1083+ CD_data = CD_left .* left_weight .+ CD_right .* right_weight
1084+ CM_data = CM_left .* left_weight .+ CM_right .* right_weight
1085+
1086+ return (alpha_left, delta_left, CL_data, CD_data, CM_data)
1087+
1088+ elseif isequal (model_type, LEI_AIRFOIL_BREUKELS)
1089+ data_left = aero_data[section_index]
1090+ data_right = aero_data[section_index + 1 ]
1091+ (data_left isa NTuple{2 , Float64}) ||
1092+ throw (ArgumentError (" Provide LEI aero data as (tube_diameter, chamber_height)." ))
1093+ (data_right isa NTuple{2 , Float64}) ||
1094+ throw (ArgumentError (" Provide LEI aero data as (tube_diameter, chamber_height)." ))
1095+
1096+ tube_diameter_left = data_left[1 ]
1097+ tube_diameter_right = data_right[1 ]
10841098 tube_diameter_i = tube_diameter_left * left_weight + tube_diameter_right * right_weight
10851099
1086- chamber_height_left = aero_data[section_index] [2 ]
1087- chamber_height_right = aero_data[section_index + 1 ] [2 ]
1100+ chamber_height_left = data_left [2 ]
1101+ chamber_height_right = data_right [2 ]
10881102 chamber_height_i = chamber_height_left * left_weight + chamber_height_right * right_weight
10891103
10901104 @debug " Interpolation weights" left_weight right_weight
0 commit comments