Commit c14be9dc authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

Merge branch 'bugfix/particle_distribution' into develop

parents 407d3044 415b6b89
Pipeline #64807 passed with stage
in 4 minutes and 46 seconds
...@@ -33,22 +33,22 @@ import sys ...@@ -33,22 +33,22 @@ import sys
import TurTLE import TurTLE
from TurTLE import DNS from TurTLE import DNS
def basic_test():
def main():
nclouds = 10 nclouds = 10
nparticles_per_cloud = 1000 nparticles_per_cloud = 1000
nparticles = nclouds*nparticles_per_cloud nparticles = nclouds*nparticles_per_cloud
niterations = 32 niterations = 32
c = DNS() c = DNS()
c.dns_type = 'NSVEparticles' c.dns_type = 'NSVEparticles'
c.parameters['nparticles'] = nparticles c.simname = 'basic_cloud_test'
c.parameters['tracers1_integration_steps'] = 4 f0 = h5py.File(
c.generate_tracer_state(rseed = 2, species = 1) os.path.join(
del c.parameters['nparticles'] os.path.join(TurTLE.lib_dir, 'test'),
del c.parameters['tracers1_integration_steps'] 'B32p1e4_checkpoint_0.h5'),
'r')
ic_file = h5py.File(c.get_checkpoint_0_fname(), 'a') ic_file = h5py.File(c.get_checkpoint_0_fname(), 'a')
ic_file['tracers0/state/0'] = ic_file['tracers1/state/0'][...].reshape(nclouds, nparticles_per_cloud, 3) ic_file['tracers0/state/0'] = f0['tracers0/state/0'][...].reshape(nclouds, nparticles_per_cloud, 3)
ic_file['tracers0/rhs/0'] = ic_file['tracers1/rhs/0'][...].reshape(4, nclouds, nparticles_per_cloud, 3) ic_file['tracers0/rhs/0'] = f0['tracers0/rhs/0'][...].reshape(4, nclouds, nparticles_per_cloud, 3)
ic_file.close() ic_file.close()
c.launch( c.launch(
['NSVEparticles', ['NSVEparticles',
...@@ -57,12 +57,14 @@ def main(): ...@@ -57,12 +57,14 @@ def main():
'--forcing_type', 'linear', '--forcing_type', 'linear',
'--src-wd', TurTLE.lib_dir + '/test', '--src-wd', TurTLE.lib_dir + '/test',
'--src-iteration', '0', '--src-iteration', '0',
'--simname', c.simname,
'--np', '4', '--np', '4',
'--ntpp', '1', '--ntpp', '1',
'--fftw_plan_rigor', 'FFTW_PATIENT', '--fftw_plan_rigor', 'FFTW_PATIENT',
'--niter_todo', '{0}'.format(niterations), '--niter_todo', '{0}'.format(niterations),
'--niter_out', '{0}'.format(niterations), '--niter_out', '{0}'.format(niterations),
'--niter_stat', '1', '--niter_stat', '1',
'--checkpoints_per_file', '{0}'.format(3),
'--nparticles', '{0}'.format(nparticles), '--nparticles', '{0}'.format(nparticles),
'--njobs', '2', '--njobs', '2',
'--wd', './']) '--wd', './'])
...@@ -79,6 +81,7 @@ def main(): ...@@ -79,6 +81,7 @@ def main():
x0 = f0['tracers0/state/{0}'.format(iteration)][...] x0 = f0['tracers0/state/{0}'.format(iteration)][...]
x1 = f1['tracers0/state/{0}'.format(iteration)][...].reshape(x0.shape) x1 = f1['tracers0/state/{0}'.format(iteration)][...].reshape(x0.shape)
traj_error = np.max(np.abs(x0 - x1)) traj_error = np.max(np.abs(x0 - x1))
print(traj_error)
y0 = f0['tracers0/rhs/{0}'.format(iteration)][...] y0 = f0['tracers0/rhs/{0}'.format(iteration)][...]
y1 = f1['tracers0/rhs/{0}'.format(iteration)][...].reshape(y0.shape) y1 = f1['tracers0/rhs/{0}'.format(iteration)][...].reshape(y0.shape)
rhs_error = np.max(np.abs(y0 - y1)) rhs_error = np.max(np.abs(y0 - y1))
...@@ -88,6 +91,53 @@ def main(): ...@@ -88,6 +91,53 @@ def main():
print('SUCCESS! Basic test passed.') print('SUCCESS! Basic test passed.')
return None return None
def nasty_test():
nclouds = 10
nparticles_per_cloud = 1000000
nparticles = nclouds*nparticles_per_cloud
niterations = 8
c = DNS()
c.dns_type = 'NSVEparticles'
c.simname = 'nasty_cloud_test'
c.parameters['nparticles'] = nparticles
c.parameters['tracers1_integration_steps'] = 4
c.generate_tracer_state(rseed = 2, species = 1)
del c.parameters['nparticles']
del c.parameters['tracers1_integration_steps']
ic_file = h5py.File(c.get_checkpoint_0_fname(), 'a')
ic_file['tracers0/state/0'] = ic_file['tracers1/state/0'][...].reshape(nclouds, nparticles_per_cloud, 3)
ic_file['tracers0/rhs/0'] = ic_file['tracers1/rhs/0'][...].reshape(4, nclouds, nparticles_per_cloud, 3)
# put all particles in single z cell
ic_file['tracers0/state/0'][..., 2] = 0.0001
# put one cloud on another process
ic_file['tracers0/state/0'][1, :, 2] = np.pi + 0.0001
ic_file.close()
c.launch(
['NSVEparticles',
'-n', '8',
'--src-simname', 'B32p1e4',
'--simname', c.simname,
'--forcing_type', 'linear',
'--src-wd', TurTLE.lib_dir + '/test',
'--src-iteration', '0',
'--np', '4',
'--ntpp', '2',
'--fftw_plan_rigor', 'FFTW_PATIENT',
'--niter_todo', '{0}'.format(niterations),
'--niter_out', '{0}'.format(niterations),
'--niter_stat', '1',
'--nparticles', '{0}'.format(nparticles),
'--njobs', '1',
'--wd', './'])
print('SUCCESS! Nasty test passed.')
return None
def main():
basic_test()
nasty_test()
return None
if __name__ == '__main__': if __name__ == '__main__':
main() main()
This diff is collapsed.
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