2424! ! type(fdm2_center_mat), intent(in) :: fdm2_center
2525! ! type(phys_data), intent(in) :: rj_fld
2626! ! type(band_matrix_type), intent(in) :: band_s00_poisson
27- ! ! subroutine cal_reference_source(sph_rj, band_s00_poisson, &
28- ! ! & ref_source, ref_local)
27+ ! ! subroutine cal_reference_source(sph_rj, sc_prop, &
28+ ! ! & band_s00_poisson, ref_source, ref_local)
2929! ! type(sph_rj_grid), intent(in) :: sph_rj
30+ ! ! type(scalar_property), intent(in) :: sc_prop
3031! ! type(band_matrix_type), intent(in) :: band_s00_poisson
3132! ! real(kind = kreal), intent(in) &
3233! ! & :: ref_source(0:sph_rj%nidx_rj(1))
@@ -66,7 +67,7 @@ module const_diffusive_profile
6667!
6768 subroutine s_const_diffusive_profile (sph_rj , r_2nd , &
6869 & sc_prop , sph_bc , bcs_S , fdm2_center , band_s00_poisson , &
69- & reftemp_r , refgrad_r , ref_local )
70+ & reftemp_r , refgrad_r , ref_local , grad_local )
7071!
7172 use calypso_mpi
7273 use calypso_mpi_real
@@ -87,48 +88,48 @@ subroutine s_const_diffusive_profile(sph_rj, r_2nd, &
8788 real (kind= kreal), intent (inout ) :: reftemp_r(0 :sph_rj% nidx_rj(1 ))
8889 real (kind= kreal), intent (inout ) :: refgrad_r(0 :sph_rj% nidx_rj(1 ))
8990 real (kind = kreal), intent (inout ) &
90- & :: ref_local(0 :sph_rj% nidx_rj(1 ),0 :1 )
91+ & :: ref_local(0 :sph_rj% nidx_rj(1 ))
92+ real (kind = kreal), intent (inout ) &
93+ & :: grad_local(0 :sph_rj% nidx_rj(1 ))
9194!
9295 integer (kind = kint_gl) :: num64
9396! integer :: k
9497!
9598 if (sph_rj% idx_rj_degree_zero .gt. 0 ) then
9699! $omp parallel workshare
97- ref_local(0 :sph_rj% nidx_rj(1 ),0 ) &
98- & = ref_local(0 :sph_rj% nidx_rj(1 ),0 ) &
99- & * (sc_prop% coef_source / sc_prop% coef_diffuse)
100+ ref_local(0 :sph_rj% nidx_rj(1 )) = ref_local(0 :sph_rj% nidx_rj(1 )) &
101+ & * (sc_prop% coef_source / sc_prop% coef_diffuse)
100102! $omp end parallel workshare
101103!
102104 call set_ICB_scalar_boundary_1d &
103- & (sph_rj, sph_bc, bcs_S% ICB_Sspec, ref_local(0 , 0 ))
105+ & (sph_rj, sph_bc, bcs_S% ICB_Sspec, ref_local(0 ))
104106 call set_CMB_scalar_boundary_1d &
105- & (sph_rj, sph_bc, bcs_S% CMB_Sspec, ref_local(0 , 0 ))
107+ & (sph_rj, sph_bc, bcs_S% CMB_Sspec, ref_local(0 ))
106108!
107109! do k = 0, sph_rj%nidx_rj(1)
108- ! write(*,*) k, 'RHS', ref_local(k,0 )
110+ ! write(*,*) k, 'RHS', ref_local(k)
109111! end do
110112!
111- call lubksb_3band_ctr(band_s00_poisson, ref_local(0 , 0 ))
113+ call lubksb_3band_ctr(band_s00_poisson, ref_local(0 ))
112114! call s_cal_sol_reftemp_BiCGSTAB &
113- ! & (band_s00_poisson, ref_local(0,0 ))
115+ ! & (band_s00_poisson, ref_local(0))
114116!
115117! do k = 0, sph_rj%nidx_rj(1)
116- ! write(*,*) k, 'Solution', ref_local(k,0 )
118+ ! write(*,*) k, 'Solution', ref_local(k)
117119! end do
118120!
119121 call fill_scalar_1d_external(sph_bc, sph_rj% inod_rj_center, &
120- & sph_rj% nidx_rj(1 ), ref_local(0 , 0 ))
122+ & sph_rj% nidx_rj(1 ), ref_local(0 ))
121123!
122124 call cal_sph_nod_gradient_1d(sph_bc% kr_in, sph_bc% kr_out, &
123125 & sph_rj% nidx_rj(1 ), r_2nd% fdm(1 )% dmat, &
124- & ref_local(0 , 0 ), ref_local( 0 , 1 ))
126+ & ref_local(0 ), grad_local( 0 ))
125127!
126128 call sel_ICB_radial_grad_1d_scalar &
127129 & (sph_rj, sph_bc, bcs_S% ICB_Sspec, fdm2_center, &
128- & ref_local( 0 , 0 ), ref_local( 0 , 1 ) )
130+ & ref_local, grad_local )
129131 call sel_CMB_radial_grad_1d_scalar &
130- & (sph_rj, sph_bc, bcs_S% CMB_Sspec, &
131- & ref_local(0 ,0 ), ref_local(0 ,1 ))
132+ & (sph_rj, sph_bc, bcs_S% CMB_Sspec, ref_local, grad_local)
132133 end if
133134!
134135! $omp parallel workshare
@@ -137,9 +138,9 @@ subroutine s_const_diffusive_profile(sph_rj, r_2nd, &
137138! $omp end parallel workshare
138139!
139140 num64 = sph_rj% nidx_rj(1 ) + 1
140- call calypso_mpi_allreduce_real(ref_local(0 , 0 ), reftemp_r, &
141+ call calypso_mpi_allreduce_real(ref_local(0 ), reftemp_r, &
141142 & num64, MPI_SUM)
142- call calypso_mpi_allreduce_real(ref_local( 0 , 1 ), refgrad_r, &
143+ call calypso_mpi_allreduce_real(grad_local( 0 ), refgrad_r, &
143144 & num64, MPI_SUM)
144145!
145146 end subroutine s_const_diffusive_profile
@@ -243,7 +244,7 @@ subroutine gradient_of_radial_reference(sph_rj, r_2nd, &
243244 real (kind= kreal), intent (inout ) :: refgrad_r(0 :sph_rj% nidx_rj(1 ))
244245!
245246!
246- call fill_scalar_1d_external(sph_bc, sph_rj% inod_rj_center, &
247+ call fill_scalar_1d_external(sph_bc, sph_rj% inod_rj_center, &
247248 & sph_rj% nidx_rj(1 ), reftemp_r(0 ))
248249!
249250 call cal_sph_nod_gradient_1d(sph_bc% kr_in, sph_bc% kr_out, &
@@ -260,10 +261,11 @@ end subroutine gradient_of_radial_reference
260261!
261262! -----------------------------------------------------------------------
262263!
263- subroutine cal_reference_source (sph_rj , band_s00_poisson , &
264- & ref_source , ref_local )
264+ subroutine cal_reference_source (sph_rj , sc_prop , &
265+ & band_s00_poisson , ref_source , ref_local )
265266!
266267 type (sph_rj_grid), intent (in ) :: sph_rj
268+ type (scalar_property), intent (in ) :: sc_prop
267269 type (band_matrix_type), intent (in ) :: band_s00_poisson
268270!
269271 real (kind = kreal), intent (in ) &
@@ -288,6 +290,11 @@ subroutine cal_reference_source(sph_rj, band_s00_poisson, &
288290 k = sph_rj% nidx_rj(1 )
289291 ref_local(k) = band_s00_poisson% mat(3 ,k-1 ) * ref_source(k-1 ) &
290292 & + band_s00_poisson% mat(2 ,k ) * ref_source(k)
293+ !
294+ ! $omp parallel workshare
295+ ref_local(0 :sph_rj% nidx_rj(1 )) = ref_local(0 :sph_rj% nidx_rj(1 )) &
296+ & * (sc_prop% coef_diffuse / sc_prop% coef_source)
297+ ! $omp end parallel workshare
291298!
292299 end subroutine cal_reference_source
293300!
0 commit comments