Skip to content
Snippets Groups Projects
Commit 6b1f3487 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

add some more debug messages

parent 548d9941
Branches
Tags
1 merge request!23WIP: Feature/use cmake
Pipeline #
...@@ -116,6 +116,23 @@ int test_interpolation<rnumber>::do_work() ...@@ -116,6 +116,23 @@ int test_interpolation<rnumber>::do_work()
this->velocity->ift(); this->velocity->ift();
this->nabla_u->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 // allocate interpolation arrays
std::unique_ptr<double[]> p3data(new double[3*this->ps->getLocalNbParticles()]); std::unique_ptr<double[]> p3data(new double[3*this->ps->getLocalNbParticles()]);
std::unique_ptr<double[]> p9data(new double[9*this->ps->getLocalNbParticles()]); std::unique_ptr<double[]> p9data(new double[9*this->ps->getLocalNbParticles()]);
...@@ -135,6 +152,7 @@ int test_interpolation<rnumber>::do_work() ...@@ -135,6 +152,7 @@ int test_interpolation<rnumber>::do_work()
/// sample velocity at particles' position /// sample velocity at particles' position
this->ps->sample_compute_field(*this->velocity, p3data.get()); 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>( this->particles_sample_writer_mpi->template save_dataset<3>(
"tracers0", "tracers0",
"velocity", "velocity",
...@@ -145,6 +163,7 @@ int test_interpolation<rnumber>::do_work() ...@@ -145,6 +163,7 @@ int test_interpolation<rnumber>::do_work()
this->ps->get_step_idx()-1); this->ps->get_step_idx()-1);
/// sample vorticity at particles' position /// sample vorticity at particles' position
this->ps->sample_compute_field(*this->vorticity, p3data.get()); 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>( this->particles_sample_writer_mpi->template save_dataset<3>(
"tracers0", "tracers0",
"vorticity", "vorticity",
...@@ -155,6 +174,7 @@ int test_interpolation<rnumber>::do_work() ...@@ -155,6 +174,7 @@ int test_interpolation<rnumber>::do_work()
this->ps->get_step_idx()-1); this->ps->get_step_idx()-1);
/// sample velocity gradient at particles' position /// sample velocity gradient at particles' position
this->ps->sample_compute_field(*this->nabla_u, p9data.get()); 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>( this->particles_sample_writer_mpi->template save_dataset<9>(
"tracers0", "tracers0",
"velocity_gradient", "velocity_gradient",
......
...@@ -16,7 +16,7 @@ except ImportError: ...@@ -16,7 +16,7 @@ except ImportError:
def main(): def main():
nparticles = 10 nparticles = 100
c = TEST() c = TEST()
c.launch( c.launch(
['test_interpolation', ['test_interpolation',
...@@ -32,8 +32,13 @@ def main(): ...@@ -32,8 +32,13 @@ def main():
ofile = h5py.File( ofile = h5py.File(
'test_output.h5', 'test_output.h5',
'r') '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 vort0 = ofile['tracers0/vorticity/0'].value
print(vort0)
vel_gradient = ofile['tracers0/velocity_gradient/0'].value vel_gradient = ofile['tracers0/velocity_gradient/0'].value
print(vel_gradient)
vort1 = vort0.copy() vort1 = vort0.copy()
vort1[:, 0] = vel_gradient[:, 7] - vel_gradient[:, 5] vort1[:, 0] = vel_gradient[:, 7] - vel_gradient[:, 5]
vort1[:, 1] = vel_gradient[:, 2] - vel_gradient[:, 6] vort1[:, 1] = vel_gradient[:, 2] - vel_gradient[:, 6]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment