Skip to content

Instantly share code, notes, and snippets.

View rezamarzban's full-sized avatar
🎯
Focusing

rezamarzban

🎯
Focusing
View GitHub Profile
@rezamarzban
rezamarzban / xfemm_mfemm.ipynb
Created January 7, 2026 17:18
xfemm_mfemm.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rezamarzban
rezamarzban / n52.ipynb
Last active January 8, 2026 14:17
N52.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rezamarzban
rezamarzban / optconicalnl.ipynb
Created December 27, 2025 12:07
OptConicalNL.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import ellipk, ellipe
from scipy.integrate import quad
# --- 1. Physical Constants & Parameters ---
mu0 = 4 * np.pi * 1e-7 # Permeability of free space
mu_r = 2000 # Relative permeability
n = 1000 # Turns per meter
I = 1 # Current in A
import numpy as np
from scipy.special import ellipk, ellipe
import matplotlib.pyplot as plt
# Constants (normalized: mu0=1, I=1, a=1 for simplicity)
mu0 = 1.0
I = 1.0
a = 1.0
d = 0.01 # Small d to see changes with large n
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import ellipk, ellipe
def single_loop_B(rho, z, R, I, mu0):
alpha2 = (R + rho)**2 + z**2
beta2 = (R - rho)**2 + z**2
# avoid k2=1 exactly or k2 close to 1 leading to large errors
k2 = 1 - beta2 / alpha2
k2 = np.clip(k2, 0, 1-1e-10)
@rezamarzban
rezamarzban / VSWR.py
Last active December 11, 2025 11:32
Local vswr
import cmath
import math
# Define the chain as a simple list of tuples: ('type', value, 'unit')
# Types: 'R' for resistor, 'L' for inductor, 'C' for capacitor, 'Source' for AC Source
# Units for R/Source: 'ohm', 'kohm', 'mohm'
# Units for L: 'nH', 'uH', 'mH', 'H'
# Units for C: 'fF', 'pF', 'nF', 'uF', 'F'
# Example (AC Source with 0 impedance included as first element):
chain = [
@rezamarzban
rezamarzban / mag_tube_anode.ipynb
Created November 14, 2025 06:14
Mag_tube_anode.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rezamarzban
rezamarzban / mag.py
Created November 7, 2025 05:29
Hull split-anode design, Pulse width: 0.56 μs (time to reach $V_{bd}$). Off time: 50 μs. Duty cycle: 1.1%, 1 mm glass coating, conservative thermal limits
import math
import numpy as np
import matplotlib.pyplot as plt
# Constants
epsilon_0 = 8.85e-12 # F/m (vacuum permittivity)
mu_0 = 4 * math.pi * 1e-7 # H/m (vacuum permeability)
k_glass = 1.0 # W/m·K (thermal conductivity of glass)
epsilon_r = 5.0 # relative permittivity of glass
delta_T_max = 50.0 # Maximum temperature rise (°C)
@rezamarzban
rezamarzban / rlc.ipynb
Last active October 28, 2025 06:48
rlc.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.