@@ -65,50 +65,49 @@ settings_file = create_temp_wing_settings("body_aerodynamics", "test_wing.yaml";
6565rm(settings_file)
6666```
6767"""
68- function create_temp_wing_settings (module_name, wing_file;
69- name= " test_wing" ,
70- n_panels= 4 ,
71- n_groups= 2 ,
72- spanwise_panel_distribution= " COSINE" ,
73- spanwise_direction= [0.0 , 1.0 , 0.0 ],
74- remove_nan= true ,
75- aerodynamic_model_type= " VSM" ,
76- density= 1.225 ,
77- type_initial_gamma_distribution= " ZEROS" ,
78- alpha= 10.0 ,
79- beta= 5.0 ,
80- wind_speed= 15.0 )
81-
82- # Use wing_file path directly if it's already an absolute path, otherwise construct it
83- wing_file_path = if isabspath (wing_file)
84- wing_file
85- else
86- test_data_path (module_name, wing_file)
87- end
88-
89- settings_content = """
90- wings:
91- - name: "$name "
92- geometry_file: "$wing_file_path "
93- n_panels: $n_panels
94- n_groups: $n_groups
95- spanwise_panel_distribution: $spanwise_panel_distribution
96- spanwise_direction: $spanwise_direction
97- remove_nan: $remove_nan
98-
99- solver_settings:
100- aerodynamic_model_type: $aerodynamic_model_type
101- density: $density
102- type_initial_gamma_distribution: $type_initial_gamma_distribution
103-
104- condition:
105- alpha: $alpha
106- beta: $beta
107- wind_speed: $wind_speed
108- """
109-
68+ function create_temp_wing_settings (module_name, wing_file;
69+ name= " test_wing" ,
70+ n_panels= 4 ,
71+ n_groups= 2 ,
72+ spanwise_panel_distribution= " COSINE" ,
73+ spanwise_direction= [0.0 , 1.0 , 0.0 ],
74+ remove_nan= true ,
75+ aerodynamic_model_type= " VSM" ,
76+ density= 1.225 ,
77+ type_initial_gamma_distribution= " ZEROS" ,
78+ alpha= 10.0 ,
79+ beta= 5.0 ,
80+ wind_speed= 15.0 ,
81+ )
82+ wing_file_path = isabspath (wing_file) ? wing_file : test_data_path (module_name, wing_file)
83+ wing_file_path = replace (normpath (wing_file_path), ' \\ ' => ' /' )
84+
85+ doc = Dict (
86+ " wings" => [Dict (
87+ " name" => name,
88+ " geometry_file" => wing_file_path,
89+ " n_panels" => n_panels,
90+ " n_groups" => n_groups,
91+ " spanwise_panel_distribution" => spanwise_panel_distribution,
92+ " spanwise_direction" => spanwise_direction,
93+ " remove_nan" => remove_nan,
94+ )],
95+ " solver_settings" => Dict (
96+ " aerodynamic_model_type" => aerodynamic_model_type,
97+ " density" => density,
98+ " type_initial_gamma_distribution" => type_initial_gamma_distribution,
99+ ),
100+ " condition" => Dict (
101+ " alpha" => alpha,
102+ " beta" => beta,
103+ " wind_speed" => wind_speed,
104+ ),
105+ )
106+
110107 temp_file = joinpath (tempdir (), " temp_wing_settings_$(randstring (8 )) .yaml" )
111- write (temp_file, settings_content)
108+ open (temp_file, " w" ) do io
109+ YAML. write (io, doc)
110+ end
112111 return temp_file
113112end
114113
@@ -154,3 +153,4 @@ function get_complete_settings_file(module_name)
154153 return create_temp_wing_settings (module_name, basename (get_standard_wing_file (module_name)))
155154 end
156155end
156+
0 commit comments