diff --git a/examples/ZeldovichPancake_3D/makeIC.py b/examples/ZeldovichPancake_3D/makeIC.py index 15fb8bdef95f6e830e78f4d1b2c419051a6f00af..6b02baa3e8724d000877f0cd1f6e0ad281cbadd4 100644 --- a/examples/ZeldovichPancake_3D/makeIC.py +++ b/examples/ZeldovichPancake_3D/makeIC.py @@ -28,29 +28,34 @@ z_c = 1. # Redshift of caustic formation (non-linear collapse) z_i = 100. # Initial redshift gamma = 5./3. # Gas adiabatic index numPart_1D = 32 # Number of particles along each dimension +fileName = "zeldovichPancake.hdf5" # Some units -Mpc_in_m = 3.085678e22 -Msol_in_kg = 1.989e30 -Gyr_in_s = 3.085678e19 +Mpc_in_m = 3.08567758e22 +Msol_in_kg = 1.98848e30 +Gyr_in_s = 3.08567758e19 mH_in_kg = 1.6737236e-27 -k_in_J_K = 1.38064852e-23 -# Parameters -rho_0 = 1.8788e-26 # h^2 kg m^-3 -H_0 = 1. / Mpc_in_m * 10**5 # s^-1 +# Some constants +kB_in_SI = 1.38064852e-23 +G_in_SI = 6.67408e-11 + +# Some useful variables in h-full units +H_0 = 1. / Mpc_in_m * 10**5 # h s^-1 +rho_0 = 3. * H_0**2 / (8* math.pi * G_in_SI) # h^2 kg m^-3 lambda_i = 64. / H_0 * 10**5 # h^-1 m (= 64 h^-1 Mpc) x_min = -0.5 * lambda_i x_max = 0.5 * lambda_i -fileName = "zeldovichPancake.hdf5" +# SI system of units unit_l_in_si = Mpc_in_m unit_m_in_si = Msol_in_kg * 1.e10 unit_t_in_si = Gyr_in_s unit_v_in_si = unit_l_in_si / unit_t_in_si unit_u_in_si = unit_v_in_si**2 +# Total number of particles numPart = numPart_1D**3 #--------------------------------------------------- @@ -87,7 +92,7 @@ for i in range(numPart_1D): coords[index,1] = (j + 0.5) * delta_x coords[index,2] = (k + 0.5) * delta_x T = T_i * (1. / (1. - zfac * cos(k_i * q)))**(2. / 3.) - u[index] = k_in_J_K * T / (gamma - 1.) / mH_in_kg + u[index] = kB_in_SI * T / (gamma - 1.) / mH_in_kg h[index] = 1.2348 * delta_x m[index] = m_i v[index,0] = -H_0 * (1. + z_c) / sqrt(1. + z_i) * sin(k_i * q) / k_i diff --git a/examples/ZeldovichPancake_3D/plotSolution.py b/examples/ZeldovichPancake_3D/plotSolution.py index 163e61eb9d3738c39912c8c42c0b6c6bb9990cac..2a175e346e041a142c6921052ccf13978afa8a38 100644 --- a/examples/ZeldovichPancake_3D/plotSolution.py +++ b/examples/ZeldovichPancake_3D/plotSolution.py @@ -138,8 +138,8 @@ if np.size(x_g) > 1: plot(x_g, v_g, 's', color='g', alpha=0.8, lw=1.2, ms=4) plot(x, v, '.', color='r', ms=4.0) plot(x_s, v_s, '--', color='k', alpha=0.8, lw=1.2) -xlabel("${\\rm{Comoving Position}}~x$", labelpad=0) -ylabel("${\\rm{Peculiar Velocity}}~v_x$", labelpad=0) +xlabel("${\\rm{Comoving~position}}~x$", labelpad=0) +ylabel("${\\rm{Peculiar~velocity}}~v_x$", labelpad=0) # Density profile -------------------------------- @@ -148,7 +148,7 @@ if np.size(x_g) > 1: plot(x_g, rho_g/rho_0, 's', color='g', alpha=0.8, lw=1.2, ms=4) plot(x, rho/rho_0, '.', color='r', ms=4.0) plot(x_s, rho_s/rho_0, '--', color='k', alpha=0.8, lw=1.2) -xlabel("${\\rm{Comoving Position}}~x$", labelpad=0) +xlabel("${\\rm{Comoving~position}}~x$", labelpad=0) ylabel("${\\rm{Density}}~\\rho / \\rho_0$", labelpad=0) # Potential profile -------------------------------- @@ -156,7 +156,7 @@ subplot(233) if np.size(x_g) > 1: plot(x_g, phi_g, 's', color='g', alpha=0.8, lw=1.2, ms=4) plot(x, phi, '.', color='r', ms=4.0) -xlabel("${\\rm{Comoving Position}}~x$", labelpad=0) +xlabel("${\\rm{Comoving~position}}~x$", labelpad=0) ylabel("${\\rm{Potential}}~\\phi$", labelpad=0) # Temperature profile ------------------------- @@ -172,7 +172,7 @@ if np.size(x_g) > 1: plot(x_g, T_g, 's', color='g', alpha=0.8, lw=1.2, ms=4) plot(x, T, '.', color='r', ms=4.0) plot(x_s, T_s, '--', color='k', alpha=0.8, lw=1.2) -xlabel("${\\rm{Comoving Position}}~x$", labelpad=0) +xlabel("${\\rm{Comoving~position}}~x$", labelpad=0) ylabel("${\\rm{Temperature}}~T$", labelpad=0) # Information ------------------------------------- diff --git a/examples/ZeldovichPancake_3D/run.sh b/examples/ZeldovichPancake_3D/run.sh index 9b6b8166ac0d084898b96e2de6b0fc1ef378aecd..b3f802f978377a9615f7cdd1cdd14e85ae3baad2 100755 --- a/examples/ZeldovichPancake_3D/run.sh +++ b/examples/ZeldovichPancake_3D/run.sh @@ -8,7 +8,7 @@ then fi # Run SWIFT -../swift -a -s -c -G -t 8 zeldovichPancake.yml 2>&1 | tee output.log +../swift -s -c -G -t 8 zeldovichPancake.yml 2>&1 | tee output.log # Plot the result for i in {0..119} diff --git a/examples/ZeldovichPancake_3D/zeldovichPancake.yml b/examples/ZeldovichPancake_3D/zeldovichPancake.yml index 481432d5875470aa464f69d5aa47fb76328cde7d..5cfa01ff954a959e06076035ae22240bb3c5a120 100644 --- a/examples/ZeldovichPancake_3D/zeldovichPancake.yml +++ b/examples/ZeldovichPancake_3D/zeldovichPancake.yml @@ -17,7 +17,7 @@ Cosmology: # Parameters governing the time integration TimeIntegration: dt_min: 1e-7 # The minimal time-step size of the simulation (in internal units). - dt_max: 1e-3 # The maximal time-step size of the simulation (in internal units). + dt_max: 4e-3 # The maximal time-step size of the simulation (in internal units). # Parameters governing the snapshots Snapshots: @@ -42,10 +42,9 @@ InitialConditions: Scheduler: max_top_level_cells: 8 cell_split_size: 50 - tasks_per_cell: 125 Gravity: - mesh_side_length: 16 + mesh_side_length: 32 eta: 0.025 theta: 0.3 r_cut_max: 5.