-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsweep_debug.py
More file actions
72 lines (58 loc) · 6.24 KB
/
sweep_debug.py
File metadata and controls
72 lines (58 loc) · 6.24 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 24 15:52:57 2022
@author: sampasmann
"""
import numpy as np
from src.init_files.reeds_init import ReedsInit
from src.functions.sweep import Sweep
from src.functions.tallies import Tallies
from src.functions.source import GetSource
from src.solvers.solvers import Picard
import matplotlib.pyplot as plt
Nx = 80
generator = "halton"
N = 2**10
############################################
# one sweep
#halton
phi_j = np.array((0.6076022947244235, 0.712894547625304, 0.7224841997251003, 0.8445796230521988, 0.8904610100097817, 0.9311560990222522, 0.8622466283763308, 0.903774830364939, 1.0295519446138344, 1.181134883259566, 1.3581302316086032, 1.495848989673451, 1.3028950028034667, 1.3363340564335429, 1.2081902934733153, 0.7692751633159736, 0.7692751633159736, 0.7692751633159771, 0.7692751633159736, 0.7692751633159736, 0.7692751633159736, 0.7692751633159755, 0.7692751633159736, 0.7692751633159755, 0.7692751633159736, 0.3204691730441205, 0.06379143921563435, 0.01907840193007184, 0.014248667309393262, 0.03408964629731854, 0.9364142000401455, 0.988343855264392, 1.0742509916128495, 0.9686721845787939, 0.9650565942713422, 0.9822217107472958, 1.0709711826351915, 0.9752823641086783, 0.9851163882417052, 1.05729938202924, 0.9819090401093534, 0.9715069690352309, 0.9774310456172042, 1.0222976551244003, 1.037416995811183, 0.9385833204929988, 1.0159048346547548, 1.035689927685756, 0.9997375579269565, 0.9312484215978833, 0.6689439677595178, 0.11604288764324461, 0.035332025777928364, 0.06718468297358073, 0.3331375214016855, 0.920592989973172, 0.9205929899731743, 0.920592989973172, 0.9205929899731743, 0.920592989973172, 0.920592989973172, 0.920592989973172, 0.9205929899731763, 0.920592989973172, 0.920592989973172, 0.9182736859513162, 1.4429137023243892, 1.529868141368949, 1.359401660952798, 1.191901367339303, 1.220868157222222, 1.0567391025212893, 0.9901920951968997, 0.9317198439322086, 0.8473862821672292, 0.8350154595997494, 0.7916865009883618, 0.7997607069145034, 0.7315963260671247, 0.5682760483475702))
phi_j = np.reshape(phi_j,(80,1))
#sobol
#phi_j = np.array((0.5672239028477234, 0.6630474388484837, 0.7816077046424693, 0.8533150541139619, 0.8341833979039858, 0.8973240803830005, 0.9227263875332471, 0.9600991946516214, 0.9822070180413913, 1.144364011802079, 1.4132452864076446, 1.3933536995473943, 1.4435324375798921, 1.263330788314722, 1.100114459585862, 0.867490310126245, 0.867490310126245, 0.867490310126249, 0.867490310126245, 0.867490310126245, 0.867490310126245, 0.8674903101262469, 0.867490310126245, 0.8674903101262469, 0.867490310126245, 0.3369120436948494, 0.07205857416953518, 0.037767613406214845, 0.06284153893216166, 0.16834125298268973, 0.995405028141213, 1.0323243812537872, 0.9835310731596991, 0.9475189659709368, 1.0516580881465638, 0.9649567077342731, 0.9930701399110823, 1.0101315305743654, 0.9922616394456233, 1.0431190905998056, 0.9645836968264923, 1.0264952943369208, 0.9729798672966457, 1.0001529543667573, 1.004909387164904, 1.0393538221152492, 0.9960020138861743, 0.9946549350487672, 0.9461788298815145, 1.0142457777964602, 0.0077883500538143925, 0.006397799013595882, 0.017257520451691096, 0.06431828988034821, 0.3222721822265702, 0.7991692150752007, 0.7991692150752024, 0.7991692150752007, 0.7991692150752024, 0.7991692150752007, 0.7991692150752007, 0.7991692150752007, 0.7991692150752043, 0.7991692150752007, 0.7991692150752007, 1.1342948307364733, 1.3697329804516207, 1.3827591218663702, 1.3446464509725504, 1.46230838812668, 1.1160182148313156, 0.9940435983121451, 0.9450560628198265, 0.9108723768555502, 0.9221590623676956, 0.8130300007249766, 0.850073120916776, 0.752990503295094, 0.7378245494170141, 0.5519547575282393))
#phi_j = np.reshape(phi_j, (Nx,1))
phi_in = np.ones((Nx,1))
data = ReedsInit(N=N, Nx=Nx, generator=generator)
source = GetSource(phi_in, data)
tallies = Tallies(data)
sweep = Sweep(data)
sweep.Run(tallies,source)
phi_out = tallies.phi_avg
print(abs(phi_out-phi_j).max())
plt.figure()
plt.title('Flux')
plt.plot(range(Nx), phi_j, label='julia')
plt.plot(range(Nx), phi_out, '--', label='python')
plt.legend()
plt.figure()
plt.title('Difference Between Python-Julia Flux - Log Scale')
plt.plot(range(Nx),abs(phi_j - phi_out),'o-')
plt.yscale('log')
"""
############################################
# full SI output
phi2 = np.array((0.2933137964116022, 0.3777741364113436, 0.43976976641966686, 0.5661250265082145, 0.6862021897621232, 0.8129238107334267, 0.8354303838660747, 0.9669075414771718, 1.2357643313024111, 1.5849741817002818, 1.8524492356896467, 2.069023618011761, 1.7590070369837376, 1.7977104286943613, 1.602857029635314, 1.0244747683905624, 1.0244747683905624, 1.0244747683905668, 1.0244747683905624, 1.0244747683905624, 1.0244747683905624, 1.0244747683905646, 1.0244747683905624, 1.0244747683905646, 1.0244747683905624, 0.425040175114536, 0.08346504729897075, 0.024009373254387123, 0.015613948969324783, 0.034489471872335524, 0.9364319389556773, 0.988343855566057, 1.0742509916128589, 0.9686721845787939, 0.9650565942713422, 0.9822217107472958, 1.0709711826351915, 0.9752823641086783, 0.9851163882417052, 1.05729938202924, 0.9819090401093534, 0.9715069690352309, 0.9774310456172042, 1.0222976551244003, 1.037416995811183, 0.9385833204929988, 1.0159048346547548, 1.0356899276857696, 0.9997375584217684, 0.9312723924264299, 0.6694447196030617, 0.11765001936091452, 0.040743313065436576, 0.08705257727747728, 0.423824567189715, 1.1282451568610772, 1.1282451568610803, 1.1282451568610772, 1.1282451568610803, 1.1282451568610772, 1.1282451568610772, 1.1282451568610772, 1.1282451568610825, 1.1282451568610772, 1.1282451568610772, 1.1613682877777676, 1.9518948755247219, 2.1191208661002974, 1.7931469546681706, 1.5345322837674649, 1.549413482507327, 1.2549759120781092, 1.0656383982000979, 0.9001604078029176, 0.726997550051497, 0.6310861035184074, 0.5340073751108817, 0.4738357931882496, 0.37884958592600343, 0.2780637948713245))
phi2 = np.reshape(phi2,(80,1))
phi_out = Picard(data, save_data=False, report_progress=True)
print(abs(phi_out-phi2).max())
plt.figure()
plt.title('Flux')
plt.plot(range(Nx), phi2, label='julia')
plt.plot(range(Nx), phi_out, '--', label='python')
plt.legend()
plt.figure()
plt.title('Difference Between Python-Julia Flux - Log Scale')
plt.plot(range(Nx),abs(phi2 - phi_out),'o-')
plt.yscale('log')
"""