Skip to content

Conversation

@jackieyao0114
Copy link
Collaborator

@jackieyao0114 jackieyao0114 commented Sep 3, 2025

This PR implemented lumped circuit components (inductor L, resistor R, and capacitor C) solving.
The R, L and/or C are added on top of the physical materials & structures . The contribution of these lumped elements to current density J is added into Ampere's law:

curl(H) = J_R + J_L + J_C + sigma*E + epsilon*dE/dt

Lumped resistor is verified by a R-terminated microstrip transmission line (https://chemandy.com/calculators/microstrip-transmission-line-calculator.htm). The input file is


################################
####### GENERAL PARAMETERS ######
#################################
max_step = 200000

amr.n_cell = n_cellx n_celly n_cellz
amr.max_grid_size = max_grid_sizex max_grid_sizey max_grid_sizez
amr.blocking_factor = blocking_factor
amr.refine_grid_layout = 1  # if n_MPI > n_grids, the grids will be successively divided in half until n_MPI <= n_grids

geometry.dims = 3
geometry.prob_lo = prob_lox prob_loy prob_loz
geometry.prob_hi = prob_hix prob_hiy prob_hiz

amr.max_level = 0

# use pec instead of pml overlaying current source so you don't get a reflection
boundary.field_lo = pml pml pec
boundary.field_hi = pml pml pml

#################################
############ NUMERICS ###########
#################################
warpx.verbose = 1

warpx.cfl = 0.8

# ESSENTIAL! This extends PEC metal lines into the PML region to avoid artificial reflections.
warpx.Apply_E_excitation_in_pml_region=1

# vacuum or macroscopic
algo.em_solver_medium = macroscopic

# laxwendroff or backwardeuler
algo.macroscopic_sigma_method = laxwendroff

######################## IMPORTANT ######################
# the resistor and capcitor flag belongs to warpx class
warpx.use_lumped_resistor = 1
warpx.use_lumped_capacitor = 0
#########################################################

################ IMPORTANT ##############
# the inductor flag belongs to algo class
algo.use_lumped_inductor = 0
#########################################

#################################
############ STRUCTURE ###########
#################################

my_constants.h_si = 0.5e-3
my_constants.W_metal = 2.0e-3
my_constants.length = 100.0e-3

######################################################################
####### resistor and capacitor belongs to macroscopic class ##########
######################################################################
macroscopic.lumped_resistor_x_function(x,y,z) = "0."
macroscopic.lumped_resistor_y_function(x,y,z) = "0."
macroscopic.lumped_resistor_z_function(x,y,z) = "10.0 * (z >= 0) * (z < h_si) * (y > length-ddy) * (y < length+ddy) * (x < ddx) * (x > - ddx)"
# total inductance devided by number of cells in the z direction

macroscopic.epsilon_function(x,y,z) = "eps_0 + eps_0 * (eps_r_si - 1.) * (z <= h_si)"

macroscopic.mu_function(x,y,z) = "mu_0 + mu_0 * (mu_r_test - 1.) * (z > h_si ) * (z < h_si + dz) * (y < length + ddy)  * (x < W_metal/2 + ddx) * (x > -W_metal/2 - ddx)"

###############
# excitation
###############

warpx.E_excitation_on_grid_style = parse_E_excitation_grid_function

warpx.Ex_excitation_flag_function(x,y,z) = "flag_hs * (z > h_si - ddz) * (z < h_si + ddz) *
                                           (y < length + ddy)  * (x < W_metal/2 + ddx) * (x > -W_metal/2 - ddx)"

warpx.Ey_excitation_flag_function(x,y,z) = "flag_hs * (z > h_si - ddz) * (z < h_si + ddz) *
                                           (y < length + ddy)  * (x < W_metal/2 + ddx) * (x > -W_metal/2 - ddx)"
warpx.Ez_excitation_flag_function(x,y,z) = "flag_ss * (z >= 0) * (z < h_si) * (y > dy-ddy) * (y < dy+ddy) * (x < ddx) * (x > - ddx)"

# This is a source on a qubit control line
warpx.Ex_excitation_grid_function(x,y,z,t) = "0."
warpx.Ey_excitation_grid_function(x,y,z,t) = "0."
warpx.Ez_excitation_grid_function(x,y,z,t) = "exp(-(t-3*TP)**2/(2*TP**2))*sin(2*pi*freq*t)"


###############
# material properties
###############
my_constants.sigma_0 = 0.0
my_constants.sigma_si = 0.0
my_constants.sigma_metal = 1.e11

my_constants.eps_0 = 8.8541878128e-12
my_constants.eps_r_si = 3.0

my_constants.mu_0 = 1.25663706212e-06
my_constants.mu_r_si = 1.0
my_constants.mu_r_test = 0.999999

###############
# domain size
# n_cellx/y/z and Lx/y/z are needed to calculate dx/dy/dz
###############
my_constants.n_cellx = 100
my_constants.n_celly = 1200
my_constants.n_cellz = 40

my_constants.dx = 0.1e-3
my_constants.dy = 0.1e-3
my_constants.dz = 0.05e-3

# grid spacing
my_constants.dx = Lx / n_cellx
my_constants.dy = Ly / n_celly
my_constants.dz = Lz / n_cellz

my_constants.ddx = dx/1.e6
my_constants.ddy = dy/1.e6
my_constants.ddz = dz/1.e6

my_constants.max_grid_sizex = 50
my_constants.max_grid_sizey = 600
my_constants.max_grid_sizez = 40
my_constants.blocking_factor = 1

my_constants.prob_lox = -5.0e-3
my_constants.prob_loy = 0.0e-3
my_constants.prob_loz = 0.0

my_constants.prob_hix = 5.0e-3
my_constants.prob_hiy = 120.0e-3
my_constants.prob_hiz = 2.0e-3

my_constants.Lx = prob_hix - prob_lox
my_constants.Ly = prob_hiy - prob_loy
my_constants.Lz = prob_hiz - prob_loz

my_constants.flag_none = 0
my_constants.flag_hs = 1
my_constants.flag_ss = 2


###############
# derived quantities and fundamental constants 
###############

my_constants.pi = 3.14159265358979

my_constants.freq = 5.e9
my_constants.TP = 1./freq

###############
# diagnostics
###############

diagnostics.diags_names = plt
###############
# full plotfiles
plt.intervals = 20
plt.fields_to_plot = Ex Ey Ez Bx By Bz mu
plt.diag_type = Full
plt.file_min_digits = 7

The simulated input impedance matches analytical calculation:

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant