Skip to content

Commit 2b6f5a7

Browse files
committed
Control LBW amplification using single variable
1 parent 801328c commit 2b6f5a7

9 files changed

Lines changed: 37 additions & 95 deletions

File tree

epoch1d/src/deck/deck_qed_block.F90

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ SUBROUTINE qed_deck_initialise
4848
use_binary_collisions = .FALSE.
4949
use_LBW = .FALSE.
5050
use_LBW_diff = .TRUE.
51-
use_LBW_amp = .FALSE.
5251
LBW_amp_factor = 1.0_num
5352
END IF
5453
#endif
@@ -96,6 +95,7 @@ SUBROUTINE qed_deck_finalise
9695
END DO
9796
END IF
9897

98+
lbw_amp_factor = MAX(lbw_amp_factor, 1.0_num)
9999
#else
100100
IF (use_qed) THEN
101101
IF (rank == 0) THEN
@@ -203,11 +203,6 @@ FUNCTION qed_block_handle_element(element, value) RESULT(errcode)
203203
RETURN
204204
END IF
205205

206-
IF(str_cmp(element, 'amplify_LBW')) THEN
207-
use_LBW_amp = as_logical_print(value, element, errcode)
208-
RETURN
209-
END IF
210-
211206
IF (str_cmp(element, 'amplify_LBW_factor')) THEN
212207
LBW_amp_factor = as_real_print(value, element, errcode)
213208
RETURN

epoch1d/src/physics_packages/photons.F90

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,9 @@ SUBROUTINE setup_qed_module
7272
END DO
7373
END IF
7474

75-
76-
IF (use_LBW_amp) THEN
77-
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx * LBW_amp_factor
78-
cdt_dV = c * dt / dx * LBW_amp_factor
79-
i_LBW_amp_factor = 1.0_num / LBW_amp_factor
80-
ELSE
81-
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx
82-
cdt_dV = c * dt / dx
83-
END IF
75+
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx * LBW_amp_factor
76+
cdt_dV = c * dt / dx * LBW_amp_factor
77+
i_LBW_amp_factor = 1.0_num / LBW_amp_factor
8478

8579
END SUBROUTINE setup_qed_module
8680

@@ -1590,11 +1584,7 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, ixx, &
15901584
! Now, collide these two macro-photons.
15911585

15921586
! Pair yield
1593-
IF (use_LBW_amp) THEN
1594-
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
1595-
ELSE
1596-
Y_ij = MIN(weight_i, weight_j)
1597-
END IF
1587+
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
15981588

15991589
! Pair position
16001590
lepton_pos = (current_i%part_pos + current_j%part_pos)*0.5_num
@@ -1673,10 +1663,10 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, ixx, &
16731663
IF (ASSOCIATED(next_i)) next_j => next_i%next
16741664

16751665
! now, annihilate photons by decreasing weight, or delete macro-photon
1676-
IF (use_LBW_amp) THEN
1666+
IF (lbw_amp_factor > 1.0_num) THEN
16771667
! In this case, no macro-photons are deleted
1678-
current_i%weight = weight_i - Y_ij
1679-
current_j%weight = weight_j - Y_ij
1668+
current_i%weight = weight_i - Y_ij
1669+
current_j%weight = weight_j - Y_ij
16801670
ELSE
16811671
! no amplification of the cross-section.
16821672
! In this case, need to delete the smaller macro-photon,
@@ -1699,7 +1689,7 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, ixx, &
16991689
)%secondary_list(ixx), current_j)
17001690
DEALLOCATE(current_j)
17011691
END IF ! comparing weights
1702-
END IF ! if use_LBW_amp
1692+
END IF ! if amplification_factor > 1.0_num
17031693

17041694
! Now, collision of these two macro photons is done,
17051695
! Move pointer to next particle
@@ -1840,11 +1830,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
18401830

18411831
! Now, collide these two macro-photons.
18421832
! Pair yield
1843-
IF (use_LBW_amp) THEN
1844-
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
1845-
ELSE
1846-
Y_ij = MIN(weight_i, weight_j)
1847-
END IF
1833+
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
18481834

18491835
! Pair position
18501836
lepton_pos = (current_i%part_pos + current_j%part_pos)*0.5_num
@@ -1924,7 +1910,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
19241910
next_j => current_j%next
19251911

