|
18 | 18 | real(wp) :: y_shear_layer, delta_shear, tanh_arg, mix_factor |
19 | 19 | real(wp) :: u_max, p_ref, rho_ref |
20 | 20 | real(wp) :: u_mean, v_kick, perturbation_amp, perturbation_k |
| 21 | +real(wp) :: T_wall, T_inf, P_atm, y_height, T_loc,y_dist |
| 22 | +real(wp) :: delta_th, T_target, rho_target, R_mix |
| 23 | +real(wp) :: Y_N2, Y_O2, MW_N2, MW_O2 |
| 24 | +real(wp) :: x_lim_left, x_lim_right |
21 | 25 |
|
22 | 26 | eps = 1.e-9_wp |
23 | 27 | #:enddef |
@@ -338,53 +342,82 @@ real(wp) :: u_mean, v_kick, perturbation_amp, perturbation_k |
338 | 342 |
|
339 | 343 | case (291) |
340 | 344 |
|
341 | | -y_shear_layer = 3.048e-3_wp |
| 345 | + ! Setup Values |
| 346 | +T_wall = 600.0_wp |
| 347 | +T_inf = 1125.0_wp |
| 348 | +P_atm = 101325.0_wp ! 1 atm in Pa |
| 349 | +delta_th = 0.0001_wp ! Thermal BL thickness (e.g., 2mm - ADJUST THIS) |
| 350 | + |
| 351 | +! Geometry Limits (converting mm to meters if your grid is in meters) |
| 352 | +x_lim_left = (43.48e-3_wp - 21.99e-3_wp - 14.15e-3_wp) |
| 353 | +x_lim_right = (43.48e-3_wp - 21.99e-3_wp) |
| 354 | + |
| 355 | +! Air Properties (Approximate) |
| 356 | +MW_N2 = 28.0134e-3_wp ! kg/mol |
| 357 | +MW_O2 = 31.999e-3_wp ! kg/mol |
| 358 | +Y_N2 = 0.767_wp ! Mass fraction |
| 359 | +Y_O2 = 0.233_wp |
| 360 | + |
| 361 | +! Calculate Mixture Gas Constant R_mix = R_u * sum(Y_i / MW_i) |
| 362 | +R_mix = 8.314462618_wp * ( (Y_N2 / MW_N2) + (Y_O2 / MW_O2) ) |
| 363 | + |
| 364 | +y_shear_layer = 3.048e-3_wp |
342 | 365 |
|
343 | 366 | ! 2. Shear Layer Thickness (Smoothing) |
344 | | -! This spreads the jump over approx 1.0 mm to prevent acoustic shock. |
345 | | -delta_shear = 0.5e-3_wp |
| 367 | +delta_shear = 0.8e-3_wp |
346 | 368 |
|
347 | | -! 3. Flow Reference Conditions |
| 369 | +! Flow Reference Conditions |
348 | 370 | u_max = 50.0_wp ! Freestream Velocity (m/s) |
349 | | -p_ref = 101325.0_wp ! Reference Pressure (Pa) - KEEP CONSTANT |
350 | | -rho_ref = 1.0_wp ! Reference Density (kg/m3) - KEEP CONSTANT |
| 371 | +p_ref = 101325.0_wp ! Reference Pressure (Pa) |
| 372 | +rho_ref = 1.0_wp ! Reference Density (kg/m3) |
| 373 | + |
| 374 | +! Perturbation Parameters (To trigger vortices/Rossiter modes) |
| 375 | +perturbation_amp = 0.05_wp * u_max ! Amplitude: 5% of freestream |
| 376 | +perturbation_k = 200.0_wp ! Wavenumber: Oscillations along X |
| 377 | + |
| 378 | + |
| 379 | + |
| 380 | + |
| 381 | + IF (y_cc(j) > y_shear_layer) THEN |
351 | 382 |
|
352 | | -! 4. Perturbation Parameters (To trigger vortices) |
353 | | -! Amplitude: 5% of freestream velocity |
354 | | -! Wavenumber: Makes the kick oscillate along X |
355 | | -perturbation_amp = 0.05_wp * u_max |
356 | | -perturbation_k = 200.0_wp ! Adjust to fit |
| 383 | + tanh_arg = (y_cc(j) - y_shear_layer) / delta_shear |
| 384 | + mix_factor = tanh(tanh_arg) |
| 385 | + u_mean = u_max * mix_factor |
357 | 386 |
|
358 | | -tanh_arg = (y_cc(j) - y_shear_layer) / delta_shear |
359 | | - mix_factor = 0.5_wp * (1.0_wp + tanh(tanh_arg)) |
| 387 | + v_kick = 0.0_wp |
360 | 388 |
|
361 | | - ! --- B. Mean Velocity --- |
362 | | - u_mean = u_max * mix_factor |
| 389 | + ELSE |
| 390 | + |
| 391 | + |
| 392 | + u_mean = 0.0_wp |
| 393 | + v_kick = 0.0_wp |
| 394 | + |
| 395 | + END IF |
| 396 | + |
| 397 | +!IF (y_cc(j) > y_shear_layer-0.01) THEN |
363 | 398 |
|
364 | | - ! --- C. Vertical Perturbation (The "Kick") --- |
365 | | - ! This adds a small vertical wiggle ONLY near the shear layer. |
366 | | - ! exp(...) ensures the kick is zero far away from the interface. |
367 | | - ! sin(...) makes it oscillate along the streamwise direction. |
368 | 399 |
|
369 | | - v_kick = perturbation_amp * & |
370 | | - sin(perturbation_k * x_cc(i)) * & |
371 | | - exp( -1.0_wp * (tanh_arg**2) ) |
| 400 | + ! We are in the Left or Right regions: Apply Tanh Profile |
| 401 | + ! y_dist = y_cc(j) ! Distance from bottom wall |
| 402 | + |
| 403 | + ! Tanh Temperature Profile: T = Tw + (Tinf - Tw) * tanh(y/delta) |
| 404 | + ! T_loc = T_wall + (T_inf - T_wall) * tanh((y_dist-y_shear_layer) / delta_th) |
| 405 | + |
372 | 406 |
|
373 | | - ! --- D. Assign to State Vector --- |
374 | | - ! 1. Density (Constant) |
375 | | - q_prim_vf(contxb)%sf(i,j,0) = rho_ref |
| 407 | + ! else |
| 408 | + ! We are in the middle gap: Uniform Freestream Temperature |
| 409 | + T_loc = T_inf |
| 410 | + ! end if |
376 | 411 |
|
377 | | - ! 2. U-Velocity (Smooth Profile) |
| 412 | + q_prim_vf(contxb)%sf(i,j,0) = P_atm / (R_mix * T_loc) |
378 | 413 | q_prim_vf(momxb)%sf(i,j,0) = u_mean |
379 | 414 |
|
380 | | - ! 3. V-Velocity (The Perturbation) |
381 | 415 | q_prim_vf(momxe)%sf(i,j,0) = v_kick |
382 | 416 |
|
383 | | - ! 4. W-Velocity (assuming 2D or 0 initially) |
384 | | - ! q_prim_vf(momxz)%sf(i,j,0) = 0.0_wp |
385 | | - |
386 | | - ! 5. Pressure (Constant - Crucial for stability!) |
387 | 417 | q_prim_vf(E_idx)%sf(i,j,0) = p_ref |
| 418 | + |
| 419 | + q_prim_vf(chemxb)%sf(i,j,0) = 0.21_wp |
| 420 | + q_prim_vf(chemxe)%sf(i,j,0) = 0.79_wp |
388 | 421 | case default |
389 | 422 | if (proc_rank == 0) then |
390 | 423 | call s_int_to_str(patch_id, iStr) |
|
0 commit comments