Files

65 lines
1.7 KiB
Python

# gui1d/test_run.py
from solve_1d import build_and_solve_1d
import numpy as np
print("Running test sweep comparison up to 300V...")
steps = [
{
'enabled': True,
'type': 'p',
'dopant': 'Boron',
'method': 'Implant',
'surface': 'Top',
'energy': 80.0,
'dose': 1e12,
'temp': 1000.0,
'time': 60.0
}
]
try:
print("\n--- Solving case 1: Basic (Drift-Diffusion only) ---")
res_basic = build_and_solve_1d(
bias_target=300.0,
substrate_type='n',
substrate_doping=1e14,
length=30.0,
process_steps=steps,
enable_avalanche=False,
enable_btbt=False
)
print(f"Basic Solved Bias: {res_basic['v_solved']} V, Current Density: {res_basic['current_density']:.4e} A/cm^2")
print("\n--- Solving case 2: Avalanche-only ---")
res_av = build_and_solve_1d(
bias_target=300.0,
substrate_type='n',
substrate_doping=1e14,
length=30.0,
process_steps=steps,
enable_avalanche=True,
enable_btbt=False
)
print(f"Avalanche Solved Bias: {res_av['v_solved']} V, Current Density: {res_av['current_density']:.4e} A/cm^2")
print("\n--- Solving case 3: BTBT-only ---")
res_btbt = build_and_solve_1d(
bias_target=300.0,
substrate_type='n',
substrate_doping=1e14,
length=30.0,
process_steps=steps,
enable_avalanche=False,
enable_btbt=True
)
print(f"BTBT Solved Bias: {res_btbt['v_solved']} V, Current Density: {res_btbt['current_density']:.4e} A/cm^2")
print("\nAll comparison runs finished successfully!")
except Exception as e:
print("Test failed with error:")
import traceback
traceback.print_exc()