@@ -925,13 +925,22 @@ fn bl_error(message: impl Into<String>) -> BLDistribution {
925925 }
926926}
927927
928+ fn re_type_from_int ( v : u8 ) -> rustfoil_xfoil:: config:: ReType {
929+ match v {
930+ 2 => rustfoil_xfoil:: config:: ReType :: Type2 ,
931+ 3 => rustfoil_xfoil:: config:: ReType :: Type3 ,
932+ _ => rustfoil_xfoil:: config:: ReType :: Type1 ,
933+ }
934+ }
935+
928936fn faithful_snapshot (
929937 coords : & [ f64 ] ,
930938 alpha_deg : f64 ,
931939 reynolds : f64 ,
932940 mach : f64 ,
933941 ncrit : f64 ,
934942 max_iterations : usize ,
943+ re_type : u8 ,
935944) -> Result < FaithfulSnapshot , String > {
936945 if coords. len ( ) < 6 || coords. len ( ) % 2 != 0 {
937946 return Err ( "Invalid coordinates: need at least 3 points (6 values)" . to_string ( ) ) ;
@@ -996,6 +1005,7 @@ fn faithful_snapshot(
9961005 mach,
9971006 ncrit,
9981007 max_iterations,
1008+ re_type : re_type_from_int ( re_type) ,
9991009 ..Default :: default ( )
10001010 } ;
10011011 let oper_result = solve_operating_point_from_state ( & mut state, & factorized, & options)
@@ -1141,8 +1151,9 @@ pub fn analyze_airfoil_faithful(
11411151 mach : f64 ,
11421152 ncrit : f64 ,
11431153 max_iterations : usize ,
1154+ re_type : u8 ,
11441155) -> JsValue {
1145- let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations) {
1156+ let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations, re_type ) {
11461157 Ok ( snapshot) => snapshot. result ,
11471158 Err ( message) => analysis_error ( message) ,
11481159 } ;
@@ -1158,7 +1169,7 @@ pub fn get_bl_distribution_faithful(
11581169 ncrit : f64 ,
11591170 max_iterations : usize ,
11601171) -> JsValue {
1161- let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations) {
1172+ let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations, 1 ) {
11621173 Ok ( snapshot) => rows_to_bl_distribution (
11631174 & snapshot. upper_rows ,
11641175 & snapshot. lower_rows ,
@@ -1264,7 +1275,7 @@ pub fn get_bl_visualization_faithful(
12641275 ncrit : f64 ,
12651276 max_iterations : usize ,
12661277) -> JsValue {
1267- let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations) {
1278+ let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations, 1 ) {
12681279 Ok ( snapshot) => build_bl_visualization ( & snapshot) ,
12691280 Err ( message) => bl_vis_error ( message) ,
12701281 } ;
@@ -1442,7 +1453,7 @@ pub fn compute_streamlines_faithful(
14421453 seed_count : u32 ,
14431454 bounds : & [ f64 ] ,
14441455) -> JsValue {
1445- let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations) {
1456+ let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations, 1 ) {
14461457 Ok ( snapshot) => {
14471458 if bounds. len ( ) != 4 {
14481459 StreamlineResult {
@@ -1585,7 +1596,7 @@ pub fn compute_dividing_streamline_faithful(
15851596 max_iterations : usize ,
15861597 bounds : & [ f64 ] ,
15871598) -> JsValue {
1588- let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations) {
1599+ let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations, 1 ) {
15891600 Ok ( snapshot) => {
15901601 if bounds. len ( ) != 4 {
15911602 DividingStreamlineResult {
@@ -1809,7 +1820,7 @@ pub fn compute_psi_grid_faithful(
18091820 bounds : & [ f64 ] ,
18101821 resolution : & [ u32 ] ,
18111822) -> JsValue {
1812- let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations) {
1823+ let result = match faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations, 1 ) {
18131824 Ok ( snapshot) => {
18141825 if bounds. len ( ) != 4 {
18151826 PsiGridResult {
@@ -1952,7 +1963,7 @@ impl WasmSmokeSystem {
19521963 ncrit : f64 ,
19531964 max_iterations : usize ,
19541965 ) {
1955- if let Ok ( snapshot) = faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations) {
1966+ if let Ok ( snapshot) = faithful_snapshot ( coords, alpha_deg, reynolds, mach, ncrit, max_iterations, 1 ) {
19561967 let field = FaithfulFlowField :: from_snapshot ( & snapshot, alpha_deg) ;
19571968 self . coords = field. nodes . clone ( ) ;
19581969 self . gamma = field. gamma . clone ( ) ;
@@ -3503,7 +3514,7 @@ mod tests {
35033514 let paneled_flat = repanel_xfoil ( & buffer_flat, 160 ) ;
35043515 let alpha_deg = 15.0 ;
35053516
3506- let snapshot = faithful_snapshot ( & paneled_flat, alpha_deg, 1.0e6 , 0.0 , 9.0 , 100 )
3517+ let snapshot = faithful_snapshot ( & paneled_flat, alpha_deg, 1.0e6 , 0.0 , 9.0 , 100 , 1 )
35073518 . expect ( "faithful snapshot should solve" ) ;
35083519 let field = FaithfulFlowField :: from_snapshot ( & snapshot, alpha_deg) ;
35093520 let options = StreamlineOptions {
0 commit comments