|
| 1 | +#!/usr/bin/env python2 |
| 2 | + |
| 3 | +import math |
| 4 | + |
| 5 | +x0 = 10.E-06 |
| 6 | +p0 = 101325. |
| 7 | +rho0 = 1.E+03 |
| 8 | +c0 = math.sqrt( p0/rho0 ) |
| 9 | +patm = 1. |
| 10 | + |
| 11 | +#water props |
| 12 | +n_tait = 7.1 |
| 13 | +B_tait = 306.E+06 / p0 |
| 14 | +mul0 = 1.002E-03 #viscosity |
| 15 | +ss = 0.07275 #surface tension |
| 16 | +pv = 2.3388E+03 #vapor pressure |
| 17 | + |
| 18 | +gamma_v = 1.33 |
| 19 | +M_v = 18.02 |
| 20 | +mu_v = 0.8816E-05 |
| 21 | +k_v = 0.019426 |
| 22 | + |
| 23 | +#air props |
| 24 | +gamma_n = 1.4 |
| 25 | +M_n = 28.97 |
| 26 | +mu_n = 1.8E-05 |
| 27 | +k_n = 0.02556 |
| 28 | + |
| 29 | +#air props |
| 30 | +# gamma_gas = gamma_n |
| 31 | +gamma_gas = 1.4 |
| 32 | + |
| 33 | +#reference bubble size |
| 34 | +R0ref = 10.E-06 |
| 35 | + |
| 36 | +pa = 0.1 * 1.E+06 / 101325. |
| 37 | + |
| 38 | +#Characteristic velocity |
| 39 | +uu = math.sqrt( p0/rho0 ) |
| 40 | +#Cavitation number |
| 41 | +Ca = (p0 - pv)/(rho0*(uu**2.)) |
| 42 | +#Ca = 1. |
| 43 | +#Weber number |
| 44 | +# We = rho0*(uu**2.)*R0ref/ss |
| 45 | +We = p0*R0ref/ss |
| 46 | +#Inv. bubble Reynolds number |
| 47 | +Re_inv = mul0/(rho0*uu*R0ref) |
| 48 | + |
| 49 | +#IC setup |
| 50 | +vf0 = 0.0001 |
| 51 | +n0 = vf0/(math.pi*4.E+00/3.E+00) |
| 52 | + |
| 53 | +cact = 1475. |
| 54 | +t0 = x0/c0 |
| 55 | + |
| 56 | +nbubbles = 1 |
| 57 | +myr0 = R0ref |
| 58 | + |
| 59 | +cfl = 0.1 |
| 60 | +Nx = 400 |
| 61 | +Ldomain = 20.E-03 |
| 62 | +L = Ldomain/x0 |
| 63 | +dx = L/float(Nx) |
| 64 | +dt = cfl*dx*c0/cact |
| 65 | +Lpulse = 0.3*Ldomain |
| 66 | +Tpulse = Lpulse/cact |
| 67 | +Tfinal = 6*0.25*10.*Tpulse*c0/x0 |
| 68 | +Nt = int(Tfinal/dt) |
| 69 | + |
| 70 | +dt = dt * 0.1 |
| 71 | +# print('dt: ',dt) |
| 72 | + |
| 73 | + |
| 74 | +Nt = 60000 |
| 75 | + |
| 76 | +Nfiles = 74. |
| 77 | +Nout = int(math.ceil(Nt/Nfiles)) |
| 78 | +Nt = int(Nout*Nfiles) |
| 79 | + |
| 80 | + |
| 81 | +print('Web', We) |
| 82 | +print('Re_inv', Re_inv) |
| 83 | + |
| 84 | +# Command to navigate between directories |
| 85 | +from os import chdir |
| 86 | + |
| 87 | +# Command to acquire directory path |
| 88 | +from os.path import dirname |
| 89 | + |
| 90 | +# Command to acquire script name and module search path |
| 91 | +from sys import argv, path |
| 92 | + |
| 93 | +# Navigating to script directory |
| 94 | +if len(dirname(argv[0])) != 0: chdir(dirname(argv[0])) |
| 95 | + |
| 96 | +# Adding master_scripts directory to module search path |
| 97 | +mfc_dir = '../../src'; path[:0] = [mfc_dir + '/master_scripts'] |
| 98 | + |
| 99 | +# Command to execute the MFC components |
| 100 | +from m_python_proxy import f_execute_mfc_component |
| 101 | +#from m_python_proxy import f_execute_mfc_component_SHB |
| 102 | +#sub_name = 'XXNAME' |
| 103 | + |
| 104 | +# ============================================================================== |
| 105 | + |
| 106 | +# Case Analysis Configuration ================================================== |
| 107 | + |
| 108 | +# Selecting MFC component |
| 109 | +comp_name = argv[1].strip() |
| 110 | + |
| 111 | +# Serial or parallel computational engine |
| 112 | +engine = 'serial' |
| 113 | +if (comp_name=='pre_process'): engine = 'serial' |
| 114 | + |
| 115 | +# Configuring case dictionary |
| 116 | +case_dict = \ |
| 117 | + { \ |
| 118 | + # Logistics ================================================ |
| 119 | + 'case_dir' : '\'.\'', \ |
| 120 | + 'run_time_info' : 'F', \ |
| 121 | + 'nodes' : 1, \ |
| 122 | + 'ppn' : 2, \ |
| 123 | + 'queue' : 'normal', \ |
| 124 | + 'walltime' : '24:00:00', \ |
| 125 | + 'mail_list' : '', \ |
| 126 | + # ========================================================== |
| 127 | + \ |
| 128 | + # Computational Domain Parameters ========================== |
| 129 | + 'x_domain%beg' : -10.E-03/x0, \ |
| 130 | + 'x_domain%end' : 10.E-03/x0, \ |
| 131 | + 'stretch_x' : 'F', \ |
| 132 | + 'cyl_coord' : 'F', \ |
| 133 | + 'm' : Nx, \ |
| 134 | + 'n' : 0, \ |
| 135 | + 'p' : 0, \ |
| 136 | + 'dt' : dt, \ |
| 137 | + 't_step_start' : 0, \ |
| 138 | + 't_step_stop' : Nt, \ |
| 139 | + 't_step_save' : Nout, \ |
| 140 | + # ========================================================== |
| 141 | + \ |
| 142 | + # Simulation Algorithm Parameters ========================== |
| 143 | + 'num_patches' : 2, \ |
| 144 | + 'model_eqns' : 2, \ |
| 145 | + 'alt_soundspeed' : 'F', \ |
| 146 | + 'num_fluids' : 1, \ |
| 147 | + 'adv_alphan' : 'T', \ |
| 148 | + 'mpp_lim' : 'F', \ |
| 149 | + 'mixture_err' : 'F', \ |
| 150 | + 'time_stepper' : 3, \ |
| 151 | + 'weno_vars' : 2, \ |
| 152 | + 'weno_order' : 5, \ |
| 153 | + 'weno_eps' : 1.E-16, \ |
| 154 | + 'char_decomp' : 'F', \ |
| 155 | + 'mapped_weno' : 'T', \ |
| 156 | + 'null_weights' : 'F', \ |
| 157 | + 'mp_weno' : 'T', \ |
| 158 | + 'riemann_solver' : 2, \ |
| 159 | + 'wave_speeds' : 1, \ |
| 160 | + 'avg_state' : 2, \ |
| 161 | + 'commute_err' : 'F', \ |
| 162 | + 'split_err' : 'F', \ |
| 163 | + 'bc_x%beg' : -8, \ |
| 164 | + 'bc_x%end' : -8, \ |
| 165 | + # ========================================================== |
| 166 | + \ |
| 167 | + # Formatted Database Files Structure Parameters ============ |
| 168 | + 'format' : 1, \ |
| 169 | + 'precision' : 2, \ |
| 170 | + 'prim_vars_wrt' :'T', \ |
| 171 | + 'parallel_io' :'F', \ |
| 172 | + 'fd_order' : 1, \ |
| 173 | + #'schlieren_wrt' :'T', \ |
| 174 | + 'probe_wrt' :'T', \ |
| 175 | + 'num_probes' : 1, \ |
| 176 | + 'probe(1)%x' : 0., \ |
| 177 | + # ========================================================== |
| 178 | + |
| 179 | + # Patch 1 _ Background ===================================== |
| 180 | + 'patch_icpp(1)%geometry' : 1, \ |
| 181 | + 'patch_icpp(1)%x_centroid' : 0., \ |
| 182 | + 'patch_icpp(1)%length_x' : 20.E-03/x0, \ |
| 183 | + 'patch_icpp(1)%vel(1)' : 0.0, \ |
| 184 | + 'patch_icpp(1)%pres' : 1, \ |
| 185 | + 'patch_icpp(1)%alpha_rho(1)' : (1.-1.E-12)*1.E+03/rho0, \ |
| 186 | + 'patch_icpp(1)%alpha(1)' : 1.E-12, \ |
| 187 | + 'patch_icpp(1)%r0' : 1., \ |
| 188 | + 'patch_icpp(1)%v0' : 0.0E+00, \ |
| 189 | + # ========================================================== |
| 190 | + |
| 191 | + # Patch 2 Screen =========================================== |
| 192 | + 'patch_icpp(2)%geometry' : 1, \ |
| 193 | + 'patch_icpp(2)%x_centroid' : 0., \ |
| 194 | + 'patch_icpp(2)%length_x' : 5.E-03/x0, \ |
| 195 | + # 'patch_icpp(1)%length_x' : 20.E-03/x0, \ |
| 196 | + 'patch_icpp(2)%alter_patch(1)' : 'T', \ |
| 197 | + 'patch_icpp(2)%vel(1)' : 0.0, \ |
| 198 | + 'patch_icpp(2)%pres' : 1, \ |
| 199 | + 'patch_icpp(2)%alpha_rho(1)' : (1.-vf0)*1.E+03/rho0, \ |
| 200 | + 'patch_icpp(2)%alpha(1)' : vf0, \ |
| 201 | + 'patch_icpp(2)%r0' : 1., \ |
| 202 | + 'patch_icpp(2)%v0' : 0., \ |
| 203 | + # ========================================================== |
| 204 | + |
| 205 | + # Fluids Physical Parameters =============================== |
| 206 | + # Surrounding liquid |
| 207 | + 'fluid_pp(1)%gamma' : 1.E+00/(n_tait-1.E+00), \ |
| 208 | + 'fluid_pp(1)%pi_inf' : n_tait*B_tait/(n_tait-1.), \ |
| 209 | + 'fluid_pp(1)%mul0' : mul0, \ |
| 210 | + 'fluid_pp(1)%ss' : ss, \ |
| 211 | + 'fluid_pp(1)%pv' : pv, \ |
| 212 | + 'fluid_pp(1)%gamma_v' : gamma_v, \ |
| 213 | + 'fluid_pp(1)%M_v' : M_v, \ |
| 214 | + 'fluid_pp(1)%mu_v' : mu_v, \ |
| 215 | + 'fluid_pp(1)%k_v' : k_v, \ |
| 216 | + |
| 217 | + # Last fluid_pp is always reserved for bubble gas state === |
| 218 | + # if applicable ========================================== |
| 219 | + 'fluid_pp(2)%gamma' : 1./(gamma_gas-1.), \ |
| 220 | + 'fluid_pp(2)%pi_inf' : 0.0E+00, \ |
| 221 | + 'fluid_pp(2)%gamma_v' : gamma_n, \ |
| 222 | + 'fluid_pp(2)%M_v' : M_n, \ |
| 223 | + 'fluid_pp(2)%mu_v' : mu_n, \ |
| 224 | + 'fluid_pp(2)%k_v' : k_n, \ |
| 225 | + # ========================================================== |
| 226 | + |
| 227 | + # Non-polytropic gas compression model AND/OR Tait EOS ===== |
| 228 | + 'pref' : p0, \ |
| 229 | + 'rhoref' : rho0, \ |
| 230 | + # ========================================================== |
| 231 | + |
| 232 | + # Bubbles ================================================== |
| 233 | + 'bubbles' : 'T', \ |
| 234 | + 'bubble_model' : 2, \ |
| 235 | + 'polytropic' : 'F', \ |
| 236 | + 'polydisperse' : 'T', \ |
| 237 | + 'R0_type' : 1, \ |
| 238 | + #'polydisperse' : 'F', \ |
| 239 | + 'poly_sigma' : 0.5, \ |
| 240 | + 'thermal' : 3, \ |
| 241 | + 'R0ref' : myr0, \ |
| 242 | + 'nb' : 21, \ |
| 243 | + #'nb' : 1, \ |
| 244 | + 'Ca' : Ca, \ |
| 245 | + 'Web' : We, \ |
| 246 | + 'Re_inv' : Re_inv, \ |
| 247 | + #'qbmm' : 'T', \ |
| 248 | + #'nnode' : 4, \ |
| 249 | + #'dist_type' : 2, \ |
| 250 | + #'sigR' : 0.1, \ |
| 251 | + #'sigV' : 0.1, \ |
| 252 | + #'rhoRV' : 0.0, \ |
| 253 | + # ========================================================== |
| 254 | + |
| 255 | + # Acoustic source ========================================== |
| 256 | + 'Monopole' : 'T', \ |
| 257 | + 'num_mono' : 1, \ |
| 258 | + 'Mono(1)%loc(1)' : -8.E-03/x0, \ |
| 259 | + 'Mono(1)%npulse' : 1, \ |
| 260 | + 'Mono(1)%dir' : 1., \ |
| 261 | + 'Mono(1)%pulse' : 1, \ |
| 262 | + 'Mono(1)%mag' : 1*pa, \ |
| 263 | + 'Mono(1)%length' : (1./(300000.))*cact/x0, \ |
| 264 | + # ========================================================== |
| 265 | + } |
| 266 | + |
| 267 | +# Executing MFC component |
| 268 | +f_execute_mfc_component(comp_name, case_dict, mfc_dir, engine) |
| 269 | +#_execute_mfc_component_SHB(comp_name, case_dict, mfc_dir, engine, sub_name) |
| 270 | + |
| 271 | +# ========================================================================== |
0 commit comments