forked from ECP-WarpX/WarpX
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c753798
commit ee59b48
Showing
4 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/use/bin/env python3 | ||
# | ||
# Copyright 2023-2024 Revathi Jambunathan | ||
# | ||
# This file is part of WarpX | ||
# | ||
# License: BSD-3-Clause-LBNL | ||
|
||
""" | ||
The script checks to see the growth in total field energy and total particle energy | ||
The input file in 2D initializes uniform plasma (electrons,ions) with | ||
thermal boundary condition. We do not expect the particle energy to increase | ||
beyond 2% in the time that it takes all particles to cross the domain boundary | ||
""" | ||
|
||
|
||
import os | ||
import sys | ||
|
||
import numpy as np | ||
|
||
sys.path.insert(1,'../../../../warpx/Regression/Checksum/') | ||
import checksumAPI | ||
|
||
filename = sys.argv[1] | ||
|
||
FE_rdiag = '/diags/reducedfiles/EF.txt' | ||
init_Fenergy = np.loadtxt(FE_rdiag)[1,2] | ||
final_Fenergy = np.loadtxt(FE_rdiag)[-1,2] | ||
assert(final_Fenergy/init_Fenergy < 40) | ||
assert(final_Fenergy < 5.e-5) | ||
|
||
PE_rdiag = '/diags/reducedfiles/EN.txt' | ||
init_Penergy = np.loadtxt(PE_rdiag)[0,2] | ||
final_Penergy = np.loadtxt(PE_rdiag)[-1,2] | ||
assert( abs(final_Penergy - init_Penergy)/init_Penergy < 0.02) | ||
|
||
test_name = os.path.splot(os.getcwd())[1] | ||
checksumAPI.evaluate_checksum(test_name, filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
max_step = 2000 | ||
|
||
# number of grid points | ||
amr.n_cell = 16 16 | ||
|
||
# Maximum allowable size of each subdomain in the problem domain; | ||
# this is used to decompose the domain for parallel calculations. | ||
amr.max_grid_size = 128 | ||
|
||
# Maximum level in hierarchy (for now must be 0, i.e., one level in total) | ||
amr.max_level = 0 | ||
|
||
# Geometry | ||
geometry.dims = 2 | ||
geometry.prob_lo = 0.e-6 0.e-6 # physical domain | ||
geometry.prob_hi = 2.5e-7 2.5e-7 | ||
|
||
# Boundary condition | ||
boundary.field_lo = pml pml | ||
boundary.field_hi = pml pml | ||
boundary.particle_lo = thermal thermal | ||
boundary.particle_hi = thermal thermal | ||
boundary.electrons.u_th = uth_e | ||
boundary.C.u_th = uth_C | ||
warpx.do_dive_cleaning = 0 | ||
|
||
# Verbosity | ||
warpx.verbose = 1 | ||
|
||
# Order of particle shape factors | ||
algo.particle_shape = 2 | ||
|
||
# CFL | ||
warpx.cfl = 0.98 | ||
|
||
# Density | ||
my_constants.n0 = 4e26 | ||
my_constants.uth_e = 0.06256112470898544 | ||
my_constants.uth_C = 0.00042148059678527106 | ||
|
||
# Particles | ||
particles.species_names = electrons C | ||
|
||
electrons.charge = -q_e | ||
electrons.mass = m_e | ||
electrons.injection_style = "NUniformPerCell" | ||
electrons.num_particles_per_cell_each_dim = 8 8 | ||
electrons.profile = constant | ||
electrons.density = n0 | ||
electrons.momentum_distribution_type = gaussian | ||
electrons.ux_th = uth_e | ||
electrons.uy_th = uth_e | ||
electrons.uz_th = uth_e | ||
|
||
C.charge = 6*q_e | ||
C.mass = 12*m_p | ||
C.injection_style = "NUniformPerCell" | ||
C.num_particles_per_cell_each_dim = 8 8 | ||
C.profile = constant | ||
C.density = n0/6 | ||
C.momentum_distribution_type = gaussian | ||
C.ux_th = uth_C | ||
C.uy_th = uth_C | ||
C.uz_th = uth_C | ||
|
||
# Diagnostics | ||
diagnostics.diags_names = diag1 | ||
diag1.intervals = 3000 | ||
diag1.write_species = 0 | ||
diag1.fields_to_plot = Ex Ey Ez Bx By Bz rho divE | ||
diag1.diag_type = Full | ||
|
||
warpx.reduced_diags_names = EN EF | ||
EN.intervals = 10 | ||
EN.type = ParticleEnergy | ||
EF.intervals = 10 | ||
EF.type = FieldEnergy |
12 changes: 12 additions & 0 deletions
12
Regression/Checksum/benchmarks_json/particle_thermal_boundary.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"lev=0": { | ||
"Bx": 229.28366410112736, | ||
"By": 242.40221902487008, | ||
"Bz": 164.70543954019666, | ||
"Ex": 789234700854.9321, | ||
"Ey": 15892271613.51144, | ||
"Ez": 693631132513.1528, | ||
"divE": 5.441439446237374e+19, | ||
"rho": 331367728.98455656 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters