Skip to content
Snippets Groups Projects
Commit aae58a9d authored by Josh Borrow's avatar Josh Borrow
Browse files

Added ability to select the number of particles in the initial conditions as a runtime parameter

parent 07f1e5b1
No related branches found
No related tags found
1 merge request!518Added ability to select the number of particles in the initial conditions as a runtime parameter for Evrard Collapse
......@@ -18,9 +18,24 @@
################################################################################
import h5py
import argparse as ap
from numpy import *
# Generates a swift IC file for the Evrard collapse
parser = ap.ArgumentParser(
description="Generates a swift IC file for the Evrard collapse"
)
parser.add_argument(
"-n",
"--nparts",
help="""
Number of particles to be used in the Evrard collapse.
""",
required=False,
default=100000
)
args = vars(parser.parse_args())
# Parameters
gamma = 5. / 3. # Gas adiabatic index
......@@ -28,7 +43,7 @@ M = 1. # total mass of the sphere
R = 1. # radius of the sphere
u0 = 0.05 / M # initial thermal energy
fileName = "evrard.hdf5"
numPart = 100000
numPart = int(args["nparts"])
r = R * sqrt(random.random(numPart))
phi = 2. * pi * random.random(numPart)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment