pub mod export;
pub mod settings;
pub mod induced_velocity_calc;
pub mod initialization;
pub mod update_data;
pub mod builder;
use stormath::spatial_vector::SpatialVector;
use stormath::type_aliases::Float;
use std::ops::Range;
use crate::lifting_line::singularity_elements::prelude::*;
use settings::*;
#[derive(Debug, Clone)]
pub struct DynamicWake {
pub indices: WakeIndices,
pub points: Vec<SpatialVector>,
pub velocity_at_points: Vec<SpatialVector>,
pub strengths: Vec<Float>,
pub panels_viscous_core_length: Vec<Float>,
pub settings: WakeSettings,
pub potential_theory_settings: PotentialTheorySettings,
pub wing_indices: Vec<Range<usize>>,
pub number_of_time_steps_completed: usize,
pub panels: Vec<Panel>,
pub representative_chord_length: Float,
}
impl DynamicWake {
pub fn wing_index(&self, span_index: usize) -> usize {
for i in 0..self.wing_indices.len() {
if self.wing_indices[i].contains(&span_index) {
return i;
}
}
panic!("Span index not found in any wing");
}
fn panel_point_indices(&self, panel_stream_index: usize, panel_span_index: usize) -> [usize; 4] {
let wing_index = self.wing_index(panel_span_index);
[
self.indices.point_index(panel_stream_index, panel_span_index + wing_index),
self.indices.point_index(panel_stream_index, panel_span_index + 1 + wing_index),
self.indices.point_index(panel_stream_index + 1, panel_span_index + 1 + wing_index),
self.indices.point_index(panel_stream_index + 1, panel_span_index + wing_index),
]
}
fn panel_points(&self, panel_stream_index: usize, panel_span_index: usize) -> [SpatialVector; 4] {
let point_indices = self.panel_point_indices(panel_stream_index, panel_span_index);
[
self.points[point_indices[0]],
self.points[point_indices[1]],
self.points[point_indices[2]],
self.points[point_indices[3]],
]
}
}
#[cfg(test)]
mod tests;