Skip to content

Commit

Permalink
correct output times for window in hdf
Browse files Browse the repository at this point in the history
  • Loading branch information
pdziekan committed Sep 10, 2024
1 parent d53ff5e commit de403f4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libmpdata++/output/hdf5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,17 @@ namespace libmpdataxx
// T
{
const hsize_t
nt_out = nt / this->outfreq + 1; // incl. t=0
nt_out = (nt / this->outfreq + 1) * this->outwindow // incl. t=0
- (this->outwindow - (nt % this->outfreq) - 1); // timsteps from outwindow that go beyond nt
float dt = this->dt;

blitz::Array<typename solver_t::real_t, 1> coord(nt_out);
coord = (this->var_dt ? this->outfreq : this->outfreq * this->dt) * blitz::firstIndex();

for(int i=0; i<nt_out; ++i)
{
int timestep = int(i / this->outwindow) * this->outfreq + (i % this->outwindow);
coord(i) = timestep * (this->var_dt ? this->outfreq : this->outfreq * this->dt);
}

auto curr_dim = (*hdfp).createDataSet("T", flttype_output, H5::DataSpace(1, &nt_out));

Expand Down

0 comments on commit de403f4

Please sign in to comment.