|
| 1 | +#!/usr/bin/env python3 |
| 2 | + |
| 3 | +# Case file contributed by Anand Radhakrishnan and modified by Henry Le Berre |
| 4 | +# for integration as a weak scaling benchmark for MFC. |
| 5 | + |
| 6 | +import json, math, argparse |
| 7 | + |
| 8 | +parser = argparse.ArgumentParser( |
| 9 | + prog="3D_weak_scaling", |
| 10 | + description="This MFC case was created for the purposes of weak scaling.", |
| 11 | + formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
| 12 | + |
| 13 | +parser.add_argument("dict", type=str, metavar="DICT", help=argparse.SUPPRESS) |
| 14 | +parser.add_argument("gbpp", type=int, metavar="MEM", default=16, help="Adjusts the problem size per rank to fit into [MEM] GB of GPU memory per GPU.") |
| 15 | + |
| 16 | +ARGS = vars(parser.parse_args()) |
| 17 | +DICT = json.loads(ARGS["dict"]) |
| 18 | + |
| 19 | +ppg = 8000000 / 16.0 |
| 20 | +procs = DICT["nodes"] * DICT["tasks_per_node"] |
| 21 | +ncells = math.floor(ppg * procs * ARGS["gbpp"]) |
| 22 | +s = math.floor((ncells / 2.0) ** (1/3)) |
| 23 | +Nx, Ny, Nz = 2*s, s, s |
| 24 | + |
| 25 | +# athmospheric pressure - Pa (used as reference value) |
| 26 | +patm = 101325 |
| 27 | + |
| 28 | +# Initial Droplet Diameter / Reference length - m |
| 29 | +D0 = 1.0E-3 |
| 30 | + |
| 31 | +# cavity to droplet ratio |
| 32 | +CtD = 0.06 |
| 33 | + |
| 34 | +# cavity relative eccentricity (distance between radii) |
| 35 | +ecc = 0.564 |
| 36 | + |
| 37 | +# initial shock distance from the y axis. Note that the droplet center is located at y = 0. Thus, the distance from the shock to |
| 38 | +# the droplet is about D0/8 |
| 39 | +ISD = 5.0/8 * D0 |
| 40 | + |
| 41 | +## pre-shock properties - AIR |
| 42 | + |
| 43 | +# pressure - Pa |
| 44 | +p0a = patm |
| 45 | + |
| 46 | +# density - kg/m3 |
| 47 | +rho0a = 1.204 |
| 48 | + |
| 49 | +# gamma |
| 50 | +gama = 1.40 |
| 51 | + |
| 52 | +# pi infinity - Pa |
| 53 | +pia = 0 |
| 54 | + |
| 55 | +# speed of sound - M/s |
| 56 | +c_a = math.sqrt( gama * ( p0a + pia ) / rho0a ) |
| 57 | + |
| 58 | +## Droplet - WATER |
| 59 | + |
| 60 | +# surface tension - N / m |
| 61 | +st = 0.00E+0 |
| 62 | + |
| 63 | +# Delta Pressure - Pa |
| 64 | +DP = -st * 4 / D0 |
| 65 | + |
| 66 | +# initial pressure inside the droplet - Pa |
| 67 | +p0w = p0a - DP |
| 68 | + |
| 69 | +# density - kg/m3 |
| 70 | +rho0w = 1000 |
| 71 | + |
| 72 | +# gama |
| 73 | +gamw = 6.12 |
| 74 | + |
| 75 | +# pi infty - Pa |
| 76 | +piw = 3.43E+08 |
| 77 | + |
| 78 | +# speed of sound - m/s |
| 79 | +c_w = math.sqrt( gamw * ( p0w + piw ) / rho0w ) |
| 80 | + |
| 81 | +# Shock Mach number of interest. Note that the post-shock properties can be defined in terms of either |
| 82 | +# Min or psOp0a. Just comment/uncomment appropriatelly |
| 83 | +Min = 2.4 |
| 84 | + |
| 85 | +## Pos to pre shock ratios - AIR |
| 86 | + |
| 87 | +# pressure |
| 88 | +psOp0a = ( Min ** 2 -1 ) * 2 * gama / ( gama + 1 ) + 1 |
| 89 | +# psOp0a = 4.5 |
| 90 | + |
| 91 | +# density |
| 92 | +rhosOrho0a = ( 1 + ( gama + 1 ) / ( gama - 1) * psOp0a ) / ( ( gama + 1 ) / ( gama - 1) + psOp0a ) |
| 93 | + |
| 94 | +# Mach number of the shocked region - just a checker, as it must return "Min" |
| 95 | +Ms = math.sqrt( ( gama + 1. ) / ( 2. * gama ) * ( psOp0a - 1. ) * ( p0a / ( p0a + pia ) ) + 1. ) |
| 96 | + |
| 97 | +# shock speed of sound - m/s |
| 98 | +ss = Ms * c_a |
| 99 | + |
| 100 | +## post-shock - AIR |
| 101 | + |
| 102 | +# pressure - Pa |
| 103 | +ps = psOp0a * p0a |
| 104 | + |
| 105 | +# density - kg / m3 |
| 106 | +rhos = rhosOrho0a * rho0a |
| 107 | + |
| 108 | +# post shock speed of sound - m/s |
| 109 | +c_s = math.sqrt( gama * (ps + pia) / rhos ) |
| 110 | + |
| 111 | +# velocity at the post shock - m/s |
| 112 | +vel = c_a/gama * (psOp0a - 1.) * p0a / ( p0a + pia ) / Ms |
| 113 | + |
| 114 | +## Domain boundaries - m |
| 115 | + |
| 116 | +# x direction |
| 117 | +xb = -8.4707 * D0 |
| 118 | +xe = 9.6226 * D0 |
| 119 | + |
| 120 | +#xb = -10 * D0 |
| 121 | +#xe = 10 * D0 |
| 122 | + |
| 123 | +# y direction |
| 124 | +yb = 0 * D0 |
| 125 | +ye = 10 * D0 |
| 126 | + |
| 127 | +# y direction |
| 128 | +zb = 0 * D0 |
| 129 | +ze = 10 * D0 |
| 130 | + |
| 131 | +# Stretching factor, to make sure the domaing is sufficiently large after the mesh strecth |
| 132 | +StF = 4.0 |
| 133 | + |
| 134 | +# grid delta x if mesh were uniform in x direction - m. Note that I do not need a measure for dy |
| 135 | +dx = ( xe - xb ) / Nx |
| 136 | + |
| 137 | +# I calculate tend twice; first is an estimate, second is |
| 138 | +# the actual value used. This is because I am getting errors in the |
| 139 | +# post process part every time I approximate the actual Nt by an integer |
| 140 | +# number (think of a smarter way). |
| 141 | + |
| 142 | +# dimensionless time |
| 143 | +ttilde = 1.92 |
| 144 | + |
| 145 | +# auxiliary simulation physical time - s. This is not YET the total simulation time, as it will be corrected so as to avoid |
| 146 | +# mismatches in simulation and post_process parts. Note that I wrote it this way so I have better control over the # of autosaves |
| 147 | +tendA = ttilde * D0 / vel |
| 148 | + |
| 149 | +cfl = 0.1 |
| 150 | + |
| 151 | +# time-step - s |
| 152 | +dt = dx * cfl/ ss |
| 153 | + |
| 154 | +# Save Frequency. Note that the number of autosaves will be SF + 1, as th IC (0.dat) is also saved |
| 155 | +SF = 400 |
| 156 | + |
| 157 | +## making Nt divisible by SF |
| 158 | +# 1 - ensure NtA goes slightly beyond tendA |
| 159 | +NtA = int( tendA//dt + 1 ) |
| 160 | + |
| 161 | +# Array of saves. It is the same as Nt/Sf = t_step_save |
| 162 | +AS = int( NtA // SF + 1 ) |
| 163 | + |
| 164 | +# Nt = total number of steps. Note that Nt >= NtA (so at least tendA is completely simulated) |
| 165 | +Nt = AS * SF |
| 166 | + |
| 167 | +# total simulation time - s. Note that tend >= tendA |
| 168 | +tend = Nt * dt |
| 169 | + |
| 170 | +# Configuring case dictionary |
| 171 | +print(json.dumps({ |
| 172 | + # Logistics ================================================ |
| 173 | + 'run_time_info' : 'T', |
| 174 | + # ========================================================== |
| 175 | + |
| 176 | + # Computational Domain Parameters ========================== |
| 177 | + 'x_domain%beg' : xb, |
| 178 | + 'x_domain%end' : xe, |
| 179 | + 'y_domain%beg' : yb, |
| 180 | + 'y_domain%end' : ye, |
| 181 | + 'z_domain%beg' : zb, |
| 182 | + 'z_domain%end' : ze, |
| 183 | + 'm' : Nx, |
| 184 | + 'n' : Ny, |
| 185 | + 'p' : Nz, |
| 186 | + 'cyl_coord' : 'F', |
| 187 | + 'dt' : dt, |
| 188 | + 't_step_start' : 0, |
| 189 | + 't_step_stop' : int(5000*16.0/ARGS["gbpp"]), |
| 190 | + 't_step_save' : int(1000*16.0/ARGS["gbpp"]), |
| 191 | + # ========================================================== |
| 192 | + |
| 193 | + # Simulation Algorithm Parameters ========================== |
| 194 | + 'num_patches' : 3, |
| 195 | + 'model_eqns' : 2, |
| 196 | + 'alt_soundspeed' : 'F', |
| 197 | + 'num_fluids' : 2, |
| 198 | + 'adv_alphan' : 'T', |
| 199 | + 'mpp_lim' : 'T', |
| 200 | + 'mixture_err' : 'T', |
| 201 | + 'time_stepper' : 3, |
| 202 | + 'weno_vars' : 2, |
| 203 | + 'weno_order' : 3, |
| 204 | + 'weno_eps' : 1.0E-16, |
| 205 | + 'mapped_weno' : 'T', |
| 206 | + 'riemann_solver' : 2, |
| 207 | + 'wave_speeds' : 1, |
| 208 | + 'avg_state' : 2, |
| 209 | + 'bc_x%beg' : -6, |
| 210 | + 'bc_x%end' : -6, |
| 211 | + 'bc_y%beg' : -2, |
| 212 | + 'bc_y%end' : -3, |
| 213 | + 'bc_z%beg' : -2, |
| 214 | + 'bc_z%end' : -3, |
| 215 | + # ========================================================== |
| 216 | + |
| 217 | + # Formatted Database Files Structure Parameters ============ |
| 218 | + 'format' : 1, |
| 219 | + 'precision' : 2, |
| 220 | + 'prim_vars_wrt' :'T', |
| 221 | + 'parallel_io' :'T', |
| 222 | + # ========================================================== |
| 223 | + # I will use 1 for WATER properties, and 2 for AIR properties |
| 224 | + # Patch 1: Background (AIR - 2) ============================= |
| 225 | + 'patch_icpp(1)%geometry' : 9, |
| 226 | + 'patch_icpp(1)%x_centroid' : (xb+xe) / 2 * StF, |
| 227 | + 'patch_icpp(1)%y_centroid' : (yb+ye) / 2 * StF, |
| 228 | + 'patch_icpp(1)%z_centroid' : (yb+ye) / 2 * StF, |
| 229 | + 'patch_icpp(1)%length_x' : (xe-xb) * StF, |
| 230 | + 'patch_icpp(1)%length_y' : (ye-yb) * StF, |
| 231 | + 'patch_icpp(1)%length_z' : (ze-zb) * StF, |
| 232 | + 'patch_icpp(1)%vel(1)' : 0.0E+00, |
| 233 | + 'patch_icpp(1)%vel(2)' : 0.0E+00, |
| 234 | + 'patch_icpp(1)%vel(3)' : 0.0E+00, |
| 235 | + 'patch_icpp(1)%pres' : p0a, |
| 236 | + 'patch_icpp(1)%alpha_rho(1)' : 0.0E+00, |
| 237 | + 'patch_icpp(1)%alpha_rho(2)' : rho0a, |
| 238 | + 'patch_icpp(1)%alpha(1)' : 0.0E+00, |
| 239 | + 'patch_icpp(1)%alpha(2)' : 1.0E+00, |
| 240 | + # ========================================================== |
| 241 | + |
| 242 | + # Patch 2: Shocked state (AIR - 2) ========================= |
| 243 | + 'patch_icpp(2)%geometry' : 9, |
| 244 | + 'patch_icpp(2)%alter_patch(1)' : 'T', |
| 245 | + 'patch_icpp(2)%x_centroid' : -ISD - ( xe - xb ) / 2 * StF, |
| 246 | + 'patch_icpp(2)%y_centroid' : ( yb + ye ) / 2 * StF, |
| 247 | + 'patch_icpp(2)%z_centroid' : ( zb + ze ) / 2 * StF, |
| 248 | + 'patch_icpp(2)%length_x' : ( xe - xb ) * StF, |
| 249 | + 'patch_icpp(2)%length_y' : ( ye - yb ) * StF, |
| 250 | + 'patch_icpp(2)%length_z' : ( ze - zb ) * StF, |
| 251 | + 'patch_icpp(2)%vel(1)' : vel, |
| 252 | + 'patch_icpp(2)%vel(2)' : 0.0E+00, |
| 253 | + 'patch_icpp(2)%vel(3)' : 0.0E+00, |
| 254 | + 'patch_icpp(2)%pres' : ps, |
| 255 | + 'patch_icpp(2)%alpha_rho(1)' : 0.0E+00, |
| 256 | + 'patch_icpp(2)%alpha_rho(2)' : rhos, |
| 257 | + 'patch_icpp(2)%alpha(1)' : 0.0E+00, |
| 258 | + 'patch_icpp(2)%alpha(2)' : 1.0E+00, |
| 259 | + # ========================================================== |
| 260 | + |
| 261 | + # Patch 3: Droplet (WATER - 1) ============================= |
| 262 | + 'patch_icpp(3)%geometry' : 8, |
| 263 | + 'patch_icpp(3)%x_centroid' : 0.0E+00, |
| 264 | + 'patch_icpp(3)%y_centroid' : 0.0E+00, |
| 265 | + 'patch_icpp(3)%z_centroid' : 0.0E+00, |
| 266 | + 'patch_icpp(3)%radius' : D0/2, |
| 267 | + 'patch_icpp(3)%alter_patch(1)' : 'T', |
| 268 | + 'patch_icpp(3)%vel(1)' : 0.0E+00, |
| 269 | + 'patch_icpp(3)%vel(2)' : 0.0E+00, |
| 270 | + 'patch_icpp(3)%vel(3)' : 0.0E+00, |
| 271 | + 'patch_icpp(3)%pres' : p0w, |
| 272 | + 'patch_icpp(3)%alpha_rho(1)' : rho0w, |
| 273 | + 'patch_icpp(3)%alpha_rho(2)' : 0.0E+00, |
| 274 | + 'patch_icpp(3)%alpha(1)' : 1.0E+00, |
| 275 | + 'patch_icpp(3)%alpha(2)' : 0.0E+00, |
| 276 | + # ========================================================== |
| 277 | + |
| 278 | + # Fluids Physical Parameters =============================== |
| 279 | + 'fluid_pp(1)%gamma' : 1.0E+00/(gamw-1), |
| 280 | + 'fluid_pp(1)%pi_inf' : gamw*piw/(gamw-1), |
| 281 | + 'fluid_pp(2)%gamma' : 1.0E+00/(gama-1), |
| 282 | + 'fluid_pp(2)%pi_inf' : gama*pia/(gama-1), |
| 283 | + # ========================================================== |
| 284 | +})) |
| 285 | + |
| 286 | +# ============================================================================== |
| 287 | + |
0 commit comments