Skip to content
Snippets Groups Projects
Commit 885c9a3c authored by Folkert Nobels's avatar Folkert Nobels
Browse files

Change the angularmomentum check script

parent e9143839
Branches
Tags
1 merge request!681Add example of isolated galaxy and change hernquist potential configuration
...@@ -27,6 +27,7 @@ import scipy.optimize as sco ...@@ -27,6 +27,7 @@ import scipy.optimize as sco
Nmax = 2001 Nmax = 2001
steps = 10 steps = 10
angmomcomp = False
iterarray = np.arange(0, Nmax + 1, steps) iterarray = np.arange(0, Nmax + 1, steps)
Lxtot = np.zeros(len(iterarray)) Lxtot = np.zeros(len(iterarray))
...@@ -37,7 +38,6 @@ time_array = np.zeros(len(iterarray)) ...@@ -37,7 +38,6 @@ time_array = np.zeros(len(iterarray))
for i in np.arange(0, Nmax + 1, steps): for i in np.arange(0, Nmax + 1, steps):
print(i)
f = h5py.File("output_%04d.hdf5" % i, "r") f = h5py.File("output_%04d.hdf5" % i, "r")
boxsize = f["Header"].attrs["BoxSize"] / 2.0 boxsize = f["Header"].attrs["BoxSize"] / 2.0
...@@ -72,9 +72,10 @@ for i in np.arange(0, Nmax + 1, steps): ...@@ -72,9 +72,10 @@ for i in np.arange(0, Nmax + 1, steps):
Ltot[int(i / steps)] = np.sum(L) Ltot[int(i / steps)] = np.sum(L)
time_array[-1] = 2.0 time_array[-1] = 2.0
plt.plot(time_array, Lxtot / Lxtot[0] - 1, label="Lx total") if angmomcomp:
plt.plot(time_array, Lytot / Lytot[0] - 1, label="Ly total") plt.plot(time_array, Lxtot / Lxtot[0] - 1, label="Lx total")
plt.plot(time_array, Lztot / Lztot[0] - 1, label="Lz total") plt.plot(time_array, Lytot / Lytot[0] - 1, label="Ly total")
plt.plot(time_array, Lztot / Lztot[0] - 1, label="Lz total")
plt.plot(time_array, Ltot / Ltot[0] - 1, label="L total") plt.plot(time_array, Ltot / Ltot[0] - 1, label="L total")
plt.xlabel("Time") plt.xlabel("Time")
plt.ylabel("ratio between current and zero angular momentum") plt.ylabel("ratio between current and zero angular momentum")
......
...@@ -27,6 +27,7 @@ import scipy.optimize as sco ...@@ -27,6 +27,7 @@ import scipy.optimize as sco
Nmax = 2001 Nmax = 2001
steps = 10 steps = 10
angmomcomp = False
iterarray = np.arange(0, Nmax + 1, steps) iterarray = np.arange(0, Nmax + 1, steps)
Lxtot = np.zeros(len(iterarray)) Lxtot = np.zeros(len(iterarray))
...@@ -37,7 +38,6 @@ time_array = np.zeros(len(iterarray)) ...@@ -37,7 +38,6 @@ time_array = np.zeros(len(iterarray))
for i in np.arange(0, Nmax + 1, steps): for i in np.arange(0, Nmax + 1, steps):
print(i)
f = h5py.File("output_%04d.hdf5" % i, "r") f = h5py.File("output_%04d.hdf5" % i, "r")
boxsize = f["Header"].attrs["BoxSize"] / 2.0 boxsize = f["Header"].attrs["BoxSize"] / 2.0
...@@ -72,9 +72,10 @@ for i in np.arange(0, Nmax + 1, steps): ...@@ -72,9 +72,10 @@ for i in np.arange(0, Nmax + 1, steps):
Ltot[int(i / steps)] = np.sum(L) Ltot[int(i / steps)] = np.sum(L)
time_array[-1] = 2.0 time_array[-1] = 2.0
plt.plot(time_array, Lxtot / Lxtot[0] - 1, label="Lx total") if angmomcomp:
plt.plot(time_array, Lytot / Lytot[0] - 1, label="Ly total") plt.plot(time_array, Lxtot / Lxtot[0] - 1, label="Lx total")
plt.plot(time_array, Lztot / Lztot[0] - 1, label="Lz total") plt.plot(time_array, Lytot / Lytot[0] - 1, label="Ly total")
plt.plot(time_array, Lztot / Lztot[0] - 1, label="Lz total")
plt.plot(time_array, Ltot / Ltot[0] - 1, label="L total") plt.plot(time_array, Ltot / Ltot[0] - 1, label="L total")
plt.xlabel("Time") plt.xlabel("Time")
plt.ylabel("ratio between current and zero angular momentum") plt.ylabel("ratio between current and zero angular momentum")
......
...@@ -33,6 +33,9 @@ Statistics: ...@@ -33,6 +33,9 @@ Statistics:
delta_time: 1e-2 # Time between statistics output delta_time: 1e-2 # Time between statistics output
time_first: 0. # (Optional) Time of the first stats output if non-cosmological time-integration (in internal units) time_first: 0. # (Optional) Time of the first stats output if non-cosmological time-integration (in internal units)
Scheduler:
max_top_level_cells: 96
# Parameters related to the initial conditions # Parameters related to the initial conditions
InitialConditions: InitialConditions:
file_name: 3e11-star-only-static-potential-galaxy.hdf5 # The file to read file_name: 3e11-star-only-static-potential-galaxy.hdf5 # The file to read
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment