From 229bfdf2c0590e4a271b144113ec053de362e11d Mon Sep 17 00:00:00 2001 From: dreamer2368 Date: Mon, 19 Dec 2022 21:25:13 -0600 Subject: [PATCH] DeformingWall2D: experimental setup. --- examples/DeformingWall2D/UV.4.5v_0msC.txt | 40 +++++++++++++++ examples/DeformingWall2D/bc.dat | 8 +-- examples/DeformingWall2D/config.py | 61 +++++++++++++++++++---- examples/DeformingWall2D/magudi.inp | 14 +++--- 4 files changed, 102 insertions(+), 21 deletions(-) create mode 100644 examples/DeformingWall2D/UV.4.5v_0msC.txt diff --git a/examples/DeformingWall2D/UV.4.5v_0msC.txt b/examples/DeformingWall2D/UV.4.5v_0msC.txt new file mode 100644 index 0000000..6ecb40a --- /dev/null +++ b/examples/DeformingWall2D/UV.4.5v_0msC.txt @@ -0,0 +1,40 @@ + 0.0000000e+00 0.0000000e+00 0.0000000e+00 + 7.7500000e-01 1.0269702e-01 6.7599471e-04 + 1.3950000e+00 2.7844396e-01 8.7345091e-04 + 2.0150000e+00 4.1571953e-01 1.1208973e-03 + 2.6350000e+00 5.4588182e-01 1.4286481e-03 + 3.2550000e+00 6.6419449e-01 1.8084931e-03 + 3.8750000e+00 7.6359723e-01 2.2737388e-03 + 4.4950000e+00 8.4386860e-01 2.8392028e-03 + 5.1150000e+00 9.0808872e-01 3.5211488e-03 + 5.7350000e+00 9.5786920e-01 4.3371504e-03 + 6.3550000e+00 9.9233047e-01 5.3058712e-03 + 6.9750000e+00 1.0144638e+00 6.4467533e-03 + 7.5950000e+00 1.0262109e+00 7.7796048e-03 + 8.2150000e+00 1.0337019e+00 9.3240832e-03 + 8.8350000e+00 1.0391355e+00 1.1099077e-02 + 9.4550000e+00 1.0428803e+00 1.3121991e-02 + 1.0075000e+01 1.0453558e+00 1.5407945e-02 + 1.0695000e+01 1.0469143e+00 1.7968915e-02 + 1.1315000e+01 1.0480733e+00 2.0812828e-02 + 1.1935000e+01 1.0489944e+00 2.3942664e-02 + 1.2555000e+01 1.0498121e+00 2.7355583e-02 + 1.3175000e+01 1.0505113e+00 3.1042137e-02 + 1.3795000e+01 1.0510102e+00 3.4985603e-02 + 1.4415000e+01 1.0513859e+00 3.9161494e-02 + 1.5035000e+01 1.0515183e+00 4.3537278e-02 + 1.5655000e+01 1.0517174e+00 4.8072357e-02 + 1.6275000e+01 1.0518798e+00 5.2718335e-02 + 1.6895000e+01 1.0519059e+00 5.7419590e-02 + 1.7515000e+01 1.0520611e+00 6.2114160e-02 + 1.8135000e+01 1.0525543e+00 6.6734939e-02 + 1.8755000e+01 1.0532225e+00 7.1211159e-02 + 1.9375000e+01 1.0537087e+00 7.5470107e-02 + 1.9995000e+01 1.0539957e+00 7.9439043e-02 + 2.0615000e+01 1.0540580e+00 8.3047234e-02 + 2.1235000e+01 1.0539087e+00 8.6228031e-02 + 2.1855000e+01 1.0535182e+00 8.8920909e-02 + 2.2475000e+01 1.0529715e+00 9.1073378e-02 + 2.3095000e+01 1.0523842e+00 9.2642683e-02 + 2.3715000e+01 1.0517568e+00 9.3597217e-02 + 2.4335000e+01 1.0512911e+00 9.3917575e-02 diff --git a/examples/DeformingWall2D/bc.dat b/examples/DeformingWall2D/bc.dat index d49d9bf..b576a10 100644 --- a/examples/DeformingWall2D/bc.dat +++ b/examples/DeformingWall2D/bc.dat @@ -3,8 +3,8 @@ farField.N SAT_FAR_FIELD 1 -2 1 -1 -1 -1 1 -1 inflow.W SAT_FAR_FIELD 1 1 1 1 1 -1 1 -1 outflow.E SAT_FAR_FIELD 1 -1 -1 -1 1 -1 1 -1 - immersed1 IMMERSED_BOUNDARY 1 0 1 -1 1 171 1 -1 - sponge.N SPONGE 1 -2 1 -1 -15 -1 1 -1 - sponge.W SPONGE 1 1 1 15 1 -1 1 -1 - sponge.E SPONGE 1 -1 -15 -1 1 -1 1 -1 + immersed1 IMMERSED_BOUNDARY 1 0 1 -1 1 115 1 -1 + sponge.N SPONGE 1 -2 1 -1 -10 -1 1 -1 + sponge.W SPONGE 1 1 1 10 1 -1 1 -1 + sponge.E SPONGE 1 -1 -10 -1 1 -1 1 -1 # targetRegion COST_TARGET 1 2 1 -1 1 1 1 -1 diff --git a/examples/DeformingWall2D/config.py b/examples/DeformingWall2D/config.py index 006bac8..129aa96 100644 --- a/examples/DeformingWall2D/config.py +++ b/examples/DeformingWall2D/config.py @@ -6,14 +6,16 @@ def mapping_function(x, sigma): return np.sinh(sigma * x) / np.sinh(sigma) -def grid(size, dip_range, mapping_type='sinh'): +def grid(size, Lx, dip_range, mapping_type='sinh'): + dip_range /= Lx + from scipy.optimize import fsolve - x_min = -10. - x_max = 100. - y_min = 0. - y_max = 25. - z_min = -40. - z_max = 40. + x_min = 0. / Lx + x_max = 180. / Lx + y_min = 0. / Lx + y_max = 30. / Lx + z_min = -40. / Lx + z_max = 40. / Lx dy_min = 0.016 num_uniform = 7 @@ -156,10 +158,49 @@ def initial_condition(g, mach_number=1.0 / 343.0, gamma=1.4, Re = 1.16e6): s.q[0][:,:,:,4] = p return s.fromprimitive() +def initial_condition_from_exp(g, expFilename, Lx = 5.0, a0 = 343.0, gamma = 1.4, Re = 1.1588e+05): + x = g.xyz[0][:,:,:,0] + y = g.xyz[0][:,:,:,1] + + expData = np.loadtxt(expFilename) + ymax = expData[-1, 0] / Lx + uFunc = cubicSplineInterp(expData[:, 0], expData[:, 1]) + vtFunc = cubicSplineInterp(expData[:, 0], expData[:, 2]) + + u0 = uFunc(y * Lx) / a0 + v0 = vtFunc(y * Lx) / a0 + p = 1.0 / gamma + + mask = (y < 0.0) + u0[mask] = 0.0 + v0[mask] = 0.0 + + u0[u0 <= 0.0] = 0.0 + v0[v0 <= 0.0] = 0.0 + u0[y > ymax] = expData[-1, 1] / a0 + v0[y > ymax] = expData[-1, 2] / a0 + + s = p3d.Solution().copy_from(g).quiescent(gamma) + s.q[0][:,:,:,0] = 1.0 + s.q[0][:,:,:,1:4] = 0.0 + s.q[0][:,:,:,1] = u0 + s.q[0][:,:,:,2] = v0 + s.q[0][:,:,:,4] = p + return s.fromprimitive() + if __name__ == '__main__': - dip_range = [0.0, 15.0, 5.0] - g = grid([301, 201], dip_range, mapping_type='geom') + Lx = 5.0 # mm + a0 = 343.0 # m/s + gamma = 1.4 + nu0 = 1.48e-5 # m2/s + Re = Lx * 1e-3 * a0 / nu0 + print("Reynolds number: %.5E" % Re) + expFile = 'UV.4.5v_0msC.txt' + + dip_range = np.array([0.0, 15.0, 7.5]) + g = grid([501, 201], Lx, dip_range, mapping_type='geom') g.save('DeformingWall2D.xyz') - s = initial_condition(g, Re = 23175.7) + s = initial_condition_from_exp(g, expFile, Lx, a0, gamma, Re) + # s = initial_condition(g, mach_number = 0.1, Re = 23175.7) s.save('DeformingWall2D.ic.q') s.save('DeformingWall2D.target.q') diff --git a/examples/DeformingWall2D/magudi.inp b/examples/DeformingWall2D/magudi.inp index 1924fba..b17c68d 100644 --- a/examples/DeformingWall2D/magudi.inp +++ b/examples/DeformingWall2D/magudi.inp @@ -33,7 +33,7 @@ controller_buffer_size = 100 check_gradient_accuracy = false # Physical constants -Reynolds_number = 23175.7 +Reynolds_number = 115878.0 Prandtl_number = 0.7 viscosity_power_law_exponent = 0.0 @@ -42,9 +42,9 @@ defaults/discretization_scheme = "SBP 3-6" # Time stepping options time_step_size = 1.2e-2 -number_of_timesteps = 4000 -report_interval = 10 -save_interval = 200 +number_of_timesteps = 1000000 +report_interval = 1000 +save_interval = 5000 # Artificial dissipation add_dissipation = true @@ -76,9 +76,9 @@ enable_immersed_boundary = true immersed_boundary/levelset_type = "sinusoidal_wall" immersed_boundary/dissipation_amount = 1e-3 immersed_boundary/regularization_parameter = 3.0 -immersed_boundary/period = 48.0 -immersed_boundary/location = 10.0 -immersed_boundary/width = 20.0 +immersed_boundary/period = 1372.0 +immersed_boundary/location = 8.5 +immersed_boundary/width = 9.0 immersed_boundary/amplitude = 1.0