@@ -66,7 +66,7 @@ class KolmoLaw(SpecificOutput):
66
66
67
67
This output saves the components in the spherical basis of the vectors
68
68
:math:`\J_\alpha` averaged over the azimutal angle (i.e. as a function of
69
- :math:`r_h` and :math:`r_z `).
69
+ :math:`r_h` and :math:`r_v `).
70
70
71
71
We can take the example of the quantity :math:`\langle | \delta b |^2
72
72
\delta \v \rangle_\x` to explain how these quantities are computed. Using
@@ -147,7 +147,7 @@ def __init__(self, output):
147
147
"drz" : rz_store ,
148
148
"dr" : r_store ,
149
149
}
150
- self .pow_store = 5 / 4
150
+ self .pow_store = 5 / 4
151
151
pow_store = self .pow_store
152
152
for i in range (n_store ):
153
153
index = ((i + 1 ) / n_store ) ** (pow_store )
@@ -418,7 +418,7 @@ def plot_kolmo_law(
418
418
ax2 .set_xscale ("log" )
419
419
if slope is not None :
420
420
ax2 .plot (posxprime , check_slope , label = f"$r^{ 2 } $" )
421
- # ax2.plot(posx, E_k / (rad ** (coef_comp2)), label="4*E")
421
+
422
422
ax2 .plot (posx , pos2ycomp )
423
423
ax2 .set_title (f"tmin={ tmin :.2g} , tmax={ tmax :.2g} " )
424
424
@@ -496,15 +496,15 @@ def compute(self):
496
496
J_A_xyz = [None ] * 3
497
497
498
498
E_k_mean = 0.0
499
- K_k = np .ones_like (K )
499
+ K_k = np .ones_like (K )
500
500
E_k_proc = np .mean (K )
501
501
collect_E_k = mpi .comm .gather (E_k_proc , root = 0 )
502
502
if mpi .rank == 0 :
503
503
E_k_mean = np .mean (collect_E_k )
504
504
else :
505
- E_k_mean = None
505
+ E_k_mean = None
506
506
507
- E_k_mean = mpi .comm .bcast (E_k_mean , root = 0 )
507
+ E_k_mean = mpi .comm .bcast (E_k_mean , root = 0 )
508
508
509
509
E_k = E_k_mean * K_k
510
510
val = None
@@ -525,16 +525,18 @@ def compute(self):
525
525
for ind_j in range (3 ):
526
526
tmp += 4 * tf_vi [ind_j ] * tf_vjvi [ind_i , ind_j ].conj ()
527
527
528
- tmp = 1j * tmp .imag
528
+ tmp = 1j * tmp .imag
529
+ mom = 1j * tmp .imag
529
530
530
531
J_K_xyz [ind_i ] = self .sim .oper .ifft (tmp )
532
+
531
533
if "b" in keys_state_phys :
532
534
J_A_xyz [ind_i ] = self .sim .oper .ifft (mom )
533
535
534
536
S2_K_xyz = 2 * E_k - 2 * self .sim .oper .ifft (val )
535
537
536
- # S2_K_xyz = 2 * K - S2_K_xyz
537
-
538
+ nh_store = n_store
539
+ nv_store = n_store
538
540
539
541
J_k_v = np .zeros ([nh_store , nv_store ])
540
542
J_k_h = np .zeros ([nh_store , nv_store ])
@@ -592,7 +594,7 @@ def compute(self):
592
594
593
595
if "b" in keys_state_phys :
594
596
J_a_xyz = np .array (J_A_xyz )
595
-
597
+
596
598
pow_store = self .pow_store
597
599
598
600
for index , value in np .ndenumerate (J_k_xyz [2 ]): # average on each process
@@ -622,29 +624,24 @@ def compute(self):
622
624
623
625
if "b" in keys_state_phys :
624
626
J_a_hv_average ["J_a_v" ][rh_i , rv_i ] += J_a_xyz [2 ][index ]
625
- ((self .rhrz ["rh" ][index ] / self .rh_max ) ** (1 / pow_store )) * n_store
626
- )
627
- ((self .rhrz ["rz" ][index ] / self .rh_max ) ** (1 / pow_store )) * n_store
628
-
629
- else :
630
- r_i = floor (
631
- ((self .rhrz ["r" ][index ] / self .r_max ) ** (1 / pow_store )) * n_store
627
+ J_a_hv_average ["J_a_h" ][rh_i , rv_i ] += np .sqrt (
628
+ J_a_xyz [0 ] ** 2 + J_a_xyz [1 ] ** 2
632
629
)
633
- count_iso [r_i ] += 1
634
- J_k_xyz_prov ["J_k_prov" ][r_i ] += J_k_xyz_pro [index ]
635
- S2_k_xyz_prov ["S2_k_prov" ][r_i ] += S2_k_xyz [index ]
636
630
637
- if mpi .nb_proc == 1 :
638
- J_k_hv_prov ["count" ] = J_a_hv_prov ["count" ] = count
631
+ if mpi .nb_proc > 0 : # average on one process
639
632
640
- if mpi . nb_proc > 0 :
641
-
642
- collect_J_k_prov = mpi . comm . gather ( J_k_xyz_prov [ "J_k_prov" ], root = 0 )
643
- collect_S2_k_prov = mpi .comm .gather (
644
- S2_k_xyz_prov [ "S2_k_prov " ], root = 0
633
+ collect_J_k_average = mpi . comm . gather (
634
+ J_k_xyz_average [ "J_k_average" ], root = 0
635
+ ) # gather all results on one process
636
+ collect_S2_k_average = mpi .comm .gather (
637
+ S2_k_xyz_average [ "S2_k_average " ], root = 0
645
638
)
646
639
collect_count_iso = mpi .comm .gather (count_iso , root = 0 )
647
640
641
+ collect_J_k_v = mpi .comm .gather (J_k_hv_average ["J_k_v" ], root = 0 )
642
+ collect_J_k_h = mpi .comm .gather (J_k_hv_average ["J_k_h" ], root = 0 )
643
+ collect_count = mpi .comm .gather (count , root = 0 )
644
+
648
645
if "b" in keys_state_phys :
649
646
collect_J_a_v = mpi .comm .gather (J_a_hv_average ["J_a_v" ], root = 0 )
650
647
collect_J_a_h = mpi .comm .gather (J_a_hv_average ["J_a_h" ], root = 0 )
@@ -672,20 +669,24 @@ def compute(self):
672
669
J_k_xyz_average ["count" ] = count_final_iso
673
670
S2_k_xyz_average ["count2" ] = count_final_iso
674
671
675
- count_final_iso = np .sum (collect_count_iso , axis = 0 )
676
- J_k_xyz_prov ["count" ] = count_final_iso
677
- S2_k_xyz_prov ["count2" ] = count_final_iso
678
- if "b" in keys_state_phys :
679
- for index , value in np .ndenumerate (J_k_hv_prov ["J_k_z" ]):
680
- if count_final [index ] == 0 :
681
- J_k_hv_prov ["J_k_z" ][index ] = 0.0
682
- J_k_hv_prov ["J_k_h" ][index ] = 0.0
683
-
684
- J_a_hv_prov ["J_a_z" ][index ] = 0.0
685
- J_a_hv_prov ["J_a_h" ][index ] = 0.0
686
- else :
687
- J_k_hv_prov ["J_k_z" ][index ] = (
688
- value / count_final [index ]
672
+ for index , value in np .ndenumerate (J_k_hv_average ["J_k_v" ]):
673
+ if count_final [index ] == 0 :
674
+ J_k_hv_average ["J_k_v" ][index ] = 0.0
675
+ J_k_hv_average ["J_k_h" ][index ] = 0.0
676
+ if "b" in keys_state_phys :
677
+ J_a_hv_average ["J_a_v" ][index ] = 0.0
678
+ J_a_hv_average ["J_a_h" ][index ] = 0.0
679
+ else :
680
+ J_k_hv_average ["J_k_v" ][index ] = (
681
+ value / count_final [index ]
682
+ )
683
+ J_k_hv_average ["J_k_h" ][index ] = (
684
+ J_k_hv_average ["J_k_h" ][index ] / count_final [index ]
685
+ )
686
+ if "b" in keys_state_phys :
687
+ J_a_hv_average ["J_a_v" ][index ] = (
688
+ J_a_hv_average ["J_a_v" ][index ]
689
+ / count_final [index ]
689
690
)
690
691
J_a_hv_average ["J_a_h" ][index ] = (
691
692
J_a_hv_average ["J_a_h" ][index ]
0 commit comments