Skip to content

Commit

Permalink
Merge branch 'development' into RecordingDataAtStation
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Jan 2, 2024
2 parents aebef6a + 2444f15 commit 715a53c
Show file tree
Hide file tree
Showing 23 changed files with 600 additions and 469 deletions.
7 changes: 6 additions & 1 deletion Examples/Tests/Implicit/analysis_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# 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 re
import sys

import numpy as np
Expand All @@ -28,7 +29,11 @@
delta_E = (total_energy - total_energy[0])/total_energy[0]
max_delta_E = np.abs(delta_E).max()

tolerance_rel = 1.e-14
if re.match('SemiImplicitPicard_1d', fn):
tolerance_rel = 2.5e-5
elif re.match('ImplicitPicard_1d', fn):
# This case should have near machine precision conservation of energy
tolerance_rel = 1.e-14

print(f"max change in energy: {max_delta_E}")
print(f"tolerance: {tolerance_rel}")
Expand Down
81 changes: 81 additions & 0 deletions Examples/Tests/Implicit/inputs_1d_semiimplicit
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 = semi_implicit_picard
algo.max_picard_iterations = 5
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
12 changes: 6 additions & 6 deletions Regression/Checksum/benchmarks_json/BTD_rz.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"lev=0": {
"Br": 1.8705552174367742e-08,
"Bt": 2380179.567792259,
"Bz": 2.4079075035536954e-08,
"Br": 1.8705552264208163e-08,
"Bt": 2380179.5677922587,
"Bz": 2.4079077116116535e-08,
"Er": 497571119514841.25,
"Et": 7.048225282653208,
"Ez": 137058870936728.17,
"Et": 7.048225464720808,
"Ez": 137058870936728.28,
"jr": 0.0,
"jt": 0.0,
"jz": 0.0
}
}
}
56 changes: 28 additions & 28 deletions Regression/Checksum/benchmarks_json/LaserAccelerationBoost.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"beam": {
"particle_momentum_x": 3.535284585563231e-19,
"particle_momentum_y": 4.403094613346061e-19,
"particle_momentum_z": 5.658013779496569e-17,
"particle_position_x": 0.008317876520240174,
"particle_position_y": 1.1704335094514386,
"particle_weight": 62415090744.60765
"lev=0": {
"Bx": 4818955.485214876,
"By": 1752.8017794063862,
"Bz": 14516.212849468406,
"Ex": 2366115511749.6064,
"Ey": 1446112026972328.0,
"Ez": 21864189477873.78,
"jx": 1996366361598696.5,
"jy": 5.312583836700398e+16,
"jz": 2.0491352591140016e+16,
"rho": 68443961.6079968
},
"electrons": {
"particle_momentum_x": 2.2135959939611405e-23,
"particle_momentum_y": 2.822519730011994e-22,
"particle_momentum_z": 5.260625039372931e-22,
"particle_position_x": 0.010800577787577741,
"particle_position_y": 0.21115060628258137,
"particle_momentum_x": 2.2135944672847805e-23,
"particle_momentum_y": 2.82245592458273e-22,
"particle_momentum_z": 5.260626007649988e-22,
"particle_position_x": 0.010800577787630073,
"particle_position_y": 0.21115060628317733,
"particle_weight": 4.121554826246186e+16
},
"ions": {
"particle_momentum_x": 6.248472008953412e-23,
"particle_momentum_y": 4.449200926395666e-22,
"particle_momentum_z": 5.768167708374496e-22,
"particle_position_x": 0.010800001678510793,
"particle_position_y": 0.21114947608115497,
"particle_momentum_x": 6.24847236820344e-23,
"particle_momentum_y": 4.449097670697282e-22,
"particle_momentum_z": 5.768168724446374e-22,
"particle_position_x": 0.010800001678510515,
"particle_position_y": 0.21114947608115428,
"particle_weight": 4.121554826246186e+16
},
"lev=0": {
"Bx": 4818965.813977506,
"By": 1752.781451346485,
"Bz": 14516.29947347909,
"Ex": 2366115950699.717,
"Ey": 1446115205306590.0,
"Ez": 21864183756771.12,
"jx": 1996366451911408.0,
"jy": 5.312642483130767e+16,
"jz": 2.049134468340688e+16,
"rho": 68443935.06252655
"beam": {
"particle_momentum_x": 3.5357352601344873e-19,
"particle_momentum_y": 4.363147101327531e-19,
"particle_momentum_z": 5.658494028187168e-17,
"particle_position_x": 0.008314957057032625,
"particle_position_y": 1.1704335719922687,
"particle_weight": 62415090744.60765
}
}
60 changes: 30 additions & 30 deletions Regression/Checksum/benchmarks_json/LaserAccelerationRZ.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
{
"lev=0": {
"Br": 104965.61239547668,
"Br_0_real": 0.27473110662919303,
"Br_1_imag": 104.10451752777047,
"Br": 104965.61239547684,
"Br_0_real": 0.2747311066289638,
"Br_1_imag": 104.10451752777048,
"Br_1_real": 104965.62478916143,
"Bt": 1296.2723279668432,
"Btheta_0_real": 1297.3296772773876,
"Bt": 1296.2723277779253,
"Btheta_0_real": 1297.3296772773874,
"Btheta_1_imag": 105725.25398122355,
"Btheta_1_real": 141.255481019691,
"Bz": 5076.744762384442,
"Bz_0_real": 0.4603819957305941,
"Bz_1_imag": 1.007360812967319,
"Btheta_1_real": 141.2554810196911,
"Bz": 5076.74476238461,
"Bz_0_real": 0.4603819957306249,
"Bz_1_imag": 1.0073608129672305,
"Bz_1_real": 5076.632351216658,
"Er": 273570494222.5625,
"Er": 273570493775.55588,
"Er_0_real": 271974091013.7082,
"Er_1_imag": 39530787242966.72,
"Er_1_real": 42616886403.53066,
"Et": 39016542462571.72,
"Etheta_0_real": 112249482.93967965,
"Etheta_1_imag": 33602799006.8748,
"Er_1_real": 42616886403.53069,
"Et": 39016542462571.68,
"Etheta_0_real": 112249482.93975669,
"Etheta_1_imag": 33602799006.874825,
"Etheta_1_real": 39016517454881.91,
"Ez": 511653064866.5733,
"Ez": 511653064863.048,
"Ez_0_real": 496845125310.57947,
"Ez_1_imag": 1245709520854.4875,
"Ez_1_real": 24849976994.356285,
"Jr_0_real": 1264417193501.7915,
"Ez_1_imag": 1245709520854.488,
"Ez_1_real": 24849976994.356266,
"Jr_0_real": 1264417193503.146,
"Jr_1_imag": 2.3356633334993878e+17,
"Jr_1_real": 2272922066062.2944,
"Jr_1_real": 2272922066062.586,
"Jtheta_0_real": 475304056513.7001,
"Jtheta_1_imag": 1028929701334.7467,
"Jtheta_1_imag": 1028929701334.8286,
"Jtheta_1_real": 2.1766379427377802e+17,
"Jz_0_real": 1832468408628522.8,
"Jz_1_imag": 556484600934089.9,
"Jz_1_real": 602703622358902.4,
"jr": 1749994884866.3667,
"jt": 2.176637940885753e+17,
"jz": 1954078685186198.5,
"rho": 39314210.88334631,
"jr": 1749985661974.403,
"jt": 2.1766379408857264e+17,
"jz": 1954078684852864.2,
"rho": 39314210.931097575,
"rho_0_real": 38889615.839967206,
"rho_1_imag": 21546499.619336687,
"rho_1_real": 2012888.5658883716
"rho_1_imag": 21546499.619336277,
"rho_1_real": 2012888.5658883736
},
"electrons": {
"particle_momentum_x": 1.3203417227476259e-24,
"particle_momentum_x": 1.3203417227476271e-24,
"particle_momentum_y": 4.0070625287284664e-22,
"particle_momentum_z": 1.2493391415020164e-23,
"particle_momentum_z": 1.2493391415020162e-23,
"particle_orig_x": 0.026508328457558912,
"particle_orig_z": 0.04789125000000001,
"particle_position_x": 0.04160250006680718,
"particle_position_y": 0.04789125046517409,
"particle_theta": 7325.121266775259,
"particle_theta": 7325.160426984388,
"particle_weight": 813672305.532158
},
"beam": {
Expand All @@ -61,4 +61,4 @@
"particle_theta": 151.40797316586125,
"particle_weight": 6241509.074460764
}
}
}
48 changes: 24 additions & 24 deletions Regression/Checksum/benchmarks_json/LaserAcceleration_BTD.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"lev=0": {
"Bx": 497087553.4743837,
"By": 252364344.72213668,
"Bz": 16986109.62608196,
"Ex": 7.304419665394173e+16,
"Ey": 1.4583459400150573e+17,
"Ez": 2.261309965998215e+16,
"jx": 8.273582439836952e+17,
"jy": 2.1044181577417728e+18,
"jz": 2.84208498868846e+19,
"rho": 91637594416.50476
"Bx": 497756265.44724107,
"By": 252197580.117894,
"Bz": 16988475.5444833,
"Ex": 7.299911104263803e+16,
"Ey": 1.460116488178734e+17,
"Ez": 2.26033100286114e+16,
"jx": 8.27644503757345e+17,
"jy": 2.1062078409959675e+18,
"jz": 2.8491727096438305e+19,
"rho": 91863764144.41415
},
"electrons": {
"particle_momentum_x": 5.922677819206403e-20,
"particle_momentum_y": 2.7778096010261295e-19,
"particle_momentum_z": 4.183846407463124e-19,
"particle_position_x": 0.0025865980636989934,
"particle_position_y": 0.002652673793955211,
"particle_position_z": 0.18411922027879662,
"particle_weight": 1731649095408.5505
"particle_momentum_x": 5.76165226700654e-20,
"particle_momentum_y": 2.7567389504898156e-19,
"particle_momentum_z": 4.134562048099117e-19,
"particle_position_x": 0.0025269863605945427,
"particle_position_y": 0.0024538321295153346,
"particle_position_z": 0.17818421763751244,
"particle_weight": 1675789447169.5652
},
"beam": {
"particle_momentum_x": 1.1925686969448298e-17,
"particle_momentum_y": 2.570810132551278e-17,
"particle_momentum_z": 5.156190278524037e-14,
"particle_position_x": 0.0005608477913384702,
"particle_position_y": 0.0008431191912437461,
"particle_position_z": 2.9800048756186395,
"particle_momentum_x": 1.1926313055043134e-17,
"particle_momentum_y": 2.7056205218547404e-17,
"particle_momentum_z": 5.1562131494813424e-14,
"particle_position_x": 0.000560821518739447,
"particle_position_y": 0.000800729816549036,
"particle_position_z": 2.9800048650570097,
"particle_weight": 62415.090744607616
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"lev=0": {
"Bx": 5863879.051452597,
"By": 2411.5124004699082,
"Bz": 116025.40178726945,
"Ex": 6267725953308.365,
"Ey": 1670763222566621.8,
"Ez": 104345977762699.77,
"jx": 555688154318027.4,
"jy": 1595897074125252.8,
"jz": 1045267363178542.9,
"rho": 2205684400.3678846
},
"electrons": {
"particle_initialenergy": 0.0,
"particle_momentum_x": 1.7921229236407606e-20,
"particle_momentum_y": 7.225825184653885e-20,
"particle_momentum_z": 4.231731488281653e-20,
"particle_position_x": 0.7139122621535502,
"particle_position_y": 0.7150340889556129,
"particle_position_z": 1.3175770602802896,
"particle_regionofinterest": 1936.0,
"particle_position_x": 0.7139122620952513,
"particle_position_y": 0.7150340902640349,
"particle_position_z": 1.317577060220835,
"particle_momentum_x": 1.7921232385614662e-20,
"particle_momentum_y": 7.22582607277354e-20,
"particle_momentum_z": 4.231730764749506e-20,
"particle_weight": 12926557617.187498
},
"lev=0": {
"Bx": 5863879.02030842,
"By": 2411.501904737579,
"Bz": 116025.42462998998,
"Ex": 6267728094111.663,
"Ey": 1670763233105822.0,
"Ez": 104345989831222.4,
"jx": 555687912108453.8,
"jy": 1595896363359136.0,
"jz": 1045267552192496.5,
"rho": 2205684400.307701
}
}
Loading

0 comments on commit 715a53c

Please sign in to comment.