19261912
! now, annihilate photons by decreasing weight, or delete macro-photon
1927-
IF (use_LBW_amp) THEN
1913+
IF (lbw_amp_factor > 1.0_num) THEN
19281914
! In this case, no macro-photons are deleted
19291915
current_i%weight = weight_i - Y_ij
19301916
current_j%weight = weight_j - Y_ij
@@ -1950,7 +1936,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
19501936
)%secondary_list(ixx), current_j)
19511937
DEALLOCATE(current_j)
19521938
END IF ! comparing weights
1953-
END IF ! if use_LBW_amp
1939+
END IF ! if lbw_amp_factor > 1.0
19541940

19551941
! Now, collision of these two macro photons is done,
19561942
! Move pointer to next particle

epoch1d/src/shared_data.F90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,7 @@ MODULE shared_data
616616
REAL(num) :: photon_sample_fraction = 1.0_num
617617
LOGICAL :: use_LBW = .FALSE.
618618
LOGICAL :: use_LBW_diff = .TRUE.
619-
LOGICAL :: use_LBW_amp = .FALSE.
620-
REAL(num) :: LBW_amp_factor
619+
REAL(num) :: LBW_amp_factor = 1.0_num
621620
INTEGER :: lbw_electron_species = -1
622621
INTEGER :: lbw_positron_species = -1
623622
REAL(num), PARAMETER :: tolerance_cdf = 1.0e-6_num

epoch2d/src/deck/deck_qed_block.F90

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ SUBROUTINE qed_deck_initialise
4848
use_binary_collisions = .FALSE.
4949
use_LBW = .FALSE.
5050
use_LBW_diff = .TRUE.
51-
use_LBW_amp = .FALSE.
5251
LBW_amp_factor = 1.0_num
5352
END IF
5453
#endif
@@ -97,6 +96,7 @@ SUBROUTINE qed_deck_finalise
9796
END DO
9897
END IF
9998

99+
lbw_amp_factor = MAX(lbw_amp_factor, 1.0_num)
100100
#else
101101
IF (use_qed) THEN
102102
IF (rank == 0) THEN
@@ -204,11 +204,6 @@ FUNCTION qed_block_handle_element(element, value) RESULT(errcode)
204204
RETURN
205205
END IF
206206

207-
IF(str_cmp(element, 'amplify_LBW')) THEN
208-
use_LBW_amp = as_logical_print(value, element, errcode)
209-
RETURN
210-
END IF
211-
212207
IF (str_cmp(element, 'amplify_LBW_factor')) THEN
213208
LBW_amp_factor = as_real_print(value, element, errcode)
214209
RETURN

epoch2d/src/physics_packages/photons.F90

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,10 @@ SUBROUTINE setup_qed_module
7272
END DO
7373
END IF
7474

75-
IF (use_LBW_amp) THEN
76-
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx / dy &
77-
* LBW_amp_factor
78-
cdt_dV = c * dt / dx / dy * LBW_amp_factor
79-
i_LBW_amp_factor = 1.0_num / LBW_amp_factor
80-
ELSE
81-
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx / dy
82-
cdt_dV = c * dt / dx / dy
83-
END IF
75+
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx / dy &
76+
* LBW_amp_factor
77+
cdt_dV = c * dt / dx / dy * LBW_amp_factor
78+
i_LBW_amp_factor = 1.0_num / LBW_amp_factor
8479

8580
END SUBROUTINE setup_qed_module
8681

@@ -1607,11 +1602,7 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, &
16071602

16081603
! Now, collide these two macro-photons.
16091604
! Pair yield
1610-
IF (use_LBW_amp) THEN
1611-
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
1612-
ELSE
1613-
Y_ij = MIN(weight_i, weight_j)
1614-
END IF
1605+
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
16151606

16161607
! Pair position
16171608
lepton_pos = (current_i%part_pos + current_j%part_pos)*0.5_num
@@ -1691,7 +1682,7 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, &
16911682
IF (ASSOCIATED(next_i)) next_j => next_i%next
16921683

