|
| 1 | +#!/usr/bin/env python3 |
| 2 | +import argparse |
| 3 | +import json |
| 4 | +import math |
| 5 | + |
| 6 | +import numpy as np |
| 7 | + |
| 8 | +# Domain extents |
| 9 | +xb = -2 |
| 10 | +xe = 2 |
| 11 | +yb = -2 |
| 12 | +ye = 2 |
| 13 | +cw = 0.05 # Characteristic width for 3D bubble cloud |
| 14 | + |
| 15 | +# Reference values for nondimensionalization |
| 16 | +L0 = 1e-3 # length - m (min bubble radius) |
| 17 | +rho0 = 950 # density - kg/m3 |
| 18 | +c0 = 1449.0 # speed of sound - m/s |
| 19 | +p0 = rho0 * c0 * c0 # pressure - Pa |
| 20 | +T0 = 298 # temperature - K |
| 21 | + |
| 22 | +# Host properties (water) |
| 23 | +gamma_host = 6.12 # Specific heat ratio |
| 24 | +pi_inf_host = 3.43e8 # Stiffness - Pa |
| 25 | +mu_host = 0.001 |
| 26 | +c_host = 1449.0 # speed of sound - m/s |
| 27 | +rho_host = 950 # density kg/m3 |
| 28 | +T_host = 298 # temperature K |
| 29 | + |
| 30 | +# Lagrangian bubbles' properties |
| 31 | +R_uni = 8314 # Universal gas constant - J/kmol/K |
| 32 | +MW_g = 28.0 # Molar weight of the gas - kg/kmol |
| 33 | +MW_v = 18.0 # Molar weight of the vapor - kg/kmol |
| 34 | +gamma_g = 1.4 # Specific heat ratio of the gas |
| 35 | +gamma_v = 1.333 # Specific heat ratio of the vapor |
| 36 | +pv = 2350 # Vapor pressure of the host - Pa |
| 37 | +cp_g = 1.0e3 # Specific heat of the gas - J/kg/K |
| 38 | +cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K |
| 39 | +k_g = 0.025 # Thermal conductivity of the gas - W/m/K |
| 40 | +k_v = 0.02 # Thermal conductivity of the vapor - W/m/K |
| 41 | +diffVapor = 2.5e-5 # Diffusivity coefficient of the vapor - m2/s |
| 42 | +sigBubble = 0.020 # Surface tension of the bubble - N/m |
| 43 | +mu_g = 1.48e-5 |
| 44 | +rho_g = 1 # density kg/m3 |
| 45 | + |
| 46 | +# Nondimmensionalization of domain size |
| 47 | +xb = xb / L0 |
| 48 | +xe = xe / L0 |
| 49 | +yb = yb / L0 |
| 50 | +ye = ye / L0 |
| 51 | +cw = cw / L0 |
| 52 | + |
| 53 | +# patm = 1.0e05 # Atmospheric pressure - Pa |
| 54 | +patm = 1e5 |
| 55 | +g0 = 9.81 / (c0 * c0 / L0) |
| 56 | + |
| 57 | +# Patch prim vars |
| 58 | +rho_host = rho_host / rho0 |
| 59 | +rho_g = rho_g / rho0 |
| 60 | +pres = patm / p0 |
| 61 | + |
| 62 | +# Timing |
| 63 | +tend = 0.004 * c0 / L0 |
| 64 | +tsave = tend / 50 # save time - sec |
| 65 | + |
| 66 | +c_host = math.sqrt(gamma_host * (pres + pi_inf_host / p0) / rho_host) |
| 67 | +dx = (xe - xb) / (199 + 1) |
| 68 | +dt = 0.05 * dx / c_host |
| 69 | + |
| 70 | +t_step_stop = int(tend / dt) |
| 71 | +t_step_save = int(t_step_stop / 100) |
| 72 | + |
| 73 | +eps = 1e-8 |
| 74 | + |
| 75 | +# Configuration case dictionary |
| 76 | +data = { |
| 77 | + # Logistics |
| 78 | + "run_time_info": "T", |
| 79 | + # Computational Domain |
| 80 | + "x_domain%beg": xb, |
| 81 | + "x_domain%end": xe, |
| 82 | + "y_domain%beg": yb, |
| 83 | + "y_domain%end": ye, |
| 84 | + "m": 199, |
| 85 | + "n": 199, |
| 86 | + "p": 0, |
| 87 | + "cyl_coord": "F", |
| 88 | + "dt": 1, |
| 89 | + "t_step_start": 0, |
| 90 | + "t_step_stop": 6000, |
| 91 | + "t_step_save": 60, |
| 92 | + "adap_dt": "T", |
| 93 | + "adap_dt_max_iters": 1000, |
| 94 | + # Simulation Algorithm |
| 95 | + "model_eqns": 2, |
| 96 | + "alt_soundspeed": "F", |
| 97 | + "mixture_err": "F", |
| 98 | + "mpp_lim": "T", |
| 99 | + "time_stepper": 3, |
| 100 | + "weno_order": 5, |
| 101 | + "mapped_weno": "T", |
| 102 | + "mp_weno": "T", |
| 103 | + "avg_state": 2, |
| 104 | + "weno_eps": 1e-16, |
| 105 | + "riemann_solver": 2, |
| 106 | + "wave_speeds": 1, |
| 107 | + "bc_x%beg": -1, |
| 108 | + "bc_x%end": -1, |
| 109 | + "bc_y%beg": -1, |
| 110 | + "bc_y%end": -1, |
| 111 | + "num_patches": 2, |
| 112 | + "num_fluids": 2, |
| 113 | + # Database Structure Parameters |
| 114 | + "format": 1, |
| 115 | + "precision": 2, |
| 116 | + "prim_vars_wrt": "T", |
| 117 | + "parallel_io": "T", |
| 118 | + "lag_db_wrt": "T", |
| 119 | + "lag_pres_wrt": "T", |
| 120 | + # Fluid Parameters Host |
| 121 | + "fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0), |
| 122 | + "fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0), |
| 123 | + # Fluid Parameters Gas |
| 124 | + "fluid_pp(2)%gamma": 1.0 / (gamma_g - 1.0), |
| 125 | + "fluid_pp(2)%pi_inf": 0.0e00, |
| 126 | + # Bubble parameters |
| 127 | + "bub_pp%R0ref": 1.0, |
| 128 | + "bub_pp%p0ref": 1.0, |
| 129 | + "bub_pp%rho0ref": 1.0, |
| 130 | + "bub_pp%T0ref": 1.0, |
| 131 | + "bub_pp%ss": sigBubble / (rho0 * L0 * c0 * c0), |
| 132 | + "bub_pp%pv": pv / p0, |
| 133 | + "bub_pp%vd": diffVapor / (L0 * c0), |
| 134 | + "bub_pp%mu_l": mu_host / (rho0 * L0 * c0), |
| 135 | + "bub_pp%gam_v": gamma_v, |
| 136 | + "bub_pp%gam_g": gamma_g, |
| 137 | + "bub_pp%M_v": MW_v, |
| 138 | + "bub_pp%M_g": MW_g, |
| 139 | + "bub_pp%k_v": k_v * (T0 / (L0 * rho0 * c0 * c0 * c0)), |
| 140 | + "bub_pp%k_g": k_g * (T0 / (L0 * rho0 * c0 * c0 * c0)), |
| 141 | + "bub_pp%cp_v": cp_v * (T0 / (c0 * c0)), |
| 142 | + "bub_pp%cp_g": cp_g * (T0 / (c0 * c0)), |
| 143 | + "bub_pp%R_v": (R_uni / MW_v) * (T0 / (c0 * c0)), |
| 144 | + "bub_pp%R_g": (R_uni / MW_g) * (T0 / (c0 * c0)), |
| 145 | + # Viscosity |
| 146 | + "viscous": "T", |
| 147 | + "fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * L0)), |
| 148 | + "fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * L0)), |
| 149 | + # Patch for background flow |
| 150 | + "patch_icpp(1)%geometry": 3, |
| 151 | + "patch_icpp(1)%x_centroid": (xb + xe) / 2, |
| 152 | + "patch_icpp(1)%y_centroid": (yb + ye) / 2, |
| 153 | + "patch_icpp(1)%length_x": (xe - xb), |
| 154 | + "patch_icpp(1)%length_y": (ye - yb), |
| 155 | + "patch_icpp(1)%vel(1)": 0, |
| 156 | + "patch_icpp(1)%vel(2)": 0, |
| 157 | + "patch_icpp(1)%pres": pres, |
| 158 | + "patch_icpp(1)%alpha_rho(1)": (1 - eps) * rho_host, |
| 159 | + "patch_icpp(1)%alpha_rho(2)": eps * rho_g, |
| 160 | + "patch_icpp(1)%alpha(1)": 1 - eps, |
| 161 | + "patch_icpp(1)%alpha(2)": eps, |
| 162 | + # High pressure |
| 163 | + "patch_icpp(2)%geometry": 2, |
| 164 | + "patch_icpp(2)%alter_patch(1)": "T", |
| 165 | + "patch_icpp(2)%smoothen": "T", |
| 166 | + "patch_icpp(2)%smooth_patch_id": 1, |
| 167 | + "patch_icpp(2)%smooth_coeff": 0.5, |
| 168 | + "patch_icpp(2)%x_centroid": 0, |
| 169 | + "patch_icpp(2)%y_centroid": 0, |
| 170 | + "patch_icpp(2)%radius": 0.2 / L0, |
| 171 | + "patch_icpp(2)%vel(1)": 0, |
| 172 | + "patch_icpp(2)%vel(2)": 0, |
| 173 | + "patch_icpp(2)%pres": 10 * pres, |
| 174 | + "patch_icpp(2)%alpha_rho(1)": (1 - eps) * rho_host, |
| 175 | + "patch_icpp(2)%alpha_rho(2)": eps * rho_g, |
| 176 | + "patch_icpp(2)%alpha(1)": 1 - eps, |
| 177 | + "patch_icpp(2)%alpha(2)": eps, |
| 178 | + # Lagrangian Bubbles |
| 179 | + "bubbles_lagrange": "T", |
| 180 | + "fd_order": 4, |
| 181 | + "bubble_model": 2, # (0) Particle (2) KM (3) RP |
| 182 | + "thermal": 3, |
| 183 | + "polytropic": "F", |
| 184 | + "lag_params%nBubs_glb": 5000, # Max number of bubbles |
| 185 | + "lag_params%vel_model": 2, |
| 186 | + "lag_params%drag_model": 1, |
| 187 | + "lag_params%solver_approach": 2, |
| 188 | + "lag_params%cluster_type": 2, |
| 189 | + "lag_params%pressure_corrector": "F", |
| 190 | + "lag_params%smooth_type": 1, |
| 191 | + "lag_params%epsilonb": 1.0, |
| 192 | + "lag_params%valmaxvoid": 0.9, |
| 193 | + "lag_params%write_bubbles": "T", |
| 194 | + "lag_params%write_bubbles_stats": "T", |
| 195 | + "lag_params%write_void_evol": "T", |
| 196 | + "lag_params%charwidth": cw, |
| 197 | + "lag_params%charNz": 10, |
| 198 | +} |
| 199 | + |
| 200 | +mods = {} |
| 201 | + |
| 202 | +print(json.dumps({**data, **mods}, indent=4)) |
0 commit comments