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
Sten Delos
Gadget4
Commits
e1df7dda
Commit
e1df7dda
authored
Nov 09, 2020
by
Oliver Zier
Browse files
add initial creation file for evrard collapse
parent
d8a622e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/G2-gassphere/create_initial_conditions.py
View file @
e1df7dda
...
...
@@ -15,6 +15,7 @@ IntType = np.int32
Grid
=
14
#size of the grid used to generate particle distribution
Mtot
=
1.0
#total mass of the sphere
gamma
=
5.
/
3.
x
=
np
.
zeros
((
Grid
,
Grid
,
Grid
))
y
=
np
.
zeros
((
Grid
,
Grid
,
Grid
))
...
...
@@ -80,6 +81,13 @@ Mass[:] = particle_mass
Uthermal
[:]
=
0.05
rad
=
np
.
sqrt
(
x
[:]
**
2
+
y
[:]
**
2
+
z
[:]
**
2
)
rho
=
1.0
/
(
2.
*
np
.
pi
*
rad
[:])
entr
=
(
gamma
-
1
)
*
Uthermal
[:]
/
(
rho
[:]
**
(
gamma
-
1
))
#write intial conditions file
IC
=
h5py
.
File
(
'IC.hdf5'
,
'w'
)
...
...
@@ -107,7 +115,6 @@ header.attrs.create("Flag_Cooling", 0)
header
.
attrs
.
create
(
"Flag_StellarAge"
,
0
)
header
.
attrs
.
create
(
"Flag_Metals"
,
0
)
header
.
attrs
.
create
(
"Flag_Feedback"
,
0
)
header
.
attrs
.
create
(
"Flag_Entropy_ICs"
,
0
)
if
Pos
.
dtype
==
np
.
float64
:
header
.
attrs
.
create
(
"Flag_DoublePrecision"
,
1
)
else
:
...
...
@@ -120,6 +127,6 @@ part0.create_dataset("Coordinates", data=Pos)
part0
.
create_dataset
(
"Masses"
,
data
=
Mass
)
part0
.
create_dataset
(
"Velocities"
,
data
=
Vel
)
part0
.
create_dataset
(
"InternalEnergy"
,
data
=
Uthermal
)
part0
.
create_dataset
(
"InternalEnergy"
,
data
=
entr
)
IC
.
close
()
\ No newline at end of file
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