diff --git a/bfps/cpp/full_code/test_interpolation.cpp b/bfps/cpp/full_code/test_interpolation.cpp index 9c4cf62d11f9bece1aea8f06d033e0c0f6de16b7..b7efdebdf8bb54321ec76d4907d1eb77b00e4720 100644 --- a/bfps/cpp/full_code/test_interpolation.cpp +++ b/bfps/cpp/full_code/test_interpolation.cpp @@ -116,6 +116,23 @@ int test_interpolation<rnumber>::do_work() this->velocity->ift(); this->nabla_u->ift(); + *this->vorticity = 1.0; + *this->velocity = 2.0; + *this->nabla_u = 3.0; + DEBUG_MSG("changed values\n"); + DEBUG_MSG("some velocity values: %g %g %g\n", + this->velocity->rval(20, 1), + this->velocity->rval(200, 2), + this->velocity->rval(741, 0)); + DEBUG_MSG("some vorticity values: %g %g %g\n", + this->vorticity->rval(20, 1), + this->vorticity->rval(200, 2), + this->vorticity->rval(741, 0)); + DEBUG_MSG("some velocity gradient values: %g %g %g\n", + this->nabla_u->rval(20, 1, 0), + this->nabla_u->rval(200, 2, 1), + this->nabla_u->rval(741, 0, 1)); + // allocate interpolation arrays std::unique_ptr<double[]> p3data(new double[3*this->ps->getLocalNbParticles()]); std::unique_ptr<double[]> p9data(new double[9*this->ps->getLocalNbParticles()]); @@ -135,6 +152,7 @@ int test_interpolation<rnumber>::do_work() /// sample velocity at particles' position this->ps->sample_compute_field(*this->velocity, p3data.get()); + DEBUG_MSG("first vel value is %g\n", p3data.get()[0]); this->particles_sample_writer_mpi->template save_dataset<3>( "tracers0", "velocity", @@ -145,6 +163,7 @@ int test_interpolation<rnumber>::do_work() this->ps->get_step_idx()-1); /// sample vorticity at particles' position this->ps->sample_compute_field(*this->vorticity, p3data.get()); + DEBUG_MSG("first vort value is %g\n", p3data.get()[0]); this->particles_sample_writer_mpi->template save_dataset<3>( "tracers0", "vorticity", @@ -155,6 +174,7 @@ int test_interpolation<rnumber>::do_work() this->ps->get_step_idx()-1); /// sample velocity gradient at particles' position this->ps->sample_compute_field(*this->nabla_u, p9data.get()); + DEBUG_MSG("first vel gradient value is %g\n", p9data.get()[0]); this->particles_sample_writer_mpi->template save_dataset<9>( "tracers0", "velocity_gradient", diff --git a/bfps/test/test_interpolation.py b/bfps/test/test_interpolation.py index 6a8cf0fad71af7411f36a1d5a80b00a1b07fa685..a3991a1c37b375d59f6cbb94603aa1292cdbd240 100644 --- a/bfps/test/test_interpolation.py +++ b/bfps/test/test_interpolation.py @@ -16,7 +16,7 @@ except ImportError: def main(): - nparticles = 10 + nparticles = 100 c = TEST() c.launch( ['test_interpolation', @@ -32,8 +32,13 @@ def main(): ofile = h5py.File( 'test_output.h5', 'r') + pos0 = ifile['tracers0/state/0'].value + pos1 = ofile['tracers0/position/0'].value + print('maximum position error is ', np.max(np.abs(pos0-pos1) / np.abs(pos0))) vort0 = ofile['tracers0/vorticity/0'].value + print(vort0) vel_gradient = ofile['tracers0/velocity_gradient/0'].value + print(vel_gradient) vort1 = vort0.copy() vort1[:, 0] = vel_gradient[:, 7] - vel_gradient[:, 5] vort1[:, 1] = vel_gradient[:, 2] - vel_gradient[:, 6]