Skip to content

Commit de1e630

Browse files
committed
Updates to old tests
1 parent bfb5fbb commit de1e630

File tree

3 files changed

+29
-37
lines changed

3 files changed

+29
-37
lines changed

t-step-test-3d.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"import time\n",
1414
"\n",
1515
"from lcode2dPy.plasma3d.initialization import init_plasma\n",
16-
"from lcode2dPy.push_solver_3d import PushAndSolver3d\n",
16+
"from lcode2dPy.push_solvers.push_solver_3d import PushAndSolver3d\n",
1717
"\n",
1818
"from lcode2dPy.beam3d import beam\n",
1919
"from lcode2dPy.beam_generator.beam_generator import *\n",

t-step-test1-3d-gpu.ipynb

+7-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 3,
12+
"execution_count": 1,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
@@ -19,16 +19,12 @@
1919
},
2020
{
2121
"cell_type": "code",
22-
"execution_count": 4,
22+
"execution_count": 2,
2323
"metadata": {},
2424
"outputs": [],
2525
"source": [
2626
"# Import required modules\n",
27-
"from lcode2dPy.simulation.three_dimensional import Cartesian3dSimulation\n",
28-
"from lcode2dPy.diagnostics.diagnostics_3d import (DiagnosticsFXi,\n",
29-
" DiagnosticsColormaps,\n",
30-
" DiagnosticsTransverse,\n",
31-
" SaveRunState)\n",
27+
"from lcode2dPy import *\n",
3228
"\n",
3329
"# Set some parameters of the config:\n",
3430
"config = {\n",
@@ -52,10 +48,10 @@
5248
"beam_parameters = {'current': 0.01 * (2*pi), 'particles_in_layer': 5000}\n",
5349
"\n",
5450
"# Set diagnostics\n",
55-
"diag = [DiagnosticsFXi(f_xi='Ez', output_period=0, saving_xi_period=25),\n",
56-
" DiagnosticsTransverse(output_period=0, colormaps='ne', saving_xi_period=25),\n",
51+
"diag = [DiagnosticsFXi(f_xi='Ez', output_period=0),\n",
52+
" DiagnosticsTransverse(output_period=0, colormaps='rho'),\n",
5753
" DiagnosticsColormaps(output_period=0, colormaps='Ez',\n",
58-
" xi_from=0, xi_to=-30, saving_xi_period=10),\n",
54+
" xi_from=0, xi_to=-30),\n",
5955
" SaveRunState(saving_period=0, save_beam=True, save_plasma=True)]"
6056
]
6157
},
@@ -135,7 +131,7 @@
135131
"name": "python",
136132
"nbconvert_exporter": "python",
137133
"pygments_lexer": "ipython3",
138-
"version": "3.8.10"
134+
"version": "3.10.4"
139135
},
140136
"orig_nbformat": 4
141137
},

t-step-test1-3d.ipynb

+21-25
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"metadata": {},
56
"source": [
67
"### Test 1 for lcode 3d with a single time step and an alternative beam generator."
7-
],
8-
"metadata": {}
8+
]
99
},
1010
{
1111
"cell_type": "code",
1212
"execution_count": null,
13+
"metadata": {},
14+
"outputs": [],
1315
"source": [
1416
"# Import required modules\n",
1517
"from math import pi, inf\n",
1618
"\n",
17-
"from lcode2dPy.alt_beam_generator.beam_generator import generate_beam\n",
18-
"from lcode2dPy.simulation.three_dimensional import Cartesian3dSimulation\n",
19-
"from lcode2dPy.diagnostics.diagnostics_3d import (DiagnosticsFXi,\n",
20-
" DiagnosticsColormaps,\n",
21-
" SaveRunState)\n",
19+
"from lcode2dPy import *\n",
2220
"\n",
2321
"# Set some parameters of the config:\n",
2422
"config = {\n",
@@ -40,47 +38,47 @@
4038
"diag = [DiagnosticsFXi(f_xi='Ez, Ex', output_period=0),\n",
4139
" DiagnosticsColormaps(output_period=0, colormaps='Ez'),\n",
4240
" SaveRunState(saving_period=0, save_beam=True)]"
43-
],
44-
"outputs": [],
45-
"metadata": {}
41+
]
4642
},
4743
{
4844
"cell_type": "code",
4945
"execution_count": null,
46+
"metadata": {},
47+
"outputs": [],
5048
"source": [
5149
"# Create a beam\n",
5250
"\n",
5351
"beam_parameters = {'current': 0.01 * (2*pi), 'particles_in_layer': 2000}\n",
5452
"\n",
5553
"beam_particles = generate_beam(config=config, beam_parameters=beam_parameters)\n",
5654
"beam_particles.save('beamfile_1')"
57-
],
58-
"outputs": [],
59-
"metadata": {}
55+
]
6056
},
6157
{
6258
"cell_type": "code",
6359
"execution_count": null,
60+
"metadata": {},
61+
"outputs": [],
6462
"source": [
6563
"sim = Cartesian3dSimulation(config=config, diagnostics=diag)\n",
6664
"sim.load_beamfile('beamfile_1.npz')\n",
6765
"# sim.load_plasmastate('plasmastate.npz')"
68-
],
69-
"outputs": [],
70-
"metadata": {}
66+
]
7167
},
7268
{
7369
"cell_type": "code",
7470
"execution_count": null,
71+
"metadata": {},
72+
"outputs": [],
7573
"source": [
7674
"sim.step()"
77-
],
78-
"outputs": [],
79-
"metadata": {}
75+
]
8076
},
8177
{
8278
"cell_type": "code",
8379
"execution_count": null,
80+
"metadata": {},
81+
"outputs": [],
8482
"source": [
8583
"# Should work correctly. Compare results with the test 1 result with a rigid beam:\n",
8684
"# xi Ez_00\n",
@@ -110,16 +108,14 @@
110108
"# xi=+0.4600 -6.0912e-04\n",
111109
"# xi=+0.4800 -6.8855e-04\n",
112110
"# xi=+0.5000 -7.7437e-04"
113-
],
114-
"outputs": [],
115-
"metadata": {}
111+
]
116112
},
117113
{
118114
"cell_type": "code",
119115
"execution_count": null,
120-
"source": [],
116+
"metadata": {},
121117
"outputs": [],
122-
"metadata": {}
118+
"source": []
123119
}
124120
],
125121
"metadata": {
@@ -148,4 +144,4 @@
148144
},
149145
"nbformat": 4,
150146
"nbformat_minor": 2
151-
}
147+
}

0 commit comments

Comments
 (0)