From d86c8480f3cc772bd7bac19c4eb3e921a86fe32d Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez - Galactica Date: Sat, 2 Aug 2025 16:51:00 +0200 Subject: [PATCH] Fixed issue with some velocities. Still, at some point I need to rething all the injection thing. --- src/modules/moduleInject.f90 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/moduleInject.f90 b/src/modules/moduleInject.f90 index 5e72835..2a2c393 100644 --- a/src/modules/moduleInject.f90 +++ b/src/modules/moduleInject.f90 @@ -385,6 +385,13 @@ MODULE moduleInject self%v(2)%obj%randomVel(), & self%v(3)%obj%randomVel() /) + !If injecting a no-drift distribution and velocity is negative, reflect + if ((self%vMod == 0.D0) .and. & + (dot_product(direction, partInj(n)%v) < 0.D0)) then + partInj(n)%v = - partInj(n)%v + + end if + !Obtain natural coordinates of particle in cell partInj(n)%Xi = mesh%cells(partInj(n)%cell)%obj%phy2log(partInj(n)%r) !Push new particle with the minimum time step