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
17096ce7
Commit
17096ce7
authored
7 years ago
by
lhausamm
Browse files
Options
Downloads
Patches
Plain Diff
Add protype of testReading with cooling
parent
b41060a4
No related branches found
No related tags found
1 merge request
!486
Add chemistry in part
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/cooling/grackle/cooling_io.h
+1
-1
1 addition, 1 deletion
src/cooling/grackle/cooling_io.h
tests/Makefile.am
+1
-1
1 addition, 1 deletion
tests/Makefile.am
tests/makeInput.py
+5
-1
5 additions, 1 deletion
tests/makeInput.py
tests/testReading.c
+8
-0
8 additions, 0 deletions
tests/testReading.c
with
15 additions
and
3 deletions
src/cooling/grackle/cooling_io.h
+
1
−
1
View file @
17096ce7
...
@@ -33,7 +33,7 @@ void cooling_read_particles(struct part* parts, struct io_props* list,
...
@@ -33,7 +33,7 @@ void cooling_read_particles(struct part* parts, struct io_props* list,
*
num_fields
+=
1
;
*
num_fields
+=
1
;
/* List what we want to read */
/* List what we want to read */
list
[
0
]
=
io_make_input_field
(
"HeDensity"
,
FLOAT
,
1
,
OPTIONAL
,
list
[
0
]
=
io_make_input_field
(
"HeDensity"
,
FLOAT
,
1
,
COMPULSORY
,
UNIT_CONV_DENSITY
,
parts
,
cooling_data
.
He_density
);
UNIT_CONV_DENSITY
,
parts
,
cooling_data
.
He_density
);
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/Makefile.am
+
1
−
1
View file @
17096ce7
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
# Add the source directory and debug to CFLAGS
# Add the source directory and debug to CFLAGS
AM_CFLAGS
=
-I
$(
top_srcdir
)
/src
$(
HDF5_CPPFLAGS
)
AM_CFLAGS
=
-I
$(
top_srcdir
)
/src
$(
HDF5_CPPFLAGS
)
AM_LDFLAGS
=
../src/.libs/libswiftsim.a
$(
HDF5_LDFLAGS
)
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
AM_LDFLAGS
=
../src/.libs/libswiftsim.a
$(
HDF5_LDFLAGS
)
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
$(
GRACKLE_LIBS
)
# List of programs and scripts to run in the test suite
# List of programs and scripts to run in the test suite
TESTS
=
testGreetings testMaths testReading.sh testSingle testKernel testSymmetry
\
TESTS
=
testGreetings testMaths testReading.sh testSingle testKernel testSymmetry
\
...
...
This diff is collapsed.
Click to expand it.
tests/makeInput.py
+
5
−
1
View file @
17096ce7
...
@@ -37,6 +37,7 @@ fileName = "input.hdf5"
...
@@ -37,6 +37,7 @@ fileName = "input.hdf5"
numPart
=
L
**
3
numPart
=
L
**
3
mass
=
boxSize
**
3
*
rho
/
numPart
mass
=
boxSize
**
3
*
rho
/
numPart
internalEnergy
=
P
/
((
gamma
-
1.
)
*
rho
)
internalEnergy
=
P
/
((
gamma
-
1.
)
*
rho
)
he_density
=
rho
*
0.24
#Generate particles
#Generate particles
coords
=
zeros
((
numPart
,
3
))
coords
=
zeros
((
numPart
,
3
))
...
@@ -45,6 +46,7 @@ m = zeros((numPart, 1))
...
@@ -45,6 +46,7 @@ m = zeros((numPart, 1))
h
=
zeros
((
numPart
,
1
))
h
=
zeros
((
numPart
,
1
))
u
=
zeros
((
numPart
,
1
))
u
=
zeros
((
numPart
,
1
))
ids
=
zeros
((
numPart
,
1
),
dtype
=
'
L
'
)
ids
=
zeros
((
numPart
,
1
),
dtype
=
'
L
'
)
he
=
zeros
((
numPart
,
1
))
for
i
in
range
(
L
):
for
i
in
range
(
L
):
for
j
in
range
(
L
):
for
j
in
range
(
L
):
...
@@ -63,7 +65,7 @@ for i in range(L):
...
@@ -63,7 +65,7 @@ for i in range(L):
h
[
index
]
=
2.251
*
boxSize
/
L
h
[
index
]
=
2.251
*
boxSize
/
L
u
[
index
]
=
internalEnergy
u
[
index
]
=
internalEnergy
ids
[
index
]
=
index
ids
[
index
]
=
index
he
[
index
]
=
he_density
#--------------------------------------------------
#--------------------------------------------------
...
@@ -110,5 +112,7 @@ ds = grp.create_dataset('InternalEnergy', (numPart,1), 'f')
...
@@ -110,5 +112,7 @@ ds = grp.create_dataset('InternalEnergy', (numPart,1), 'f')
ds
[()]
=
u
ds
[()]
=
u
ds
=
grp
.
create_dataset
(
'
ParticleIDs
'
,
(
numPart
,
1
),
'
L
'
)
ds
=
grp
.
create_dataset
(
'
ParticleIDs
'
,
(
numPart
,
1
),
'
L
'
)
ds
[()]
=
ids
ds
[()]
=
ids
ds
=
grp
.
create_dataset
(
'
HeDensity
'
,
(
numPart
,
1
),
'
f
'
)
ds
[()]
=
he
file
.
close
()
file
.
close
()
This diff is collapsed.
Click to expand it.
tests/testReading.c
+
8
−
0
View file @
17096ce7
...
@@ -42,6 +42,7 @@ int main() {
...
@@ -42,6 +42,7 @@ int main() {
const
double
boxSize
=
1
.;
const
double
boxSize
=
1
.;
const
size_t
L
=
4
;
const
size_t
L
=
4
;
const
double
rho
=
2
.;
const
double
rho
=
2
.;
const
float
He_density
=
rho
*
0
.
24
;
/* Read data */
/* Read data */
read_ic_single
(
"input.hdf5"
,
&
us
,
dim
,
&
parts
,
&
gparts
,
&
sparts
,
&
Ngas
,
read_ic_single
(
"input.hdf5"
,
&
us
,
dim
,
&
parts
,
&
gparts
,
&
sparts
,
&
Ngas
,
...
@@ -92,6 +93,13 @@ int main() {
...
@@ -92,6 +93,13 @@ int main() {
assert
(
parts
[
n
].
a_hydro
[
0
]
==
0
.);
assert
(
parts
[
n
].
a_hydro
[
0
]
==
0
.);
assert
(
parts
[
n
].
a_hydro
[
1
]
==
0
.);
assert
(
parts
[
n
].
a_hydro
[
1
]
==
0
.);
assert
(
parts
[
n
].
a_hydro
[
2
]
==
0
.);
assert
(
parts
[
n
].
a_hydro
[
2
]
==
0
.);
#ifdef COOLING_GRACKLE
printf
(
"Test %g, %g, %g
\n
"
,
parts
[
n
].
cooling_data
.
He_density
,
He_density
,
parts
[
n
].
cooling_data
.
He_density
-
He_density
);
assert
(
parts
[
n
].
cooling_data
.
He_density
==
He_density
);
#endif
}
}
/* Clean-up */
/* Clean-up */
...
...
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