|
| 1 | +#!/usr/bin/env python3 |
| 2 | +import math |
| 3 | +import json |
| 4 | + |
| 5 | +# Bubble screen |
| 6 | +# Description: A planar acoustic wave interacts with a bubble cloud |
| 7 | +# in water. The background field is modeled in using an Eulerian framework, |
| 8 | +# while the bubbles are tracked using a Lagrangian framework. |
| 9 | + |
| 10 | +# Reference values for nondimensionalization |
| 11 | +x0 = 1.0e-03 # length - m |
| 12 | +rho0 = 1.0e03 # density - kg/m3 |
| 13 | +c0 = 1475.0 # speed of sound - m/s |
| 14 | +p0 = rho0 * c0 * c0 # pressure - Pa |
| 15 | +T0 = 298 # temperature - K |
| 16 | + |
| 17 | +# Host properties (water) |
| 18 | +gamma_host = 2.7466 # Specific heat ratio |
| 19 | +pi_inf_host = 792.02e06 # Stiffness - Pa |
| 20 | +mu_host = 1e-3 # Dynamic viscosity - Pa.s |
| 21 | +c_host = 1475.0 # speed of sound - m/s |
| 22 | +rho_host = 1000 # density kg/m3 |
| 23 | +T_host = 298 # temperature K |
| 24 | + |
| 25 | +# Lagrangian bubbles' properties |
| 26 | +R_uni = 8314 # Universal gas constant - J/kmol/K |
| 27 | +MW_g = 28.0 # Molar weight of the gas - kg/kmol |
| 28 | +MW_v = 18.0 # Molar weight of the vapor - kg/kmol |
| 29 | +gamma_g = 1.4 # Specific heat ratio of the gas |
| 30 | +gamma_v = 1.333 # Specific heat ratio of the vapor |
| 31 | +pv = 2350 # Vapor pressure of the host - Pa |
| 32 | +cp_g = 1.0e3 # Specific heat of the gas - J/kg/K |
| 33 | +cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K |
| 34 | +k_g = 0.025 # Thermal conductivity of the gas - W/m/K |
| 35 | +k_v = 0.02 # Thermal conductivity of the vapor - W/m/K |
| 36 | +diffVapor = 2.5e-5 # Diffusivity coefficient of the vapor - m2/s |
| 37 | +sigBubble = 0.069 # Surface tension of the bubble - N/m |
| 38 | +mu_g = 1.48e-5 |
| 39 | + |
| 40 | +# Acoustic source properties |
| 41 | +patm = 101325.0 # Atmospheric pressure - Pa |
| 42 | +pamp = 1.0e5 # Amplitude of the acoustic source - Pa |
| 43 | +freq = 300e03 # Source frequency - Hz |
| 44 | +wlen = c_host / freq # Wavelength - m |
| 45 | + |
| 46 | +# Domain and time set up |
| 47 | + |
| 48 | +xb = -12.0e-3 # Domain boundaries - m (x direction) |
| 49 | +xe = 12.0e-3 |
| 50 | +yb = -2.5e-3 # Domain boundaries - m (y direction) |
| 51 | +ye = 2.5e-3 |
| 52 | +z_virtual = 5.0e-3 # Virtual depth (z direction) |
| 53 | + |
| 54 | +Nx = 240 # number of elements into x direction |
| 55 | +Ny = 50 # number of elements into y direction |
| 56 | + |
| 57 | +dt = 7.5e-9 # constant time-step - sec |
| 58 | + |
| 59 | +# Configuring case dictionary |
| 60 | +print( |
| 61 | + json.dumps( |
| 62 | + { |
| 63 | + # Logistics |
| 64 | + "run_time_info": "T", |
| 65 | + # Computational Domain Parameters |
| 66 | + "x_domain%beg": xb / x0, |
| 67 | + "x_domain%end": xe / x0, |
| 68 | + "y_domain%beg": yb / x0, |
| 69 | + "y_domain%end": ye / x0, |
| 70 | + "stretch_y": "F", |
| 71 | + "stretch_x": "F", |
| 72 | + "m": Nx, |
| 73 | + "n": Ny, |
| 74 | + "p": 0, |
| 75 | + "dt": dt * (c0 / x0), |
| 76 | + "t_step_start": 0, |
| 77 | + "t_step_stop": 3000, |
| 78 | + "t_step_save": 500, |
| 79 | + # Simulation Algorithm Parameters |
| 80 | + "model_eqns": 2, |
| 81 | + "time_stepper": 3, |
| 82 | + "num_fluids": 2, |
| 83 | + "num_patches": 1, |
| 84 | + "viscous": "T", |
| 85 | + "mpp_lim": "F", |
| 86 | + "weno_order": 5, |
| 87 | + "weno_eps": 1.0e-16, |
| 88 | + "mapped_weno": "T", |
| 89 | + "riemann_solver": 2, |
| 90 | + "wave_speeds": 1, |
| 91 | + "avg_state": 2, |
| 92 | + "bc_x%beg": -6, |
| 93 | + "bc_x%end": -6, |
| 94 | + "bc_y%beg": -1, |
| 95 | + "bc_y%end": -1, |
| 96 | + # Acoustic source |
| 97 | + "acoustic_source": "T", |
| 98 | + "num_source": 1, |
| 99 | + "acoustic(1)%support": 2, |
| 100 | + "acoustic(1)%pulse": 1, |
| 101 | + "acoustic(1)%npulse": 1, |
| 102 | + "acoustic(1)%mag": pamp / p0, |
| 103 | + "acoustic(1)%wavelength": wlen / x0, |
| 104 | + "acoustic(1)%length": 2 * (ye - yb) / x0, |
| 105 | + "acoustic(1)%loc(1)": -7.0e-03 / x0, |
| 106 | + "acoustic(1)%loc(2)": 0.0, |
| 107 | + "acoustic(1)%dir": 0.0, |
| 108 | + "acoustic(1)%delay": 0.0, |
| 109 | + # Formatted Database Files Structure Parameters |
| 110 | + "format": 1, |
| 111 | + "precision": 2, |
| 112 | + "prim_vars_wrt": "T", |
| 113 | + "parallel_io": "T", |
| 114 | + # Patch 1: Water (left) |
| 115 | + "patch_icpp(1)%geometry": 3, |
| 116 | + "patch_icpp(1)%x_centroid": 0.0, |
| 117 | + "patch_icpp(1)%y_centroid": 0.0, |
| 118 | + "patch_icpp(1)%length_x": 2 * (xe - xb) / x0, |
| 119 | + "patch_icpp(1)%length_y": 2 * (ye - yb) / x0, |
| 120 | + "patch_icpp(1)%vel(1)": 0.0, |
| 121 | + "patch_icpp(1)%vel(2)": 0.0, |
| 122 | + "patch_icpp(1)%pres": patm / p0, |
| 123 | + "patch_icpp(1)%alpha_rho(1)": rho_host / rho0, |
| 124 | + "patch_icpp(1)%alpha_rho(2)": 0.0, |
| 125 | + "patch_icpp(1)%alpha(1)": 1.0, |
| 126 | + "patch_icpp(1)%alpha(2)": 0.0, |
| 127 | + # Lagrangian Bubbles |
| 128 | + "bubbles_lagrange": "T", |
| 129 | + "bubble_model": 2, # Keller-Miksis model |
| 130 | + "lag_params%nBubs_glb": 1194, # Number of bubbles |
| 131 | + "lag_params%solver_approach": 2, |
| 132 | + "lag_params%cluster_type": 2, |
| 133 | + "lag_params%pressure_corrector": "T", |
| 134 | + "lag_params%smooth_type": 1, |
| 135 | + "lag_params%heatTransfer_model": "T", |
| 136 | + "lag_params%massTransfer_model": "T", |
| 137 | + "lag_params%epsilonb": 1.0, |
| 138 | + "lag_params%valmaxvoid": 0.9, |
| 139 | + "lag_params%write_bubbles": "F", |
| 140 | + "lag_params%write_bubbles_stats": "F", |
| 141 | + "lag_params%c0": c0, |
| 142 | + "lag_params%rho0": rho0, |
| 143 | + "lag_params%T0": T0, |
| 144 | + "lag_params%x0": x0, |
| 145 | + "lag_params%diffcoefvap": diffVapor, |
| 146 | + "lag_params%Thost": T_host, |
| 147 | + "lag_params%charwidth": z_virtual / x0, |
| 148 | + # Fluids Physical Parameters |
| 149 | + # Host medium |
| 150 | + "fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0), |
| 151 | + "fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0), |
| 152 | + "fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * x0)), |
| 153 | + "fluid_pp(1)%mul0": mu_host, |
| 154 | + "fluid_pp(1)%ss": sigBubble, |
| 155 | + "fluid_pp(1)%pv": pv, |
| 156 | + "fluid_pp(1)%gamma_v": gamma_v, |
| 157 | + "fluid_pp(1)%M_v": MW_v, |
| 158 | + "fluid_pp(1)%k_v": k_v, |
| 159 | + "fluid_pp(1)%cp_v": cp_v, |
| 160 | + # Bubble gas state |
| 161 | + "fluid_pp(2)%gamma": 1.0 / (gamma_g - 1.0), |
| 162 | + "fluid_pp(2)%pi_inf": 0.0e00, |
| 163 | + "fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * x0)), |
| 164 | + "fluid_pp(2)%gamma_v": gamma_g, |
| 165 | + "fluid_pp(2)%M_v": MW_g, |
| 166 | + "fluid_pp(2)%k_v": k_g, |
| 167 | + "fluid_pp(2)%cp_v": cp_g, |
| 168 | + } |
| 169 | + ) |
| 170 | +) |
0 commit comments