| 44 | } |
| 45 | |
| 46 | int EEDFTwoTermApproximation::calculateDistributionFunction() |
| 47 | { |
| 48 | if (m_first_call) { |
| 49 | initSpeciesIndexCrossSections(); |
| 50 | m_first_call = false; |
| 51 | } |
| 52 | |
| 53 | updateMoleFractions(); |
| 54 | updateCrossSections(); |
| 55 | |
| 56 | if (!m_has_EEDF) { |
| 57 | writelog("No existing EEDF. Using first guess method: {}\n", m_firstguess); |
| 58 | if (m_firstguess == "maxwell") { |
| 59 | writelog("First guess EEDF maxwell\n"); |
| 60 | for (size_t j = 0; j < m_points; j++) { |
| 61 | m_f0(j) = 2.0 * pow(1.0 / Pi, 0.5) * pow(m_init_kTe, -3. / 2.) * |
| 62 | exp(-m_gridCenter[j] / m_init_kTe); |
| 63 | } |
| 64 | } else { |
| 65 | throw CanteraError("EEDFTwoTermApproximation::calculateDistributionFunction", |
| 66 | " unknown EEDF first guess"); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | converge(m_f0); |
| 71 | |
| 72 | // write the EEDF at grid edges |
| 73 | vector<double> f(m_f0.data(), m_f0.data() + m_f0.rows() * m_f0.cols()); |
| 74 | vector<double> x(m_gridCenter.data(), m_gridCenter.data() + m_gridCenter.rows() * m_gridCenter.cols()); |
| 75 | for (size_t i = 0; i < m_points + 1; i++) { |
| 76 | m_f0_edge[i] = linearInterp(m_gridEdge[i], x, f); |
| 77 | } |
| 78 | |
| 79 | m_has_EEDF = true; |
| 80 | |
| 81 | // update electron mobility |
| 82 | m_electronMobility = electronMobility(m_f0); |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | void EEDFTwoTermApproximation::converge(Eigen::VectorXd& f0) |
| 87 | { |
no test coverage detected