Advances centers to next timestep.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_set), | intent(inout) | :: | this |
Collection of Point Particles |
||
| real(kind=wp), | intent(in) | :: | dt |
Timestep |
pure subroutine particle_set_AdvanceCenters(this,dt) !> Advances centers to next timestep. class(particle_set), intent(inout) :: this !! Collection of Point Particles real(wp), intent(in) :: dt !! Timestep ! Work variables real(wp),parameter :: Pi=4.0_wp*atan(1.0_wp) integer :: n !! iterators real(wp):: Mp !! Particle mass real(wp):: Ip !! Moment of inertia real(wp):: Fh_mid(3),Th_mid(3) !! Force and torque at midstep real(wp):: Fc_mid(3),Tc_mid(3) !! Force and torque at midstep select type (particle =>this%p) type is (particle_obj) do n=1,this%count_ ! Compute mass and moment of inertia Mp = particle(n)%rho*particle(n)%d**3/6.0_wp*Pi Ip = Mp*particle(n)%d**2/10.0_wp ! Compute forces and torques at mid-timestep Fh_mid = (particle(n)%Fh + particle(n)%Fhold) * 0.5_wp Th_mid = (particle(n)%Th + particle(n)%Thold) * 0.5_wp Fc_mid = particle(n)%Fc Tc_mid = particle(n)%Tc ! Update linear velocity particle(n)%v = particle(n)%v + dt*(Fc_mid+Fh_mid)/Mp & + dt*this%gravity & - dt*this%CPG/particle(n)%rho & - dt*this%rhof/particle(n)%rho*this%gravity ! Update angular velocity particle(n)%w = particle(n)%w + dt*(Tc_mid+Th_mid)/Ip ! Update position particle(n)%p = particle(n)%p + dt*particle(n)%v end do end select return end subroutine particle_set_AdvanceCenters