77! >@brief Copy sphectr indices structure between IO buffer
88! !
99! !@verbatim
10- ! ! subroutine copy_sph_node_4_rj_from_IO(sph_IO, rj, l_truncation)
10+ ! ! subroutine copy_sph_node_4_rj_from_IO(sph_IO, sph_rj, &
11+ ! ! & l_truncation)
1112! ! integer(kind = kint), intent(inout) :: l_truncation
12- ! ! type(sph_rj_grid), intent(inout) :: rj
13+ ! ! type(sph_rj_grid), intent(inout) :: sph_rj
1314! ! type(sph_IO_data), intent(in) :: sph_IO
14- ! ! subroutine copy_sph_node_4_rj_to_IO(l_truncation, rj, sph_IO)
15+ ! ! subroutine copy_sph_node_4_rj_to_IO(l_truncation, sph_rj, &
16+ ! ! & sph_IO)
1517! ! integer(kind = kint), intent(in) :: l_truncation
16- ! ! type(sph_rj_grid), intent(in) :: rj
18+ ! ! type(sph_rj_grid), intent(in) :: sph_rj
1719! ! type(sph_IO_data), intent(inout) :: sph_IO
1820! ! integer(kind = kint) function compare_sph_node_rj_with_IO &
19- ! ! & (l_truncation, rj , sph_IO)
20- ! ! type(sph_rj_grid), intent(in) :: rj
21+ ! ! & (l_truncation, sph_rj , sph_IO)
22+ ! ! type(sph_rj_grid), intent(in) :: sph_rj
2123! ! type(sph_IO_data), intent(in) :: sph_IO
2224! !@endverbatim
2325!
@@ -37,167 +39,180 @@ module copy_sph_rj_mode_4_IO
3739!
3840! ----------------------------------------------------------------------
3941!
40- subroutine copy_sph_node_4_rj_from_IO (sph_IO , rj , l_truncation )
42+ subroutine copy_sph_node_4_rj_from_IO (sph_IO , sph_rj , &
43+ & l_truncation )
4144!
4245 integer (kind = kint), intent (inout ) :: l_truncation
43- type (sph_rj_grid), intent (inout ) :: rj
46+ type (sph_rj_grid), intent (inout ) :: sph_rj
4447 type (sph_IO_data), intent (in ) :: sph_IO
4548!
4649 integer (kind = kint) :: i
4750!
48- rj % irank_sph_rj(1 :itwo) = sph_IO% sph_rank(1 :itwo)
51+ sph_rj % irank_sph_rj(1 :itwo) = sph_IO% sph_rank(1 :itwo)
4952!
50- rj % nidx_global_rj(1 :itwo) = sph_IO% nidx_gl_sph(1 :itwo)
53+ sph_rj % nidx_global_rj(1 :itwo) = sph_IO% nidx_gl_sph(1 :itwo)
5154 l_truncation = sph_IO% ltr_gl
5255!
53- rj % nnod_rj = sph_IO% numnod_sph
54- rj % nidx_rj(1 :itwo) = sph_IO% nidx_sph(1 :itwo)
55- rj % ist_rj(1 :itwo) = sph_IO% ist_sph(1 :itwo)
56- rj % ied_rj(1 :itwo) = sph_IO% ied_sph(1 :itwo)
56+ sph_rj % nnod_rj = sph_IO% numnod_sph
57+ sph_rj % nidx_rj(1 :itwo) = sph_IO% nidx_sph(1 :itwo)
58+ sph_rj % ist_rj(1 :itwo) = sph_IO% ist_sph(1 :itwo)
59+ sph_rj % ied_rj(1 :itwo) = sph_IO% ied_sph(1 :itwo)
5760!
58- call alloc_spheric_param_rj(rj )
59- call alloc_sph_1d_index_rj(rj )
61+ call alloc_spheric_param_rj(sph_rj )
62+ call alloc_sph_1d_index_rj(sph_rj )
6063!
6164 do i = 1 , itwo
62- rj % idx_global_rj(1 :rj % nnod_rj,i) &
63- & = sph_IO% idx_gl_sph(1 :rj % nnod_rj,i)
65+ sph_rj % idx_global_rj(1 :sph_rj % nnod_rj,i) &
66+ & = sph_IO% idx_gl_sph(1 :sph_rj % nnod_rj,i)
6467 end do
6568!
6669! $omp parallel workshare
67- rj% radius_1d_rj_r(1 :rj% nidx_rj(1 )) &
68- & = sph_IO% r_gl_1(1 :rj% nidx_rj(1 ))
69- rj% a_r_1d_rj_r(1 :rj% nidx_rj(1 )) &
70- & = one / rj% radius_1d_rj_r(1 :rj% nidx_rj(1 ))
71- !
72- rj% idx_gl_1d_rj_r(1 :rj% nidx_rj(1 )) &
73- & = sph_IO% idx_gl_1(1 :rj% nidx_rj(1 ))
70+ sph_rj% idx_gl_1d_rj_r(1 :sph_rj% nidx_rj(1 )) &
71+ & = sph_IO% idx_gl_1(1 :sph_rj% nidx_rj(1 ))
72+ !
73+ sph_rj% radius_1d_rj_r(1 :sph_rj% nidx_rj(1 )) &
74+ & = sph_IO% r_gl_1(1 :sph_rj% nidx_rj(1 ))
75+ sph_rj% a_r_1d_rj_r(1 :sph_rj% nidx_rj(1 )) &
76+ & = one / sph_rj% radius_1d_rj_r(1 :sph_rj% nidx_rj(1 ))
77+ !
78+ sph_rj% ar_1d_rj(1 :sph_rj% nidx_rj(1 ),1 ) &
79+ & = sph_rj% a_r_1d_rj_r(1 :sph_rj% nidx_rj(1 ))
80+ sph_rj% ar_1d_rj(1 :sph_rj% nidx_rj(1 ),2 ) &
81+ & = sph_rj% ar_1d_rj(1 :sph_rj% nidx_rj(1 ),1 ) &
82+ & * sph_rj% a_r_1d_rj_r(1 :sph_rj% nidx_rj(1 ))
83+ sph_rj% ar_1d_rj(1 :sph_rj% nidx_rj(1 ),3 ) &
84+ & = sph_rj% ar_1d_rj(1 :sph_rj% nidx_rj(1 ),2 ) &
85+ & * sph_rj% a_r_1d_rj_r(1 :sph_rj% nidx_rj(1 ))
7486! $omp end parallel workshare
7587!
7688! $omp parallel workshare
77- rj % idx_gl_1d_rj_j(1 :rj % nidx_rj(2 ),1 ) &
78- & = sph_IO% idx_gl_2(1 :rj % nidx_rj(2 ),1 )
79- rj % idx_gl_1d_rj_j(1 :rj % nidx_rj(2 ),2 ) &
80- & = sph_IO% idx_gl_2(1 :rj % nidx_rj(2 ),2 )
81- rj % idx_gl_1d_rj_j(1 :rj % nidx_rj(2 ),3 ) &
82- & = sph_IO% idx_gl_2(1 :rj % nidx_rj(2 ),3 )
89+ sph_rj % idx_gl_1d_rj_j(1 :sph_rj % nidx_rj(2 ),1 ) &
90+ & = sph_IO% idx_gl_2(1 :sph_rj % nidx_rj(2 ),1 )
91+ sph_rj % idx_gl_1d_rj_j(1 :sph_rj % nidx_rj(2 ),2 ) &
92+ & = sph_IO% idx_gl_2(1 :sph_rj % nidx_rj(2 ),2 )
93+ sph_rj % idx_gl_1d_rj_j(1 :sph_rj % nidx_rj(2 ),3 ) &
94+ & = sph_IO% idx_gl_2(1 :sph_rj % nidx_rj(2 ),3 )
8395! $omp end parallel workshare
8496!
8597 end subroutine copy_sph_node_4_rj_from_IO
8698!
8799! ----------------------------------------------------------------------
88100!
89- subroutine copy_sph_node_4_rj_to_IO (l_truncation , rj , sph_IO )
101+ subroutine copy_sph_node_4_rj_to_IO (l_truncation , sph_rj , &
102+ & sph_IO )
90103!
91104 use t_spheric_rj_data
92105!
93106 integer (kind = kint), intent (in ) :: l_truncation
94- type (sph_rj_grid), intent (in ) :: rj
107+ type (sph_rj_grid), intent (in ) :: sph_rj
95108 type (sph_IO_data), intent (inout ) :: sph_IO
96109!
97110 integer (kind = kint) :: i
98111 integer (kind = kint_gl) :: nr_8
99112!
100113 sph_IO% numdir_sph = itwo
101- sph_IO% sph_rank(1 :itwo) = rj % irank_sph_rj(1 :itwo)
114+ sph_IO% sph_rank(1 :itwo) = sph_rj % irank_sph_rj(1 :itwo)
102115!
103116 sph_IO% ncomp_table_1d(1 ) = ione
104117 sph_IO% ncomp_table_1d(2 ) = ithree
105118!
106- sph_IO% nidx_gl_sph(1 :itwo) = rj % nidx_global_rj(1 :itwo)
119+ sph_IO% nidx_gl_sph(1 :itwo) = sph_rj % nidx_global_rj(1 :itwo)
107120 sph_IO% ltr_gl = l_truncation
108121!
109- sph_IO% numnod_sph = rj % nnod_rj
122+ sph_IO% numnod_sph = sph_rj % nnod_rj
110123!
111124 call alloc_num_idx_sph_IO(sph_IO)
112125!
113- sph_IO% nidx_sph(1 :itwo) = rj % nidx_rj(1 :itwo)
114- sph_IO% ist_sph(1 :itwo) = rj % ist_rj(1 :itwo)
115- sph_IO% ied_sph(1 :itwo) = rj % ied_rj(1 :itwo)
126+ sph_IO% nidx_sph(1 :itwo) = sph_rj % nidx_rj(1 :itwo)
127+ sph_IO% ist_sph(1 :itwo) = sph_rj % ist_rj(1 :itwo)
128+ sph_IO% ied_sph(1 :itwo) = sph_rj % ied_rj(1 :itwo)
116129!
117130 call alloc_nod_id_sph_IO(sph_IO)
118131 call alloc_idx_sph_1d1_IO(sph_IO)
119132 call alloc_idx_sph_1d2_IO(sph_IO)
120133!
121134! $omp parallel do private(i,nr_8)
122- do i = 1 , rj % nnod_rj
123- nr_8 = rj % nidx_global_rj(1 )
124- sph_IO% idx_gl_sph(i,1 ) = rj % idx_global_rj(i,1 )
125- sph_IO% idx_gl_sph(i,2 ) = rj % idx_global_rj(i,2 )
126- sph_IO% inod_gl_sph(i) = rj % idx_global_rj(i,1 ) &
127- & + rj % idx_global_rj(i,2 ) * nr_8
135+ do i = 1 , sph_rj % nnod_rj
136+ nr_8 = sph_rj % nidx_global_rj(1 )
137+ sph_IO% idx_gl_sph(i,1 ) = sph_rj % idx_global_rj(i,1 )
138+ sph_IO% idx_gl_sph(i,2 ) = sph_rj % idx_global_rj(i,2 )
139+ sph_IO% inod_gl_sph(i) = sph_rj % idx_global_rj(i,1 ) &
140+ & + sph_rj % idx_global_rj(i,2 ) * nr_8
128141 end do
129142! $omp end parallel do
130143!
131- if (sph_IO% inod_gl_sph(rj % nnod_rj) .eq. izero) then
132- nr_8 = (rj % nidx_global_rj(2 ) + 1 )
133- sph_IO% inod_gl_sph(rj % nnod_rj) &
134- & = rj % nidx_global_rj(1 ) * nr_8 + 1
144+ if (sph_IO% inod_gl_sph(sph_rj % nnod_rj) .eq. izero) then
145+ nr_8 = (sph_rj % nidx_global_rj(2 ) + 1 )
146+ sph_IO% inod_gl_sph(sph_rj % nnod_rj) &
147+ & = sph_rj % nidx_global_rj(1 ) * nr_8 + 1
135148 end if
136149!
137150! $omp parallel workshare
138- sph_IO% r_gl_1(1 :rj % nidx_rj(1 )) &
139- & = rj % radius_1d_rj_r(1 :rj % nidx_rj(1 ))
140- sph_IO% idx_gl_1(1 :rj % nidx_rj(1 )) &
141- & = rj % idx_gl_1d_rj_r(1 :rj % nidx_rj(1 ))
151+ sph_IO% r_gl_1(1 :sph_rj % nidx_rj(1 )) &
152+ & = sph_rj % radius_1d_rj_r(1 :sph_rj % nidx_rj(1 ))
153+ sph_IO% idx_gl_1(1 :sph_rj % nidx_rj(1 )) &
154+ & = sph_rj % idx_gl_1d_rj_r(1 :sph_rj % nidx_rj(1 ))
142155! $omp end parallel workshare
143156!
144157! $omp parallel workshare
145- sph_IO% idx_gl_2(1 :rj % nidx_rj(2 ),1 ) &
146- & = rj % idx_gl_1d_rj_j(1 :rj % nidx_rj(2 ),1 )
147- sph_IO% idx_gl_2(1 :rj % nidx_rj(2 ),2 ) &
148- & = rj % idx_gl_1d_rj_j(1 :rj % nidx_rj(2 ),2 )
149- sph_IO% idx_gl_2(1 :rj % nidx_rj(2 ),3 ) &
150- & = rj % idx_gl_1d_rj_j(1 :rj % nidx_rj(2 ),3 )
158+ sph_IO% idx_gl_2(1 :sph_rj % nidx_rj(2 ),1 ) &
159+ & = sph_rj % idx_gl_1d_rj_j(1 :sph_rj % nidx_rj(2 ),1 )
160+ sph_IO% idx_gl_2(1 :sph_rj % nidx_rj(2 ),2 ) &
161+ & = sph_rj % idx_gl_1d_rj_j(1 :sph_rj % nidx_rj(2 ),2 )
162+ sph_IO% idx_gl_2(1 :sph_rj % nidx_rj(2 ),3 ) &
163+ & = sph_rj % idx_gl_1d_rj_j(1 :sph_rj % nidx_rj(2 ),3 )
151164! $omp end parallel workshare
152165!
153166 end subroutine copy_sph_node_4_rj_to_IO
154167!
155168! ----------------------------------------------------------------------
156169!
157170 integer (kind = kint) function compare_sph_node_rj_with_IO &
158- & (l_truncation, rj , sph_IO)
171+ & (l_truncation, sph_rj , sph_IO)
159172!
160173 integer (kind = kint), intent (in ) :: l_truncation
161- type (sph_rj_grid), intent (in ) :: rj
174+ type (sph_rj_grid), intent (in ) :: sph_rj
162175 type (sph_IO_data), intent (in ) :: sph_IO
163176!
164177 integer (kind = kint) :: i
165178!
166179 compare_sph_node_rj_with_IO = 1
167180 do i = 1 , itwo
168- if (sph_IO% sph_rank(i) .ne. rj % irank_sph_rj(i)) return
181+ if (sph_IO% sph_rank(i) .ne. sph_rj % irank_sph_rj(i)) return
169182 end do
170183!
171184 do i = 1 , itwo
172- if (sph_IO% nidx_gl_sph(i) .ne. rj % nidx_global_rj(i)) return
185+ if (sph_IO% nidx_gl_sph(i) .ne. sph_rj % nidx_global_rj(i)) return
173186 end do
174187 if (sph_IO% ltr_gl .ne. l_truncation) return
175188!
176- if (sph_IO% numnod_sph .ne. rj % nnod_rj) return
189+ if (sph_IO% numnod_sph .ne. sph_rj % nnod_rj) return
177190!
178191 do i = 1 , itwo
179- if (sph_IO% nidx_sph(i) .ne. rj % nidx_rj(i)) return
180- if (sph_IO% ist_sph(i) .ne. rj % ist_rj(i)) return
181- if (sph_IO% ied_sph(i) .ne. rj % ied_rj(i)) return
192+ if (sph_IO% nidx_sph(i) .ne. sph_rj % nidx_rj(i)) return
193+ if (sph_IO% ist_sph(i) .ne. sph_rj % ist_rj(i)) return
194+ if (sph_IO% ied_sph(i) .ne. sph_rj % ied_rj(i)) return
182195 end do
183196!
184- do i = 1 , rj% nnod_rj
185- if (sph_IO% idx_gl_sph(i,1 ) .ne. rj% idx_global_rj(i,1 )) return
186- if (sph_IO% idx_gl_sph(i,2 ) .ne. rj% idx_global_rj(i,2 )) return
197+ do i = 1 , sph_rj% nnod_rj
198+ if (sph_IO% idx_gl_sph(i,1 ) &
199+ & .ne. sph_rj% idx_global_rj(i,1 )) return
200+ if (sph_IO% idx_gl_sph(i,2 ) &
201+ & .ne. sph_rj% idx_global_rj(i,2 )) return
187202 end do
188203!
189- do i = 1 , rj % nidx_rj(1 )
190- if (sph_IO% r_gl_1(i) .ne. rj % radius_1d_rj_r(i)) then
191- if (abs (sph_IO% r_gl_1(i) - rj % radius_1d_rj_r(i)) &
204+ do i = 1 , sph_rj % nidx_rj(1 )
205+ if (sph_IO% r_gl_1(i) .ne. sph_rj % radius_1d_rj_r(i)) then
206+ if (abs (sph_IO% r_gl_1(i) - sph_rj % radius_1d_rj_r(i)) &
192207 & .gt. 1.0d-10 ) return
193208 end if
194- if (sph_IO% idx_gl_1(i) .ne. rj % idx_gl_1d_rj_r(i)) return
209+ if (sph_IO% idx_gl_1(i) .ne. sph_rj % idx_gl_1d_rj_r(i)) return
195210 end do
196211!
197- do i = 1 , rj % nidx_rj(2 )
198- if (sph_IO% idx_gl_2(i,1 ) .ne. rj % idx_gl_1d_rj_j(i,1 )) return
199- if (sph_IO% idx_gl_2(i,2 ) .ne. rj % idx_gl_1d_rj_j(i,2 )) return
200- if (sph_IO% idx_gl_2(i,3 ) .ne. rj % idx_gl_1d_rj_j(i,3 )) return
212+ do i = 1 , sph_rj % nidx_rj(2 )
213+ if (sph_IO% idx_gl_2(i,1 ) .ne. sph_rj % idx_gl_1d_rj_j(i,1 )) return
214+ if (sph_IO% idx_gl_2(i,2 ) .ne. sph_rj % idx_gl_1d_rj_j(i,2 )) return
215+ if (sph_IO% idx_gl_2(i,3 ) .ne. sph_rj % idx_gl_1d_rj_j(i,3 )) return
201216 end do
202217 compare_sph_node_rj_with_IO = 0
203218!
0 commit comments