Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
c5245090
Commit
c5245090
authored
9 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
fix stupid bug
parent
e233f12f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bfps/NavierStokes.py
+17
-16
17 additions, 16 deletions
bfps/NavierStokes.py
bfps/code.py
+4
-4
4 additions, 4 deletions
bfps/code.py
with
21 additions
and
20 deletions
bfps/NavierStokes.py
+
17
−
16
View file @
c5245090
...
@@ -53,9 +53,10 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -53,9 +53,10 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
hid_t Cdset, Cspace;
hid_t Cdset, Cspace;
int ndims;
int ndims;
// store kspace information
// store kspace information
Cdset = H5Dopen(
parameter
_file,
"
/kspace/kshell
"
, H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file,
"
/kspace/kshell
"
, H5P_DEFAULT);
Cspace = H5Dget_space(Cdset);
Cspace = H5Dget_space(Cdset);
H5Sget_simple_extent_dims(Cspace, dims, NULL);
H5Sget_simple_extent_dims(Cspace, dims, NULL);
H5Sclose(Cspace);
if (fs->nshells != dims[0])
if (fs->nshells != dims[0])
{
{
std::cerr <<
"
ERROR: computed nshells not equal to data file nshells
\\
n
"
<< std::endl;
std::cerr <<
"
ERROR: computed nshells not equal to data file nshells
\\
n
"
<< std::endl;
...
@@ -63,13 +64,13 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -63,13 +64,13 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
}
}
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fs->kshell);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fs->kshell);
H5Dclose(Cdset);
H5Dclose(Cdset);
Cdset = H5Dopen(
parameter
_file,
"
/kspace/nshell
"
, H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file,
"
/kspace/nshell
"
, H5P_DEFAULT);
H5Dwrite(Cdset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, fs->nshell);
H5Dwrite(Cdset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, fs->nshell);
H5Dclose(Cdset);
H5Dclose(Cdset);
Cdset = H5Dopen(
parameter
_file,
"
/kspace/kM
"
, H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file,
"
/kspace/kM
"
, H5P_DEFAULT);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &fs->kM);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &fs->kM);
H5Dclose(Cdset);
H5Dclose(Cdset);
Cdset = H5Dopen(
parameter
_file,
"
/kspace/dk
"
, H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file,
"
/kspace/dk
"
, H5P_DEFAULT);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &fs->dk);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &fs->dk);
H5Dclose(Cdset);
H5Dclose(Cdset);
//endcpp
//endcpp
...
@@ -79,7 +80,7 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -79,7 +80,7 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
'
/statistics/moments/{0}
'
.
format
(
field
),
'
/statistics/moments/{0}
'
.
format
(
field
),
'
/statistics/histograms/{0}
'
.
format
(
field
),
'
/statistics/histograms/{0}
'
.
format
(
field
),
'
/statistics/spectra/{0}_{0}
'
.
format
(
field
)]:
'
/statistics/spectra/{0}_{0}
'
.
format
(
field
)]:
self
.
file_datasets_grow
+=
(
'
Cdset = H5Dopen(
parameter
_file,
"
{0}
"
, H5P_DEFAULT);
\n
'
.
format
(
key
)
+
self
.
file_datasets_grow
+=
(
'
Cdset = H5Dopen(
stat
_file,
"
{0}
"
, H5P_DEFAULT);
\n
'
.
format
(
key
)
+
'
Cspace = H5Dget_space(Cdset);
\n
'
+
'
Cspace = H5Dget_space(Cdset);
\n
'
+
'
ndims = H5Sget_simple_extent_dims(Cspace, dims, NULL);
\n
'
+
'
ndims = H5Sget_simple_extent_dims(Cspace, dims, NULL);
\n
'
+
'
dims[0] += niter_todo/niter_stat;
\n
'
+
'
dims[0] += niter_todo/niter_stat;
\n
'
+
...
@@ -154,14 +155,14 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -154,14 +155,14 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
"""
]
"""
]
stat_template
=
"""
stat_template
=
"""
//begincpp
//begincpp
Cdset = H5Dopen(
parameter
_file,
"
{0}
"
, H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file,
"
{0}
"
, H5P_DEFAULT);
wspace = H5Dget_space(Cdset);
wspace = H5Dget_space(Cdset);
ndims = H5Sget_simple_extent_dims(wspace, dims, NULL);
ndims = H5Sget_simple_extent_dims(wspace, dims, NULL);
mspace = H5Screate_simple(ndims, count, NULL);
mspace = H5Screate_simple(ndims, count, NULL);
H5Sselect_hyperslab(wspace, H5S_SELECT_SET, offset, NULL, count, NULL);
H5Sselect_hyperslab(wspace, H5S_SELECT_SET, offset, NULL, count, NULL);
H5Dwrite(Cdset, {1}, mspace, wspace, H5P_DEFAULT, {2});
H5Dwrite(Cdset, {1}, mspace, wspace, H5P_DEFAULT, {2});
H5Dclose(Cdset);
H5Dclose(Cdset);
Cdset = H5Dopen(
parameter
_file,
"
{3}
"
, H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file,
"
{3}
"
, H5P_DEFAULT);
H5Dwrite(Cdset, {1}, mspace, wspace, H5P_DEFAULT, {4});
H5Dwrite(Cdset, {1}, mspace, wspace, H5P_DEFAULT, {4});
H5Sclose(mspace);
H5Sclose(mspace);
H5Sclose(wspace);
H5Sclose(wspace);
...
@@ -248,7 +249,7 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -248,7 +249,7 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
temp_string = (std::string(
"
/particles/
"
) +
temp_string = (std::string(
"
/particles/
"
) +
std::string(ps{0}->name) +
std::string(ps{0}->name) +
std::string(
"
/{1}
"
));
std::string(
"
/{1}
"
));
Cdset = H5Dopen(
parameter
_file, temp_string.c_str(), H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file, temp_string.c_str(), H5P_DEFAULT);
Cspace = H5Dget_space(Cdset);
Cspace = H5Dget_space(Cdset);
ndims = H5Sget_simple_extent_dims(Cspace, dims, NULL);
ndims = H5Sget_simple_extent_dims(Cspace, dims, NULL);
dims[0] += niter_todo/niter_part;
dims[0] += niter_todo/niter_part;
...
@@ -288,16 +289,16 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -288,16 +289,16 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
std::string temp_string = (std::string(
"
/particles/
"
) +
std::string temp_string = (std::string(
"
/particles/
"
) +
std::string(ps{0}->name) +
std::string(ps{0}->name) +
std::string(
"
/velocity
"
));
std::string(
"
/velocity
"
));
hid_t Cdset = H5Dopen(
parameter
_file, temp_string.c_str(), H5P_DEFAULT);
hid_t Cdset = H5Dopen(
stat
_file, temp_string.c_str(), H5P_DEFAULT);
hid_t mspace, wspace;
hid_t mspace, wspace;
int ndims;
int ndims;
hsize_t count[3], offset[3], dims[3];
hsize_t count[3], offset[3];
wspace = H5Dget_space(Cdset);
ndims = H5Sget_simple_extent_dims(wspace, count, NULL);
count[0] = 1;
count[0] = 1;
offset[0] = ps{0}->iteration / ps{0}->traj_skip;
offset[0] = ps{0}->iteration / ps{0}->traj_skip;
offset[1] = 0;
offset[1] = 0;
offset[2] = 0;
offset[2] = 0;
wspace = H5Dget_space(Cdset);
ndims = H5Sget_simple_extent_dims(wspace, dims, NULL);
mspace = H5Screate_simple(ndims, count, NULL);
mspace = H5Screate_simple(ndims, count, NULL);
H5Sselect_hyperslab(wspace, H5S_SELECT_SET, offset, NULL, count, NULL);
H5Sselect_hyperslab(wspace, H5S_SELECT_SET, offset, NULL, count, NULL);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, mspace, wspace, H5P_DEFAULT, ps{0}->rhs[0]);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, mspace, wspace, H5P_DEFAULT, ps{0}->rhs[0]);
...
@@ -307,7 +308,7 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -307,7 +308,7 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
temp_string = (std::string(
"
/particles/
"
) +
temp_string = (std::string(
"
/particles/
"
) +
std::string(ps{0}->name) +
std::string(ps{0}->name) +
std::string(
"
/acceleration
"
));
std::string(
"
/acceleration
"
));
Cdset = H5Dopen(
parameter
_file, temp_string.c_str(), H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file, temp_string.c_str(), H5P_DEFAULT);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, mspace, wspace, H5P_DEFAULT, acceleration);
H5Dwrite(Cdset, H5T_NATIVE_DOUBLE, mspace, wspace, H5P_DEFAULT, acceleration);
H5Sclose(mspace);
H5Sclose(mspace);
H5Sclose(wspace);
H5Sclose(wspace);
...
@@ -327,13 +328,13 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
...
@@ -327,13 +328,13 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
'
ps{1}->dt = dt;
\n
'
+
'
ps{1}->dt = dt;
\n
'
+
'
ps{1}->iteration = iteration;
\n
'
+
'
ps{1}->iteration = iteration;
\n
'
+
update_field
+
update_field
+
'
ps{1}->read(
parameter
_file);
\n
'
).
format
(
self
.
C_dtype
,
self
.
particle_species
)
'
ps{1}->read(
stat
_file);
\n
'
).
format
(
self
.
C_dtype
,
self
.
particle_species
)
self
.
particle_loop
+=
((
update_field
+
self
.
particle_loop
+=
((
update_field
+
'
ps{0}->step();
\n
'
+
'
ps{0}->step();
\n
'
+
'
if (ps{0}->iteration % niter_part == 0)
\n
'
+
'
if (ps{0}->iteration % niter_part == 0)
\n
'
+
'
ps{0}->write(
parameter
_file, false);
\n
'
).
format
(
self
.
particle_species
)
+
'
ps{0}->write(
stat
_file, false);
\n
'
).
format
(
self
.
particle_species
)
+
output_vel_acc
)
output_vel_acc
)
self
.
particle_end
+=
(
'
ps{0}->write(
parameter
_file);
\n
'
+
self
.
particle_end
+=
(
'
ps{0}->write(
stat
_file);
\n
'
+
'
delete ps{0};
\n
'
).
format
(
self
.
particle_species
)
'
delete ps{0};
\n
'
).
format
(
self
.
particle_species
)
self
.
particle_species
+=
1
self
.
particle_species
+=
1
return
None
return
None
...
...
This diff is collapsed.
Click to expand it.
bfps/code.py
+
4
−
4
View file @
c5245090
...
@@ -61,7 +61,7 @@ class code(base):
...
@@ -61,7 +61,7 @@ class code(base):
self
.
variables
=
'
int myrank, nprocs;
\n
'
self
.
variables
=
'
int myrank, nprocs;
\n
'
self
.
variables
+=
'
int iteration;
\n
'
self
.
variables
+=
'
int iteration;
\n
'
self
.
variables
+=
'
char simname[256], fname[256];
\n
'
self
.
variables
+=
'
char simname[256], fname[256];
\n
'
self
.
variables
+=
(
'
hid_t parameter_file, Cdset;
\n
'
)
self
.
variables
+=
(
'
hid_t parameter_file,
stat_file,
Cdset;
\n
'
)
self
.
definitions
=
''
self
.
definitions
=
''
self
.
main_start
=
"""
self
.
main_start
=
"""
//begincpp
//begincpp
...
@@ -91,7 +91,7 @@ class code(base):
...
@@ -91,7 +91,7 @@ class code(base):
read_parameters(parameter_file);
read_parameters(parameter_file);
H5Fclose(parameter_file);
H5Fclose(parameter_file);
if (myrank == 0)
if (myrank == 0)
parameter
_file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
stat
_file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
//endcpp
//endcpp
"""
"""
for
ostream
in
[
'
cout
'
,
'
cerr
'
]:
for
ostream
in
[
'
cout
'
,
'
cerr
'
]:
...
@@ -101,10 +101,10 @@ class code(base):
...
@@ -101,10 +101,10 @@ class code(base):
// clean up
// clean up
if (myrank == 0)
if (myrank == 0)
{
{
Cdset = H5Dopen(
parameter
_file,
"
iteration
"
, H5P_DEFAULT);
Cdset = H5Dopen(
stat
_file,
"
iteration
"
, H5P_DEFAULT);
H5Dwrite(Cdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &iteration);
H5Dwrite(Cdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &iteration);
H5Dclose(Cdset);
H5Dclose(Cdset);
H5Fclose(
parameter
_file);
H5Fclose(
stat
_file);
}
}
fftwf_mpi_cleanup();
fftwf_mpi_cleanup();
fftw_mpi_cleanup();
fftw_mpi_cleanup();
...
...
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