From 7c6b816b933c8cc6456669c3f37ffb9ad8a3d9b1 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Fri, 23 Feb 2024 11:58:12 -0800 Subject: [PATCH 01/10] test resonator --- Examples/Tests/circuits/inputs_resonator | 83 ++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Examples/Tests/circuits/inputs_resonator diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator new file mode 100644 index 000000000..f1ebe691f --- /dev/null +++ b/Examples/Tests/circuits/inputs_resonator @@ -0,0 +1,83 @@ +################################ +####### GENERAL PARAMETERS ###### +################################# +max_step = 20000 +amr.n_cell = 100 100 100 +amr.max_grid_size = 100 +amr.blocking_factor = 128 +geometry.dims = 3 +geometry.prob_lo = 0. 0. 0. +geometry.prob_hi = 0.01 0.01 0.01 +amr.max_level = 0 +boundary.field_lo = periodic periodic periodic +boundary.field_hi = periodic periodic periodic + +################################# +############ NUMERICS ########### +################################# +warpx.verbose = 1 +warpx.use_filter = 0 +warpx.cfl = 0.9 + +algo.em_solver_medium = macroscopic # vacuum/macroscopic + +algo.macroscopic_sigma_method = laxwendroff # laxwendroff or backwardeuler + +macroscopic.sigma_function(x,y,z) = "sigma_0" + +macroscopic.epsilon_function(x,y,z) = "epsilon_0" + +macroscopic.mu_function(x,y,z) = "mu_0 " + +################################# +############ FIELDS ############# +################################# + +my_constants.flag_ss = 2 + +my_constants.pi = 3.14159265359 +my_constants.c = 299792458. +my_constants.wavelength = 1.e-2 +my_constants.f = 2.99792458e10 +my_constants.t0 = 2.e-10 +my_constants.BW = 6.32e-11 + +my_constants.sigma_0 = 0.0 +my_constants.epsilon_0 = 8.8541878128e-12 +my_constants.mu_0 = 1.25663706212e-06 + +warpx.E_ext_grid_init_style = parse_E_ext_grid_function +warpx.Ex_external_grid_function(x,y,z) = "0." +warpx.Ey_external_grid_function(x,y,z) = "0." +warpx.Ez_external_grid_function(x,y,z) = "0." + +warpx.B_ext_grid_init_style = parse_B_ext_grid_function +warpx.Bx_external_grid_function(x,y,z) = "0." +warpx.By_external_grid_function(x,y,z) = "0." +warpx.Bz_external_grid_function(x,y,z) = "0." + +warpx.E_excitation_on_grid_style = parse_E_excitation_grid_function + +warpx.Ex_excitation_flag_function(x,y,z) = "0." +warpx.Ey_excitation_flag_function(x,y,z) = "0." +warpx.Ez_excitation_flag_function(x,y,z) = "0." + +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) = "0." + +warpx.B_excitation_on_grid_style = parse_B_excitation_grid_function + +warpx.Bx_excitation_flag_function(x,y,z) = "flag_ss * (x>0.499e-2) * (x<0.501e-2) * (y>0.499e-2) * (y<0.501e-2)" +warpx.By_excitation_flag_function(x,y,z) = "0." +warpx.Bz_excitation_flag_function(x,y,z) = "0." + +warpx.Bx_excitation_grid_function(x,y,z,t) = "exp(-(t-t0)*(t-t0)/(BW*BW))*cos(2*pi*f*(t-t0))" +warpx.By_excitation_grid_function(x,y,z,t) = "0." +warpx.Bz_excitation_grid_function(x,y,z,t) = "0." + +# Diagnostics +diagnostics.diags_names = plt +plt.intervals = 100 +plt.fields_to_plot = Ex Ey Ez Bx By Bz +plt.diag_type = Full From b5e82a5d2301e4ce87ed5e4bba167f008437c77f Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Fri, 23 Feb 2024 12:05:47 -0800 Subject: [PATCH 02/10] BW = 2T --- Examples/Tests/circuits/inputs_resonator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index f1ebe691f..1a4c0164a 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -40,7 +40,7 @@ my_constants.c = 299792458. my_constants.wavelength = 1.e-2 my_constants.f = 2.99792458e10 my_constants.t0 = 2.e-10 -my_constants.BW = 6.32e-11 +my_constants.BW = 6.67e-11 my_constants.sigma_0 = 0.0 my_constants.epsilon_0 = 8.8541878128e-12 From 8f2b2b78a06fbd719c76b49a7eb0dc162e12ca52 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Fri, 23 Feb 2024 12:18:12 -0800 Subject: [PATCH 03/10] fix source --- Examples/Tests/circuits/inputs_resonator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index 1a4c0164a..a8d84fe53 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -68,7 +68,7 @@ warpx.Ez_excitation_grid_function(x,y,z,t) = "0." warpx.B_excitation_on_grid_style = parse_B_excitation_grid_function -warpx.Bx_excitation_flag_function(x,y,z) = "flag_ss * (x>0.499e-2) * (x<0.501e-2) * (y>0.499e-2) * (y<0.501e-2)" +warpx.Bx_excitation_flag_function(x,y,z) = "flag_ss * (x>0.499e-2) * (x<0.501e-2) * (y>0.49e-2) * (y<0.50e-2)" warpx.By_excitation_flag_function(x,y,z) = "0." warpx.Bz_excitation_flag_function(x,y,z) = "0." From 7edaef345177b45f5349030040ccdae67ebf0072 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Fri, 23 Feb 2024 17:12:46 -0800 Subject: [PATCH 04/10] observation --- Examples/Tests/circuits/inputs_resonator | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index a8d84fe53..b9c098beb 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -81,3 +81,16 @@ diagnostics.diags_names = plt plt.intervals = 100 plt.fields_to_plot = Ex Ey Ez Bx By Bz plt.diag_type = Full + + +warpx.reduced_diags_names = Eobs1 + +Eobs1.type = RawEFieldReduction + +Eobs1.reduction_type = integral + +Eobs1.integration_type = volume + +Eobs1.intervals = 1 + +Eobs1.reduced_function(x,y,z) = (x>0.754e-2) * (x<0.761e-2) * (y>0.754e-2) * (y<0.761e-2) * (z>0.754e-2) * (z<0.761e-2) From 229d7eacc12999d536e3eb16c5538082d5e2fb02 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Fri, 23 Feb 2024 17:19:14 -0800 Subject: [PATCH 05/10] PEC --- Examples/Tests/circuits/inputs_resonator | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index b9c098beb..25910c32f 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -9,8 +9,8 @@ geometry.dims = 3 geometry.prob_lo = 0. 0. 0. geometry.prob_hi = 0.01 0.01 0.01 amr.max_level = 0 -boundary.field_lo = periodic periodic periodic -boundary.field_hi = periodic periodic periodic +boundary.field_lo = pec pec pec +boundary.field_hi = pec pec pec ################################# ############ NUMERICS ########### From af0be11ae09356cf77331d8062ae58851be5108b Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Mon, 26 Feb 2024 08:53:00 -0800 Subject: [PATCH 06/10] thin layer of metal --- Examples/Tests/circuits/inputs_resonator | 57 ++++++++++++++++-------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index 25910c32f..0fea3eb2c 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -2,15 +2,26 @@ ####### GENERAL PARAMETERS ###### ################################# max_step = 20000 -amr.n_cell = 100 100 100 -amr.max_grid_size = 100 -amr.blocking_factor = 128 +amr.n_cell = 200 200 200 +amr.max_grid_size = 200 +amr.blocking_factor = 256 geometry.dims = 3 -geometry.prob_lo = 0. 0. 0. -geometry.prob_hi = 0.01 0.01 0.01 + +# physical domain size in [m] +geometry.prob_lo = -1.e-2 -1.e-2 -1.e-2 +geometry.prob_hi = 1.e-2 1.e-2 1.e-2 + +my_constants.dx = 2.e-2/200 +my_constants.dy = 2.e-2/200 +my_constants.dz = 2.e-2/200 + +my_constants.ddx = dx/100 +my_constants.ddy = dy/100 +my_constants.ddz = dz/100 + amr.max_level = 0 -boundary.field_lo = pec pec pec -boundary.field_hi = pec pec pec +boundary.field_lo = pml pml pml +boundary.field_hi = pml pml pml ################################# ############ NUMERICS ########### @@ -23,12 +34,17 @@ algo.em_solver_medium = macroscopic # vacuum/macroscopic algo.macroscopic_sigma_method = laxwendroff # laxwendroff or backwardeuler -macroscopic.sigma_function(x,y,z) = "sigma_0" - macroscopic.epsilon_function(x,y,z) = "epsilon_0" - macroscopic.mu_function(x,y,z) = "mu_0 " +macroscopic.sigma_function(x,y,z) = "sigma * ( +( (x>-L/2-t) * (x<-L/2) * (y>-L/2-t) * (y-L/2-t) * (zL/2) * (x-L/2-t) * (y-L/2-t) * (z-L/2-t) * (x-L/2-t) * (y<-L/2) * (z>-L/2-t) * (z-L/2-t) * (xL/2) * (y-L/2-t) * (z-L/2-t) * (x-L/2-t) * (y-L/2-t) * (z<-L/2) ) or +( (x>-L/2-t) * (x-L/2-t) * (yL/2) * (zL/4) * (xL/4) * (yL/4) * (z0.754e-2) * (x<0.761e-2) * (y>0.754e-2) * (y<0.761e-2) * (z>0.754e-2) * (z<0.761e-2) From 1d97c7c9bdc8076a58c85a91e00693dd2cd43a12 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Mon, 26 Feb 2024 10:25:01 -0800 Subject: [PATCH 07/10] add comments --- Examples/Tests/circuits/inputs_resonator | 60 ++++++++++++++---------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index 0fea3eb2c..38baf3634 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -1,34 +1,41 @@ ################################ ####### GENERAL PARAMETERS ###### ################################# -max_step = 20000 -amr.n_cell = 200 200 200 -amr.max_grid_size = 200 -amr.blocking_factor = 256 + +# do not modify these geometry.dims = 3 +warpx.verbose = 1 +amr.max_level = 0 + +max_step = 20000 +warpx.cfl = 0.9 + +my_constants.ncells = 200 + +# units [m] +my_constants.Ldomain = 0.02 + +amr.n_cell = ncells ncells ncells +amr.max_grid_size = ncells # physical domain size in [m] -geometry.prob_lo = -1.e-2 -1.e-2 -1.e-2 -geometry.prob_hi = 1.e-2 1.e-2 1.e-2 +geometry.prob_lo = -Ldomain/2 -Ldomain/2 -Ldomain/2 +geometry.prob_hi = Ldomain/2 Ldomain/2 Ldomain/2 -my_constants.dx = 2.e-2/200 -my_constants.dy = 2.e-2/200 -my_constants.dz = 2.e-2/200 +my_constants.dx = Ldomain/ncells +my_constants.dy = Ldomain/ncells +my_constants.dz = Ldomain/ncells -my_constants.ddx = dx/100 -my_constants.ddy = dy/100 -my_constants.ddz = dz/100 +my_constants.smalldx = dx/100 +my_constants.smalldy = dy/100 +my_constants.smalldz = dz/100 -amr.max_level = 0 boundary.field_lo = pml pml pml boundary.field_hi = pml pml pml ################################# ############ NUMERICS ########### ################################# -warpx.verbose = 1 -warpx.use_filter = 0 -warpx.cfl = 0.9 algo.em_solver_medium = macroscopic # vacuum/macroscopic @@ -49,17 +56,13 @@ macroscopic.sigma_function(x,y,z) = "sigma * ( ############ FIELDS ############# ################################# -my_constants.flag_ss = 2 - -my_constants.pi = 3.14159265359 -my_constants.c = 299792458. - # length of cubic cavity my_constants.L = 1.e-2 # thickness of metal my_constants.t = 1.e-3 +# excitation parameters my_constants.wavelength = 1.e-2 my_constants.f = 2.99792458e10 my_constants.t0 = 2.e-10 @@ -69,19 +72,24 @@ my_constants.BW = 6.67e-11 # 5.8e7 = copper my_constants.sigma = 5.8e3 +my_constants.pi = 3.14159265359 +my_constants.c = 299792458. my_constants.epsilon_0 = 8.8541878128e-12 my_constants.mu_0 = 1.25663706212e-06 +# initial E field warpx.E_ext_grid_init_style = parse_E_ext_grid_function warpx.Ex_external_grid_function(x,y,z) = "0." warpx.Ey_external_grid_function(x,y,z) = "0." warpx.Ez_external_grid_function(x,y,z) = "0." +# initial B field warpx.B_ext_grid_init_style = parse_B_ext_grid_function warpx.Bx_external_grid_function(x,y,z) = "0." warpx.By_external_grid_function(x,y,z) = "0." warpx.Bz_external_grid_function(x,y,z) = "0." +# external E excitation warpx.E_excitation_on_grid_style = parse_E_excitation_grid_function warpx.Ex_excitation_flag_function(x,y,z) = "0." @@ -92,9 +100,11 @@ 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) = "0." +# external B excitation warpx.B_excitation_on_grid_style = parse_B_excitation_grid_function -warpx.Bx_excitation_flag_function(x,y,z) = "flag_ss * (x>-ddx) * (x0) * (y-L/2) * (zL/4) * (xL/4) * (yL/4) * (zL/4) * (xL/4) * (yL/4) * (z Date: Mon, 26 Feb 2024 12:35:15 -0800 Subject: [PATCH 08/10] add an arbitrarily large blocking factor --- Examples/Tests/circuits/inputs_resonator | 1 + 1 file changed, 1 insertion(+) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index 38baf3634..ec9992879 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -6,6 +6,7 @@ geometry.dims = 3 warpx.verbose = 1 amr.max_level = 0 +amr.blocking_factor = 1024 max_step = 20000 warpx.cfl = 0.9 From 7e7c82c23e31ef74d3a3ff548dc8af6db038aa63 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Tue, 27 Feb 2024 10:58:12 -0800 Subject: [PATCH 09/10] comments --- Examples/Tests/circuits/inputs_resonator | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index ec9992879..6363ba99a 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -11,22 +11,22 @@ amr.blocking_factor = 1024 max_step = 20000 warpx.cfl = 0.9 +# number of cells in each direction my_constants.ncells = 200 - -# units [m] -my_constants.Ldomain = 0.02 - amr.n_cell = ncells ncells ncells amr.max_grid_size = ncells -# physical domain size in [m] +# physical size of domain in [m] +my_constants.Ldomain = 0.02 geometry.prob_lo = -Ldomain/2 -Ldomain/2 -Ldomain/2 geometry.prob_hi = Ldomain/2 Ldomain/2 Ldomain/2 +# define grid spacing in each direction my_constants.dx = Ldomain/ncells my_constants.dy = Ldomain/ncells my_constants.dz = Ldomain/ncells +# define a 'small' grid spacing my_constants.smalldx = dx/100 my_constants.smalldy = dy/100 my_constants.smalldz = dz/100 @@ -42,26 +42,15 @@ algo.em_solver_medium = macroscopic # vacuum/macroscopic algo.macroscopic_sigma_method = laxwendroff # laxwendroff or backwardeuler -macroscopic.epsilon_function(x,y,z) = "epsilon_0" -macroscopic.mu_function(x,y,z) = "mu_0 " - -macroscopic.sigma_function(x,y,z) = "sigma * ( -( (x>-L/2-t) * (x<-L/2) * (y>-L/2-t) * (y-L/2-t) * (zL/2) * (x-L/2-t) * (y-L/2-t) * (z-L/2-t) * (x-L/2-t) * (y<-L/2) * (z>-L/2-t) * (z-L/2-t) * (xL/2) * (y-L/2-t) * (z-L/2-t) * (x-L/2-t) * (y-L/2-t) * (z<-L/2) ) or -( (x>-L/2-t) * (x-L/2-t) * (yL/2) * (zL/4) * (xL/4) * (yL/4) * (zLcavity/4) * (xLcavity/4) * (yLcavity/4) * (z Date: Tue, 27 Feb 2024 12:30:06 -0800 Subject: [PATCH 10/10] cleanup --- Examples/Tests/circuits/inputs_resonator | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Examples/Tests/circuits/inputs_resonator b/Examples/Tests/circuits/inputs_resonator index 6363ba99a..0931ff71a 100644 --- a/Examples/Tests/circuits/inputs_resonator +++ b/Examples/Tests/circuits/inputs_resonator @@ -8,7 +8,9 @@ warpx.verbose = 1 amr.max_level = 0 amr.blocking_factor = 1024 -max_step = 20000 +# stop at max_step or 100 periods, whichever occurs first +max_step = 100000 +stop_time = 100 * wavelength/c warpx.cfl = 0.9 # number of cells in each direction @@ -53,17 +55,18 @@ my_constants.Lcavity = 1.e-2 my_constants.tmetal = 1.e-3 # excitation parameters +# speed of light +my_constants.c = 299792458. my_constants.wavelength = 1.e-2 -my_constants.f = 2.99792458e10 +my_constants.f = c/wavelength +my_constants.BW = 2/f my_constants.t0 = 2.e-10 -my_constants.BW = 6.67e-11 # conductivity of metal # 5.8e7 = copper my_constants.sigma = 5.8e3 my_constants.pi = 3.14159265359 -my_constants.c = 299792458. my_constants.epsilon_0 = 8.8541878128e-12 my_constants.mu_0 = 1.25663706212e-06