99! ! subroutine const_radial_mat_4_press_sph &
1010! ! & (sph_rj, r_2nd, fl_prop, sph_bc_U, fdm2_center, &
1111! ! & g_sph_rj, band_p_poisson)
12- ! ! subroutine const_radial_mat_4_scalar_sph(mat_name, coef_advect, &
13- ! ! & dt, sph_params, sph_rj, r_2nd, property, &
14- ! ! & sph_bc, bcs_S, fdm2_center, g_sph_rj, band_s_evo)
15- ! ! type(scalar_property), intent(in) :: property
16- ! ! type(sph_shell_parameters), intent(in) :: sph_params
17- ! ! type(sph_rj_grid), intent(in) :: sph_rj
12+ ! ! subroutine const_radial_mat_4_scalar_sph(mat_name, dt, sph_rj, &
13+ ! ! & g_sph_rj, r_2nd, fdm2_center, property, sph_bc, bcs_S,&
14+ ! ! & k_ratio, dk_dr, band_s_evo)
15+ ! ! type(sph_rj_grid), intent(in) :: sph_rj
1816! ! type(fdm_matrices), intent(in) :: r_2nd
17+ ! ! type(scalar_property), intent(in) :: property
18+ ! ! type(fluid_property), intent(in) :: fl_prop
1919! ! type(sph_boundary_type), intent(in) :: sph_bc_U
20+ ! ! type(sph_boundary_type), intent(in) :: sph_bc
2021! ! type(sph_scalar_boundary_data) :: bcs_S
2122! ! type(fdm2_center_mat), intent(in) :: fdm2_center
23+ ! ! real(kind = kreal), intent(in) :: dt
24+ ! ! real(kind=kreal), intent(in) :: g_sph_rj(sph_rj%nidx_rj(2),13)
25+ ! ! real(kind = kreal), intent(in) :: k_ratio(0:sph_rj%nidx_rj(1))
26+ ! ! real(kind = kreal), intent(in) :: dk_dr(0:sph_rj%nidx_rj(1))
27+ ! ! character(len=kchara), intent(in) :: mat_name
28+ ! ! type(band_matrices_type), intent(inout) :: band_p_poisson
29+ ! ! type(band_matrices_type), intent(inout) :: band_s_evo
2230! !
2331! ! subroutine const_r_mat00_scalar_sph(id_file, mat_name, &
2432! ! & diffuse_reduction_ratio_ICB, sph_params, &
@@ -86,30 +94,23 @@ subroutine const_radial_mat_4_press_sph &
8694 type (band_matrices_type), intent (inout ) :: band_p_poisson
8795!
8896 real (kind = kreal) :: coef_p
89- real (kind = kreal), allocatable :: r_coef(:)
9097!
9198!
9299 write (band_p_poisson% mat_name,' (a)' ) ' pressure_poisson'
93100 coef_p = - fl_prop% coef_press
94- !
95- allocate (r_coef(sph_rj% nidx_rj(1 )))
96- ! $omp parallel workshare
97- r_coef(1 :sph_rj% nidx_rj(1 )) = coef_p
98- ! $omp end parallel workshare
99101!
100102 call alloc_band_mat_sph(ithree, sph_rj, band_p_poisson)
101-
103+ !
102104 call set_unit_mat_4_poisson &
103105 & (sph_rj% nidx_rj(1 ), sph_rj% nidx_rj(2 ), &
104106 & sph_bc_U% kr_in, sph_bc_U% kr_out, band_p_poisson% mat)
105107 call add_scalar_poisson_mat_sph &
106108 & (sph_rj% nidx_rj(1 ), sph_rj% nidx_rj(2 ), sph_rj% ar_1d_rj, &
107- & g_sph_rj, sph_bc_U% kr_in, sph_bc_U% kr_out, r_coef( 1 ), &
109+ & g_sph_rj, sph_bc_U% kr_in, sph_bc_U% kr_out, coef_p, &
108110 & r_2nd% fdm(1 )% dmat, r_2nd% fdm(2 )% dmat, band_p_poisson% mat)
109111!
110112 call sel_radial_mat_press_bc_sph(sph_rj, sph_bc_U, fdm2_center, &
111- & g_sph_rj, r_coef, band_p_poisson)
112- deallocate (r_coef)
113+ & g_sph_rj, coef_p, band_p_poisson)
113114!
114115 call ludcmp_3band_mul_t &
115116 & (np_smp, sph_rj% istack_rj_j_smp, band_p_poisson)
@@ -119,42 +120,38 @@ end subroutine const_radial_mat_4_press_sph
119120! -----------------------------------------------------------------------
120121! -----------------------------------------------------------------------
121122!
122- subroutine const_radial_mat_4_scalar_sph (mat_name , coef_advect , &
123- & dt , sph_params , sph_rj , r_2nd , property , &
124- & sph_bc , bcs_S , fdm2_center , g_sph_rj , k_ratio , dk_dr , &
125- & band_s_evo )
123+ subroutine const_radial_mat_4_scalar_sph (mat_name , dt , sph_rj , &
124+ & g_sph_rj , r_2nd , fdm2_center , property , sph_bc , bcs_S , &
125+ & k_ratio , dk_dr , band_s_evo )
126126!
127127 use m_ludcmp_3band
128128 use center_sph_matrices
129129 use set_radial_mat_sph
130130 use select_r_mat_scalar_bc_sph
131131!
132- type (sph_shell_parameters), intent (in ) :: sph_params
133132 type (sph_rj_grid), intent (in ) :: sph_rj
134133 type (fdm_matrices), intent (in ) :: r_2nd
135134 type (scalar_property), intent (in ) :: property
136135 type (sph_boundary_type), intent (in ) :: sph_bc
137136 type (sph_scalar_boundary_data) :: bcs_S
138137 type (fdm2_center_mat), intent (in ) :: fdm2_center
139138!
140- real (kind = kreal), intent (in ) :: g_sph_rj(sph_rj% nidx_rj(2 ),13 )
141139 real (kind = kreal), intent (in ) :: dt
142- real (kind = kreal), intent (in ) :: coef_advect
140+ real (kind = kreal), intent (in ) :: g_sph_rj(sph_rj % nidx_rj( 2 ), 13 )
143141 real (kind = kreal), intent (in ) :: k_ratio(0 :sph_rj% nidx_rj(1 ))
144142 real (kind = kreal), intent (in ) :: dk_dr(0 :sph_rj% nidx_rj(1 ))
145143 character (len= kchara), intent (in ) :: mat_name
146144!
147145 type (band_matrices_type), intent (inout ) :: band_s_evo
148146!
149147 real (kind = kreal) :: coef
150- real (kind = kreal), allocatable :: r_coef(:)
151148!
152149!
153150 band_s_evo% mat_name = mat_name
154151 call alloc_band_mat_sph(ithree, sph_rj, band_s_evo)
155152 call set_unit_on_diag(band_s_evo)
156153!
157- if (coef_advect .eq. zero) then
154+ if (property % coef_advect .eq. zero) then
158155 coef = one
159156 call set_unit_mat_4_poisson &
160157 & (sph_rj% nidx_rj(1 ), sph_rj% nidx_rj(2 ), &
@@ -164,38 +161,26 @@ subroutine const_radial_mat_4_scalar_sph(mat_name, coef_advect, &
164161 call set_unit_mat_4_time_evo &
165162 & (sph_rj% nidx_rj(1 ), sph_rj% nidx_rj(2 ), band_s_evo% mat)
166163 end if
167- !
168- allocate (r_coef(sph_rj% nidx_rj(1 )))
169- ! $omp parallel workshare
170- r_coef(1 :sph_rj% nidx_rj(1 )) = coef
171- ! $omp end parallel workshare
172- !
173- if (property% diffuse_reduction_ratio_ICB .lt. one) then
174- r_coef(sph_params% nlayer_ICB) &
175- & = property% diffuse_reduction_ratio_ICB &
176- & * r_coef(sph_params% nlayer_ICB)
177- if (my_rank .eq. 0 ) write (* ,* ) ' reduction of diffusivity at' , &
178- & sph_params% nlayer_ICB, ' to ' , r_coef(sph_params% nlayer_ICB), &
179- & ' from ' , coef
180- end if
181- !
182164!
183165 if (property% flag_val_diffuse) then
184166 call add_scalar_r_diffuse_mat_sph &
185167 & (sph_rj% nidx_rj(1 ), sph_rj% nidx_rj(2 ), sph_rj% ar_1d_rj, &
186168 & g_sph_rj, sph_bc% kr_in, sph_bc% kr_out, &
187- & r_coef( 1 ) , k_ratio(1 ), dk_dr(1 ), &
169+ & coef , k_ratio(1 ), dk_dr(1 ), &
188170 & r_2nd% fdm(1 )% dmat, r_2nd% fdm(2 )% dmat, band_s_evo% mat)
189171 else
190172 call add_scalar_poisson_mat_sph &
191173 & (sph_rj% nidx_rj(1 ), sph_rj% nidx_rj(2 ), sph_rj% ar_1d_rj, &
192- & g_sph_rj, sph_bc% kr_in, sph_bc% kr_out, r_coef( 1 ), &
174+ & g_sph_rj, sph_bc% kr_in, sph_bc% kr_out, coef, &
193175 & r_2nd% fdm(1 )% dmat, r_2nd% fdm(2 )% dmat, band_s_evo% mat)
194176 end if
195177!
196- call sel_radial_mat_scalar_bc_sph(sph_rj, sph_bc, bcs_S, &
197- & fdm2_center, g_sph_rj, r_coef, band_s_evo)
198- deallocate (r_coef)
178+ call sel_sph_radial_mat_scalar_ICB(property% flag_val_diffuse, &
179+ & sph_rj, sph_bc, bcs_S, fdm2_center, g_sph_rj, &
180+ & coef, k_ratio(sph_bc% kr_in), dk_dr(sph_bc% kr_in), band_s_evo)
181+ call sel_sph_radial_mat_scalar_CMB(property% flag_val_diffuse, &
182+ & sph_rj, sph_bc, bcs_S, fdm2_center, g_sph_rj, &
183+ & coef, k_ratio(sph_bc% kr_out), band_s_evo)
199184!
200185 call ludcmp_3band_mul_t &
201186 & (np_smp, sph_rj% istack_rj_j_smp, band_s_evo)
0 commit comments