Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
be0074a1
Commit
be0074a1
authored
7 years ago
by
lhausamm
Browse files
Options
Downloads
Patches
Plain Diff
Remove config.h parsing
parent
743713e3
No related branches found
No related tags found
1 merge request
!486
Add chemistry in part
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/makeInput.py
+11
-21
11 additions, 21 deletions
tests/makeInput.py
with
11 additions
and
21 deletions
tests/makeInput.py
+
11
−
21
View file @
be0074a1
...
...
@@ -33,24 +33,13 @@ P = 1. # Pressure
gamma
=
5.
/
3.
# Gas adiabatic index
fileName
=
"
input.hdf5
"
# read flags from config.h
flags
=
{}
config_file
=
"
../config.h
"
with
open
(
config_file
,
"
r
"
)
as
f
:
reg
=
"
#define (\w*) (.*)
\n
"
for
line
in
f
:
m
=
regex
.
match
(
reg
,
line
)
if
m
:
flags
[
m
.
group
(
1
)]
=
m
.
group
(
2
)
cooling_grackle
=
"
COOLING_GRACKLE
"
in
flags
#---------------------------------------------------
numPart
=
L
**
3
mass
=
boxSize
**
3
*
rho
/
numPart
internalEnergy
=
P
/
((
gamma
-
1.
)
*
rho
)
if
cooling_grackle
:
he_density
=
rho
*
0.24
# chemistry data
he_density
=
rho
*
0.24
#Generate particles
coords
=
zeros
((
numPart
,
3
))
...
...
@@ -59,8 +48,9 @@ m = zeros((numPart, 1))
h
=
zeros
((
numPart
,
1
))
u
=
zeros
((
numPart
,
1
))
ids
=
zeros
((
numPart
,
1
),
dtype
=
'
L
'
)
if
cooling_grackle
:
he
=
zeros
((
numPart
,
1
))
# chemistry data
he
=
zeros
((
numPart
,
1
))
for
i
in
range
(
L
):
for
j
in
range
(
L
):
...
...
@@ -79,8 +69,8 @@ for i in range(L):
h
[
index
]
=
2.251
*
boxSize
/
L
u
[
index
]
=
internalEnergy
ids
[
index
]
=
index
if
cooling_grackle
:
he
[
index
]
=
he_density
# chemistry data
he
[
index
]
=
he_density
#--------------------------------------------------
...
...
@@ -127,8 +117,8 @@ ds = grp.create_dataset('InternalEnergy', (numPart,1), 'f')
ds
[()]
=
u
ds
=
grp
.
create_dataset
(
'
ParticleIDs
'
,
(
numPart
,
1
),
'
L
'
)
ds
[()]
=
ids
if
cooling_grackle
:
ds
=
grp
.
create_dataset
(
'
HeDensity
'
,
(
numPart
,
1
),
'
f
'
)
ds
[()]
=
he
# chemistry
ds
=
grp
.
create_dataset
(
'
HeDensity
'
,
(
numPart
,
1
),
'
f
'
)
ds
[()]
=
he
file
.
close
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment