diff --git a/TurTLE/DNS.py b/TurTLE/DNS.py index d69d83715f22a14046359759c28db1b01708890a..33495f44111b3bbabef4999768f443bbbc3556da 100644 --- a/TurTLE/DNS.py +++ b/TurTLE/DNS.py @@ -26,7 +26,6 @@ import os import h5py import numpy as np -import glob import TurTLE from ._code import _code @@ -867,13 +866,24 @@ class DNS(_code): 'User may not request sourcing the initial condition from another simulation unless "field_random_seed" is 0. Aborting.' f = h5py.File(self.get_checkpoint_0_fname(), 'a') if len(opt.src_simname) > 0: - source_checkpoints = glob.glob(os.path.join( - os.path.realpath(opt.src_work_dir), - opt.src_simname + '_checkpoint_*.h5')) + source_simfile = os.path.join( + os.path.realpath(opt.src_work_dir), + opt.src_simname + '.h5') + if os.path.exists(source_simfile): + source_current_checkpoint = h5py.File( + source_simfile, 'r')['checkpoint'][()] + else: + source_current_checkpoint = 0 + source_checkpoints = [ + os.path.join( + os.path.realpath(opt.src_work_dir), + opt.src_simname + '_checkpoint_{0}.h5'.format(cp)) + for cp in range(source_current_checkpoint+1)] src_file = None for check_file in source_checkpoints: f0 = h5py.File(check_file, 'r') - if '{0}'.format(opt.src_iteration) in f0[checkpoint_field + '/complex'].keys(): + if ('{0}'.format(opt.src_iteration) + in f0[checkpoint_field + '/complex'].keys()): f0.close() src_file = check_file break diff --git a/cpp/particles/particle_solver.cpp b/cpp/particles/particle_solver.cpp index 10055011d43ad581846a6d9edc5cb288424b809d..fde1d9c2d6f921b6ab46beef8ae5a7fb36ffbd64 100644 --- a/cpp/particles/particle_solver.cpp +++ b/cpp/particles/particle_solver.cpp @@ -85,7 +85,7 @@ int particle_solver::Heun( double dt, abstract_particle_rhs &rhs) { - TIMEZONE("particle_solver::Euler"); + TIMEZONE("particle_solver::Heun"); assert(this->pset->getStateSize() == rhs.getStateSize()); // temporary arrays for storing the two right-hand-side values // We need to be able to redistribute the initial condition for computations to make sense, @@ -186,7 +186,7 @@ int particle_solver::cRK4( double dt, abstract_particle_rhs &rhs) { - TIMEZONE("particle_solver::Euler"); + TIMEZONE("particle_solver::cRK4"); assert(this->pset->getStateSize() == rhs.getStateSize()); // temporary arrays for storing the two right-hand-side values // We need to be able to redistribute the initial condition for computations to make sense, @@ -278,7 +278,7 @@ int particle_solver::cRK4( kcurrent.reset(new particle_rnumber[ this->pset->getLocalNumberOfParticles()* this->pset->getStateSize()]); - rhs(0.5, *(this->pset), kcurrent.get(), extra_values); + rhs(1.0, *(this->pset), kcurrent.get(), extra_values); this->pset->copy_state_tofrom(extra_values[4], kcurrent); /*** COMPUTE xn+h*(k1 + 2*k2 + 2*k3 + k4)/6 ***/