@@ -28,39 +28,31 @@ void Axis::SymmetrizeEx1Side(int jref) {
2828 IdefixArray3D<real> Ex1 = this ->ex ;
2929 IdefixArray1D<real> Ex1Avg = this ->Ex1Avg ;
3030
31- if (isTwoPi) {
32- idefix_for (" Ex1_ini" ,0 ,data->np_tot [IDIR ],
33- KOKKOS_LAMBDA (int i) {
34- Ex1Avg (i) = ZERO_F ;
35- });
36-
37- idefix_for (" Ex1_Symmetrize" ,data->beg [KDIR ],data->end [KDIR ],0 ,data->np_tot [IDIR ],
38- KOKKOS_LAMBDA (int k,int i) {
39- Kokkos::atomic_add (&Ex1Avg (i), Ex1 (k,jref,i));
31+ idefix_for (" Ex1_ini" ,0 ,data->np_tot [IDIR ],
32+ KOKKOS_LAMBDA (int i) {
33+ Ex1Avg (i) = ZERO_F ;
4034 });
41- if (needMPIExchange) {
42- #ifdef WITH_MPI
43- Kokkos::fence ();
44- // sum along all of the processes on the same r
45- MPI_Allreduce (MPI_IN_PLACE , Ex1Avg.data (), data->np_tot [IDIR ], realMPI,
46- MPI_SUM , data->mygrid ->AxisComm );
47- #endif
48- }
49-
50- int ncells=data->mygrid ->np_int [KDIR ];
5135
52- idefix_for (" Ex1_Store " , 0 ,data->np_tot [KDIR ],0 ,data->np_tot [IDIR ],
36+ idefix_for (" Ex1_Symmetrize " ,data-> beg [ KDIR ] ,data->end [KDIR ],0 ,data->np_tot [IDIR ],
5337 KOKKOS_LAMBDA (int k,int i) {
54- Ex1 (k,jref,i) = Ex1Avg (i)/((real) ncells);
55- });
56- } else {
57- // if we're not doing full two pi, the flow is symmetric with respect to the axis, and the axis
58- // EMF is simply zero
59- idefix_for (" Ex1_Store" ,0 ,data->np_tot [KDIR ],0 ,data->np_tot [IDIR ],
60- KOKKOS_LAMBDA (int k,int i) {
61- Ex1 (k,jref,i) = ZERO_F ;
38+ Kokkos::atomic_add (&Ex1Avg (i), Ex1 (k,jref,i));
6239 });
40+ if (needMPIExchange) {
41+ #ifdef WITH_MPI
42+ Kokkos::fence ();
43+ // sum along all of the processes on the same r
44+ MPI_Allreduce (MPI_IN_PLACE , Ex1Avg.data (), data->np_tot [IDIR ], realMPI,
45+ MPI_SUM , data->mygrid ->AxisComm );
46+ #endif
6347 }
48+
49+ int ncells=data->mygrid ->np_int [KDIR ];
50+
51+ idefix_for (" Ex1_Store" ,0 ,data->np_tot [KDIR ],0 ,data->np_tot [IDIR ],
52+ KOKKOS_LAMBDA (int k,int i) {
53+ Ex1 (k,jref,i) = Ex1Avg (i)/((real) ncells);
54+ });
55+
6456#endif
6557}
6658
@@ -100,9 +92,9 @@ void Axis::RegularizeCurrentSide(int side) {
10092 sign = -1 ;
10193 }
10294 IdefixArray1D<real> BAvg = this ->Ex1Avg ;
103- IdefixArray1D<real> x2 = data->x [JDIR ];
10495 IdefixArray1D<real> x1 = data->x [IDIR ];
10596 IdefixArray1D<real> dx3 = data->dx [KDIR ];
97+ IdefixArray1D<real> dx2 = data->dx [JDIR ];
10698
10799 idefix_for (" B_ini" ,0 ,data->np_tot [IDIR ],
108100 KOKKOS_LAMBDA (int i) {
@@ -132,8 +124,7 @@ void Axis::RegularizeCurrentSide(int side) {
132124
133125 idefix_for (" fixJ" ,0 ,data->np_tot [KDIR ],0 ,data->np_tot [IDIR ],
134126 KOKKOS_LAMBDA (int k,int i) {
135- real th = x2 (jc);
136- real fact = 2 *sign/(deltaPhi*x1 (i)*sin (th));
127+ real fact = 2 *sign/(deltaPhi*x1 (i)*dx2 (jc));
137128 J (IDIR , k,js,i) = BAvg (i)*fact;
138129 });
139130
0 commit comments