16931684
! now, annihilate photons by decreasing weight, or delete macro-photon
1694-
IF (use_LBW_amp) THEN
1685+
IF (lbw_amp_factor > 1.0_num) THEN
16951686
! In this case, no macro-photons are deleted
16961687
current_i%weight = weight_i - Y_ij
16971688
current_j%weight = weight_j - Y_ij
@@ -1717,7 +1708,7 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, &
17171708
)%secondary_list(ixx,iyy), current_j)
17181709
DEALLOCATE(current_j)
17191710
END IF ! comparing weights
1720-
END IF ! if use_LBW_amp
1711+
END IF ! if amplification_factor > 1.0_num
17211712

17221713
! Now, collision of these two macro photons is done,
17231714
! Move pointer to next particle
@@ -1858,11 +1849,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
18581849

18591850
! Now, collide these two macro-photons.
18601851
! Pair yield
1861-
IF (use_LBW_amp) THEN
1862-
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
1863-
ELSE
1864-
Y_ij = MIN(weight_i, weight_j)
1865-
END IF
1852+
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
18661853

18671854
! Pair position
18681855
lepton_pos = (current_i%part_pos + current_j%part_pos)*0.5_num
@@ -1942,7 +1929,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
19421929
next_j => current_j%next
19431930

19441931
! Now, annihilate photons by decreasing weight, or delete macro-photon
1945-
IF (use_LBW_amp) THEN
1932+
IF (lbw_amp_factor > 1.0_num) THEN
19461933
! In this case, no macro-photons are deleted
19471934
current_i%weight = weight_i - Y_ij
19481935
current_j%weight = weight_j - Y_ij
@@ -1968,7 +1955,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
19681955
)%secondary_list(ixx,iyy), current_j)
19691956
DEALLOCATE(current_j)
19701957
END IF ! comparing weights
1971-
END IF ! if use_LBW_amp
1958+
END IF ! if lbw_amp_factor > 1.0
19721959

19731960
! Now, collision of these two macro photons is done,
19741961
! Move pointer to next particle

epoch2d/src/shared_data.F90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,7 @@ MODULE shared_data
639639
REAL(num) :: photon_sample_fraction = 1.0_num
640640
LOGICAL :: use_LBW = .FALSE.
641641
LOGICAL :: use_LBW_diff = .TRUE.
642-
LOGICAL :: use_LBW_amp = .FALSE.
643-
REAL(num) :: LBW_amp_factor
642+
REAL(num) :: LBW_amp_factor = 1.0_num
644643
INTEGER :: lbw_electron_species = -1
645644
INTEGER :: lbw_positron_species = -1
646645
REAL(num), PARAMETER :: tolerance_cdf = 1.0e-6_num

epoch3d/src/deck/deck_qed_block.F90

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ SUBROUTINE qed_deck_initialise
4848
use_binary_collisions = .FALSE.
4949
use_LBW = .FALSE.
5050
use_LBW_diff = .TRUE.
51-
use_LBW_amp = .FALSE.
5251
LBW_amp_factor = 1.0_num
5352
END IF
5453
#endif
@@ -97,6 +96,7 @@ SUBROUTINE qed_deck_finalise
9796
END DO
9897
END IF
9998

99+
lbw_amp_factor = MAX(lbw_amp_factor, 1.0_num)
100100
#else
101101
IF (use_qed) THEN
102102
IF (rank == 0) THEN
@@ -204,11 +204,6 @@ FUNCTION qed_block_handle_element(element, value) RESULT(errcode)
204204
RETURN
205205
END IF
206206

207-
IF(str_cmp(element, 'amplify_LBW')) THEN
208-
use_LBW_amp = as_logical_print(value, element, errcode)
209-
RETURN
210-
END IF
211-
212207
IF (str_cmp(element, 'amplify_LBW_factor')) THEN
213208
LBW_amp_factor = as_real_print(value, element, errcode)
214209
RETURN

epoch3d/src/physics_packages/photons.F90

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,10 @@ SUBROUTINE setup_qed_module
7272
END DO
7373
END IF
7474

