Advances markers to next timestep
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ResPart_set), | intent(inout) | :: | this |
Collection of Resolved Particles |
||
| real(kind=wp), | intent(in) | :: | dt |
Timestep |
pure subroutine ResPart_set_AdvanceMarkers(this,dt) !> Advances markers to next timestep class(ResPart_set), intent(inout) :: this !! Collection of Resolved Particles real(wp), intent(in) :: dt !! Timestep ! Work variables integer :: n,m integer(leapI8):: id real(wp) :: rot_rate real(wp) :: angle real(wp) :: axis(3) real(wp) :: disp(3) real(wp) :: disp_old(3) real(wp) :: a1,a2,a3 integer :: dir select type (particle =>this%p) type is (ResPart_obj) select type(markers=>this%ib%p) type is (marker_obj) do m=1,this%ib%count_ ! Get ID of parent centroid id=markers(m)%s ! Get local index of the centroid n = this%lookup(id) ! prepare rotation coefficients rot_rate = norm2(particle(n)%w) axis = particle(n)%w/(rot_rate+epsilon(1.0_wp)) angle = dt*rot_rate a1 = cos(angle) a2 = sin(angle) a3 = (1.0_wp-cos(angle)) ! Old displacement disp_old = markers(m)%pold-particle(n)%pold ! Treatment for periodicity do dir=1,3 if (this%block%periods(dir)) then if ( disp_old(dir).gt.0 .and. abs(disp_old(dir)).gt.0.5_wp*particle(n)%d) then disp_old(dir) = disp_old(dir) - (this%block%pmax(dir)-this%block%pmin(dir)) end if if ( disp_old(dir).lt.0 .and. abs(disp_old(dir)).gt.0.5_wp*particle(n)%d) then disp_old(dir) = disp_old(dir) + (this%block%pmax(dir)-this%block%pmin(dir)) end if end if end do ! New rotated displacement disp = a1*disp_old & + a2*cross_product(axis,disp_old) & + a3*dot_product(disp_old,axis)*axis ! Update position and velocity markers(m)%p = particle(n)%p + disp markers(m)%v = particle(n)%v + cross_product(particle(n)%w,disp) ! Update normals markers(m)%n = disp/norm2(disp) end do end select end select return end subroutine ResPart_set_AdvanceMarkers