Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
aae58a9d
Commit
aae58a9d
authored
Mar 20, 2018
by
Josh Borrow
Browse files
Added ability to select the number of particles in the initial conditions as a runtime parameter
parent
07f1e5b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/EvrardCollapse_3D/makeIC.py
View file @
aae58a9d
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment