Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
80a5c1b
Add microclumping options to artis options
AMG3141 Jan 13, 2026
8378493
Update calls to functions which use clumping factor
AMG3141 Jan 22, 2026
6fa75d0
Store the reciprocal of the clumping factor instead of the actual clu…
AMG3141 Jan 23, 2026
7603c8c
Calculate clumping factors using function in artisoptions instead of …
AMG3141 Feb 9, 2026
c63fd73
Fix update_grid.cc
AMG3141 Feb 16, 2026
d4d81a9
Update update_grid.cc
AMG3141 Feb 16, 2026
c0dad9c
Update clumping factor function to use mean radial velocity of model …
AMG3141 Feb 16, 2026
4667293
Apply clang-tidy fixes
AMG3141 Feb 16, 2026
108f4e2
Update new grid functions to use DEVICE_FUNC
AMG3141 Feb 23, 2026
bb248f2
Fix ratecoeff.h
AMG3141 Feb 23, 2026
60e76fd
Update grid.cc
AMG3141 Feb 23, 2026
7677762
Apply clang-format fixes
AMG3141 Feb 25, 2026
728eff5
Fix spelling mistake in grid.h
AMG3141 Feb 25, 2026
364e2a8
Update macroatom.cc
AMG3141 Feb 25, 2026
038420c
Fix lost changes...
AMG3141 Mar 4, 2026
defb34a
Fix error when calculating clumping factors
AMG3141 Mar 4, 2026
686ed72
Reduce number of calculations for clumping factors
AMG3141 Mar 5, 2026
d03d97e
Update update_grid.cc
AMG3141 Mar 5, 2026
f6feda0
Add check for clumping-factors.txt if they are to be read in
AMG3141 Mar 5, 2026
340b711
Merge branch 'develop' into microclumping
AMG3141 Mar 6, 2026
6fbcd1d
Remove redundant function
AMG3141 Mar 6, 2026
eee7c3c
Apply clang-tidy fix
AMG3141 Mar 6, 2026
4f55f30
Merge branch 'develop' into microclumping
AMG3141 Mar 10, 2026
9ae070d
Fix compilation for gpu
AMG3141 Mar 10, 2026
eb1a329
Rename oneoverfv -> clumpfactor
AMG3141 Mar 11, 2026
77cf234
Merge branch 'develop' into microclumping
AMG3141 Mar 18, 2026
0580850
Add clumping factors to kpkt ff, kpkt bf, nonthermal heating, nonther…
AMG3141 Mar 19, 2026
9316e01
Fix radial velocity calculation
AMG3141 Mar 19, 2026
2fb1d56
Remove unused include
AMG3141 Mar 19, 2026
7cb6d7f
Add [[maybe_unused]] attribute to clumping_factor function
AMG3141 Mar 19, 2026
614771a
Update check_mgi_is_nonempty
AMG3141 Mar 19, 2026
68b8923
Update update_grid.cc
AMG3141 Mar 20, 2026
ca137a7
Update nonthermal.cc
AMG3141 Mar 23, 2026
fc30a28
Merge branch 'develop' into microclumping
AMG3141 Mar 23, 2026
f2b2ed1
Update update_grid.cc
AMG3141 Mar 26, 2026
7059e58
Update reading clumping factors from file
AMG3141 Mar 27, 2026
00927fd
Update update_grid.cc
AMG3141 Mar 27, 2026
8d8bd5c
Cleanup
AMG3141 Mar 27, 2026
4306c85
Update update_grid.cc
AMG3141 Mar 27, 2026
7a27b9b
Update update_grid.cc
AMG3141 Mar 27, 2026
7c60728
Update sn3d.cc
AMG3141 Mar 27, 2026
f04bc83
Update update_grid.cc
AMG3141 Mar 27, 2026
b3c6201
Update update_grid.cc
AMG3141 Mar 27, 2026
4fe758d
Merge branch 'develop' into microclumping
AMG3141 Mar 27, 2026
e0a1585
Update signature of get_modelcell_mean_radial_vel
AMG3141 Mar 27, 2026
cc93982
Update grid.cc
AMG3141 Mar 27, 2026
1a779dc
Update sn3d.cc
AMG3141 Mar 27, 2026
a3f073c
Apply suggestion from @Copilot
AMG3141 Mar 27, 2026
90d9547
Merge branch 'microclumping' of github.com:artis-mcrt/artis into micr…
AMG3141 Mar 27, 2026
4156f5c
Apply clang-format fix
AMG3141 Mar 27, 2026
c555db6
Update rpkt.cc
AMG3141 Mar 28, 2026
cd1c76a
Update sn3d.cc
AMG3141 Mar 28, 2026
250c680
Change READ_CLUMPING_FACTORS_FROM_FILE to option
AMG3141 Mar 28, 2026
4ebdbd4
Apply clang-tidy fixes
AMG3141 Mar 28, 2026
3642506
Update sn3d.cc
AMG3141 Mar 28, 2026
7cf9b1e
Update artisoptions_doc.md
AMG3141 Mar 28, 2026
7941363
Small changes
AMG3141 Mar 28, 2026
3f28d1b
Update artisoptions_doc.md
AMG3141 Mar 28, 2026
3835f22
Merge branch 'microclumping' of github.com:artis-mcrt/artis into micr…
AMG3141 Mar 28, 2026
b16ac52
Last few places to apply clumping + a couple of other thiings
AMG3141 Mar 30, 2026
de2dced
Merge branch 'develop' into microclumping
AMG3141 Mar 30, 2026
9233232
Add grid::check_mgi_is_nonempty
AMG3141 Mar 30, 2026
4d6b0c9
Update how clumping factors are read in
AMG3141 Mar 30, 2026
c591795
Apply clang-tidy fix
AMG3141 Mar 30, 2026
65fffaf
Merge branch 'develop' into microclumping
AMG3141 Mar 30, 2026
9f4979c
Think about input in terms of volume filling factors
AMG3141 Mar 31, 2026
70ba5e7
Update artisoptions_doc.md
AMG3141 Mar 31, 2026
7efa654
Merge branch 'develop' into microclumping
AMG3141 Mar 31, 2026
f650739
Update update_grid.cc
AMG3141 Apr 1, 2026
17bf183
Merge branch 'microclumping' of github.com:artis-mcrt/artis into micr…
AMG3141 Apr 1, 2026
48d0f7c
Update checking of clumping factors
AMG3141 Apr 1, 2026
374cbb6
Apply clang-tidy fix
AMG3141 Apr 1, 2026
274db1a
Merge branch 'develop' into microclumping
AMG3141 Apr 2, 2026
0f42ee4
Change clumping factors file to volume filling factors file
AMG3141 Apr 2, 2026
6a7e956
Merge branch 'develop' into microclumping
AMG3141 Apr 8, 2026
08a33a9
Fix variable name
AMG3141 Apr 8, 2026
c8dcddf
Fix type of clumpfactor_allcells
AMG3141 Apr 8, 2026
73452bd
Inline grid::apply_clumping
AMG3141 Apr 8, 2026
3729fb9
Update set_clumpfactor
AMG3141 Apr 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions artisoptions_christinenonthermal.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,11 @@ constexpr auto GAMMA_THERMALISATION_SCHEME = GammaThermalisationScheme::FREQUENC

