Skip to content

Commit 3f4981e

Browse files
authored
eliminate screenz (#293)
Only 3 networks were using screenz (triple_alpha_plus_cago, ignition_simple, ignition_chamulak). We swap them over to screen5.
1 parent c083cf0 commit 3f4981e

File tree

5 files changed

+72
-215
lines changed

5 files changed

+72
-215
lines changed

networks/ignition_chamulak/actual_rhs.F90

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ module actual_rhs_module
1313

1414
subroutine actual_rhs_init()
1515

16+
use screening_module, only: screening_init, add_screening_factor
17+
1618
implicit none
1719

20+
call add_screening_factor(zion(ic12),aion(ic12),zion(ic12),aion(ic12))
21+
22+
call screening_init()
23+
1824
end subroutine actual_rhs_init
1925

2026
subroutine get_ebin(density, ebin)
@@ -59,15 +65,15 @@ end subroutine get_ebin
5965

6066
subroutine get_rates(state, rr)
6167

62-
use screening_module, only: screenz
68+
use screening_module, only: screen5, plasma_state, fill_plasma_state
6369

6470
type (burn_t), intent(in) :: state
6571
type (rate_t), intent(out) :: rr
6672

6773
real(rt) :: temp, T9, T9a, dT9dt, dT9adt
6874

6975
real(rt) :: scratch, dscratchdt
70-
real(rt) :: rate, dratedt, sc1212, dsc1212dt, xc12tmp
76+
real(rt) :: rate, dratedt, sc1212, dsc1212dt, dsc1212dd, xc12tmp
7177

7278
real(rt) :: dens
7379

@@ -76,6 +82,8 @@ subroutine get_rates(state, rr)
7682
real(rt) :: y(nspec)
7783

7884
real(rt) , parameter :: FIVE6TH = FIVE / SIX
85+
integer :: jscr
86+
type(plasma_state) :: pstate
7987

8088
!$gpu
8189

@@ -86,8 +94,10 @@ subroutine get_rates(state, rr)
8694
y(1:nspec) = state % xn(1:nspec) * aion_inv(1:nspec)
8795

8896
! call the screening routine
89-
call screenz(temp, dens, 6.0e0_rt, 6.0e0_rt, 12.0e0_rt, 12.0e0_rt, &
90-
y, sc1212, dsc1212dt)
97+
call fill_plasma_state(pstate, temp, dens, y)
98+
99+
jscr = 1
100+
call screen5(pstate,jscr,sc1212,dsc1212dt,dsc1212dd)
91101

92102
! compute some often used temperature constants
93103
T9 = temp/1.e9_rt

networks/ignition_simple/actual_rhs.F90

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ module actual_rhs_module
1313

1414
subroutine actual_rhs_init()
1515

16+
use screening_module, only: screening_init, add_screening_factor
17+
1618
implicit none
1719

20+
call add_screening_factor(zion(ic12),aion(ic12),zion(ic12),aion(ic12))
21+
22+
call screening_init()
23+
1824
end subroutine actual_rhs_init
1925

2026

@@ -209,7 +215,7 @@ subroutine evaluate_rates(state, rr)
209215

210216
!$acc routine seq
211217

212-
use screening_module, only: screenz
218+
use screening_module, only: screen5, plasma_state, fill_plasma_state
213219

214220
implicit none
215221

@@ -219,13 +225,15 @@ subroutine evaluate_rates(state, rr)
219225
real(rt) :: temp, T9, T9a, dT9dt, dT9adt
220226

221227
real(rt) :: scratch, dscratchdt
222-
real(rt) :: rate, dratedt, sc1212, dsc1212dt, xc12tmp
228+
real(rt) :: rate, dratedt, sc1212, dsc1212dt, dsc1212dd, xc12tmp
223229

224230
real(rt) :: dens
225231

226232
real(rt) :: a, b, dadt, dbdt
227233

228234
real(rt) :: y(nspec)
235+
integer :: jscr
236+
type(plasma_state) :: pstate
229237

230238
!$gpu
231239

@@ -236,7 +244,10 @@ subroutine evaluate_rates(state, rr)
236244
y = state % xn * aion_inv
237245

238246
! call the screening routine
239-
call screenz(temp,dens,6.0e0_rt,6.0e0_rt,12.0e0_rt,12.0e0_rt,y,sc1212,dsc1212dt)
247+
call fill_plasma_state(pstate, temp, dens, y)
248+
249+
jscr = 1
250+
call screen5(pstate,jscr,sc1212,dsc1212dt,dsc1212dd)
240251

241252
! compute some often used temperature constants
242253
T9 = temp/1.e9_rt

networks/triple_alpha_plus_cago/actual_rhs.F90

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ module actual_rhs_module
1616

1717
subroutine actual_rhs_init()
1818

19+
use screening_module, only: screening_init
20+
1921
implicit none
2022

21-
!$gpu
23+
call set_up_screening_factors()
24+
25+
call screening_init()
2226

2327
end subroutine actual_rhs_init
2428

@@ -181,4 +185,27 @@ subroutine ener_gener_rate(dydt, enuc)
181185

182186
end subroutine ener_gener_rate
183187

188+
! Compute and store the more expensive screening factors
189+
190+
subroutine set_up_screening_factors()
191+
192+
use screening_module, only: add_screening_factor
193+
use network, only: aion, zion
194+
195+
implicit none
196+
197+
! note: it is critical that these are called in the exact order
198+
! that the screening calls are done in the RHS routine, since we
199+
! use that order in the screening
200+
201+
call add_screening_factor(zion(ihe4),aion(ihe4),zion(ihe4),aion(ihe4))
202+
203+
call add_screening_factor(zion(ihe4),aion(ihe4),4.0e0_rt,8.0e0_rt)
204+
205+
call add_screening_factor(zion(ic12),aion(ic12),zion(ihe4),aion(ihe4))
206+
207+
208+
end subroutine set_up_screening_factors
209+
210+
184211
end module actual_rhs_module

networks/triple_alpha_plus_cago/screen_module.F90

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
! fractions. The triple-alpha reaction goes through a compound nucleus
44
! channel and therefore screening must be applied to both reactions.
55
!
6-
! A call is made to screenz which lives in screen.f to apply the screening
6+
! A call is made to screen5 which lives in screen.f to apply the screening
77
! to a single reaction.
88
module screen_module
99

@@ -19,33 +19,33 @@ subroutine screen(temp, dens, ymol, rates, dratesdt)
1919

2020
!$acc routine seq
2121

22-
use screening_module, only: screenz
22+
use screening_module, only: screen5, plasma_state, fill_plasma_state
2323

2424
real(rt), intent(IN ) :: temp, dens, ymol(nspec)
2525
real(rt), intent(INOUT) :: rates(nrates)
2626
real(rt), intent(INOUT) :: dratesdt(nrates)
2727

28-
real(rt) :: scorr1, dscorr1dt
29-
real(rt) :: scorr2, dscorr2dt
30-
real(rt) :: scorr, dscorrdt
28+
real(rt) :: scorr1, dscorr1dt, dscorr1dd
29+
real(rt) :: scorr2, dscorr2dt, dscorr2dd
30+
real(rt) :: scorr, dscorrdt, dscorrdd
3131

3232
real(rt) :: rates_in(nrates), dratesdt_in(nrates)
33+
integer :: jscr
34+
35+
type (plasma_state) :: state
3336

3437
!$gpu
3538

3639
rates_in = rates
3740
dratesdt_in = dratesdt
3841

39-
! triple alpha going through compound nucleus channel
40-
call screenz(temp, dens, &
41-
zion(ihe4), zion(ihe4), &
42-
aion(ihe4), aion(ihe4), &
43-
ymol, scorr1, dscorr1dt)
42+
call fill_plasma_state(state, temp, dens, ymol)
43+
44+
jscr = 1
45+
call screen5(state,jscr,scorr1,dscorr1dt,dscorr1dd)
4446

45-
call screenz(temp, dens, &
46-
zion(ihe4), FOUR, &
47-
aion(ihe4), EIGHT, &
48-
ymol, scorr2, dscorr2dt)
47+
jscr = jscr + 1
48+
call screen5(state,jscr,scorr2,dscorr2dt,dscorr2dd)
4949

5050
scorr = scorr1 * scorr2
5151
dscorrdt = dscorr1dt * scorr2 + scorr1 * dscorr2dt
@@ -55,10 +55,8 @@ subroutine screen(temp, dens, ymol, rates, dratesdt)
5555
rates_in(ir3a) * dscorrdt
5656

5757
! C12 + alpha --> O16
58-
call screenz(temp, dens, &
59-
zion(ic12), zion(ihe4), &
60-
aion(ic12), aion(ihe4), &
61-
ymol, scorr, dscorrdt)
58+
jscr = jscr + 1
59+
call screen5(state,jscr,scorr,dscorrdt,dscorrdd)
6260

6361
rates(ircago) = rates_in(ircago) * scorr
6462
dratesdt(ircago) = dratesdt_in(ircago) * scorr + &

0 commit comments

Comments
 (0)