|
7 | 7 | #ifdef WARPX_DIM_RZ |
8 | 8 |
|
9 | 9 | #define WRPX_PXR_CURRENT_DEPOSITION depose_jrjtjz_generic_rz |
10 | | -#define WRPX_PXR_RZ_VOLUME_SCALING_RHO apply_rz_volume_scaling_rho |
11 | 10 |
|
12 | 11 | #else |
13 | 12 |
|
@@ -49,149 +48,6 @@ module warpx_to_pxr_module |
49 | 48 |
|
50 | 49 | contains |
51 | 50 |
|
52 | | -! _________________________________________________________________ |
53 | | -!> |
54 | | -!> @brief |
55 | | -!> Main subroutine for the charge deposition |
56 | | -!> |
57 | | -!> @details |
58 | | -!> This subroutines enable to controle the interpolation order |
59 | | -!> via the parameters nox,noy,noz and the type of algorithm via |
60 | | -!> the parameter charge_depo_algo |
61 | | -! |
62 | | -!> @param[inout] rho charge array |
63 | | -!> @param[in] np number of particles |
64 | | -!> @param[in] xp,yp,zp particle position arrays |
65 | | -!> @param[in] w particle weight arrays |
66 | | -!> @param[in] q particle species charge |
67 | | -!> @param[in] xmin,ymin,zmin tile grid minimum position |
68 | | -!> @param[in] dx,dy,dz space discretization steps |
69 | | -!> @param[in] nx,ny,nz number of cells |
70 | | -!> @param[in] nxguard,nyguard,nzguard number of guard cells |
71 | | -!> @param[in] nox,noy,noz interpolation order |
72 | | -!> @param[in] lvect vector length |
73 | | -!> @param[in] charge_depo_algo algorithm choice for the charge deposition |
74 | | -!> |
75 | | -subroutine warpx_charge_deposition(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,nx,ny,nz,& |
76 | | - nxguard,nyguard,nzguard,nox,noy,noz,lvect,charge_depo_algo) & |
77 | | - bind(C, name="warpx_charge_deposition") |
78 | | - |
79 | | - integer(c_long), intent(IN) :: np |
80 | | - integer(c_long), intent(IN) :: nx,ny,nz |
81 | | - integer(c_long), intent(IN) :: nxguard,nyguard,nzguard |
82 | | - integer(c_long), intent(IN) :: nox,noy,noz |
83 | | - real(amrex_real), intent(IN OUT) :: rho(*) |
84 | | - real(amrex_real), intent(IN) :: q |
85 | | - real(amrex_real), intent(IN) :: dx,dy,dz |
86 | | - real(amrex_real), intent(IN) :: xmin,ymin,zmin |
87 | | - real(amrex_real), intent(IN), dimension(np) :: xp,yp,zp,w |
88 | | - integer(c_long), intent(IN) :: lvect |
89 | | - integer(c_long), intent(IN) :: charge_depo_algo |
90 | | - |
91 | | - |
92 | | - ! Dimension 3 |
93 | | -#if (AMREX_SPACEDIM==3) |
94 | | - |
95 | | - SELECT CASE(charge_depo_algo) |
96 | | - |
97 | | - ! Scalar classical charge deposition subroutines |
98 | | - CASE(1) |
99 | | - IF ((nox.eq.1).and.(noy.eq.1).and.(noz.eq.1)) THEN |
100 | | - |
101 | | - CALL depose_rho_scalar_1_1_1(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,nx,ny,nz,& |
102 | | - nxguard,nyguard,nzguard,lvect) |
103 | | - |
104 | | - ELSE IF ((nox.eq.2).and.(noy.eq.2).and.(noz.eq.2)) THEN |
105 | | - |
106 | | - CALL depose_rho_scalar_2_2_2(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,nx,ny,nz,& |
107 | | - nxguard,nyguard,nzguard,lvect) |
108 | | - |
109 | | - ELSE IF ((nox.eq.3).and.(noy.eq.3).and.(noz.eq.3)) THEN |
110 | | - |
111 | | - CALL depose_rho_scalar_3_3_3(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,nx,ny,nz,& |
112 | | - nxguard,nyguard,nzguard,lvect) |
113 | | - |
114 | | - ELSE |
115 | | - CALL pxr_depose_rho_n(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,nx,ny,nz,& |
116 | | - nxguard,nyguard,nzguard,nox,noy,noz, & |
117 | | - .TRUE._c_long,.FALSE._c_long) |
118 | | - ENDIF |
119 | | - |
120 | | - ! Optimized subroutines |
121 | | - CASE DEFAULT |
122 | | - |
123 | | - IF ((nox.eq.1).and.(noy.eq.1).and.(noz.eq.1)) THEN |
124 | | - CALL depose_rho_vecHVv2_1_1_1(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,nx,ny,nz,& |
125 | | - nxguard,nyguard,nzguard,lvect) |
126 | | - |
127 | | - ELSE IF ((nox.eq.2).and.(noy.eq.2).and.(noz.eq.2)) THEN |
128 | | - CALL depose_rho_vecHVv2_2_2_2(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,nx,ny,nz,& |
129 | | - nxguard,nyguard,nzguard,lvect) |
130 | | - |
131 | | - ELSE |
132 | | - CALL pxr_depose_rho_n(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,nx,ny,nz,& |
133 | | - nxguard,nyguard,nzguard,nox,noy,noz, & |
134 | | - .TRUE._c_long,.FALSE._c_long) |
135 | | - ENDIF |
136 | | - END SELECT |
137 | | - |
138 | | - ! Dimension 2 |
139 | | -#elif (AMREX_SPACEDIM==2) |
140 | | - |
141 | | -#ifdef WARPX_DIM_RZ |
142 | | - logical(pxr_logical) :: l_2drz = .TRUE._c_long |
143 | | -#else |
144 | | - logical(pxr_logical) :: l_2drz = .FALSE._c_long |
145 | | -#endif |
146 | | - |
147 | | - CALL pxr_depose_rho_n_2dxz(rho,np,xp,yp,zp,w,q,xmin,zmin,dx,dz,nx,nz,& |
148 | | - nxguard,nzguard,nox,noz, & |
149 | | - .TRUE._c_long, .FALSE._c_long, l_2drz, 0_c_long) |
150 | | - |
151 | | -#endif |
152 | | - |
153 | | - end subroutine warpx_charge_deposition |
154 | | - |
155 | | - ! _________________________________________________________________ |
156 | | - !> |
157 | | - !> @brief |
158 | | - !> Applies the inverse volume scaling for RZ charge deposition |
159 | | - !> |
160 | | - !> @details |
161 | | - !> The scaling is done for both single mode (FDTD) and |
162 | | - !> multi mode (spectral) (todo) |
163 | | - ! |
164 | | - !> @param[inout] rho charge array |
165 | | - !> @param[in] rmin tile grid minimum radius |
166 | | - !> @param[in] dr radial space discretization steps |
167 | | - !> @param[in] nx,ny,nz number of cells |
168 | | - !> @param[in] nxguard,nyguard,nzguard number of guard cells |
169 | | - !> |
170 | | - subroutine warpx_charge_deposition_rz_volume_scaling(rho,rho_ng,rho_ntot,rmin,dr) & |
171 | | - bind(C, name="warpx_charge_deposition_rz_volume_scaling") |
172 | | - |
173 | | - integer, intent(in) :: rho_ntot(AMREX_SPACEDIM) |
174 | | - integer(c_long), intent(in) :: rho_ng |
175 | | - real(amrex_real), intent(IN OUT):: rho(*) |
176 | | - real(amrex_real), intent(IN) :: rmin, dr |
177 | | - |
178 | | -#ifdef WARPX_DIM_RZ |
179 | | - integer(c_long) :: type_rz_depose = 1 |
180 | | -#endif |
181 | | - |
182 | | - ! Compute the number of valid cells and guard cells |
183 | | - integer(c_long) :: rho_nvalid(AMREX_SPACEDIM), rho_nguards(AMREX_SPACEDIM) |
184 | | - rho_nvalid = rho_ntot - 2*rho_ng |
185 | | - rho_nguards = rho_ng |
186 | | - |
187 | | -#ifdef WARPX_DIM_RZ |
188 | | - CALL WRPX_PXR_RZ_VOLUME_SCALING_RHO( & |
189 | | - rho,rho_nguards,rho_nvalid, & |
190 | | - rmin,dr,type_rz_depose) |
191 | | -#endif |
192 | | - |
193 | | - end subroutine warpx_charge_deposition_rz_volume_scaling |
194 | | - |
195 | 51 | ! _________________________________________________________________ |
196 | 52 | !> |
197 | 53 | !> @brief |
|
0 commit comments