constexpr std::optional<double> GAMMA_USE_KAPPA_GREY;

constexpr bool USE_MICROCLUMPING = false;

constexpr bool READ_VOLUME_FILLING_FACTORS_FROM_FILE = false;
Copy link
Copy Markdown
Member

@lukeshingles lukeshingles Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we had eliminated the need for file I/O using the artisoptions function? Can that be removed now?


constexpr float volume_filling_factor([[maybe_unused]] double tmid, [[maybe_unused]] double rad_vel) { return 1.; }

// NOLINTEND(modernize*,misc-unused-parameters)
#endif // ARTISOPTIONS_H
6 changes: 6 additions & 0 deletions artisoptions_classic.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,11 @@ constexpr auto GAMMA_THERMALISATION_SCHEME = GammaThermalisationScheme::FREQUENC

constexpr std::optional<double> GAMMA_USE_KAPPA_GREY;

constexpr bool USE_MICROCLUMPING = false;

constexpr bool READ_VOLUME_FILLING_FACTORS_FROM_FILE = false;

constexpr float volume_filling_factor([[maybe_unused]] double tmid, [[maybe_unused]] double rad_vel) { return 1.; }

// NOLINTEND(modernize*,misc-unused-parameters)
#endif // ARTISOPTIONS_H
13 changes: 13 additions & 0 deletions artisoptions_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,17 @@ constexpr bool USE_XCOM_GAMMAPHOTOION;
// Override frequency-dependent gamma-ray opacity with a grey opacity [cm^2/g]
constexpr std::optional<double> GAMMA_USE_KAPPA_GREY;

