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

18 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-19 21:56 +0000

1"""Module for cathode models. 

2 

3Includes: 

4 

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

6""" 

7from typing import cast 

8 

9import numpy as np 

10from pem_core.constants import TORR_2_PA 

11from pem_core.types import Dataset 

12 

13__all__ = ['cathode_coupling'] 

14 

15 

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

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

18 

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

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

21 and P_T (Torr). 

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

23 """ 

24 input_dict = cast(dict, inputs) 

25 # Load inputs 

26 PB = input_dict['P_b'] * TORR_2_PA # Background Pressure (Torr) 

27 Va = input_dict['V_a'] # Anode voltage (V) 

28 Te = input_dict['T_e'] # Electron temperature at the cathode (eV) 

29 V_vac = input_dict['V_vac'] # Vacuum coupling voltage model parameter (V) 

30 Pstar = input_dict['Pstar'] * TORR_2_PA # Model parameter P* (Torr) 

31 PT = input_dict['P_T'] * TORR_2_PA # Model parameter P_T (Torr) 

32 

33 # Compute cathode coupling voltage 

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

35 V_cc[V_cc < 0] = 0 

36 ind = np.where(V_cc > Va) 

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

38 return cast(Dataset, {'V_cc': V_cc})