Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
Browse files Browse the repository at this point in the history
…to development
  • Loading branch information
jackieyao0114 committed May 13, 2024
2 parents e708db4 + e480040 commit 93168a7
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 9 deletions.
14 changes: 13 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@
#
# License: BSD-3-Clause-LBNL

requirements_file: Docs/requirements.txt
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: Docs/source/conf.py

python:
install:
- requirements: Docs/requirements.txt

formats:
- htmlzip
Expand Down
132 changes: 132 additions & 0 deletions Examples/Tests/circuits/inputs_resonator
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
################################
####### GENERAL PARAMETERS ######
#################################

# do not modify these
geometry.dims = 3
warpx.verbose = 1
amr.max_level = 0
amr.blocking_factor = 1024

# 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
my_constants.ncells = 40
amr.n_cell = ncells ncells ncells
amr.max_grid_size = ncells

# 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

boundary.field_lo = pml pml pml
boundary.field_hi = pml pml pml

#################################
############ NUMERICS ###########
#################################

algo.em_solver_medium = macroscopic # vacuum/macroscopic

algo.macroscopic_sigma_method = laxwendroff # laxwendroff or backwardeuler

#################################
############ FIELDS #############
#################################

# length of cubic cavity
my_constants.Lcavity = 1.e-2

# thickness of metal
my_constants.tmetal = 1.e-3

# excitation parameters
# speed of light
my_constants.c = 299792458.
my_constants.wavelength = 1.e-2
my_constants.f = c/wavelength
my_constants.BW = 2/f
my_constants.t0 = 2.e-10

# conductivity of metal
# 5.8e7 = copper
my_constants.sigma = 5.8e3

my_constants.pi = 3.14159265359
my_constants.epsilon_0 = 8.8541878128e-12
my_constants.mu_0 = 1.25663706212e-06

macroscopic.epsilon_function(x,y,z) = "epsilon_0"
macroscopic.mu_function(x,y,z) = "mu_0"

macroscopic.sigma_function(x,y,z) = "sigma * (
( (x>-Lcavity/2-tmetal) * (x<-Lcavity/2) * (y>-Lcavity/2-tmetal) * (y<Lcavity/2+tmetal) * (z>-Lcavity/2-tmetal) * (z<Lcavity/2+tmetal) ) or
( (x>Lcavity/2) * (x<Lcavity/2+tmetal) * (y>-Lcavity/2-tmetal) * (y<Lcavity/2+tmetal) * (z>-Lcavity/2-tmetal) * (z<Lcavity/2+tmetal) ) or
( (x>-Lcavity/2-tmetal) * (x<Lcavity/2+tmetal) * (y>-Lcavity/2-tmetal) * (y<-Lcavity/2) * (z>-Lcavity/2-tmetal) * (z<Lcavity/2+tmetal) ) or
( (x>-Lcavity/2-tmetal) * (x<Lcavity/2+tmetal) * (y>Lcavity/2) * (y<Lcavity/2+tmetal) * (z>-Lcavity/2-tmetal) * (z<Lcavity/2+tmetal) ) or
( (x>-Lcavity/2-tmetal) * (x<Lcavity/2+tmetal) * (y>-Lcavity/2-tmetal) * (y<Lcavity/2+tmetal) * (z>-Lcavity/2-tmetal) * (z<-Lcavity/2) ) or
( (x>-Lcavity/2-tmetal) * (x<Lcavity/2+tmetal) * (y>-Lcavity/2-tmetal) * (y<Lcavity/2+tmetal) * (z>Lcavity/2) * (z<Lcavity/2+tmetal) ) )"

# 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."
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."

# external B excitation
warpx.B_excitation_on_grid_style = parse_B_excitation_grid_function

# 2 = soft source excitation (increment field as opposed to overwrite with a hard source)
warpx.Bx_excitation_flag_function(x,y,z) = "2 * (x>-smalldx) * (x<smalldx) * (y>0) * (y<dy) * (z>-Lcavity/2) * (z<Lcavity/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))*sin(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."

# plotfile diagnostics
diagnostics.diags_names = plt
plt.intervals = 100
plt.fields_to_plot = Ex Ey Ez Bx By Bz
plt.diag_type = Full
plt.plot_raw_fields = 0

