Skip to content

Commit

Permalink
[plasma] Add 'discretized' to function name
Browse files Browse the repository at this point in the history
  • Loading branch information
BangShiuh authored and speth committed Apr 23, 2022
1 parent 033f9f1 commit 3d7d06e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
13 changes: 7 additions & 6 deletions include/cantera/thermo/PlasmaPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Cantera
* where \f$ x = 1 \f$ and \f$ x = 2 \f$ correspond to the Maxwellian and
* Druyvesteyn (default) electron energy distribution, respectively.
* \f$ \epsilon_m = 3/2 T_e \f$ [eV] (mean electron energy). The second
* method uses setElectronEnergyDistribution() to manually set electron
* method uses setDiscretizedElectronEnergyDist() to manually set electron
* energy distribution and calculate electron temperature from mean electron
* energy, which is calculated as [3],
* \f[
Expand Down Expand Up @@ -107,14 +107,15 @@ class PlasmaPhase: public IdealGasPhase
Eigen::Map<Eigen::ArrayXd>(levels, m_nPoints) = m_electronEnergyLevels;
}

//! Set electron energy distribution.
//! Set discretized electron energy distribution.
//! @param levels The vector of electron energy levels (eV).
//! Length: #m_nPoints.
//! @param distrb The vector of electron energy distribution.
//! @param length The length of \p levels and \p distrb
void setElectronEnergyDistribution(const double* levels,
const double* distrb,
size_t length);
//! Length: #m_nPoints.
//! @param length The length of the vectors, which equals #m_nPoints.
void setDiscretizedElectronEnergyDist(const double* levels,
const double* distrb,
size_t length);

//! Get electron energy distribution.
//! @param distrb The vector of electron energy distribution.
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/_cantera.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ cdef extern from "cantera/thermo/PlasmaPhase.h":
void setElectronTemperature(double) except +translate_exception
void setElectronEnergyLevels(double*, size_t) except +translate_exception
void getElectronEnergyLevels(double*)
void setElectronEnergyDistribution(double*, double*, size_t) except +translate_exception
void setDiscretizedElectronEnergyDist(double*, double*, size_t) except +translate_exception
void getElectronEnergyDistribution(double*)
void setIsotropicShapeFactor(double) except +translate_exception
void setElectronEnergyDistributionType(const string&) except +translate_exception
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/test/test_thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ def test_discretized_electron_energy_distribution(self):
dist = np.array([0.0, 0.9, 0.01])
self.phase.normalize_electron_energy_distribution_enabled = False
self.phase.quadrature_method = "trapezoidal"
self.phase.set_electron_energy_distribution(levels, dist)
self.phase.set_discretized_electron_energy_distribution(levels, dist)
self.assertArrayNear(levels, self.phase.electron_energy_levels)
self.assertArrayNear(dist, self.phase.electron_energy_distribution)
mean_energy = 2.0 / 5.0 * np.trapz(dist, np.power(levels, 5./2.))
Expand Down
8 changes: 4 additions & 4 deletions interfaces/cython/cantera/thermo.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ cdef class ThermoPhase(_SolutionBase):
f'thermo model: {self.thermo_model}.')
self.plasma.setElectronTemperature(value)

def set_electron_energy_distribution(self, levels, distribution):
def set_discretized_electron_energy_distribution(self, levels, distribution):
"""
Set electron energy distribution. When this method is used, electron
temperature is calculated from the distribution.
Expand All @@ -1819,9 +1819,9 @@ cdef class ThermoPhase(_SolutionBase):
cdef np.ndarray[np.double_t, ndim=1] data_dist = \
np.ascontiguousarray(distribution, dtype=np.double)

self.plasma.setElectronEnergyDistribution(&data_levels[0],
&data_dist[0],
len(levels))
self.plasma.setDiscretizedElectronEnergyDist(&data_levels[0],
&data_dist[0],
len(levels))

property n_electron_energy_levels:
""" Number of electron energy levels """
Expand Down
8 changes: 4 additions & 4 deletions src/thermo/PlasmaPhase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void PlasmaPhase::checkElectronEnergyDistribution() const
}
}

void PlasmaPhase::setElectronEnergyDistribution(const double* levels,
void PlasmaPhase::setDiscretizedElectronEnergyDist(const double* levels,
const double* dist,
size_t length)
{
Expand Down Expand Up @@ -212,9 +212,9 @@ void PlasmaPhase::setParameters(const AnyMap& phaseNode, const AnyMap& rootNode)
if (eedf.hasKey("normalize")) {
enableNormalizeElectronEnergyDist(eedf["normalize"].asBool());
}
setElectronEnergyDistribution(eedf["energy-levels"].asVector<double>().data(),
eedf["distribution"].asVector<double>().data(),
eedf["energy-levels"].asVector<double>().size());
setDiscretizedElectronEnergyDist(eedf["energy-levels"].asVector<double>().data(),
eedf["distribution"].asVector<double>().data(),
eedf["energy-levels"].asVector<double>().size());
}
}
}
Expand Down

0 comments on commit 3d7d06e

Please sign in to comment.