Skip to content

Commit

Permalink
Sync changes from #53 except for binding_energy related
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Mar 27, 2024
1 parent 9a9075d commit 6ef47c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ltepop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ static auto find_uppermost_ion(const int modelgridindex, const int element, cons
int uppermost_ion = 0;

uppermost_ion = nions - 1;
if (!force_lte) {
if (!use_lte) {
for (int ion = 0; ion < nions - 1; ion++) {
if (iongamma_is_zero(nonemptymgi, element, ion) &&
(!NT_ON || ((globals::dep_estimator_gamma[nonemptymgi] == 0.) &&
Expand Down Expand Up @@ -504,8 +504,10 @@ void set_groundlevelpops(const int modelgridindex, const int element, const floa
/// calculate number density of the current element (abundances are given by mass)
const double nnelement = grid::get_elem_numberdens(modelgridindex, element);

const bool use_phi_lte = force_lte || FORCE_SAHA_ION_BALANCE(get_atomicnumber(element));

const auto ionfractions =
(nnelement > 0) ? calculate_ionfractions(element, modelgridindex, nne, force_lte) : std::vector<double>();
(nnelement > 0) ? calculate_ionfractions(element, modelgridindex, nne, use_phi_lte) : std::vector<double>();

const int uppermost_ion = static_cast<int>(ionfractions.size() - 1);

Expand Down
3 changes: 3 additions & 0 deletions nltepop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,9 @@ void nltepop_write_to_file(const int modelgridindex, const int timestep) {
// timestep, n, grid::get_TR(n), grid::get_Te(n), grid::get_W(n), grid::get_TJ(n), grid::get_nne(n));

for (int element = 0; element < get_nelements(); element++) {
if (!elem_has_nlte_levels(element)) {
continue;
}
const int nions = get_nions(element);
const int atomic_number = get_atomicnumber(element);

Expand Down
2 changes: 1 addition & 1 deletion update_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ void solve_Te_nltepops(const int mgi, const int nonemptymgi, const int nts, cons
// population change))
double fracdiff_nne = 0.;
for (int element = 0; element < get_nelements(); element++) {
if (get_nions(element) > 0) {
if (get_nions(element) > 0 && elem_has_nlte_levels(element)) {
solve_nlte_pops_element(element, mgi, nts, nlte_iter);
calculate_cellpartfuncts(mgi, element);
}
Expand Down

0 comments on commit 6ef47c1

Please sign in to comment.