# output diagnostics
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>Lcavity/4-smalldx) * (x<Lcavity/4+dx/2+smalldx) * (y>Lcavity/4-smalldy) * (y<Lcavity/4+dy/2+smalldy) * (z>Lcavity/4-smalldz) * (z<Lcavity/4+dz/2+smalldz)
80 changes: 80 additions & 0 deletions Examples/Tests/circuits/inputs_wave_freespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
################################
####### GENERAL PARAMETERS ######
#################################
max_step = 250
amr.n_cell = 32 32 32
amr.max_grid_size = 32
amr.blocking_factor = 32
geometry.dims = 3
geometry.prob_lo = -4.e-6 -4.e-6 -4.e-6
geometry.prob_hi = 4.e-6 4.e-6 4.e-6
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.pi = 3.14159265359
my_constants.L = 50.e-6
my_constants.c = 299792458.
my_constants.wavelength = 4.e-6

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) = "1.e5*exp(-(y)**2/(L/32)**2)*cos(2*pi*(y)/wavelength)"
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) = "(-1.e5*exp(-(y)**2/(L/32)**2)*cos(2*pi*(y)/wavelength)/c)"

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) = "0."
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) = "0."
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 = 1
plt.fields_to_plot = Ex Ey Ez Bx By Bz
plt.diag_type = Full
plt.plot_raw_fields = 1
2 changes: 1 addition & 1 deletion Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ WarpX::Evolve (int numsteps)
// ionization, Coulomb collisions, QED
doFieldIonization();
ExecutePythonCallback("beforecollisions");
mypc->doCollisions( cur_time, dt[0] );
//mypc->doCollisions( cur_time, dt[0] );
ExecutePythonCallback("aftercollisions");
#ifdef WARPX_QED
doQEDEvents();
Expand Down
9 changes: 6 additions & 3 deletions Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,18 @@ WarpX::InitData ()
ComputeDt();
WarpX::PrintDtDxDyDz();
InitFromScratch();
if (WarpX::em_solver_medium==1) {
m_macroscopic_properties->InitData();
}
InitDiagnostics();
}
else
{
InitFromCheckpoint();
WarpX::PrintDtDxDyDz();
if (WarpX::em_solver_medium==1) {
m_macroscopic_properties->InitData();
}
PostRestart();
reduced_diags->InitData();
}
Expand All @@ -414,9 +420,6 @@ WarpX::InitData ()

BuildBufferMasks();

if (WarpX::em_solver_medium==1) {
m_macroscopic_properties->InitData();
}

if (WarpX::yee_coupled_solver_algo == CoupledYeeSolver::MaxwellLondon) {
amrex::Print() << " calling london \n";
Expand Down
2 changes: 1 addition & 1 deletion Source/Particles/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include $(WARPX_HOME)/Source/Particles/Gather/Make.package
include $(WARPX_HOME)/Source/Particles/Sorting/Make.package
include $(WARPX_HOME)/Source/Particles/ParticleCreation/Make.package
include $(WARPX_HOME)/Source/Particles/ElementaryProcess/Make.package
include $(WARPX_HOME)/Source/Particles/Collision/Make.package
#include $(WARPX_HOME)/Source/Particles/Collision/Make.package
include $(WARPX_HOME)/Source/Particles/Filter/Make.package
include $(WARPX_HOME)/Source/Particles/Resampling/Make.package

Expand Down
4 changes: 2 additions & 2 deletions Source/Particles/MultiParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public:
const amrex::MultiFab& Ex, const amrex::MultiFab& Ey, const amrex::MultiFab& Ez,
const amrex::MultiFab& Bx, const amrex::MultiFab& By, const amrex::MultiFab& Bz);

void doCollisions (amrex::Real cur_time, amrex::Real dt);
//void doCollisions (amrex::Real cur_time, amrex::Real dt);

/**
* \brief This function loops over all species and performs resampling if appropriate.
Expand Down Expand Up @@ -357,7 +357,7 @@ protected:

std::vector<std::string> lasers_names;

std::unique_ptr<CollisionHandler> collisionhandler;
//std::unique_ptr<CollisionHandler> collisionhandler;

//! instead of depositing (current, charge) on the finest patch level, deposit to the coarsest grid
std::vector<bool> m_deposit_on_main_grid;
Expand Down
4 changes: 3 additions & 1 deletion Source/Particles/MultiParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core)
pc_tmp = std::make_unique<PhysicalParticleContainer>(amr_core);

// Setup particle collisions
collisionhandler = std::make_unique<CollisionHandler>(this);
//collisionhandler = std::make_unique<CollisionHandler>(this);

}

Expand Down Expand Up @@ -933,12 +933,14 @@ MultiParticleContainer::doFieldIonization (int lev,
}
}

/*
void
MultiParticleContainer::doCollisions ( Real cur_time, amrex::Real dt )
{
WARPX_PROFILE("MultiParticleContainer::doCollisions()");
collisionhandler->doCollisions(cur_time, dt, this);
}
*/

void MultiParticleContainer::doResampling (const int timestep)
{
Expand Down

0 comments on commit 93168a7

Please sign in to comment.