From c1c0372619e5debd8e04a8da42ab4cd034868504 Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Thu, 7 May 2020 10:30:50 +0200 Subject: [PATCH] add code to sample vorticity at particle locations --- TurTLE/DNS.py | 1 + cpp/full_code/NSVE_Stokes_particles.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/TurTLE/DNS.py b/TurTLE/DNS.py index 3aea17ba..ffa839e2 100644 --- a/TurTLE/DNS.py +++ b/TurTLE/DNS.py @@ -1098,6 +1098,7 @@ class DNS(_code): particle_file.create_group('tracers0/velocity_gradient') if self.dns_type in ['NSVE_Stokes_particles']: particle_file.create_group('tracers0/momentum') + particle_file.create_group('tracers0/vorticity') if self.dns_type in ['NSVEp_extra_sampling']: particle_file.create_group('tracers0/velocity_gradient') particle_file.create_group('tracers0/pressure') diff --git a/cpp/full_code/NSVE_Stokes_particles.cpp b/cpp/full_code/NSVE_Stokes_particles.cpp index a3e4dd38..37e34604 100644 --- a/cpp/full_code/NSVE_Stokes_particles.cpp +++ b/cpp/full_code/NSVE_Stokes_particles.cpp @@ -183,6 +183,20 @@ int NSVE_Stokes_particles<rnumber>::do_stats() this->ps->getLocalNbParticles(), this->ps->get_step_idx()-1); + /// sample vorticity + std::fill_n(pdata1.get(), 3*this->ps->getLocalNbParticles(), 0); + *this->tmp_vec_field = this->fs->cvorticity->get_cdata(); + this->tmp_vec_field->ift(); + this->ps->sample_compute_field(*this->tmp_vec_field, pdata1.get()); + this->particles_sample_writer_mpi->template save_dataset<3>( + "tracers0", + "vorticity", + pdata0.get(), + &pdata1, + this->ps->getParticlesIndexes(), + this->ps->getLocalNbParticles(), + this->ps->get_step_idx()-1); + // deallocate temporary data array delete[] pdata0.release(); delete[] pdata1.release(); -- GitLab