Skip to content

Commit

Permalink
Merge pull request #802 from vg3095/plasma_ion_fix
Browse files Browse the repository at this point in the history
Fix for PR #801
  • Loading branch information
wkerzendorf committed Nov 10, 2017
2 parents efcc374 + ac8e671 commit 37c4ebf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
16 changes: 0 additions & 16 deletions tardis/plasma/properties/ion_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,20 +349,4 @@ def calculate(self, phi, partition_function, number_density,
1].sum(axis=0))
ion_number_density.ix[2].ix[2].update(helium_population_updated.ix[
2].ix[0])
ion_numbers = ion_number_density.index.get_level_values(1).values
ion_numbers = ion_numbers.reshape((ion_numbers.shape[0], 1))
new_n_electron = (ion_number_density.values * ion_numbers).sum(
axis=0)
if np.any(np.isnan(new_n_electron)):
raise PlasmaIonizationError('n_electron just turned "nan" -'
' aborting')
n_electron_iterations += 1
if n_electron_iterations > 100:
logger.warn('n_electron iterations above 100 ({0}) -'
' something is probably wrong'.format(
n_electron_iterations))
if np.all(np.abs(new_n_electron - n_electron)
/ n_electron < n_e_convergence_threshold):
break
n_electron = 0.5 * (new_n_electron + n_electron)
return ion_number_density, n_electron, helium_population_updated
3 changes: 2 additions & 1 deletion tardis/plasma/standard_plasmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
JBluesDetailed,
RadiationFieldCorrection,
StimulatedEmissionFactor,
HeliumNumericalNLTE)
HeliumNumericalNLTE,
IonNumberDensity)

logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 37c4ebf

Please sign in to comment.