Builds and writes resolved particles.
subroutine SetUpCaseRP() !> Builds and writes resolved particles. use particles_resolved implicit none ! Work variables character(str64) :: filename type(ResPart_set) :: RP !! Resolved particles real(wp) :: L(3) real(wp) :: diam real(wp) :: rhop real(wp) :: dl real(wp) :: VFP real(wp) :: Vp real(wp) :: Lp real(wp) :: ymin real(wp) :: ymax real(wp) :: Vel real(wp) :: amp real(wp) :: rand(3) integer :: iimax,jjmax,kkmax integer :: i,j,k integer :: n real(wp),parameter :: Pi=4.0_wp*atan(1.0_wp) ! Get case info call parser%Get('RP IC file', filename ) call parser%Get('Domain size', L ) call parser%Get("Particle diameter", diam ) call parser%Get("Particle density", rhop ) call parser%Get("Particle velocity", Vel ) call parser%Get('Particle fluctuations', amp , default = 0.0_wp) call parser%Get("Avg VFP", VFP ) ymin = -0.5_wp*L(2) ymax = 0.5_wp*L(2) ! Compute average spacing for uniform distribution Vp = Pi/6.0_wp*diam**3 Lp = (Vp/VFP)**(1.0_wp/3.0_wp) iimax = floor(L(1)/Lp) jjmax = floor((IBy(2)-IBy(1))/Lp) kkmax = floor(L(3)/Lp) ! Initialze resolved particles call RP%Initialize('ResPart',block,parallel) ! Total count of particles to seed RP%count = iimax*jjmax*kkmax ! Activate particles on Root if (parallel%RankIsRoot()) then call RP%Resize(RP%count) dl=0.5_wp*minval(block%dx) select type(particle => RP%p) type is (ResPart_obj) do k=1,kkmax do j=1,jjmax do i=1,iimax n = i + (j-1)*iimax + (k-1)*jjmax*iimax ! Particle globabl ID particle(n)%id = int(n,kind=8) ! Diameter particle(n)%d = diam ! Position particle(n)%p(1) = block%pmin(1) + real(i-0.5_wp,wp)*L(1)/real(iimax,wp) particle(n)%p(2) = IBy(1) + real(j-0.5_wp,wp)*(IBy(2)-IBy(1))/real(jjmax,wp) particle(n)%p(3) = block%pmin(3) + real(k-0.5_wp,wp)*L(3)/real(kkmax,wp) ! Velocity call random_number(rand) particle(n)%v(1) = Vel + Vel*amp*(rand(1)-0.5_wp) particle(n)%v(2) = 0.0_wp + Vel*amp*(rand(2)-0.5_wp) particle(n)%v(3) = 0.0_wp + Vel*amp*(rand(3)-0.5_wp) ! Angular velocity particle(n)%w = 0.0_wp ! Density particle(n)%rho = rhop ! Zero force and torque particle(n)%Fh = 0.0_wp particle(n)%Th = 0.0_wp particle(n)%Fc = 0.0_wp particle(n)%Tc = 0.0_wp ! Add surface markers call RP%ib%AddSphere(particle(n)%p,particle(n)%d/2.0_wp,particle(n)%v,dl,particle(n)%id) end do end do end do end select end if ! Treatment for periodicity call RP%ApplyPeriodicity call RP%ib%ApplyPeriodicity ! Send to the right rank call RP%Communicate call RP%ib%Communicate ! Localize centers and markers on grid call RP%Localize call RP%ib%Localize ! Write data to disk call RP%SetWriteFileName(filename) call RP%Write(0,0.0_WP) ! Finalize call RP%Finalize return end subroutine SetUpCaseRP