forked from ECP-WarpX/WarpX
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
48 changed files
with
3,168 additions
and
543 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
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
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
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
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,39 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright 2023 David Grote | ||
# | ||
# | ||
# This file is part of WarpX. | ||
# | ||
# License: BSD-3-Clause-LBNL | ||
# | ||
# This is a script that analyses the simulation results from | ||
# the script `inputs_1d`. This simulates a 1D periodic plasma using the implicit solver. | ||
import os | ||
import sys | ||
|
||
import numpy as np | ||
|
||
sys.path.insert(1, '../../../../warpx/Regression/Checksum/') | ||
import checksumAPI | ||
|
||
# this will be the name of the plot file | ||
fn = sys.argv[1] | ||
|
||
field_energy = np.loadtxt('diags/reducedfiles/field_energy.txt', skiprows=1) | ||
particle_energy = np.loadtxt('diags/reducedfiles/particle_energy.txt', skiprows=1) | ||
|
||
total_energy = field_energy[:,2] + particle_energy[:,2] | ||
|
||
delta_E = (total_energy - total_energy[0])/total_energy[0] | ||
max_delta_E = np.abs(delta_E).max() | ||
|
||
tolerance_rel = 1.e-14 | ||
|
||
print(f"max change in energy: {max_delta_E}") | ||
print(f"tolerance: {tolerance_rel}") | ||
|
||
assert( max_delta_E < tolerance_rel ) | ||
|
||
test_name = os.path.split(os.getcwd())[1] | ||
checksumAPI.evaluate_checksum(test_name, fn) |
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,81 @@ | ||
################################# | ||
############ CONSTANTS ############# | ||
################################# | ||
|
||
my_constants.n0 = 1.e30 # plasma densirty, m^-3 | ||
my_constants.nz = 40 # number of grid cells | ||
my_constants.Ti = 100. # ion temperature, eV | ||
my_constants.Te = 100. # electron temperature, eV | ||
my_constants.wpe = q_e*sqrt(n0/(m_e*epsilon0)) # electron plasma frequency, radians/s | ||
my_constants.de0 = clight/wpe # skin depth, m | ||
my_constants.nppcz = 100 # number of particles/cell in z | ||
my_constants.dt = 0.1/wpe # time step size, s | ||
|
||
################################# | ||
####### GENERAL PARAMETERS ###### | ||
################################# | ||
|
||
max_step = 100 | ||
amr.n_cell = nz | ||
amr.max_level = 0 | ||
|
||
geometry.dims = 1 | ||
geometry.prob_lo = 0.0 | ||
geometry.prob_hi = 10.*de0 | ||
boundary.field_lo = periodic | ||
boundary.field_hi = periodic | ||
boundary.particle_lo = periodic | ||
boundary.particle_hi = periodic | ||
|
||
################################# | ||
############ NUMERICS ########### | ||
################################# | ||
|
||
warpx.const_dt = dt | ||
algo.evolve_scheme = implicit_picard | ||
algo.max_picard_iterations = 31 | ||
algo.picard_iteration_tolerance = 0. | ||
algo.current_deposition = esirkepov | ||
algo.field_gathering = energy-conserving | ||
algo.particle_shape = 2 | ||
warpx.use_filter = 0 | ||
|
||
################################# | ||
############ PLASMA ############# | ||
################################# | ||
|
||
particles.species_names = electrons protons | ||
|
||
electrons.species_type = electron | ||
electrons.injection_style = "NUniformPerCell" | ||
electrons.num_particles_per_cell_each_dim = nppcz | ||
electrons.profile = constant | ||
electrons.density = n0 | ||
electrons.momentum_distribution_type = gaussian | ||
electrons.ux_th = sqrt(Te*q_e/m_e)/clight | ||
electrons.uy_th = sqrt(Te*q_e/m_e)/clight | ||
electrons.uz_th = sqrt(Te*q_e/m_e)/clight | ||
|
||
protons.species_type = proton | ||
protons.injection_style = "NUniformPerCell" | ||
protons.num_particles_per_cell_each_dim = nppcz | ||
protons.profile = constant | ||
protons.density = n0 | ||
protons.momentum_distribution_type = gaussian | ||
protons.ux_th = sqrt(Ti*q_e/m_p)/clight | ||
protons.uy_th = sqrt(Ti*q_e/m_p)/clight | ||
protons.uz_th = sqrt(Ti*q_e/m_p)/clight | ||
|
||
# Diagnostics | ||
diagnostics.diags_names = diag1 | ||
diag1.intervals = 100 | ||
diag1.diag_type = Full | ||
diag1.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho divE | ||
diag1.electrons.variables = w ux uy uz | ||
diag1.protons.variables = w ux uy uz | ||
|
||
warpx.reduced_diags_names = particle_energy field_energy | ||
particle_energy.type = ParticleEnergy | ||
particle_energy.intervals = 1 | ||
field_energy.type = FieldEnergy | ||
field_energy.intervals = 1 |
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
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
29 changes: 29 additions & 0 deletions
29
Regression/Checksum/benchmarks_json/ImplicitPicard_1d.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,29 @@ | ||
{ | ||
"lev=0": { | ||
"Bx": 3730.0029376363264, | ||
"By": 1593.5906541698305, | ||
"Bz": 0.0, | ||
"Ex": 797541065253.7858, | ||
"Ey": 981292393404.0359, | ||
"Ez": 3528134993266.091, | ||
"divE": 2.0829069134855788e+21, | ||
"jx": 7.639291641209293e+17, | ||
"jy": 1.4113587963237038e+18, | ||
"jz": 1.3506587033985085e+18, | ||
"rho": 18442449008.581665 | ||
}, | ||
"protons": { | ||
"particle_momentum_x": 5.231105747759245e-19, | ||
"particle_momentum_y": 5.367982834807453e-19, | ||
"particle_momentum_z": 5.253213507906386e-19, | ||
"particle_position_x": 0.00010628272743703996, | ||
"particle_weight": 5.314093261582036e+22 | ||
}, | ||
"electrons": { | ||
"particle_momentum_x": 1.196379551301037e-20, | ||
"particle_momentum_y": 1.2271443795645239e-20, | ||
"particle_momentum_z": 1.2277752539495415e-20, | ||
"particle_position_x": 0.00010649569055433632, | ||
"particle_weight": 5.314093261582036e+22 | ||
} | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
CEXE_sources += WarpXEvolve.cpp | ||
CEXE_sources += WarpXComputeDt.cpp | ||
CEXE_sources += WarpXOneStepImplicitPicard.cpp | ||
|
||
VPATH_LOCATIONS += $(WARPX_HOME)/Source/Evolve |
Oops, something went wrong.