// Use microclumping, which enhances collisional (de)excitation, collisional ionisation, collisional recombination,
// radiative recombination, collisional capture, stimulated recombination, free-free heating, free-free cooling by the
// reciprocal of the volume filling factor (the "clumping factor")
constexpr bool USE_MICROCLUMPING;

// Read the volume filling factors from a plain text file with (num timesteps) rows * (num cells) cols.
// Entries should be in (0,1] and formatted using %.6e.
// Has no effect if USE_MICROCLUMPING is set to false.
constexpr bool READ_VOLUME_FILLING_FACTORS_FROM_FILE;

// Calculate volume filling factors based on time and radial velocity
// Will be passed globals::timesteps[nts].mid and grid::get_modelcell_mean_radial_vel(mgi, globals::tmin)
constexpr float volume_filling_factor([[maybe_unused]] double tmid, [[maybe_unused]] double rad_vel) { return 1.; }
```
6 changes: 6 additions & 0 deletions artisoptions_kilonova_lte.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,11 @@ constexpr auto GAMMA_THERMALISATION_SCHEME = GammaThermalisationScheme::FREQUENC

constexpr std::optional<double> GAMMA_USE_KAPPA_GREY;

constexpr bool USE_MICROCLUMPING = false;

constexpr bool READ_VOLUME_FILLING_FACTORS_FROM_FILE = false;

constexpr float volume_filling_factor([[maybe_unused]] double tmid, [[maybe_unused]] double rad_vel) { return 1.; }

// NOLINTEND(modernize*,misc-unused-parameters)
#endif // ARTISOPTIONS_H
6 changes: 6 additions & 0 deletions artisoptions_nltenebular.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,11 @@ constexpr auto GAMMA_THERMALISATION_SCHEME = GammaThermalisationScheme::FREQUENC

constexpr std::optional<double> GAMMA_USE_KAPPA_GREY;

constexpr bool USE_MICROCLUMPING = false;

constexpr bool READ_VOLUME_FILLING_FACTORS_FROM_FILE = false;

constexpr float volume_filling_factor([[maybe_unused]] double tmid, [[maybe_unused]] double rad_vel) { return 1.; }

// NOLINTEND(modernize*,misc-unused-parameters)
#endif // ARTISOPTIONS_H
6 changes: 6 additions & 0 deletions artisoptions_nltephotospheric_dynamic_ion_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,11 @@ constexpr auto GAMMA_THERMALISATION_SCHEME = GammaThermalisationScheme::FREQUENC

constexpr std::optional<double> GAMMA_USE_KAPPA_GREY;

constexpr bool USE_MICROCLUMPING = false;

constexpr bool READ_VOLUME_FILLING_FACTORS_FROM_FILE = false;

constexpr float volume_filling_factor([[maybe_unused]] double tmid, [[maybe_unused]] double rad_vel) { return 1.; }

// NOLINTEND(modernize*,misc-unused-parameters)
#endif // ARTISOPTIONS_H
6 changes: 6 additions & 0 deletions artisoptions_nltewithoutnonthermal.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,11 @@ constexpr auto GAMMA_THERMALISATION_SCHEME = GammaThermalisationScheme::FREQUENC

constexpr std::optional<double> GAMMA_USE_KAPPA_GREY;

constexpr bool USE_MICROCLUMPING = false;

constexpr bool READ_VOLUME_FILLING_FACTORS_FROM_FILE = false;

constexpr float volume_filling_factor([[maybe_unused]] double tmid, [[maybe_unused]] double rad_vel) { return 1.; }

// NOLINTEND(modernize*,misc-unused-parameters)
#endif // ARTISOPTIONS_H
46 changes: 45 additions & 1 deletion grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,11 @@ void allocate_nonemptymodelcells() {
kappagrey_allcells = MPI_shared_array<float>(nonempty_npts_model, 0.);
grey_depth_allcells = MPI_shared_array<float>(nonempty_npts_model, 0.);
thick_allcells = MPI_shared_array<int>(nonempty_npts_model, 0);
const auto modelgrid_mem_usage = nonempty_npts_model * ((sizeof(float) * 9) + sizeof(double) + sizeof(int));
if constexpr (USE_MICROCLUMPING) {
clumpfactor_allcells = MPI_shared_array<float>(nonempty_npts_model, -1.);
}
const auto modelgrid_mem_usage =
nonempty_npts_model * ((sizeof(float) * (USE_MICROCLUMPING ? 10 : 9)) + sizeof(double) + sizeof(int));
printlnlog(
"[info] mem_usage: the modelgrid properties (temperatures and electron densities) occupies {:.3f} MB (node "
"shared memory)",
Expand Down Expand Up @@ -1506,6 +1510,18 @@ auto get_rho_tmin(const int modelgridindex) -> float { return modelgrid_input[mo
return nne_allcells[nonemptymgi];
}

[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_clumpfactor(const int nonemptymgi) -> float {
assert_testmodeonly(nonemptymgi >= 0);
assert_testmodeonly(nonemptymgi < get_nonempty_npts_model());

if constexpr (USE_MICROCLUMPING) {
assert_testmodeonly(std::isfinite(clumpfactor_allcells[nonemptymgi]) && clumpfactor_allcells[nonemptymgi] >= 1.F);
return clumpfactor_allcells[nonemptymgi];
}

return 1.;
}

[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_nnetot(const int nonemptymgi) -> float {
assert_testmodeonly(nonemptymgi >= 0);
assert_testmodeonly(nonemptymgi < get_nonempty_npts_model());
Expand All @@ -1522,6 +1538,16 @@ auto get_rho_tmin(const int modelgridindex) -> float { return modelgrid_input[mo
return modelgrid_input[modelgridindex].initial_radial_pos_sum * tratmid / assoc_cells;
}

[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_modelcell_mean_radial_vel(const int modelgridindex, const double tmin)
-> double {
// TODO: both versions give the same thing. uncommented one should give ever so slightly better performance

const int assoc_cells = grid::get_numpropcells(modelgridindex);
return modelgrid_input[modelgridindex].initial_radial_pos_sum / tmin / assoc_cells;
// ---------------
// return get_modelcell_mean_radial_pos(modelgridindex, tratmid) / tmid;
}

Comment on lines +1541 to +1550
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivial function used only once. Inline at the call site.

// mass fraction of an element (all isotopes combined)
[[gnu::pure]] [[nodiscard]] auto get_elem_abundance(const std::ptrdiff_t nonemptymgi, const int element) -> float {
const auto massfrac = elem_massfracs_allcells[(nonemptymgi * get_nelements()) + element];
Expand Down Expand Up @@ -1579,6 +1605,12 @@ void set_nne(const int nonemptymgi, const float nne) {
nne_allcells[nonemptymgi] = nne;
}

void set_clumpfactor(const int nonemptymgi, const float clumpfactor) {
assert_testmodeonly(USE_MICROCLUMPING);
assert_always(std::isfinite(clumpfactor) && clumpfactor >= 1);
clumpfactor_allcells[nonemptymgi] = clumpfactor;
}

// Calculate and set the total density of electrons (free and bound) in grid cell. These are targets for Compton
// scattering of gamma rays
void set_nnetot(const int nonemptymgi) {
Expand Down Expand Up @@ -1678,6 +1710,18 @@ DEVICE_FUNC auto get_modelgridtype() -> GridType {
return nonemptymgi;
}

// Check if cell with index `mgi` is a non-empty cell
// If the cell is non-empty will return `true` and `nonemptymgi` will be set accordingly, otherwise returns `false` and
// `nonemptymgi` is set to -1
[[nodiscard]] DEVICE_FUNC auto check_mgi_is_nonempty(const int mgi, int& nonemptymgi) -> bool {
assert_testmodeonly(get_nonempty_npts_model() > 0);
assert_testmodeonly(mgi >= 0);
assert_testmodeonly(mgi < get_npts_model());

nonemptymgi = nonemptymgi_of_mgi[mgi];
return nonemptymgi >= 0;
}

Comment on lines +1716 to +1724
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other parts of the code check if a cell is non-empty using the expression: grid::get_numpropcells(mgi) > 0

// get the index in the list of non-empty cells for a given model grid cell
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_mgi_of_nonemptymgi(const ptrdiff_t nonemptymgi) -> int {
assert_testmodeonly(get_nonempty_npts_model() > 0);
Expand Down
5 changes: 5 additions & 0 deletions grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ inline MPI_shared_array<float> kappagrey_allcells;
inline MPI_shared_array<float> grey_depth_allcells; // Grey optical depth to surface of the modelgridcell
inline MPI_shared_array<int>
thick_allcells; // whether the cell is optically thick (1) or not (0), or (2) thick for vpkts only
inline MPI_shared_array<float> clumpfactor_allcells;

inline ptrdiff_t ngrid{0};

Expand Down Expand Up @@ -52,6 +53,7 @@ void set_elements_uppermost_ion(int nonemptymgi, int element, int uppermost_ion)
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_ffegrp(int modelgridindex) -> float;
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_modelcell_mean_radial_pos(int modelgridindex, double tratmid)
-> double;
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_modelcell_mean_radial_vel(int modelgridindex, double tmin) -> double;
void set_elem_abundance(std::ptrdiff_t nonemptymgi, int element, float newabundance);
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_elem_numberdens(std::ptrdiff_t nonemptymgi, int element) -> double;
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_initenergyq(int modelgridindex) -> double;
Expand All @@ -78,6 +80,7 @@ void set_element_meanweight(std::ptrdiff_t nonemptymgi, int element, float meanw
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_numpropcells(int modelgridindex) -> int;
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_nonemptymgi_of_mgi(int mgi) -> int;
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_mgi_of_nonemptymgi(std::ptrdiff_t nonemptymgi) -> int;
[[nodiscard]] DEVICE_FUNC auto check_mgi_is_nonempty(int mgi, int& nonemptymgi) -> bool;
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_modelgridtype() -> GridType;
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_npts_model() -> int;
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_nonempty_npts_model() -> int;
Expand All @@ -95,6 +98,8 @@ void write_grid_restart_data(int timestep);
[[nodiscard]] auto get_propcell_random_position_tmin(int cellindex) -> Vec3d;
[[nodiscard]] DEVICE_FUNC auto boundary_distance(const Vec3d& dir, const Vec3d& pos, double tstart, int cellindex)
-> std::tuple<double, int>;
void set_clumpfactor(int nonemptymgi, float clumpfactor);
[[gnu::pure]] [[nodiscard]] DEVICE_FUNC auto get_clumpfactor(int nonemptymgi) -> float;

[[nodiscard]] auto calculate_cell_kappagrey(int nonemptymgi) -> float;

Expand Down
27 changes: 16 additions & 11 deletions kpkt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ auto calculate_cooling_rates_ion(const int nonemptymgi, const int element, const
double* const C_exc, double* const C_ionisation) -> double {
const auto nne = grid::get_nne(nonemptymgi);
const auto T_e = grid::get_Te(nonemptymgi);
const float clumpfactor = grid::get_clumpfactor(nonemptymgi);

double C_ion = 0.;
[[maybe_unused]] int i = 0; // NOLINT(misc-const-correctness)
Expand All @@ -63,7 +64,7 @@ auto calculate_cooling_rates_ion(const int nonemptymgi, const int element, const
const int ioncharge = get_ionstage(element, ion) - 1;
if (ioncharge > 0) {
const double C_ff_ion = 1.426e-27 * sqrt(T_e) * pow(ioncharge, 2) * nncurrention * nne;
C_ion += C_ff_ion;
C_ion += C_ff_ion * clumpfactor;

if constexpr (update_cellcache_contribs) {
ion_contribs[i] = C_ion;
Expand Down Expand Up @@ -93,9 +94,10 @@ auto calculate_cooling_rates_ion(const int nonemptymgi, const int element, const
const int upper = globals::alltrans.targetlevelindex[alltransindex];
const double epsilon_trans = epsilon(ionuniquelevelindexstart + upper) - epsilon_current;
const auto upper_statweight = stat_weight(ionuniquelevelindexstart + upper);
const double C = nnlevel *
col_excitation_ratecoeff(T_e, nne, upper_statweight, alltransindex, epsilon_trans, statweight) *
epsilon_trans;
const double C =
nnlevel *
col_excitation_ratecoeff(T_e, nne, upper_statweight, alltransindex, epsilon_trans, statweight, clumpfactor) *
epsilon_trans;
C_ion += C;
if constexpr (!update_cellcache_contribs) {
*C_exc += C;
Expand Down Expand Up @@ -126,9 +128,10 @@ auto calculate_cooling_rates_ion(const int nonemptymgi, const int element, const
const int upper = get_phixsupperlevel(uniquelevelindex, phixstargetindex);
const double epsilon_upper = epsilon(element, ion + 1, upper);
const double epsilon_trans = epsilon_upper - epsilon_current;
const double C = nnlevel *
col_ionisation_ratecoeff(T_e, nne, element, ion, level, phixstargetindex, epsilon_trans) *
epsilon_trans;
const double C =
nnlevel *
col_ionisation_ratecoeff(T_e, nne, element, ion, level, phixstargetindex, epsilon_trans, clumpfactor) *
epsilon_trans;

C_ion += C;
if constexpr (update_cellcache_contribs) {
Expand Down Expand Up @@ -159,7 +162,7 @@ auto calculate_cooling_rates_ion(const int nonemptymgi, const int element, const
return nnupperion;
}();
const double C = get_bfcoolingcoeff(element, ion, level, phixstargetindex, T_e) * pop * nne;
C_ion += C;
C_ion += C * clumpfactor;

if constexpr (update_cellcache_contribs) {
ion_contribs[i] = C_ion;
Expand Down Expand Up @@ -479,6 +482,7 @@ DEVICE_FUNC void do_kpkt(Packet& pkt, const double t2, const int nts) {
} else if (rndcoolingtype == CoolingType::COLLEXC) {
// the k-packet activates a macro-atom due to collisional excitation
const float nne = grid::get_nne(nonemptymgi);
const float clumpfactor = grid::get_clumpfactor(nonemptymgi);

// if the previous entry belongs to the same ion, then pick up the cumulative sum from
// the previous entry, otherwise start from zero
Expand All @@ -500,9 +504,10 @@ DEVICE_FUNC void do_kpkt(Packet& pkt, const double t2, const int nts) {
const auto upperuniquelevelindex = ionuniquelevelindexstart + tmpupper;
const double epsilon_trans = epsilon(upperuniquelevelindex) - epsilon_current;
const auto upper_statweight = stat_weight(upperuniquelevelindex);
const double C = nnlevel *
col_excitation_ratecoeff(T_e, nne, upper_statweight, alltransindex, epsilon_trans, statweight) *
epsilon_trans;
const double C =
nnlevel *
col_excitation_ratecoeff(T_e, nne, upper_statweight, alltransindex, epsilon_trans, statweight, clumpfactor) *
epsilon_trans;
contrib += C;
if (contrib > rndcool_ion_process) {
upper = tmpupper;
Expand Down
Loading
Loading