-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThursday_Zoom_Background.html
More file actions
1798 lines (1650 loc) · 84.4 KB
/
Thursday_Zoom_Background.html
File metadata and controls
1798 lines (1650 loc) · 84.4 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>Cole Jerum Projects Overview (SULI/LCLS)</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism-tomorrow.min.css" rel="stylesheet" />
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 20px;
background-color: #f5f5f5;
color: #333;
}
.container {
max-width: 800px;
margin: 0 auto;
background-color: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
header {
text-align: center;
margin-bottom: 40px;
}
h1 {
font-size: 2.5rem;
margin-bottom: 10px;
color: #2d3748;
}
.subtitle {
font-size: 1.25rem;
color: #4a5568;
margin: 5px 0;
}
.card {
text-align: left;
background-color: white;
border-radius: 8px;
padding: 20px;
margin-bottom: 30px;
border: 1px solid #e2e8f0;
}
.nav-buttons {
display: flex;
align-items: center;
gap: 10px;
}
.nav-button {
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: #666;
padding: 4px 8px;
transition: color 0.2s;
}
.nav-button:hover {
color: #000;
}
.title-container {
flex: 1;
display: flex;
align-items: center;
gap: 20px;
}
.title-text h2 {
margin: 0;
color: #2c3e50;
}
.title-text p {
margin: 5px 0 0 0;
font-size: 0.9em;
color: #666;
font-style: italic;
}
.card-title {
font-size: 1.5rem;
color: #2d3748;
margin-bottom: 10px;
border-bottom: 2px solid #3498db;
}
.card-subtitle {
text-align: left;
font-size: 1.1rem;
color: #718096;
margin-bottom: 20px;
}
.section-title {
font-size: 1.2rem;
font-weight: 600;
margin-bottom: 10px;
color: #2d3748;
}
.grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
}
ul {
margin: 0;
padding-left: 20px;
}
li {
margin-bottom: 8px;
color: #4a5568;
}
.button {
background-color: #4CAF50;
border: none;
color: white;
padding: 12px 24px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 4px;
transition: background-color 0.3s;
}
.button:hover {
background-color: #45a049;
}
.hidden {
display: none;
}
.image-container {
text-align: center;
margin: 20px 0;
}
.image-container img {
max-width: 100%;
height: auto;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.image-caption {
font-size: 0.9rem;
color: #718096;
margin-top: 8px;
}
.svg-container {
position: relative;
width: 100%;
height: 600px;
overflow: hidden;
border: 1px solid #ccc;
border-radius: 8px;
}
.diagram-legend {
position: absolute;
top: 10px;
left: 10px;
background: rgba(255, 255, 255, 0.9);
padding: 15px;
border-radius: 8px;
border: 1px solid #ccc;
font-size: 14px;
z-index: 1000;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.legend-item {
display: flex;
align-items: center;
margin-bottom: 8px;
}
.legend-color {
width: 20px;
height: 20px;
margin-right: 10px;
border: 1px solid rgba(0,0,0,0.1);
border-radius: 4px;
}
.zoom-controls {
position: absolute;
top: 10px;
right: 10px;
z-index: 1000;
background: rgba(255, 255, 255, 0.9);
padding: 5px;
border-radius: 4px;
}
.zoom-button {
width: 30px;
height: 30px;
cursor: pointer;
margin: 2px;
background-color: white;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
font-weight: bold;
}
.zoom-button:hover {
background-color: #f0f0f0;
}
.popup-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.popup-container {
background: white;
width: 90%;
height: 90vh;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
display: flex;
flex-direction: column;
overflow: hidden;
}
.popup-header {
padding: 20px;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
background: #f8f9fa;
}
.popup-header h2 {
margin: 0;
color: #2c3e50;
}
.close-button {
background: none;
text-align: left;
border: none;
font-size: 24px;
cursor: pointer;
color: #666;
padding: 0 8px;
}
.close-button:hover {
color: #000;
}
.popup-content {
text-align: left;
display: flex;
flex: 1;
overflow: hidden;
padding: 20px;
gap: 20px;
}
.code-column {
flex: 1;
overflow-y: auto;
padding-right: 20px;
background: #f8f9fa;
border-radius: 8px;
}
.explanation-column {
flex: 1;
overflow-y: auto;
padding-right: 20px;
}
.explanation-block {
background: white;
padding: 20px;
margin-bottom: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.explanation-block ul {
list-style: none;
padding-left: 0;
}
pre[class*="language-"] {
margin: 0;
border-radius: 4px;
}
code[class*="language-"] {
font-size: 14px;
}
.highlight {
background: #fff3cd;
padding: 2px 4px;
border-radius: 2px;
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
</style>
</head>
<body>
<header>
<h1 style="text-align: center; font-size: 4em; margin-bottom: 0;">Background for SULI/LCLS Zoom</h1>
<p class="subtitle">Cole Jerum </p>
<p class="subtitle">University of Rochester '28 (B.S. Physics & B.S. Neuroscience) </p>
</header>
</div>
</div>
<p style="font-size: 3.0em; text-align: center; margin: 0; padding-bottom: 0;"><b>Relevant Research Projects</b></p>
<div class="container">
<header>
<h1 style="margin-bottom: 0; border-bottom: 2px solid #3498db;">THOR</h1>
<p class="subtitle">(Teleoperated High-precision Optics Repositioner)</h2>
<p style="font-size: 2.0em; text-align: center;"> <b></b></p>
<div class="card">
<div class="section-title"></div>
<div class="image-container">
<img src="image9.png" alt=" " style="width: 450px; height: auto;">
<p class="image-caption">THOR Module attached to a kinematic lens/mirror mount</p>
</div>
<details>
<summary style="font-size: 1.4em;">What does the kinematic mount look like <i>without THOR?</i></summary>
<div class="image-container">
<img src="image1.png" alt=" " style="width: 350px; height: auto;">
<p class="image-caption"> </p>
</div>
</details>
<div class="image-container">
<br><br>
<img id="original" src="image8.png" style="width: auto; height: auto;">
<img id="motorized" src="image6.png" style="width: auto; height: 100%;" class="hidden">
<p id="original-caption" class="image-caption">Motorized Adjustment Mechanism</p>
<p id="motorized-caption" class="image-caption hidden">Motorized Adjustment Mechanism</p>
<button class="button" onclick="toggleImages()">Hide Kinematic Mount Adapter</button>
</div>
<details>
<summary style="font-size: 1.4em;">How does one <i>usually</i> adjust this kinematic mount?</summary>
<div class="image-container">
<img src="image2.png" alt=" " style="width: auto; height: 400px;">
<p class="image-caption"></p>
</div>
</details>
<div class="section">
<p style="font-size: 1.8em; margin-bottom: 5px; text-align: center;"><b>THOR—Control System</b></p>
<div style="display: flex; justify-content: space-between; gap: 20px;"></div>
<div style="flex: 1;">
<h2 style="margin-top: 0;">PCB Layout (2D)</h2>
<img src="V2PCB_2D.png" alt="2D PCB Layout" class="project-image" style="width: 100%;">
<p class="caption">2D PCB layout showing component placement and routing</p>
</div>
<div style="flex: 1;">
<h2>PCB Layout (3D)</h2>
<img src="V2PCB_3D.png" alt="3D PCB Rendering" class="project-image" style="width: 100%;">
<p class="caption">3D rendering of the 2D PCB layout</p>
</div>
</div>
</div>
<div class="svg-container" id="svgContainer">
<div class="diagram-legend">
<div class="legend-item" style="border-bottom: 1px solid #ccc; padding-bottom: 8px; margin-bottom: 8px;">
<span><b>PCB Diagram</b><br>
Mouse-wheel to zoom in/out<br>
Click-and-drag LMB to pan</span>
</div>
</div>
</div>
<br></br>
</div>
</div>
<br> </br>
<div class="container">
<h1 style="margin-bottom: 0; border-bottom: 2px solid #3498db; text-align: center;">PERSEUS</h1>
<p class="subtitle" style="text-align: center;">(<b>P</b>hysics of an <b>E</b>xtended-mhd <b>R</b>elaxation <b>S</b>ystem using <b>E</b>fficient <b>U</b>pwind <b>S</b>cheme)</h2>
<div class="card">
<h2 style="text-align: left; font-size: 1.6em;">Background</h2>
<p>PERSEUS is a single-fluid extended magnetohydrodynamics (xMHD) code that treats the generalized Ohm's law as an evolution equation. By treating the dJ/dt term implicitly in the evolution equations, PERSEUS can capture electron dynamics while taking timesteps characteristic of ion effects. I've found working with PERSEUS to be incredibly interesting, and would be happy to say more about what it can do Thursday if you're interested.</p>
<h2 style="text-align: left; font-size: 1.6em;">My Work</h2>
<p>My contributions to PERSEUS include implementing directional resistivity (prev. η was assumed isotropic) and developing a method to load radially symmetric profiles from previous simulation timesteps, enabling studies of laser-plasma interactions (LPIs) in z-pinches. This wouldn't have been possible without James Young, though, who both assisted me greatly in getting here and was the one to implement lasers into PERSEUS in the first place.</p>
<div style="text-align: center;">
<p style="font-size: 1.4em;"><button class="show-code-doc" style="background-color: #3498db; border: none; color: white; padding: 10px 12px; text-align: center; text-decoration: none; display: inline-block;font-size: 16px; margin: 2px 2px; cursor: pointer; border-radius: 4px; transition: background-color 0.3s; ">View My Code Documentation</button>
</div>
<h2 style="text-align: left; font-size: 1.6em;">My Simulation Results</h2>
<p>In loading the density profile, I make the assumption that the laser timescale is such orders of magnitude quicker than the other dynamics in the simulation this was pulled from that we can effectively treat them as "frozen" in time.</p>
<div class="image-container">
<image src="ion_dens.png" alt=" " style="width: 450px; height: auto; text-align: center;">
<p class="image-caption" style="text-align: center;">Initial Density Profile (made with Z-pinch→cross-section code from above).</p>
</div>
<p>This is the first time I'm seeing an EM simulation of substance (it has been a journey to get to this point). I'm looking forward to analyzing this data soon, though; Working on the data processing code in python.</p>
<div class="image-container">
<video width="100%" height="auto" controls>
<source src="movie_1_15.mp4" type="video/mp4; codecs='avc1.42E01E, mp4a.40.2'">
<source src="movie_1_15.mpg" type="video/mpg">
<source src="movie_1_15.webm" type="video/webm">
Your browser does not support this video format (.mp4 or .mpg or .webm).
</video>
<p class="image-caption">Magnitude of E-field. tf=6e-13 sec (600 fs)</p>
<image src="ion_temp.png" alt=" " style="width: 450px; height: auto;">
<p class="image-caption">Ion Temperature at timestep=46(out of 51). Though the electric field looks promising (for the most part), something is definitely wrong here... Some artifacts in charge density as well (not pictured here)</p>
</div>
</div>
<div class="popup-overlay" style="display: none;">
<div class="popup-container">
<div class="popup-header">
<h2>Z-Pinch Code Documentation</h2> This program is too long to fix all of my silly comments and odd function names, so I will just leave them in. I hope some of them are as amusing to you as they are to me.
<button class="close-button">×</button>
</div>
<div class="popup-content">
<div class="code-column">
<pre><code class="language-python"> from read_vtk import *
from read_vtk import mesh
import cv2
from scipy.interpolate import CubicSpline, interp1d
import matplotlib.pyplot as plt
####################
# DOMAIN VARIABLES #
####################
"""DEPENDENT ON YOUR SIMULATION'S (PERSEUS) PARAMETERS"""
ngu = 2
nx = 161
nz = 545
wavelength = 532e-9
rlength_PERSEUS = 1e-3
zlength_PERSEUS = 3.375e-3
"""INDEPENDENT DOMAIN VARIABLES"""
ntiles = 64
ntilesrow = 8
target_resolution = wavelength/30
dl = target_resolution # second definition of the same variable, because I cannot decide what to name it.
"""DEPENDENT DOMAIN VARIABLES"""
dl_PERSEUS = rlength_PERSEUS/nx
scale_factor = dl_PERSEUS/dl
slice_index = int(.5*nz) #the index of the slice you want to analyze (in the z direction)
"""SWITCH VARIABLES"""
plot_x_pinch = False
plot_tiles = False
plot_pizza = False
plot_rh_i = False #plot the original z-pinch
print_boundary_corner_coordinates = True #prints x1,x2,y1,y2 for the upsampled window
plot_boundary_box_location = False
convert_to_dat_file = True #determines if the tiles get saved as dat files at the end
plot_pizzas = False
plot_upsampled_pizzas = False
convert_to_dat_file = True
########################
# FUNCTION DEFINITIONS #
########################
def get_field_value(x,y,slice_array): #gets the value of a field at a given radial distance from the center of the slice
x = np.float64(x)
y = np.float64(y)
rval = np.sqrt(x**2 + y**2)
rval = int(rval)
if rval >= len(slice_array):
value = np.min(slice_array)
else:
value = slice_array[rval]
return value
def circle_pizza(target_field): #creates a 2D representation of a radially symmetric slice of a given target field
smesh = unstructured_to_structured(mesh, target_field)
nx, nz, nu = smesh.dimensions
print(nx,nz)
Fy = get_mesh_subset(smesh, [0,nx], [0,nz], target_field)
print(np.shape(Fy))
slice_array = Fy[slice_index,:]
#slice_array = np.log(slice_array)/np.log(10) #CC comment this line out to turn off log of ion density
x = np.arange(-nx,nx,1)
y = np.arange(-nx,nx,1)
r = np.zeros((len(x)-1,len(y)-1))
for i in range(len(x)-1):
for j in range(len(y)-1):
r[i,j] = get_field_value(x[i],y[j],slice_array)
return r
def bring_your_own_pizza(slice_array, *boundaries,windowed): #generates a 2D (radially symmetric) array based on the given slice array (1D array where slice[0] is the center of the 2d disc))
if windowed == True:
x1 = boundaries[0]
x2 = boundaries[1]
y1 = boundaries[2]
y2 = boundaries[3]
window_pizza = np.zeros([x2-x1,y2-y1])
for i in range(x2-x1):
for j in range(y2-y1):
windowed-slice
window_pizza[i,j] = get_field_value(x1+i,y2+j,upsampled_slice)
return window_pizza
else:
x = np.arange(-len(slice_array),len(slice_array),1)
y = np.arange(-len(slice_array),len(slice_array),1)
r = np.zeros((len(x)-1,len(y)-1))
for i in range(len(x)-1):
for j in range(len(y)-1):
r[i,j] = get_field_value(x[i],y[j],slice_array)
return r
def linear_upsample(slice_array, scale_factor):
original_indices = np.arange(len(slice_array))
new_length = int(len(slice_array) * scale_factor)
new_indices = np.linspace(0, len(slice_array) - 1, new_length)
interp_func = interp1d(original_indices, slice_array, kind='linear', fill_value="extrapolate")
upsampled_slice = interp_func(new_indices)
return upsampled_slice
def colorbar_plot(target_field,target_array,vmin=None,vmax=None):
plt.title(f"{target_field} at z_index={slice_index} & t={time_analyze}")
plt.imshow(target_array,vmin=vmin,vmax=vmax)
plt.colorbar()
plt.show()
def sheet_pizza(array, nx, nz): #splits the 2D array into smaller tiles (for MPI purposes)
ntilesrow = int(np.sqrt(ntiles)) # We want a 4x4 grid
tile_size_x = int(nx / ntilesrow) # Size of each tile in x dimension
tile_size_z = int(nz / ntilesrow) # Size of each tile in z dimension
tile_array = np.ones((tile_size_x, tile_size_z, ntiles))
tile_num = 0
for m in range(ntilesrow):
for n in range(ntilesrow):
x_start = m * tile_size_x
x_end = (m + 1) * tile_size_x
z_start = n * tile_size_z
z_end = (n + 1) * tile_size_z
tile_array[:, :, tile_num] = array[x_start:x_end, z_start:z_end]
tile_num += 1
return tile_array
def cell_subplots(tile_array,ntilesrow,vmin=None,vmax=None): #creates a grid of subplots representing each tile in tile_array
fig,axes = plt.subplots(ntilesrow, ntilesrow, figsize=(10, 10))
for i in range(ntiles):
target_row = i // ntilesrow
target_col = i % ntilesrow
axes[target_row, target_col].imshow(tile_array[:, :, i], cmap='viridis',vmin=vmin,vmax=vmax)
plt.tight_layout()
plt.show()
return
def fill_gu(current_cell, target_cell, direction): #supplementary function for "ghost_cell" function
if direction == "above":
current_cell[ngu:-ngu, :ngu] = target_cell[ngu:-ngu, -2*ngu:-ngu]
if direction == "below":
current_cell[ngu:-ngu, -ngu:] = target_cell[ngu:-ngu, ngu:2*ngu]
if direction == "right":
current_cell[-ngu:, ngu:-ngu] = target_cell[ngu:2*ngu, ngu:-ngu]
if direction == "left":
current_cell[:ngu, ngu:-ngu] = target_cell[-2*ngu:-ngu, ngu:-ngu]
else:
print("bad direction, try again")
return current_cell
def ghost_cell(tile_array): #fills the ghost cells for all tiles in tile_array using values from neighboring tiles
ntiles = len(tile_array[0, 0, :]) #look at how big the third dimension of tile array is (each xy slice is 1 tile, and there are "ntiles" of these slices in z)
gu_array = np.zeros((len(tile_array[:, 0, 0]) + 2 * ngu, len(tile_array[:, 0, 0]) + 2 * ngu, ntiles)) #initializes an empty array that's larger than before (space for ghost cells)
for tilenum in range(ntiles): #fill known values so zeros are only on the outer two cells of the arrays (these are the ghost cells)
gu_array[ngu:-ngu, ngu:-ngu, tilenum] = tile_array[:, :, tilenum]
for tilenum in range(ntiles): #loops through all the tiles and performs checks so that the ghost cells are filled in appropriately depending on their edge characteristics
if (tilenum % ntilesrow != 0): # ∃ A TILE ABOVE THIS ONE
gu_array[:, :, tilenum] = fill_gu(gu_array[:, :, tilenum], gu_array[:, :, tilenum - 1], "above")
if (tilenum % ntilesrow != ntilesrow - 1): # ∃ A TILE BELOW THIS ONE
gu_array[:, :, tilenum] = fill_gu(gu_array[:, :, tilenum], gu_array[:, :, tilenum + 1], "below")
if (tilenum - ntilesrow >= 0): # ∃ A TILE TO THE LEFT OF THIS ONE
gu_array[:, :, tilenum] = fill_gu(gu_array[:, :, tilenum], gu_array[:, :, tilenum - ntilesrow], "left")
if (tilenum + ntilesrow < ntiles): # ∃ A TILE TO THE RIGHT OF THIS ONE
gu_array[:, :, tilenum] = fill_gu(gu_array[:, :, tilenum], gu_array[:, :, tilenum + ntilesrow], "right")
return gu_array
def zpinch_to_pizza(slice_array): #creates a 2D representation of a radially symmetric slice of a given target field
x = np.arange(-nx,nx,1)
y = np.arange(-nx,nx,1)
r = np.zeros((len(x)-1,len(y)-1))
for i in range(len(x)-1):
for j in range(len(y)-1):
r[i,j] = get_field_value(x[i],y[j],slice_array)
return r
def create_pizza_arrays():
# Variable definitions
str_vars = [ #list of variables to be processed (∃ a function that pulls this from the vtk file. I know this because I probably wrote it at some point. but is it in this code? no. no it is not. But this explicit list was good enough for me at the time)
'Ion Density', 'Current Density', 'Electric Field', 'Electron Density',
'Electron Temperature', 'Electron Velocity', 'Grad Pe', 'Ion Temperature',
'Ion Velocity', 'Magnetic Field', 'eta x-direction', 'eta y-direction', 'eta z-direction'
]
array = np.zeros((nz, 83, len(str_vars)*3))
pizza_array = np.zeros((nx*2-1, nx*2-1, len(str_vars)*3))
str_vars_w_component = []
counter = 0
for var in str_vars:
print(f"Processing: {var} (counter={counter})")
ndimensions, *components = string_to_array(var)
array[:,:,counter:counter+3] = np.stack(components, axis=2)
if ndimensions == 1: #if the variable is a scalar
slice_array = array[int(nz/2),:,counter]
pizza_array[:,:,counter] = zpinch_to_pizza(slice_array)
str_vars_w_component.append(f"{var}—{counter}")
counter += 1
elif ndimensions == 3: #if the variable is a vector
for i, component in enumerate(['x', 'y', 'z']):
slice_array = array[int(nz/2),:,counter+i]
pizza_array[:,:,counter+i] = zpinch_to_pizza(slice_array)
str_vars_w_component.append(f"{var}_{component}—{counter+i}")
counter += 3
print("Components created:", str_vars_w_component)
return array, pizza_array, str_vars_w_component
array, pizza_array, str_vars_w_component = create_pizza_arrays()
##########################
# RECOVER Qin VARIABLES #
##########################
Qin_vars = ['rh','mx','my','mz','en','bx','by','bz','ex','ey','ez',
'jx','jy','jz','et','ne','ep','etax','dpx','dpy','etay','etaz']
Qin_pizza_array = np.zeros((len(pizza_array[:,0,0]), len(pizza_array[0,:,0]), len(Qin_vars)))
"""REASSIGNING VARIABLES TO BE DIMENSIONLESS"""
Qin_pizza_array[:,:,0] = pizza_array[:,:,0]/n0 # rh (ion density)
Qin_pizza_array[:,:,15] = pizza_array[:,:,7]/n0 # ne (electron density)
Qin_pizza_array[:,:,11:14] = pizza_array[:,:,1:4]/j0 # jx, jy, jz
Qin_pizza_array[:,:,8:11] = pizza_array[:,:,4:7]/e0 # ex, ey, ez
Qin_pizza_array[:,:,17] = pizza_array[:,:,22]/eta0 # etax
Qin_pizza_array[:,:,20:22] = pizza_array[:,:,23:25]/eta0 # etay, etaz
Qin_pizza_array[:,:,5:8] = pizza_array[:,:,19:22]/b0 # bx, by, bz
Qin_pizza_array[:,:,1:4] = pizza_array[:,:,16:19]*pizza_array[:,:,0]/n0/v0 # mx, my, mz
Qin_pizza_array[:,:,4] = pizza_array[:,:,15]*pizza_array[:,:,0]/n0/p0 # en (ion internal energy)
Qin_pizza_array[:,:,16] = pizza_array[:,:,8]*pizza_array[:,:,7]/te0 # ep (electron pressure)
Qin_pizza_array[:,:,14] = pizza_array[:,:,8]*pizza_array[:,:,7]/n0/p0 # et (electron total energy)
Qin_pizza_array[:,:,18:20] = pizza_array[:,:,12:14]*L0/p0 # dpx, dpy
if plot_pizzas == True:
n = len(array[0,0,:])
nrows = int(np.ceil(np.sqrt(n)))
ncols = int(np.ceil(n / nrows))
fig, axes = plt.subplots(nrows, ncols, figsize=(15, 15))
axes = axes.flatten()
for i, var in enumerate(Qin_vars):
axes[i].imshow(Qin_pizza_array[:,:,i])
axes[i].set_title(var)
axes[i].axis('off')
# Remove empty subplots
for j in range(i+1, len(axes)):
fig.delaxes(axes[j])
plt.tight_layout()
plt.show()
for i in range(len(Qin_pizza_array[0,0,:])): #loop through all the variables and save them as dat files
slice = Qin_pizza_array[nx-1:2*nx-1,nx-1,i]
upsampled_slice = linear_upsample(slice, scale_factor)
# Initialize arrays on first iteration
if i == 0:
nx_us = len(upsampled_slice)
dl_us = rlength_PERSEUS/nx_us
x1 = int(x_chosen-(32*wavelength/dl_us))
x2 = int(x_chosen+(32*wavelength/dl_us))
y1 = int(y_chosen-(32*wavelength/dl_us))
y2 = int(y_chosen+(32*wavelength/dl_us))
boundaries = (x1, x2, y1, y2)
upsampled_pizza = bring_your_own_pizza(upsampled_slice, *boundaries, windowed=True)
tile_array = sheet_pizza(upsampled_pizza, np.shape(upsampled_pizza)[0], np.shape(upsampled_pizza)[1])
array_with_gus = ghost_cell(tile_array)
# Save tiles as dat files if requested
if convert_to_dat_file:
save_tiles_in_log_form = False
for current_tile in range(ntiles):
mpi_x = current_tile // ntilesrow
mpi_y = current_tile % ntilesrow
filename = f'radial_slice_tile_{mpi_x+1}_{mpi_y+1}_{Qin_vars[i]}.dat'
dat_array = (np.log10(array_with_gus[:,:,current_tile]) if save_tiles_in_log_form
else array_with_gus[:,:,current_tile])
np.savetxt(f"{save_directory}{filename}", dat_array, fmt=f'%.{truncate_to}e')
if (mpi_x == 7 and mpi_y == 7):
print(f"Variable {Qin_vars[i]} Saved Successfully!")
if plot_upsampled_pizzas == True:
n = len(Qin_vars)
nrows = int(np.ceil(np.sqrt(n)))
ncols = int(np.ceil(n / nrows))
fig, axes = plt.subplots(nrows, ncols, figsize=(15, 15))
axes = axes.flatten()
counter = 0
for i, var in enumerate(Qin_vars):
axes[i].imshow(pizza_array[:,:,counter])
axes[i].set_title(var)
axes[i].axis('off')
counter += 1
# Remove empty subplots if any
for j in range(i+1, len(axes)):
fig.delaxes(axes[j])
plt.tight_layout()
plt.show()
</code></pre>
</div>
<div class="explanation-column">
<div class="explanation-block">
<h2 class="section-title">Introduction</h2>
<p>This code takes the data from a timestep of a 2D z-pinch simulation (ran in PERSEUS) and transforms it into a wire cross-section by taking a (1D) radial slice, converting it into a circular cross-section , upsampling it for better resolution (λ/30), and splitting it into 64 tiles with ghost cells to be passed back into PERSEUS.</p>
<ol>
<li>Reading and processing simulation data</li>
<li>Creating circular cross-sections</li>
<li>Upsampling for higher resolution</li>
<li>Splitting into tiles for parallel processing</li>
</ol>
</div>
<div class="explanation-block">
<h2 class="section-title">Domain Variables</h2>
<p>The code starts by defining simulation parameters:</p>
<ul>
<li><span class="highlight">nx</span>: Radius of the simulation domain (161 cells)</li>
<li><span class="highlight">wavelength</span>: Laser λ (532nm)</li>
<li><span class="highlight">dl</span>: Target resolution (λ/30)</li>
<li><span class="highlight">ntiles</span>: Number of MPI tiles (8x8⇒64)</li>
<li><span class="highlight">scale_factor</span>: Resolution scaling factor (~300)</li>
</ul>
</div>
<div class="explanation-block">
<h2 class="section-title">Core Functions</h2>
<h3>get_field_value()</h3>
<p>Converts Cartesian coordinates (x,y) to radial distances and retrieves the corresponding field value. This is crucial for maintaining radial symmetry in the simulation.</p>
<h3>bring_your_own_pizza()</h3>
<p>Creates a 2D circular cross-section from a 1D radial profile. Can either create a full cross-section or a windowed subset.</p>
<h3>linear_upsample()</h3>
<p>Increases resolution of the data using linear interpolation. This is essential for matching the required resolution for laser-plasma interactions (λ/30).</p>
</div>
<div class="explanation-block">
<h2 class="section-title">Variable Processing</h2>
<p>The code processes various physical quantities:</p>
• Densities (ion, electron)
• Fields (electric, magnetic)
• Currents and velocities
• Temperatures and pressures
<p>Each quantity is normalized according to PERSEUS conventions using characteristic scales (n0, b0, e0, etc.).</p>
</div>
<div class="explanation-block">
<h2 class="section-title">Tiling System</h2>
<p>The domain is split into 64 tiles (8×8 grid) for parallel processing (MPI). Each tile includes ghost cells for proper boundary handling between adjacent tiles. This enables efficient parallel computation in PERSEUS.</p>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/plugins/autoloader/prism-autoloader.min.js"></script>
<script>
// Close button functionality
document.querySelector('.close-button').addEventListener('click', function() {
document.querySelector('.popup-overlay').style.display = 'none';
});
// Close on outside click
document.querySelector('.popup-overlay').addEventListener('click', function(e) {
if (e.target === this) {
this.style.display = 'none';
}
});
</script>
</body>
</html>
</div>
</div>
</div>
<br> </br>
<div class="container">
<h1 style="margin-bottom: 0; border-bottom: 2px solid #3498db; text-align: center;">Plasma Inteferometry</h1>
The very first thing I did in the XSPL was to use an air-wedge shearing interferometer to record an interferogram of a laser-produced plasma spark—from which I was able to recover the plasma density; but unfortunately this plasma density was undetermined mod 2pi, as is always the case...</p>
This leads me to another (relatively new) active project of mine: φ unwrapping as a constrained optimization problem, utilizing THOR to achieve callibration of optics to measure the true optical derivative (the novel constraint). In the coming weeks, I'll be designing and running some proof-of-concept simulations in PERSEUS to gauge the success of this approach. If all goes according to plan, I'll present a talk or poster on this at RSPS (a conference for primarily undergrads in physics) in early march.
</div>
<br> </br>
<p style="font-size: 3.0em; text-align: center;"> <b>Potential Connections to LCLS</b></p>
<div class="container">
<header>
<div class="card">
<div class="section-title">Relevant Research Experience</div>
<ul>
<li>THOR ⇒ Automated optical alignment experience applicable to improving SPI/SFX sample delivery precision and hit-rate optimization</li>
<li>PERSEUS ⇒ experience with codes on small timescales, applicable to XFEL/XLO Optimization/Simulations</li>
<li>Plasma Interferometry ⇒ Experience with phase recovery problems directly relevant to coherent diffraction imaging challenges</li>
</ul>
<div class="section-title">(A Few of the) Areas I'm Interested In</div>
<ul>
<li>SFX - particularly interested in advancing sample delivery and data collection methods</li>
<li>XFEL Diagnostics - applying plasma diagnostic experience to X-ray pulse characterization</li>
<li>X-ray Laser Oscillators (XLOs) - leveraging experience in automated optical alignment for beamline optimization</li>
<li>Computational Methods - extending simulation experience to X-ray diffraction analysis</li>
</ul>
</div>
</div>
<script>
// Get the button and popup elements
const showButton = document.querySelector('.show-code-doc');
const popup = document.querySelector('.popup-overlay');
const closeButton = document.querySelector('.close-button');
// Show popup when button is clicked
showButton.addEventListener('click', function() {
popup.style.display = 'flex';
});
// Hide popup when close button is clicked
closeButton.addEventListener('click', function() {
popup.style.display = 'none';
});
// Hide popup when clicking outside
popup.addEventListener('click', function(e) {
if (e.target === this) {
this.style.display = 'none';
}
});
</script>
<script>
// Image toggle functionality
function toggleImages() {
var original = document.getElementById('original');
var motorized = document.getElementById('motorized');
var originalCaption = document.getElementById('original-caption');
var motorizedCaption = document.getElementById('motorized-caption');
var button = document.querySelector('.button');
if (original.classList.contains('hidden')) {
original.classList.remove('hidden');
motorized.classList.add('hidden');
originalCaption.classList.remove('hidden');
motorizedCaption.classList.add('hidden');
button.innerHTML = 'Hide Kinematic Mount Adapter';
} else {
original.classList.add('hidden');
motorized.classList.remove('hidden');
originalCaption.classList.add('hidden');
motorizedCaption.classList.remove('hidden');
button.innerHTML = 'Show Kinematic Mount Adapter';
}
}
// SVG viewer functionality
document.addEventListener('DOMContentLoaded', function() {
const container = document.getElementById('svgContainer');
// Create SVG element with proper namespace
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg.setAttribute('id', 'controlSvg');
svg.setAttribute('width', '100%');
svg.setAttribute('height', '100%');
svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
// Set viewBox to match the original SVG dimensions
svg.setAttribute('viewBox', '-4 4 1114 1231.2');
// Set initial viewBox to show the entire diagram
const initialViewBox = { x: -10, y: -10, width: 1124, height: 1247.2 };
svg.setAttribute('viewBox', `${initialViewBox.x} ${initialViewBox.y} ${initialViewBox.width} ${initialViewBox.height}`);
// Add the SVG content
svg.innerHTML = `<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 1227.2)">
<title>PowerSystem</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-1227.2 1110,-1227.2 1110,4 -4,4"></polygon>
<g id="clust1" class="cluster">
<title>cluster_caps</title>
<polygon fill="#f0f8ff" stroke="black" points="108,-958.4 108,-1035.2 514,-1035.2 514,-958.4 108,-958.4"></polygon>
<text text-anchor="middle" x="311" y="-1018.6" font-family="Times,serif" font-size="14.00">Capacitor Bank</text>
</g>
<g id="clust2" class="cluster">
<title>cluster_bc</title>
<polygon fill="#ffe4e1" stroke="black" points="434,-801.6 434,-950.4 636,-950.4 636,-801.6 434,-801.6"></polygon>
<text text-anchor="middle" x="535" y="-933.8" font-family="Times,serif" font-size="14.00">Buck Converter</text>
</g>
<g id="clust3" class="cluster">
<title>cluster_zeta</title>
<polygon fill="#e0ffff" stroke="black" points="470,-640 470,-793.6 612,-793.6 612,-640 470,-640"></polygon>
<text text-anchor="middle" x="541" y="-777" font-family="Times,serif" font-size="14.00">RF TRANSCEIVER</text>
</g>
<g id="clust4" class="cluster">
<title>cluster_q4</title>
<polygon fill="#f0fff0" stroke="black" points="356,-483.2 356,-716.8 430,-716.8 430,-483.2 356,-483.2"></polygon>
<text text-anchor="middle" x="393" y="-700.2" font-family="Times,serif" font-size="14.00">BJT 1</text>
</g>
<g id="clust5" class="cluster">
<title>cluster_q12</title>
<polygon fill="#fff0f0" stroke="black" points="356,-249.6 356,-475.2 430,-475.2 430,-249.6 356,-249.6"></polygon>
<text text-anchor="middle" x="393" y="-458.6" font-family="Times,serif" font-size="14.00">JFET 1</text>
</g>
<g id="clust6" class="cluster">
<title>cluster_drv1</title>
<polygon fill="#e6e6fa" stroke="black" points="8,-8 8,-84.8 366,-84.8 366,-8 8,-8"></polygon>
<text text-anchor="middle" x="187" y="-68.2" font-family="Times,serif" font-size="14.00">DRV8834 1</text>
</g>
<g id="clust7" class="cluster">
<title>cluster_q1</title>
<polygon fill="#f0fff0" stroke="black" points="620,-483.2 620,-716.8 694,-716.8 694,-483.2 620,-483.2"></polygon>
<text text-anchor="middle" x="657" y="-700.2" font-family="Times,serif" font-size="14.00">BJT 2</text>
</g>
<g id="clust8" class="cluster">
<title>cluster_q8</title>
<polygon fill="#fff0f0" stroke="black" points="514,-164.8 514,-398.4 588,-398.4 588,-164.8 514,-164.8"></polygon>
<text text-anchor="middle" x="551" y="-381.8" font-family="Times,serif" font-size="14.00">JFET 2</text>
</g>
<g id="clust9" class="cluster">
<title>cluster_drv2</title>
<polygon fill="#e6e6fa" stroke="black" points="374,-8 374,-84.8 732,-84.8 732,-8 374,-8"></polygon>
<text text-anchor="middle" x="553" y="-68.2" font-family="Times,serif" font-size="14.00">DRV8834 2</text>
</g>
<g id="clust10" class="cluster">
<title>cluster_q2</title>
<polygon fill="#f0fff0" stroke="black" points="776,-568 776,-793.6 850,-793.6 850,-568 776,-568"></polygon>
<text text-anchor="middle" x="813" y="-777" font-family="Times,serif" font-size="14.00">BJT 3A</text>