341341 span = 10.0
342342
343343 wing = Wing (n_panels; spanwise_distribution= LINEAR)
344- # 3 sections = 2 unrefined panels
344+ # 3 sections
345345 add_section! (wing, [0.0 , span/ 2 , 0.0 ], [1.0 , span/ 2 , 0.0 ], INVISCID)
346346 add_section! (wing, [0.0 , 0.0 , 0.0 ], [1.0 , 0.0 , 0.0 ], INVISCID)
347347 add_section! (wing, [0.0 , - span/ 2 , 0.0 ], [1.0 , - span/ 2 , 0.0 ], INVISCID)
350350
351351 @test length (wing. refined_panel_mapping) == n_panels
352352
353- # Manually verify each refined panel is mapped to its closest unrefined panel
354- n_unrefined_panels = length (wing. unrefined_sections) - 1
353+ # Manually verify each refined panel is mapped to its closest unrefined section
354+ n_unrefined_sections = length (wing. unrefined_sections)
355355 for refined_panel_idx in 1 : n_panels
356356 # Calculate refined panel center
357357 le_mid = (wing. refined_sections[refined_panel_idx]. LE_point +
@@ -360,20 +360,18 @@ end
360360 wing. refined_sections[refined_panel_idx+ 1 ]. TE_point) / 2
361361 refined_center = (le_mid + te_mid) / 2
362362
363- # Find closest unrefined panel manually
363+ # Find closest unrefined section manually
364364 min_dist = Inf
365365 closest_idx = 1
366- for unrefined_panel_idx in 1 : n_unrefined_panels
367- le_mid_unref = (wing. unrefined_sections[unrefined_panel_idx]. LE_point +
368- wing. unrefined_sections[unrefined_panel_idx+ 1 ]. LE_point) / 2
369- te_mid_unref = (wing. unrefined_sections[unrefined_panel_idx]. TE_point +
370- wing. unrefined_sections[unrefined_panel_idx+ 1 ]. TE_point) / 2
371- unrefined_center = (le_mid_unref + te_mid_unref) / 2
366+ for unrefined_section_idx in 1 : n_unrefined_sections
367+ le_point = wing. unrefined_sections[unrefined_section_idx]. LE_point
368+ te_point = wing. unrefined_sections[unrefined_section_idx]. TE_point
369+ unrefined_center = (le_point + te_point) / 2
372370
373371 dist = norm (refined_center - unrefined_center)
374372 if dist < min_dist
375373 min_dist = dist
376- closest_idx = unrefined_panel_idx
374+ closest_idx = unrefined_section_idx
377375 end
378376 end
379377
387385 span = 20.0
388386
389387 wing = Wing (n_panels; spanwise_distribution= COSINE)
390- # 4 sections = 3 unrefined panels
388+ # 4 sections
391389 add_section! (wing, [0.0 , span/ 2 , 0.0 ], [1.0 , span/ 2 , 0.0 ], INVISCID)
392390 add_section! (wing, [0.0 , span/ 6 , 0.0 ], [1.0 , span/ 6 , 0.0 ], INVISCID)
393391 add_section! (wing, [0.0 , - span/ 6 , 0.0 ], [1.0 , - span/ 6 , 0.0 ], INVISCID)
397395
398396 @test length (wing. refined_panel_mapping) == n_panels
399397
400- # Verify each panel is mapped to its closest unrefined panel
401- n_unrefined_panels = length (wing. unrefined_sections) - 1
398+ # Verify each panel is mapped to its closest unrefined section
399+ n_unrefined_sections = length (wing. unrefined_sections)
402400 for refined_panel_idx in 1 : n_panels
403401 # Calculate refined panel center
404402 le_mid = (wing. refined_sections[refined_panel_idx]. LE_point +
@@ -407,20 +405,18 @@ end
407405 wing. refined_sections[refined_panel_idx+ 1 ]. TE_point) / 2
408406 refined_center = (le_mid + te_mid) / 2
409407
410- # Find closest unrefined panel manually
408+ # Find closest unrefined section manually
411409 min_dist = Inf
412410 closest_idx = 1
413- for unrefined_panel_idx in 1 : n_unrefined_panels
414- le_mid_unref = (wing. unrefined_sections[unrefined_panel_idx]. LE_point +
415- wing. unrefined_sections[unrefined_panel_idx+ 1 ]. LE_point) / 2
416- te_mid_unref = (wing. unrefined_sections[unrefined_panel_idx]. TE_point +
417- wing. unrefined_sections[unrefined_panel_idx+ 1 ]. TE_point) / 2
418- unrefined_center = (le_mid_unref + te_mid_unref) / 2
411+ for unrefined_section_idx in 1 : n_unrefined_sections
412+ le_point = wing. unrefined_sections[unrefined_section_idx]. LE_point
413+ te_point = wing. unrefined_sections[unrefined_section_idx]. TE_point
414+ unrefined_center = (le_point + te_point) / 2
419415
420416 dist = norm (refined_center - unrefined_center)
421417 if dist < min_dist
422418 min_dist = dist
423- closest_idx = unrefined_panel_idx
419+ closest_idx = unrefined_section_idx
424420 end
425421 end
426422
433429 n_panels = 12
434430
435431 wing = Wing (n_panels; spanwise_distribution= SPLIT_PROVIDED)
436- # 4 sections = 3 unrefined panels
432+ # 4 sections
437433 add_section! (wing, [0.0 , 6.0 , 0.0 ], [1.0 , 6.0 , 0.0 ], INVISCID)
438434 add_section! (wing, [0.0 , 2.0 , 0.0 ], [1.0 , 2.0 , 0.0 ], INVISCID)
439435 add_section! (wing, [0.0 , - 2.0 , 0.0 ], [1.0 , - 2.0 , 0.0 ], INVISCID)
443439
444440 @test length (wing. refined_panel_mapping) == n_panels
445441
446- # Verify each panel is mapped to its closest unrefined panel
447- n_unrefined_panels = length (wing. unrefined_sections) - 1
442+ # Verify each panel is mapped to its closest unrefined section
443+ n_unrefined_sections = length (wing. unrefined_sections)
448444 for refined_panel_idx in 1 : n_panels
449445 # Calculate refined panel center
450446 le_mid = (wing. refined_sections[refined_panel_idx]. LE_point +
@@ -453,20 +449,18 @@ end
453449 wing. refined_sections[refined_panel_idx+ 1 ]. TE_point) / 2
454450 refined_center = (le_mid + te_mid) / 2
455451
456- # Find closest unrefined panel manually
452+ # Find closest unrefined section manually
457453 min_dist = Inf
458454 closest_idx = 1
459- for unrefined_panel_idx in 1 : n_unrefined_panels
460- le_mid_unref = (wing. unrefined_sections[unrefined_panel_idx]. LE_point +
461- wing. unrefined_sections[unrefined_panel_idx+ 1 ]. LE_point) / 2
462- te_mid_unref = (wing. unrefined_sections[unrefined_panel_idx]. TE_point +
463- wing. unrefined_sections[unrefined_panel_idx+ 1 ]. TE_point) / 2
464- unrefined_center = (le_mid_unref + te_mid_unref) / 2
455+ for unrefined_section_idx in 1 : n_unrefined_sections
456+ le_point = wing. unrefined_sections[unrefined_section_idx]. LE_point
457+ te_point = wing. unrefined_sections[unrefined_section_idx]. TE_point
458+ unrefined_center = (le_point + te_point) / 2
465459
466460 dist = norm (refined_center - unrefined_center)
467461 if dist < min_dist
468462 min_dist = dist
469- closest_idx = unrefined_panel_idx
463+ closest_idx = unrefined_section_idx
470464 end
471465 end
472466
0 commit comments