| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(particle_ptr), | intent(in) | :: | partp | |||
| double precision, | intent(in) | :: | end_time |
function sample_get_particle_dt(partp, end_time) result(dt_p) use mod_global_parameters use mod_geometry use mod_usr_methods, only: usr_particle_position type(particle_ptr), intent(in) :: partp double precision, intent(in) :: end_time double precision :: dt_p integer :: ipart, iipart, nout, id double precision :: tout, dt_cfl double precision :: v(1:ndir), xp(3), told, tnew if (const_dt_particles > 0) then dt_p = const_dt_particles return end if dt_p = dtsave_particles ! Make sure the user-defined particle movement doesn't break communication if (associated(usr_particle_position)) then xp = partp%self%x told = partp%self%time tnew = told+dt_p call usr_particle_position(xp, partp%self%index, told, tnew) do while (.not. point_in_igrid_ghostc(xp,partp%igrid,1)) dt_p = dt_p/10.d0 xp = partp%self%x tnew = told+dt_p call usr_particle_position(xp, partp%self%index, told, tnew) end do end if ! Make sure we don't advance beyond end_time call limit_dt_endtime(end_time - partp%self%time, dt_p) end function sample_get_particle_dt