Skip to content

Commit

Permalink
Improve loop order over cells in source term update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis Teunissen committed Jun 3, 2024
1 parent df79650 commit edeaa09
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/m_fluid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -445,16 +445,21 @@ subroutine add_source_terms(box, dt, n_vars, i_cc, s_deriv, s_out, n_dt, dt_lim,
box%cc(IJK, i_electron_energy+s_out) = box%cc(IJK, i_electron_energy+s_out) &
+ dt * (gain - loss_rate * box%cc(IJK, i_electron+s_out))
end if
end do; CLOSE_DO

do n = n_gas_species+1, n_species
iv = species_itree(n)
do n = n_gas_species+1, n_species
ix = 0
iv = species_itree(n)
do KJI_DO(1,nc)
ix = ix + 1
if (.not. mask(IJK)) cycle
box%cc(IJK, iv+s_out) = box%cc(IJK, iv+s_out) + dt * derivs(ix, n)
end do
end do; CLOSE_DO
end do; CLOSE_DO
end do

tmp = maxval(mean_energies)
if (tmp > 0) then
if (model_has_energy_equation) then
! Set time step restriction for energy loss
tmp = maxval(mean_energies)
dt_lim(2) = tmp/LT_get_col(td_ee_tbl, td_ee_loss, tmp)
end if

Expand Down

0 comments on commit edeaa09

Please sign in to comment.