Coverage for src/hallmd/models/cathode.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-02-20 20:43 +0000

1"""Module for cathode models. 

2 

3Includes: 

4 

5- `cathode_coupling()` - cathode coupling model with pressure dependence (Jorns 2021) 

6""" 

7import numpy as np 

8from amisc.typing import Dataset 

9 

10from hallmd.utils import TORR_2_PA 

11 

12__all__ = ['cathode_coupling'] 

13 

14 

15def cathode_coupling(inputs: Dataset) -> Dataset: 

16 """Computes cathode coupling voltage dependence on background pressure. 

17 

18 :param inputs: input arrays - `P_b`, `V_a`, `T_e`, `V_vac`, `Pstar`, `P_T` for background pressure (Torr), discharge 

19 voltage (V), electron temperature (eV), vacuum coupling voltage (V), and model parameters P* (Torr) 

20 and P_T (Torr). 

21 :returns outputs: output arrays - `V_cc` for cathode coupling voltage (V). 

22 """ 

23 # Load inputs 

24 PB = inputs['P_b'] * TORR_2_PA # Background Pressure (Torr) 

25 Va = inputs['V_a'] # Anode voltage (V) 

26 Te = inputs['T_e'] # Electron temperature at the cathode (eV) 

27 V_vac = inputs['V_vac'] # Vacuum coupling voltage model parameter (V) 

28 Pstar = inputs['Pstar'] * TORR_2_PA # Model parameter P* (Torr) 

29 PT = inputs['P_T'] * TORR_2_PA # Model parameter P_T (Torr) 

30 

31 # Compute cathode coupling voltage 

32 V_cc = np.atleast_1d(V_vac + Te * np.log(1 + PB / PT) - (Te / (PT + Pstar)) * PB) 

33 V_cc[V_cc < 0] = 0 

34 ind = np.where(V_cc > Va) 

35 V_cc[ind] = np.atleast_1d(Va)[ind] 

36 return {'V_cc': V_cc}