Skip to content

Commit a7ffad4

Browse files
authored
Merge pull request #142 from ajnonaka/fix_PEC_layer2
Fix pec layer2
2 parents 3bf4acc + d9abc3e commit a7ffad4

4 files changed

Lines changed: 198 additions & 0 deletions

File tree

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# See parameters in https://github.com/ECP-WarpX/artemis/pull/43
2+
3+
################################
4+
####### GENERAL PARAMETERS ######
5+
#################################
6+
max_step = 1
7+
8+
amr.n_cell = n_cellx n_celly n_cellz
9+
amr.max_grid_size = max_grid_sizex max_grid_sizey max_grid_sizez
10+
amr.blocking_factor = blocking_factor
11+
amr.refine_grid_layout = 1 # if n_MPI > n_grids, the grids will be successively divided in half until n_MPI <= n_grids
12+
13+
geometry.dims = 3
14+
geometry.prob_lo = prob_lox prob_loy prob_loz
15+
geometry.prob_hi = prob_hix prob_hiy prob_hiz
16+
17+
amr.max_level = 0
18+
19+
# use pec instead of pml overlaying current source so you don't get a reflection
20+
boundary.field_lo = pml pml pml
21+
boundary.field_hi = pml pml pml
22+
23+
my_constants.offset_y = -1100.e-6
24+
25+
#################################
26+
############ NUMERICS ###########
27+
#################################
28+
warpx.verbose = 1
29+
30+
warpx.cfl = 0.8
31+
32+
# vacuum or macroscopic
33+
algo.em_solver_medium = macroscopic
34+
35+
# laxwendroff or backwardeuler
36+
algo.macroscopic_sigma_method = laxwendroff
37+
38+
macroscopic.sigma_function(x,y,z) = "sigma_0 + (sigma_si - sigma_0) * (z <= h_si)"
39+
macroscopic.epsilon_function(x,y,z) = "eps_0 + eps_0 * (eps_r_si - 1.) * (z <= h_si)"
40+
macroscopic.mu_function(x,y,z) = "mu_0 + mu_0 * (mu_r_si - 1.) * (z <= h_si)"
41+
42+
macroscopic.npy_k_index = 0
43+
macroscopic.npy_k_index2 = 3
44+
45+
# comment for PEC, uncomment these for GDS-PEC
46+
macroscopic.sigma_npy_file = "voyageurs_layer1.npy"
47+
macroscopic.sigma_npy_file2 = "voyageurs_layer2.npy"
48+
macroscopic.sigma_npy_value = 1.e11
49+
algo.use_PEC_mask = 1
50+
51+
macroscopic.mu_npy_file = "voyageurs_layer1.npy"
52+
macroscopic.mu_npy_file2 = "voyageurs_layer2.npy"
53+
macroscopic.mu_npy_value = 1.25663706e-06
54+
55+
#################################
56+
############ FIELDS #############
57+
#################################
58+
59+
###############
60+
# domain size
61+
# n_cellx/y/z and Lx/y/z are needed to calculate dx/dy/dz
62+
###############
63+
my_constants.n_cellx = 7544
64+
my_constants.n_celly = 7544
65+
my_constants.n_cellz = 4
66+
67+
my_constants.max_grid_sizex = 92
68+
my_constants.max_grid_sizey = 92
69+
my_constants.max_grid_sizez = 4
70+
my_constants.blocking_factor = 2
71+
72+
my_constants.prob_lox = 0.
73+
my_constants.prob_loy = 0.
74+
my_constants.prob_loz = 0.
75+
76+
my_constants.prob_hix = 9430.e-6
77+
my_constants.prob_hiy = 9430.e-6
78+
my_constants.prob_hiz = 300.e-6
79+
80+
my_constants.Lx = prob_hix - prob_lox
81+
my_constants.Ly = prob_hiy - prob_loy
82+
my_constants.Lz = prob_hiz - prob_loz
83+
84+
###############
85+
# material properties
86+
###############
87+
my_constants.sigma_0 = 0.0
88+
my_constants.sigma_si = 0.
89+
90+
my_constants.eps_0 = 8.8541878128e-12
91+
my_constants.eps_r_si = 11.7
92+
93+
my_constants.mu_0 = 1.25663706212e-06
94+
my_constants.mu_r_si = 1.0
95+
96+
###############
97+
# silicon and palladium cross section
98+
###############
99+
my_constants.h_si = 150.e-6
100+
101+
###############
102+
# derived quantities and fundamental constants - don't touch these
103+
###############
104+
105+
my_constants.pi = 3.14159265358979
106+
107+
my_constants.freq = 8.6e9
108+
my_constants.TP = 1./freq
109+
110+
# grid spacing
111+
my_constants.dx = Lx / n_cellx
112+
my_constants.dy = Ly / n_celly
113+
my_constants.dz = Lz / n_cellz
114+
115+
my_constants.ddx = dx/1.e6
116+
my_constants.ddy = dy/1.e6
117+
my_constants.ddz = dz/1.e6
118+
119+
my_constants.flag_none = 0
120+
my_constants.flag_hs = 1
121+
my_constants.flag_ss = 2
122+
123+
###############
124+
# excitation
125+
###############
126+
127+
warpx.E_excitation_on_grid_style = parse_E_excitation_grid_function
128+
129+
warpx.Ex_excitation_flag_function(x,y,z) = "flag_none"
130+
warpx.Ey_excitation_flag_function(x,y,z) = "flag_ss * 0"
131+
warpx.Ez_excitation_flag_function(x,y,z) = "flag_none"
132+
133+
134+
# This is a source on a qubit control line
135+
warpx.Ex_excitation_grid_function(x,y,z,t) = "0."
136+
warpx.Ey_excitation_grid_function(x,y,z,t) = "0."
137+
warpx.Ez_excitation_grid_function(x,y,z,t) = "0."
138+
139+
###############
140+
# diagnostics
141+
###############
142+
143+
warpx.field_io_nfiles=64
144+
warpx.particle_io_nfiles=64
145+
146+
diagnostics.diags_names = plt
147+
###############
148+
# full plotfiles
149+
plt.intervals = 1
150+
plt.fields_to_plot = Ex Ey Ez Bx By Bz mu
151+
plt.diag_type = Full
152+
plt.file_min_digits = 7

Source/BoundaryConditions/PML.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,13 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri
723723
lev,
724724
macroscopic_properties->m_npy_k_index,
725725
macroscopic_properties->m_sigma_npy_value);
726+
if (!macroscopic_properties->m_sigma_npy_filename2.empty()) {
727+
macroscopic_properties->InitializeMacroMultiFabFromNumpy(pml_sigma_fp.get(),
728+
macroscopic_properties->m_sigma_npy_filename2,
729+
lev,
730+
macroscopic_properties->m_npy_k_index2,
731+
macroscopic_properties->m_sigma_npy_value);
732+
}
726733
}
727734

728735
if (warpx.use_PEC_mask) {
@@ -732,6 +739,10 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri
732739

733740
macroscopic_properties->InitializePECFromSigma(pml_sigma_fp.get(), pml_PEC_fp[0].get(), pml_PEC_fp[1].get(),
734741
macroscopic_properties->m_npy_k_index);
742+
if (!macroscopic_properties->m_sigma_npy_filename2.empty()) {
743+
macroscopic_properties->InitializePECFromSigma(pml_sigma_fp.get(), pml_PEC_fp[0].get(), pml_PEC_fp[1].get(),
744+
macroscopic_properties->m_npy_k_index2);
745+
}
735746

736747
// no need for sigma anymore
737748
pml_sigma_fp.get()->setVal(0.);
@@ -755,6 +766,13 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri
755766
lev,
756767
macroscopic_properties->m_npy_k_index,
757768
macroscopic_properties->m_epsilon_npy_value);
769+
if (!macroscopic_properties->m_epsilon_npy_filename2.empty()) {
770+
macroscopic_properties->InitializeMacroMultiFabFromNumpy(pml_eps_fp.get(),
771+
macroscopic_properties->m_epsilon_npy_filename2,
772+
lev,
773+
macroscopic_properties->m_npy_k_index2,
774+
macroscopic_properties->m_epsilon_npy_value);
775+
}
758776
}
759777

760778
// Initialize mu, permeability
@@ -775,6 +793,13 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri
775793
lev,
776794
macroscopic_properties->m_npy_k_index,
777795
macroscopic_properties->m_mu_npy_value);
796+
if (!macroscopic_properties->m_mu_npy_filename2.empty()) {
797+
macroscopic_properties->InitializeMacroMultiFabFromNumpy(pml_mu_fp.get(),
798+
macroscopic_properties->m_mu_npy_filename2,
799+
lev,
800+
macroscopic_properties->m_npy_k_index2,
801+
macroscopic_properties->m_mu_npy_value);
802+
}
778803
}
779804

780805
}

Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ public:
100100
amrex::Real m_mu = PhysConst::mu0;
101101
/** index to insert the mask */
102102
int m_npy_k_index = 0;
103+
int m_npy_k_index2 = 0;
103104
/** numpy arrays for layer */
104105
std::string m_sigma_npy_filename;
106+
std::string m_sigma_npy_filename2;
105107
std::string m_epsilon_npy_filename;
108+
std::string m_epsilon_npy_filename2;
106109
std::string m_mu_npy_filename;
110+
std::string m_mu_npy_filename2;
107111
/** numerical value of sigma, epsilon, and mu for gds numpy array layer */
108112
amrex::Real m_sigma_npy_value = 0.;
109113
amrex::Real m_epsilon_npy_value = 0.;

Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ MacroscopicProperties::ReadParameters ()
4444

4545
// Query mask index
4646
pp_macroscopic.query("npy_k_index", m_npy_k_index);
47+
pp_macroscopic.query("npy_k_index2", m_npy_k_index2);
4748

4849
// Query input for material conductivity, sigma.
4950
pp_macroscopic.query("sigma_npy_value", m_sigma_npy_value);
@@ -63,6 +64,8 @@ MacroscopicProperties::ReadParameters ()
6364
m_sigma_s = "parse_sigma_npy_file";
6465
sigma_specified = true;
6566
sigma_npy_specified = true;
67+
// parse second layer
68+
pp_macroscopic.query("sigma_npy_file2", m_sigma_npy_filename2);
6669
}
6770
if (sigma_func_specified && sigma_npy_specified) {
6871
// initialize both later in InitData
@@ -101,6 +104,7 @@ MacroscopicProperties::ReadParameters ()
101104
m_epsilon_s = "parse_epsilon_npy_file";
102105
epsilon_specified = true;
103106
epsilon_npy_specified = true;
107+
pp_macroscopic.query("epsilon_npy_file2", m_epsilon_npy_filename2);
104108
}
105109
if (epsilon_func_specified && epsilon_npy_specified) {
106110
// initialize both later in InitData
@@ -139,6 +143,7 @@ MacroscopicProperties::ReadParameters ()
139143
m_mu_s = "parse_mu_npy_file";
140144
mu_specified = true;
141145
mu_npy_specified = true;
146+
pp_macroscopic.query("mu_npy_file2", m_mu_npy_filename2);
142147
}
143148
if (mu_func_specified && mu_npy_specified) {
144149
// initialize both later in InitData
@@ -269,6 +274,9 @@ MacroscopicProperties::InitData ()
269274
// Step 2: Overwrite with numpy mask in valid region if provided
270275
if (m_sigma_s == "parse_sigma_npy_file" || m_sigma_s == "parse_sigma_both") {
271276
InitializeMacroMultiFabFromNumpy(m_sigma_mf.get(), m_sigma_npy_filename, lev, m_npy_k_index, m_sigma_npy_value);
277+
if (!m_sigma_npy_filename2.empty()) {
278+
InitializeMacroMultiFabFromNumpy(m_sigma_mf.get(), m_sigma_npy_filename2, lev, m_npy_k_index2, m_sigma_npy_value);
279+
}
272280
}
273281

274282
if (warpx.use_PEC_mask) {
@@ -282,6 +290,9 @@ MacroscopicProperties::InitData ()
282290
PECz->setVal(1.);
283291

284292
InitializePECFromSigma(m_sigma_mf.get(), PECx, PECy, m_npy_k_index);
293+
if (!m_sigma_npy_filename2.empty()) {
294+
InitializePECFromSigma(m_sigma_mf.get(), PECx, PECy, m_npy_k_index2);
295+
}
285296
// no need for sigma anymore
286297
m_sigma_mf->setVal(0.);
287298
}
@@ -301,6 +312,9 @@ MacroscopicProperties::InitData ()
301312
// Step 2: Overwrite with numpy mask in valid region if provided
302313
if (m_epsilon_s == "parse_epsilon_npy_file" || m_epsilon_s == "parse_epsilon_both") {
303314
InitializeMacroMultiFabFromNumpy(m_eps_mf.get(), m_epsilon_npy_filename, lev, m_npy_k_index, m_epsilon_npy_value);
315+
if (!m_epsilon_npy_filename2.empty()) {
316+
InitializeMacroMultiFabFromNumpy(m_eps_mf.get(), m_epsilon_npy_filename2, lev, m_npy_k_index2, m_epsilon_npy_value);
317+
}
304318
}
305319

306320
////////////////////////
@@ -318,6 +332,9 @@ MacroscopicProperties::InitData ()
318332
// Step 2: Overwrite with numpy mask in valid region if provided
319333
if (m_mu_s == "parse_mu_npy_file" || m_mu_s == "parse_mu_both") {
320334
InitializeMacroMultiFabFromNumpy(m_mu_mf.get(), m_mu_npy_filename, lev, m_npy_k_index, m_mu_npy_value);
335+
if (!m_mu_npy_filename2.empty()) {
336+
InitializeMacroMultiFabFromNumpy(m_mu_mf.get(), m_mu_npy_filename2, lev, m_npy_k_index2, m_mu_npy_value);
337+
}
321338
}
322339

323340
#ifdef WARPX_MAG_LLG

0 commit comments

Comments
 (0)