75-
IF (use_LBW_amp) THEN
76-
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx/dy/dz &
77-
* LBW_amp_factor
78-
cdt_dV = c * dt / dx/dy/dz * LBW_amp_factor
79-
i_LBW_amp_factor = 1.0_num / LBW_amp_factor
80-
ELSE
81-
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx/dy/dz
82-
cdt_dV = c * dt / dx/dy/dz
83-
END IF
75+
sig2cdt_dV_lbw = 2.0_num * sigma_lBW_max * c * dt / dx/dy/dz &
76+
* LBW_amp_factor
77+
cdt_dV = c * dt / dx/dy/dz * LBW_amp_factor
78+
i_LBW_amp_factor = 1.0_num / LBW_amp_factor
8479

8580
END SUBROUTINE setup_qed_module
8681

@@ -1623,11 +1618,7 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, &
16231618

16241619
! Now, collide these two macro-photons.
16251620
! Pair yield
1626-
IF (use_LBW_amp) THEN
1627-
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
1628-
ELSE
1629-
Y_ij = MIN(weight_i, weight_j)
1630-
END IF
1621+
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
16311622

16321623
! Pair position
16331624
lepton_pos = (current_i%part_pos + current_j%part_pos)*0.5_num
@@ -1705,7 +1696,7 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, &
17051696
next_i => current_j%next
17061697
IF (ASSOCIATED(next_i)) next_j => next_i%next
17071698
! Now, annihilate photons by decreasing weight, or delete macro-photon
1708-
IF (use_LBW_amp) THEN
1699+
IF (lbw_amp_factor > 1.0_num) THEN
17091700
! In this case, no macro-photons are deleted
17101701
current_i%weight = weight_i - Y_ij
17111702
current_j%weight = weight_j - Y_ij
@@ -1731,7 +1722,7 @@ SUBROUTINE linear_Breit_Wheeler_intra(p_list_i, ispe, &
17311722
)%secondary_list(ixx,iyy,izz), current_j)
17321723
DEALLOCATE(current_j)
17331724
END IF ! comparing weights
1734-
END IF ! if use_LBW_amp
1725+
END IF ! if amplification_factor > 1.0_num
17351726

17361727
! Now, collision of these two macro photons is done,
17371728
! Move pointer to next particle
@@ -1873,11 +1864,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
18731864

18741865
! Now, collide these two macro-photons.
18751866
! Pair yield
1876-
IF (use_LBW_amp) THEN
1877-
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
1878-
ELSE
1879-
Y_ij = MIN(weight_i, weight_j)
1880-
END IF
1867+
Y_ij = MIN(weight_i, weight_j) * i_LBW_amp_factor
18811868

18821869
! Pair position
18831870
lepton_pos = (current_i%part_pos + current_j%part_pos)*0.5_num
@@ -1956,7 +1943,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
19561943
next_j => current_j%next
19571944

19581945
! Now, annihilate photons by decreasing weight, or delete macro-photon
1959-
IF (use_LBW_amp) THEN
1946+
IF (lbw_amp_factor > 1.0_num) THEN
19601947
! In this case, no macro-photons are deleted
19611948
current_i%weight = weight_i - Y_ij
19621949
current_j%weight = weight_j - Y_ij
@@ -1982,7 +1969,7 @@ SUBROUTINE linear_Breit_Wheeler_inter(p_list_i, p_list_j, ispe, jspe, &
19821969
)%secondary_list(ixx,iyy,izz), current_j)
19831970
DEALLOCATE(current_j)
19841971
END IF ! comparing weights
1985-
END IF ! if use_LBW_amp
1972+
END IF ! if lbw_amp_factor > 1.0
19861973

19871974
! Now, collision of these two macro photons is done,
19881975
! Move pointer to next particle

epoch3d/src/shared_data.F90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,7 @@ MODULE shared_data
661661
REAL(num) :: photon_sample_fraction = 1.0_num
662662
LOGICAL :: use_LBW = .FALSE.
663663
LOGICAL :: use_LBW_diff = .TRUE.
664-
LOGICAL :: use_LBW_amp = .FALSE.
665-
REAL(num) :: LBW_amp_factor
664+
REAL(num) :: LBW_amp_factor = 1.0_num
666665
INTEGER :: lbw_electron_species = -1
667666
INTEGER :: lbw_positron_species = -1
668667
REAL(num), PARAMETER :: tolerance_cdf = 1.0e-6_num

0 commit comments

Comments
 (0)