|
| 1 | +""" |
| 2 | +Case file to demonstrate and test the periodic collision of immersed boundaries. |
| 3 | +This file was generated by Conrad Delgado as a minimum reproducer to prevent regression |
| 4 | +of periodic immersed boundaries. |
| 5 | +""" |
| 6 | + |
| 7 | +import json |
| 8 | +import math |
| 9 | + |
| 10 | +import numpy as np |
| 11 | + |
| 12 | +gam_a = 1.4 |
| 13 | + |
| 14 | +# particle diameter |
| 15 | +D = 0.1 |
| 16 | +R = D / 2.0 |
| 17 | + |
| 18 | +# particle params |
| 19 | +rho_s = 10.0 |
| 20 | +vol_s = 4.0 / 3.0 * np.pi * R**3 |
| 21 | +mass_s = rho_s * vol_s |
| 22 | +N_s = 2 |
| 23 | + |
| 24 | +# fluid params |
| 25 | +M = 2.0 |
| 26 | +Re = 500.0 |
| 27 | +P = 101325 |
| 28 | +rho = 1.225 |
| 29 | +v1 = M * np.sqrt(gam_a * P / rho) |
| 30 | +mu = rho * v1 * D / Re |
| 31 | + |
| 32 | +# timestep |
| 33 | +dt = 1.0e-05 |
| 34 | +Nt = 50 |
| 35 | +t_save = 5 |
| 36 | + |
| 37 | +# grid |
| 38 | +Nx = 31 |
| 39 | +Ny = 63 |
| 40 | +Nz = 31 |
| 41 | + |
| 42 | +# immersed boundary dictionary |
| 43 | +ib_dict = {} |
| 44 | +ib_dict.update( |
| 45 | + { |
| 46 | + f"patch_ib({1})%geometry": 8, |
| 47 | + f"patch_ib({1})%x_centroid": 0.0, |
| 48 | + f"patch_ib({1})%y_centroid": -2.1 * D, |
| 49 | + f"patch_ib({1})%z_centroid": 0.0, |
| 50 | + f"patch_ib({1})%vel(2)": -100.0, |
| 51 | + f"patch_ib({1})%radius": D / 2, |
| 52 | + f"patch_ib({1})%slip": "F", |
| 53 | + f"patch_ib({1})%moving_ibm": 2, |
| 54 | + f"patch_ib({1})%mass": mass_s, |
| 55 | + f"patch_ib({2})%geometry": 8, |
| 56 | + f"patch_ib({2})%x_centroid": 0.0, |
| 57 | + f"patch_ib({2})%y_centroid": 1.8 * D, |
| 58 | + f"patch_ib({2})%z_centroid": 0.0, |
| 59 | + f"patch_ib({2})%vel(2)": +100.0, |
| 60 | + f"patch_ib({2})%radius": D / 2, |
| 61 | + f"patch_ib({2})%slip": "F", |
| 62 | + f"patch_ib({2})%moving_ibm": 2, |
| 63 | + f"patch_ib({2})%mass": mass_s, |
| 64 | + } |
| 65 | +) |
| 66 | + |
| 67 | +# Configuring case dictionary |
| 68 | +case_dict = { |
| 69 | + # Logistics |
| 70 | + "run_time_info": "T", |
| 71 | + # Computational Domain Parameters |
| 72 | + # x direction |
| 73 | + "x_domain%beg": -1.25 * D, |
| 74 | + "x_domain%end": 1.25 * D, |
| 75 | + # y direction |
| 76 | + "y_domain%beg": -2.5 * D, |
| 77 | + "y_domain%end": 2.5 * D, |
| 78 | + # z direction |
| 79 | + "z_domain%beg": -1.25 * D, |
| 80 | + "z_domain%end": 1.25 * D, |
| 81 | + "cyl_coord": "F", |
| 82 | + "m": Nx, |
| 83 | + "n": Ny, |
| 84 | + "p": Nz, |
| 85 | + "dt": dt, |
| 86 | + "t_step_start": 0, |
| 87 | + "t_step_stop": Nt, |
| 88 | + "t_step_save": t_save, |
| 89 | + # Simulation Algorithm Parameters |
| 90 | + # Only one patches are necessary, the air tube |
| 91 | + "num_patches": 1, |
| 92 | + # Use the 5 equation model |
| 93 | + "model_eqns": 2, |
| 94 | + # 6 equations model does not need the K \div(u) term |
| 95 | + "alt_soundspeed": "F", |
| 96 | + # One fluids: air |
| 97 | + "num_fluids": 1, |
| 98 | + # time step |
| 99 | + "mpp_lim": "F", |
| 100 | + # Correct errors when computing speed of sound |
| 101 | + "mixture_err": "T", |
| 102 | + # Use TVD RK3 for time marching |
| 103 | + "time_stepper": 3, |
| 104 | + # Reconstruct the primitive variables to minimize spurious |
| 105 | + # Use WENO5 |
| 106 | + "weno_order": 5, |
| 107 | + "weno_eps": 1.0e-16, |
| 108 | + "weno_Re_flux": "T", |
| 109 | + "weno_avg": "T", |
| 110 | + "avg_state": 2, |
| 111 | + "null_weights": "F", |
| 112 | + "mp_weno": "T", |
| 113 | + "riemann_solver": 2, |
| 114 | + "wave_speeds": 1, |
| 115 | + # periodic bc |
| 116 | + "bc_x%beg": -3, |
| 117 | + "bc_x%end": -3, |
| 118 | + "bc_y%beg": -1, |
| 119 | + "bc_y%end": -1, |
| 120 | + "bc_z%beg": -3, |
| 121 | + "bc_z%end": -3, |
| 122 | + # Set IB to True and add 1 patch |
| 123 | + "ib": "T", |
| 124 | + "num_ibs": N_s, |
| 125 | + "viscous": "T", |
| 126 | + # Formatted Database Files Structure Parameters |
| 127 | + "format": 1, |
| 128 | + "precision": 2, |
| 129 | + "prim_vars_wrt": "T", |
| 130 | + "E_wrt": "T", |
| 131 | + "parallel_io": "T", |
| 132 | + "ib_state_wrt": "T", |
| 133 | + "fd_order": 4, |
| 134 | + # Patch: Constant Tube filled with air |
| 135 | + # Specify the cylindrical air tube grid geometry |
| 136 | + "patch_icpp(1)%geometry": 9, |
| 137 | + "patch_icpp(1)%x_centroid": 0.0, |
| 138 | + # Uniform medium density, centroid is at the center of the domain |
| 139 | + "patch_icpp(1)%y_centroid": 0.0, |
| 140 | + "patch_icpp(1)%z_centroid": 0.0, |
| 141 | + "patch_icpp(1)%length_x": 2.5 * D, |
| 142 | + "patch_icpp(1)%length_y": 5.0 * D, |
| 143 | + "patch_icpp(1)%length_z": 2.5 * D, |
| 144 | + # Specify the patch primitive variables |
| 145 | + "patch_icpp(1)%vel(1)": 0.0e00, |
| 146 | + "patch_icpp(1)%vel(2)": 0.0e00, |
| 147 | + "patch_icpp(1)%vel(3)": 0.0e00, |
| 148 | + "patch_icpp(1)%pres": P, |
| 149 | + "patch_icpp(1)%alpha_rho(1)": rho, |
| 150 | + "patch_icpp(1)%alpha(1)": 1.0e00, |
| 151 | + # Patch: Sphere Immersed Boundary |
| 152 | + # Fluids Physical Parameters |
| 153 | + "fluid_pp(1)%gamma": 1.0e00 / (gam_a - 1.0e00), # 2.50(Not 1.40) |
| 154 | + "fluid_pp(1)%pi_inf": 0, |
| 155 | + "fluid_pp(1)%Re(1)": 1.0 / mu, |
| 156 | + "collision_model": 1, # soft-sphere collision model |
| 157 | + "ib_coefficient_of_friction": 0.1, |
| 158 | + "collision_time": 20.0 * dt, |
| 159 | + "coefficient_of_restitution": 0.9, # almost perfectly elastic |
| 160 | +} |
| 161 | + |
| 162 | +case_dict.update(ib_dict) |
| 163 | + |
| 164 | +print(json.dumps(case_dict)) |
0 commit comments