|
| 1 | +import json |
| 2 | +import math |
| 3 | + |
| 4 | +Mu = 1.84E-05 |
| 5 | +gam_a = 1.4 |
| 6 | +gam_b = 1.1 |
| 7 | + |
| 8 | + |
| 9 | +x0 = 10E-06 |
| 10 | +p0 = 101325 |
| 11 | +rho0 = 1.0 |
| 12 | +c0 = math.sqrt( p0/rho0 ) |
| 13 | +patm = 1. |
| 14 | +rhoatm = 1. |
| 15 | + |
| 16 | +#air props |
| 17 | +n_tait = 1.4 |
| 18 | +B_tait = 0.0 |
| 19 | + |
| 20 | + |
| 21 | +vf0 = 0.0 |
| 22 | + |
| 23 | +cact = math.sqrt(n_tait*(p0 + p0*B_tait) / ((1 - vf0) * rho0) ) |
| 24 | +cfl = 0.3 |
| 25 | +Nx = 400 |
| 26 | +Ny = 200 |
| 27 | +dx = 6.E-03 / (x0*float(Nx)) |
| 28 | +dt = cfl*dx*c0/cact |
| 29 | + |
| 30 | + |
| 31 | +vel = 1.5 |
| 32 | +vel_ac = vel * c0 |
| 33 | + |
| 34 | +Min = (n_tait + 1)*vel_ac + math.sqrt((n_tait + 1)**2 * vel_ac**2 + 16 * cact**2) |
| 35 | +Min = Min / (4 * cact) |
| 36 | +beta = (n_tait + 1) * Min**2 / (Min**2 * (n_tait - 1 + 2*vf0) + 2 * (1 - vf0)) |
| 37 | +delta = (1 - vf0) + n_tait * Min**2 * (beta - 1) * (1 + B_tait) / beta |
| 38 | + |
| 39 | +vel = Min * cact * (beta - 1) / (beta * c0) |
| 40 | + |
| 41 | +# Configuring case dictionary |
| 42 | +print(json.dumps({ |
| 43 | + # Logistics ================================================================ |
| 44 | + 'run_time_info' : 'F', |
| 45 | + # ========================================================================== |
| 46 | + |
| 47 | + # Computational Domain Parameters ========================================== |
| 48 | + 'x_domain%beg' : 0.0E+00, |
| 49 | + 'x_domain%end' : 6.0E-03 / x0, |
| 50 | + 'y_domain%beg' : 0.0E+00, |
| 51 | + 'y_domain%end' : 3.0E-03 / x0, |
| 52 | + 'cyl_coord' : 'F', |
| 53 | + 'm' : Nx, |
| 54 | + 'n' : Ny, |
| 55 | + 'p' : 0, |
| 56 | + 'dt' : dt, |
| 57 | + 't_step_start' : 0, |
| 58 | + 't_step_stop' : 1000, #3000 |
| 59 | + 't_step_save' : 10, #10 |
| 60 | + # ========================================================================== |
| 61 | + |
| 62 | + # Simulation Algorithm Parameters ========================================== |
| 63 | + 'num_patches' : 2, |
| 64 | + # Use the 5 equation model |
| 65 | + 'model_eqns' : 2, |
| 66 | + 'alt_soundspeed' : 'F', |
| 67 | + 'num_fluids' : 1, |
| 68 | + # No need to ensure the volume fractions sum to unity at the end of each |
| 69 | + # time step |
| 70 | + 'mpp_lim' : 'F', |
| 71 | + # Correct errors when computing speed of sound |
| 72 | + 'mixture_err' : 'T', |
| 73 | + # Use TVD RK3 for time marching |
| 74 | + 'time_stepper' : 3, |
| 75 | + # Reconstruct the primitive variables to minimize spurious |
| 76 | + # Use WENO5 |
| 77 | + 'weno_order' : 5, |
| 78 | + 'weno_eps' : 1.E-16, |
| 79 | + 'weno_Re_flux' : 'F', |
| 80 | + 'weno_avg' : 'T', |
| 81 | + 'avg_state' : 2, |
| 82 | + # Use the mapped WENO weights to maintain monotinicity |
| 83 | + 'mapped_weno' : 'T', |
| 84 | + 'null_weights' : 'F', |
| 85 | + 'mp_weno' : 'F', |
| 86 | + # Use the HLLC Riemann solver |
| 87 | + 'riemann_solver' : 2, |
| 88 | + 'wave_speeds' : 1, |
| 89 | + 'bc_x%beg' : -7, |
| 90 | + 'bc_x%end' : -8, |
| 91 | + 'bc_y%beg' : -3, |
| 92 | + 'bc_y%end' : -3, |
| 93 | + # Set IB to True and add 1 patch |
| 94 | + 'ib' : 'T', |
| 95 | + 'num_ibs' : 1, |
| 96 | + # ========================================================================== |
| 97 | + |
| 98 | + # Formatted Database Files Structure Parameters ============================ |
| 99 | + # Export primitive variables in double precision with parallel |
| 100 | + # I/O to minimize I/O computational time during large simulations |
| 101 | + 'format' : 1, |
| 102 | + 'precision' : 2, |
| 103 | + 'prim_vars_wrt' :'T', |
| 104 | + 'fd_order' : 1, |
| 105 | + 'omega_wrt(3)' :'T', |
| 106 | + 'parallel_io' :'T', |
| 107 | + # ========================================================================== |
| 108 | + |
| 109 | + #Ambient State ===================================== |
| 110 | + 'patch_icpp(1)%geometry' : 3, |
| 111 | + 'patch_icpp(1)%x_centroid' : 3.0E-03 / x0, |
| 112 | + 'patch_icpp(1)%y_centroid' : 1.50E-03 / x0, |
| 113 | + 'patch_icpp(1)%length_x' : 6.0E-03 / x0, |
| 114 | + 'patch_icpp(1)%length_y' : 3.0E-03 / x0, |
| 115 | + 'patch_icpp(1)%alpha_rho(1)' : rhoatm, |
| 116 | + 'patch_icpp(1)%alpha(1)' : 1, |
| 117 | + 'patch_icpp(1)%vel(1)' : 0.0, |
| 118 | + 'patch_icpp(1)%vel(2)' : 0.0E+00, |
| 119 | + 'patch_icpp(1)%pres' : patm, |
| 120 | + 'patch_icpp(1)%r0' : 1., |
| 121 | + 'patch_icpp(1)%v0' : 0.0E+00, |
| 122 | + # # ======================================================================== |
| 123 | + |
| 124 | + #Shocked State ===================================== |
| 125 | + 'patch_icpp(2)%geometry' : 3, |
| 126 | + 'patch_icpp(2)%x_centroid' : 0.5E-03 / x0, |
| 127 | + 'patch_icpp(2)%y_centroid' : 1.50E-03 / x0, |
| 128 | + 'patch_icpp(2)%length_x' : 1.0E-03 / x0, |
| 129 | + 'patch_icpp(2)%length_y' : 3.0E-03 / x0, |
| 130 | + 'patch_icpp(2)%alpha_rho(1)' : beta*rhoatm, |
| 131 | + 'patch_icpp(2)%alpha(1)' : 1., |
| 132 | + 'patch_icpp(2)%vel(1)' : vel, |
| 133 | + 'patch_icpp(2)%vel(2)' : 0.0E+00, |
| 134 | + 'patch_icpp(2)%pres' : delta*patm, |
| 135 | + 'patch_icpp(2)%r0' : 1., |
| 136 | + 'patch_icpp(2)%v0' : 0.0E+00, |
| 137 | + 'patch_icpp(2)%alter_patch(1)' : 'T', |
| 138 | + # # ======================================================================== |
| 139 | + |
| 140 | + |
| 141 | + # CBC Inflow / Outflow ======================================== |
| 142 | + 'bc_x%grcbc_in' : 'T', |
| 143 | + 'bc_x%grcbc_out' : 'F', |
| 144 | + 'bc_x%grcbc_vel_out' : 'F', |
| 145 | + 'bc_x%vel_in(1)' : vel, |
| 146 | + 'bc_x%vel_in(2)' : 0, |
| 147 | + 'bc_x%vel_in(3)' : 0, |
| 148 | + 'bc_x%pres_in' : delta*patm, |
| 149 | + 'bc_x%alpha_rho_in(1)' : beta*rhoatm, |
| 150 | + 'bc_x%alpha_in(1)' : 1, |
| 151 | + 'bc_x%vel_out(1)' : vel, |
| 152 | + 'bc_x%vel_out(2)' : 0, |
| 153 | + 'bc_x%vel_out(3)' : 0, |
| 154 | + 'bc_x%pres_out' : 1., |
| 155 | + # # ======================================================================== |
| 156 | + |
| 157 | + # Patch: Cylinder Immersed Boundary ======================================== |
| 158 | + 'patch_ib(1)%geometry' : 4, |
| 159 | + 'patch_ib(1)%x_centroid' : 1.5E-03 / x0, |
| 160 | + 'patch_ib(1)%y_centroid' : 1.5E-03 / x0, |
| 161 | + 'patch_ib(1)%c' : 1.0E-03 / x0, |
| 162 | + 'patch_ib(1)%t' : 0.15, |
| 163 | + 'patch_ib(1)%p' : 0.4, |
| 164 | + 'patch_ib(1)%m' : 0.02, |
| 165 | + 'patch_ib(1)%slip' : 'F', |
| 166 | + 'patch_ib(1)%theta' : 15, |
| 167 | + |
| 168 | + # Fluids Physical Parameters =============================== |
| 169 | + # Surrounding liquid |
| 170 | + 'fluid_pp(1)%gamma' : 1.E+00/(n_tait-1.E+00), |
| 171 | + 'fluid_pp(1)%pi_inf' : n_tait*B_tait/(n_tait-1.), |
| 172 | + #'fluid_pp(1)%Re(1)' : 67567, |
| 173 | + |
| 174 | + |
| 175 | + # ========================================================================== |
| 176 | +})) |
0 commit comments