@@ -158,14 +158,23 @@ function Solver(body_aero; kwargs...)
158158end
159159
160160function Solver (body_aero, settings:: VSMSettings )
161+ ss = settings. solver_settings
162+ solver_type = ss. solver_type == " NONLIN" ? NONLIN : LOOP
161163 Solver (body_aero;
162- aerodynamic_model_type= settings. solver_settings. aerodynamic_model_type,
163- density= settings. solver_settings. density,
164- max_iterations= settings. solver_settings. max_iterations,
165- rtol= settings. solver_settings. rtol,
166- relaxation_factor= settings. solver_settings. relaxation_factor,
167- core_radius_fraction= settings. solver_settings. core_radius_fraction,
168- correct_aoa= settings. solver_settings. correct_aoa,
164+ solver_type,
165+ aerodynamic_model_type= ss. aerodynamic_model_type,
166+ density= ss. density,
167+ max_iterations= ss. max_iterations,
168+ rtol= ss. rtol,
169+ tol_reference_error= ss. tol_reference_error,
170+ relaxation_factor= ss. relaxation_factor,
171+ is_with_artificial_damping= ss. artificial_damping,
172+ artificial_damping= (k2= ss. k2, k4= ss. k4),
173+ type_initial_gamma_distribution= ss. type_initial_gamma_distribution,
174+ core_radius_fraction= ss. core_radius_fraction,
175+ mu= ss. mu,
176+ is_only_f_and_gamma_output= ss. calc_only_f_and_gamma,
177+ correct_aoa= ss. correct_aoa,
169178 )
170179end
171180
@@ -261,7 +270,7 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
261270 @. panel_moment_dist = cm_dist * 0.5 * density * v_a_dist^ 2 * solver. sol. _chord_dist
262271
263272 # Calculate alpha corrections based on model type
264- if aerodynamic_model_type == VSM # 64 bytes
273+ if solver . correct_aoa && aerodynamic_model_type == VSM # 64 bytes
265274 update_effective_angle_of_attack! (
266275 alpha_corrected,
267276 body_aero,
@@ -273,7 +282,7 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
273282 solver. br. va_norm_dist,
274283 solver. br. va_unit_dist
275284 )
276- elseif aerodynamic_model_type == LLT
285+ else
277286 alpha_corrected .= alpha_dist
278287 end
279288
@@ -395,7 +404,7 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
395404 panel_idx += 1
396405 end
397406
398- # Average coefficients and geometry
407+ # Average coefficients and geometry (width stays summed)
399408 for i in 1 : wing. n_unrefined_sections
400409 target_unrefined_idx = unrefined_idx + i - 1
401410 if unrefined_section_counts[i] > 0
@@ -410,6 +419,8 @@ function solve!(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=
410419 z_airf_unrefined_dist[target_unrefined_idx] ./= count
411420 va_unrefined_dist[target_unrefined_idx] ./= count
412421 chord_unrefined_dist[target_unrefined_idx] /= count
422+ # width_unrefined_dist is NOT averaged - it is the
423+ # sum of panel widths in the unrefined section
413424 end
414425 end
415426 unrefined_idx += wing. n_unrefined_sections
0 commit comments