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):
def generate_tracer_state(
self,
rseed = None,
species = 0):
species = 0,
integration_steps = None,
ncomponents = 3):
try:
ncomponents = 3
if self.dns_type in ['NSVEcomplex_particles']:
if type(integration_steps) == type(None):
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
with h5py.File(self.get_checkpoint_0_fname(), 'a') as data_file:
nn = self.parameters['nparticles']
......@@ -797,9 +802,7 @@ class DNS(_code):
data_file.create_group('tracers{0}/state'.format(species))
data_file['tracers{0}/rhs'.format(species)].create_dataset(
'0',
shape = (
(self.parameters['tracers{0}_integration_steps'.format(species)],) +
(nn, ncomponents,)),
shape = (integration_steps, nn, ncomponents,),
dtype = np.float)
dset = data_file['tracers{0}/state'.format(species)].create_dataset(
'0',
......
//#define NDEBUG
/**********************************************************************
* *
* Copyright 2019 Max Planck Institute *
* for Dynamics and Self-Organization *
* *
* 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 <cmath>
......
......@@ -242,6 +242,7 @@ public:
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
DEBUG_MSG("before writing state\n");
herr_t status = H5Dwrite(
dataset_id,
type_id,
......@@ -257,6 +258,7 @@ public:
assert(rethdf >= 0);
rethdf = H5Sclose(filespace);
assert(rethdf >= 0);
DEBUG_MSG("after writing state\n");
}
{
assert(size_particle_rhs >= 0);
......@@ -304,6 +306,7 @@ public:
variable_used_only_in_assert(rethdf);
assert(rethdf >= 0);
DEBUG_MSG("before writing rhs %d\n", idx_rhs);
herr_t status = H5Dwrite(
dataset_id,
type_id,
......@@ -317,6 +320,7 @@ public:
assert(rethdf >= 0);
rethdf = H5Sclose(memspace);
assert(rethdf >= 0);
DEBUG_MSG("after writing rhs %d\n", idx_rhs);
}
int rethdf = H5Dclose(dataset_id);
variable_used_only_in_assert(rethdf);
......
......@@ -216,7 +216,7 @@ public:
hid_t memspace = H5Screate_simple(2, count, NULL);
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);
assert(filespace >= 0);
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