Commit 3e488108 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

fix sampling file space error

parent 96e9436e
Pipeline #43348 canceled with stage
...@@ -784,10 +784,15 @@ class DNS(_code): ...@@ -784,10 +784,15 @@ class DNS(_code):
def generate_tracer_state( def generate_tracer_state(
self, self,
rseed = None, rseed = None,
species = 0): species = 0,
integration_steps = None,
ncomponents = 3):
try: try:
ncomponents = 3 if type(integration_steps) == type(None):
if self.dns_type in ['NSVEcomplex_particles']: integration_steps = self.NSVEp_extra_parameters['tracers0_integration_steps']
if 'tracers{0}_integration_steps'.format(species) in self.parameters.keys():
integration_steps = self.parameters['tracers{0}_integration_steps'.format(species)]
if self.dns_type == 'NSVEcomplex_particles' and species == 0:
ncomponents = 6 ncomponents = 6
with h5py.File(self.get_checkpoint_0_fname(), 'a') as data_file: with h5py.File(self.get_checkpoint_0_fname(), 'a') as data_file:
nn = self.parameters['nparticles'] nn = self.parameters['nparticles']
...@@ -797,9 +802,7 @@ class DNS(_code): ...@@ -797,9 +802,7 @@ class DNS(_code):
data_file.create_group('tracers{0}/state'.format(species)) data_file.create_group('tracers{0}/state'.format(species))
data_file['tracers{0}/rhs'.format(species)].create_dataset( data_file['tracers{0}/rhs'.format(species)].create_dataset(
'0', '0',
shape = ( shape = (integration_steps, nn, ncomponents,),
(self.parameters['tracers{0}_integration_steps'.format(species)],) +
(nn, ncomponents,)),
dtype = np.float) dtype = np.float)
dset = data_file['tracers{0}/state'.format(species)].create_dataset( dset = data_file['tracers{0}/state'.format(species)].create_dataset(
'0', '0',
......
/**********************************************************************
* *
* Copyright 2019 Max Planck Institute *
* for Dynamics and Self-Organization *
//#define NDEBUG * *
* This file is part of bfps. *
* *
* bfps is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, either version 3 of the License, *
* or (at your option) any later version. *
* *
* bfps is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with bfps. If not, see <http://www.gnu.org/licenses/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
**********************************************************************/
#define NDEBUG
#include <string> #include <string>
#include <cmath> #include <cmath>
......
...@@ -242,6 +242,7 @@ public: ...@@ -242,6 +242,7 @@ public:
variable_used_only_in_assert(rethdf); variable_used_only_in_assert(rethdf);
assert(rethdf >= 0); assert(rethdf >= 0);
DEBUG_MSG("before writing state\n");
herr_t status = H5Dwrite( herr_t status = H5Dwrite(
dataset_id, dataset_id,
type_id, type_id,
...@@ -257,6 +258,7 @@ public: ...@@ -257,6 +258,7 @@ public:
assert(rethdf >= 0); assert(rethdf >= 0);
rethdf = H5Sclose(filespace); rethdf = H5Sclose(filespace);
assert(rethdf >= 0); assert(rethdf >= 0);
DEBUG_MSG("after writing state\n");
} }
{ {
assert(size_particle_rhs >= 0); assert(size_particle_rhs >= 0);
...@@ -304,6 +306,7 @@ public: ...@@ -304,6 +306,7 @@ public:
variable_used_only_in_assert(rethdf); variable_used_only_in_assert(rethdf);
assert(rethdf >= 0); assert(rethdf >= 0);
DEBUG_MSG("before writing rhs %d\n", idx_rhs);
herr_t status = H5Dwrite( herr_t status = H5Dwrite(
dataset_id, dataset_id,
type_id, type_id,
...@@ -317,6 +320,7 @@ public: ...@@ -317,6 +320,7 @@ public:
assert(rethdf >= 0); assert(rethdf >= 0);
rethdf = H5Sclose(memspace); rethdf = H5Sclose(memspace);
assert(rethdf >= 0); assert(rethdf >= 0);
DEBUG_MSG("after writing rhs %d\n", idx_rhs);
} }
int rethdf = H5Dclose(dataset_id); int rethdf = H5Dclose(dataset_id);
variable_used_only_in_assert(rethdf); variable_used_only_in_assert(rethdf);
......
...@@ -216,7 +216,7 @@ public: ...@@ -216,7 +216,7 @@ public:
hid_t memspace = H5Screate_simple(2, count, NULL); hid_t memspace = H5Screate_simple(2, count, NULL);
assert(memspace >= 0); assert(memspace >= 0);
const hsize_t file_count[2] = {hsize_t(Parent::getTotalNbParticles()), size_particle_positions}; const hsize_t file_count[2] = {hsize_t(Parent::getTotalNbParticles()), size_particle_rhs};
hid_t filespace = H5Screate_simple(2, file_count, NULL); hid_t filespace = H5Screate_simple(2, file_count, NULL);
assert(filespace >= 0); assert(filespace >= 0);
int rethdf = H5Sselect_hyperslab( int rethdf = H5Sselect_hyperslab(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment