Skip to content

Commit fc24e33

Browse files
authored
Merge pull request #130 from tyh0123/gds_parsing
Initial commit for gds-parsing-feature
2 parents 595afcb + 52907be commit fc24e33

14 files changed

Lines changed: 1197 additions & 8 deletions

File tree

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# See parameters in https://github.com/ECP-WarpX/artemis/pull/43
2+
3+
################################
4+
####### GENERAL PARAMETERS ######
5+
#################################
6+
max_step = 10
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+
##########################################
39+
# sigma
40+
41+
# sigma is still parsed in the PML region
42+
macroscopic.sigma_function(x,y,z) = "sigma_0 + (sigma_si - sigma_0) * (z <= h_si)"
43+
44+
# GDS file for sigma layer
45+
macroscopic.sigma_npy_file = "/pscratch/sd/y/ytang4/Artemis_solver_veri_gds_2d/artemis/Bin/array_3d_gds_new_large_8_qubit.npy"
46+
47+
# k index of where to deposit conductivity from sigma npy file
48+
macroscopic.npy_k_index = 10
49+
50+
# enable use of PEC mask layer from sigma in valid region
51+
algo.use_PEC_mask = 0
52+
53+
##########################################
54+
55+
macroscopic.epsilon_function(x,y,z) = "eps_0 + eps_0 * (eps_r_si - 1.) * (z <= h_si)"
56+
57+
macroscopic.mu_function(x,y,z) = "mu_0 + mu_0 * (mu_r_si - 1.) * (z <= h_si)"
58+
59+
#################################
60+
############ FIELDS #############
61+
#################################
62+
63+
###############
64+
# domain size
65+
# n_cellx/y/z and Lx/y/z are needed to calculate dx/dy/dz
66+
###############
67+
my_constants.n_cellx = 3800
68+
my_constants.n_celly = 3800
69+
my_constants.n_cellz = 20
70+
71+
my_constants.max_grid_sizex = 3800
72+
my_constants.max_grid_sizey = 3800
73+
my_constants.max_grid_sizez = 20
74+
my_constants.blocking_factor = 2
75+
76+
my_constants.prob_lox = 0.
77+
my_constants.prob_loy = 0.
78+
my_constants.prob_loz = 0.
79+
80+
my_constants.prob_hix = 9500.e-6
81+
my_constants.prob_hiy = 9500.e-6
82+
my_constants.prob_hiz = 200.e-6
83+
84+
my_constants.Lx = prob_hix - prob_lox
85+
my_constants.Ly = prob_hiy - prob_loy
86+
my_constants.Lz = prob_hiz - prob_loz
87+
88+
###############
89+
# material properties
90+
###############
91+
my_constants.sigma_0 = 0.0
92+
my_constants.sigma_si = 0.
93+
my_constants.sigma_metal = 1.e11
94+
95+
my_constants.eps_0 = 8.8541878128e-12
96+
my_constants.eps_r_si = 11.7
97+
98+
my_constants.mu_0 = 1.25663706212e-06
99+
my_constants.mu_r_si = 1.0
100+
my_constants.mu_r_test = 0.9999
101+
102+
###############
103+
# silicon and palladium cross section
104+
###############
105+
my_constants.h_si = 100.e-6
106+
107+
###############
108+
# waveguide port parameters
109+
###############
110+
my_constants.h_port = 100.e-6
111+
my_constants.w_port = 200.e-6
112+
113+
###############
114+
# derived quantities and fundamental constants - don't touch these
115+
###############
116+
117+
my_constants.pi = 3.14159265358979
118+
119+
my_constants.freq = 8.6e9
120+
my_constants.TP = 1./freq
121+
122+
# grid spacing
123+
my_constants.dx = Lx / n_cellx
124+
my_constants.dy = Ly / n_celly
125+
my_constants.dz = Lz / n_cellz
126+
127+
my_constants.ddx = dx/1.e6
128+
my_constants.ddy = dy/1.e6
129+
my_constants.ddz = dz/1.e6
130+
131+
my_constants.flag_none = 0
132+
my_constants.flag_hs = 1
133+
my_constants.flag_ss = 2
134+
135+
###############
136+
# excitation
137+
###############
138+
139+
warpx.E_excitation_on_grid_style = parse_E_excitation_grid_function
140+
141+
warpx.Ex_excitation_flag_function(x,y,z) = "flag_none"
142+
warpx.Ey_excitation_flag_function(x,y,z) = "flag_ss * ( (y >= 470.e-6 + ddy) * (y < 475.e-6 - ddy) + (y >= 485e-6 + ddy) * (y <= 490e-6 - ddy)) * (z > h_si + ddz ) * (z <= h_si + dz + ddz) * (x > 0.e-6 - ddx) * (x < 0.e-6 + ddx)"
143+
warpx.Ez_excitation_flag_function(x,y,z) = "flag_none"
144+
145+
146+
# This is a source on a qubit control line
147+
warpx.Ex_excitation_grid_function(x,y,z,t) = "0."
148+
warpx.Ey_excitation_grid_function(x,y,z,t) = "exp(-(t-3*TP)**2/(2*TP**2))*sin(2*pi*freq*t) *
149+
( (y >= 470.e-6 + ddy) * (y < 475.e-6 - ddy) - (y >= 485e-6 + ddy) * (y <= 490e-6 - ddy)) * (z > h_si + ddz) * (z <= h_si + dz + ddz) * (x > 0.e-6 - ddx) * (x < 0.e-6 + ddx)"
150+
warpx.Ez_excitation_grid_function(x,y,z,t) = "0."
151+
152+
###############
153+
# diagnostics
154+
###############
155+
156+
diagnostics.diags_names = plt
157+
###############
158+
# full plotfiles
159+
plt.intervals = 5
160+
plt.fields_to_plot = Ex Ey Ez Bx By Bz sigma mu epsilon
161+
plt.diag_type = Full
162+
plt.file_min_digits = 7

GNUmakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ USE_EB = FALSE
4646

4747
WARPX_HOME := .
4848
include $(WARPX_HOME)/Source/Make.WarpX
49+
50+
LIBRARIES += -lz

Source/BoundaryConditions/PML.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,10 +706,16 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri
706706
// Initialize sigma, conductivity
707707
if (macroscopic_properties->m_sigma_s == "constant") {
708708
pml_sigma_fp->setVal(macroscopic_properties->m_sigma);
709-
} else if (macroscopic_properties->m_sigma_s == "parse_sigma_function") {
709+
}
710+
if (macroscopic_properties->m_sigma_s == "parse_sigma_function" ||
711+
macroscopic_properties->m_sigma_s == "parse_sigma_both") {
710712
macroscopic_properties->InitializeMacroMultiFabUsingParser(pml_sigma_fp.get(),
711713
macroscopic_properties->m_sigma_parser->compile<3>(), lev);
712714
}
715+
if (macroscopic_properties->m_sigma_s == "parse_sigma_npy_file" ||
716+
macroscopic_properties->m_sigma_s == "parse_sigma_both") {
717+
macroscopic_properties->InitializeMacroMultiFabFromNumpy(pml_sigma_fp.get(), macroscopic_properties->m_sigma_npy_filename, lev, macroscopic_properties->m_npy_k_index);
718+
}
713719

714720
// Initialize epsilon, permittivity
715721
if (macroscopic_properties->m_epsilon_s == "constant") {
@@ -875,7 +881,8 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& gri
875881
// Initialize sigma, conductivity
876882
if (macroscopic_properties->m_sigma_s == "constant") {
877883
pml_sigma_cp->setVal(macroscopic_properties->m_sigma);
878-
} else if (macroscopic_properties->m_sigma_s == "parse_sigma_function") {
884+
} else if (macroscopic_properties->m_sigma_s == "parse_sigma_function" ||
885+
macroscopic_properties->m_sigma_s == "parse_sigma_both") {
879886
macroscopic_properties->InitializeMacroMultiFabUsingParser(pml_sigma_cp.get(),
880887
macroscopic_properties->m_sigma_parser->compile<3>(), lev);
881888
}

Source/Evolve/WarpXEvolve.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,19 @@ WarpX::OneStep_nosub (Real cur_time)
549549
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::EfieldExternalPML);
550550
}
551551

552+
if (use_PEC_mask) {
553+
// multiply E field by PEC mask
554+
amrex::MultiFab& Ex = *Efield_fp[0][0].get();
555+
amrex::MultiFab& Ey = *Efield_fp[0][1].get();
556+
amrex::MultiFab& Ez = *Efield_fp[0][2].get();
557+
amrex::MultiFab& PECx = *PEC_fp[0][0].get();
558+
amrex::MultiFab& PECy = *PEC_fp[0][1].get();
559+
amrex::MultiFab& PECz = *PEC_fp[0][2].get();
560+
MultiFab::Multiply(Ex, PECx, 0, 0, 1, 0);
561+
MultiFab::Multiply(Ey, PECy, 0, 0, 1, 0);
562+
MultiFab::Multiply(Ez, PECz, 0, 0, 1, 0);
563+
}
564+
552565
EvolveF(0.5_rt * dt[0], DtType::SecondHalf);
553566
EvolveG(0.5_rt * dt[0], DtType::SecondHalf);
554567
#ifndef WARPX_MAG_LLG

Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,19 @@ public:
5656
amrex::ParserExecutor<3> const& macro_parser,
5757
const int lev);
5858

59-
/** Gpu Vector with index type of the conductivity multifab */
59+
void InitializeMacroMultiFabFromNumpy (amrex::MultiFab* macro_mf,
60+
const std::string& npy_filename,
61+
const int lev,
62+
const int m_npy_k_index_in);
63+
64+
void InitializePECFromSigma (amrex::MultiFab* sigma_mf,
65+
amrex::MultiFab* PECx,
66+
amrex::MultiFab* PECy,
67+
amrex::MultiFab* PECz,
68+
const int lev,
69+
const int m_npy_k_index_in);
70+
71+
/** Gpu Vector with index type of the conductivity multifab */
6072
amrex::GpuArray<int, 3> sigma_IndexType;
6173
/** Gpu Vector with index type of the permittivity multifab */
6274
amrex::GpuArray<int, 3> epsilon_IndexType;
@@ -87,6 +99,11 @@ public:
8799
amrex::Real m_epsilon = PhysConst::ep0;
88100
/** Permeability, mu, of the medium */
89101
amrex::Real m_mu = PhysConst::mu0;
102+
/** index to insert the mask */
103+
int m_npy_k_index = 0;
104+
std::string m_sigma_npy_filename;
105+
std::string m_epsilon_npy_filename;
106+
std::string m_mu_npy_filename;
90107
/** Parser Wrappers */
91108
std::unique_ptr<amrex::Parser> m_sigma_parser;
92109
std::unique_ptr<amrex::Parser> m_epsilon_parser;
@@ -123,7 +140,7 @@ public:
123140
int getmag_max_iter () {return m_mag_max_iter;}
124141
amrex::Real getmag_tol () {return m_mag_tol;}
125142

126-
// interpolate the magnetic properties to B locations
143+
// interpolate the magnetic properties to B locations
127144
// magnetic properties are cell nodal
128145
// B locations are face centered
129146
// iv is an IntVect with a 1 in the face direction of interest, and 0 in the others

0 commit comments

Comments
 (0)