blob: c1a5ba33a1b1c4c207f15c57cf58b8ca63ab4592 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env python3
# Run the default regression test for the PICMI version of the EB test
# using the same reference file as for the non-PICMI test since the two
# tests are otherwise the same.
import os
import sys
sys.path.insert(1, '../../../../warpx/Regression/Checksum/')
import checksumAPI
# Check reduced diagnostics for charge on EB
import numpy as np
from scipy.constants import epsilon_0
# Theoretical charge on the embedded boundary, for sphere at potential phi_0
phi_0 = 1. # V
R = 0.1 # m
q_th = 4*np.pi*epsilon_0*phi_0*R
print('Theoretical charge: ', q_th)
data = np.loadtxt('diags/reducedfiles/eb_charge.txt')
q_sim = data[1,2]
print('Simulation charge: ', q_sim)
assert abs((q_sim-q_th)/q_th) < 0.06
data_eighth = np.loadtxt('diags/reducedfiles/eb_charge_one_eighth.txt')
q_sim_eighth = data_eighth[1,2]
assert abs((q_sim_eighth-q_th/8)/(q_th/8)) < 0.06
filename = sys.argv[1]
test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename)
|