-
Notifications
You must be signed in to change notification settings - Fork 5
/
sort_ions.f90
106 lines (89 loc) · 3.42 KB
/
sort_ions.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
subroutine sort_ions_according_to_poloidal_location(theta)
use precision,only:p_
use constants,only: twopi
use pputil
use ions_module
implicit none
real(p_),intent(in):: theta(fixed_large_size)
integer:: ierr,np_old,np_new
!assign particles to the different processors according to their theta coordinates, using the subroutines provided in pputil_yj.f90
np_old=nmarker_i
call init_pmove(theta(:),np_old,twopi,ierr)
call pmove(r_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(z_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(phi_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(r_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(z_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(phi_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vr_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vz_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vphi_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vr_i_integer_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vz_i_integer_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vphi_i_integer_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vr_i_integer(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vz_i_integer(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vphi_i_integer(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vr_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vz_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(vphi_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(radcor_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(theta_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(alpha_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(radcor_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(theta_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(alpha_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(ps_vol_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(w_i(:), np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(w_i_mid(:), np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove(w_i_star(:), np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove2(active_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove2(active_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove2(touch_bdry_i(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call pmove2(touch_bdry_i_mid(:),np_old,np_new,ierr)
if (ierr.ne.0) call ppexit
call end_pmove(ierr)
nmarker_i=np_new
! call check_domain_particles(theta,nmarker_i)
end subroutine sort_ions_according_to_poloidal_location
subroutine check_domain_particles(theta,nmarker_i) !pass the test, comfirming domain decomposition is consistent with particles grouping
use precision,only:p_
use domain_decomposition,only:theta_start,theta_interval
integer,intent(in):: nmarker_i
real(p_),intent(in):: theta(nmarker_i)
integer:: k
do k=1,nmarker_i
if(theta(k)<theta_start .or. theta(k)>theta_start+theta_interval) write(*,*) 'warningg*** particle not in domain'
enddo
end subroutine check_domain_particles