From daba53a7d4648a7d0b1ed93786cdd286cb95c0b7 Mon Sep 17 00:00:00 2001 From: Arkaprava Bokshi Date: Sun, 2 Jun 2024 15:11:33 +0100 Subject: [PATCH 1/4] correct nperiod calculation from nx0 --- src/pyrokinetics/gk_code/gene.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyrokinetics/gk_code/gene.py b/src/pyrokinetics/gk_code/gene.py index de6ebc26a..4e6eaba82 100755 --- a/src/pyrokinetics/gk_code/gene.py +++ b/src/pyrokinetics/gk_code/gene.py @@ -527,7 +527,7 @@ def get_numerics(self) -> Numerics: numerics_data["nperiod"] = 1 else: numerics_data["nkx"] = 1 - numerics_data["nperiod"] = self.data["box"]["nx0"] - 1 + numerics_data["nperiod"] = (self.data["box"]["nx0"] + 1) // 2 numerics_data["beta"] = self.data["general"]["beta"] From 374c7d801ee8e17442269a7d32ac48de671381c1 Mon Sep 17 00:00:00 2001 From: arkabokshi Date: Sun, 2 Jun 2024 18:35:19 +0100 Subject: [PATCH 2/4] 2pi segments should equal nkx --- src/pyrokinetics/gk_code/gene.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pyrokinetics/gk_code/gene.py b/src/pyrokinetics/gk_code/gene.py index 4e6eaba82..daa45c8a9 100755 --- a/src/pyrokinetics/gk_code/gene.py +++ b/src/pyrokinetics/gk_code/gene.py @@ -1245,11 +1245,11 @@ def _get_coords( single_theta_loop = theta single_ntheta_loop = ntheta - ntheta = ntheta * (nkx - 1) + ntheta = ntheta * nkx theta = np.empty(ntheta) start = 0 - for i in range(nkx - 1): - pi_segment = i - nkx // 2 + 1 + for i in range(nkx): + pi_segment = i - nkx // 2 theta[start : start + single_ntheta_loop] = ( single_theta_loop + pi_segment * 2 * pi ) From 1388b1b1fe6808e5b4a59949f125b2f1e98626c8 Mon Sep 17 00:00:00 2001 From: arkabokshi Date: Sun, 2 Jun 2024 18:51:08 +0100 Subject: [PATCH 3/4] update indexing in 2pi connections --- src/pyrokinetics/gk_code/gene.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyrokinetics/gk_code/gene.py b/src/pyrokinetics/gk_code/gene.py index daa45c8a9..c86dc02dc 100755 --- a/src/pyrokinetics/gk_code/gene.py +++ b/src/pyrokinetics/gk_code/gene.py @@ -1396,7 +1396,7 @@ def _get_fields( phase_fac = -1 i_ball = 0 - for i_conn in range(-int(nx / 2) + 1, int((nx - 1) / 2) + 1): + for i_conn in range(-int(nx / 2), int((nx - 1) / 2) + 1): fields[:, 0, :, i_ball : i_ball + nz, :] = ( sliced_field[:, i_conn, :, :, :] * (phase_fac) ** i_conn ) From 19cc3ad4263bb4514c905cc92232c57fcbd3233b Mon Sep 17 00:00:00 2001 From: arkabokshi Date: Sun, 2 Jun 2024 21:33:14 +0100 Subject: [PATCH 4/4] update indexing in moments --- src/pyrokinetics/gk_code/gene.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyrokinetics/gk_code/gene.py b/src/pyrokinetics/gk_code/gene.py index c86dc02dc..442dd035d 100755 --- a/src/pyrokinetics/gk_code/gene.py +++ b/src/pyrokinetics/gk_code/gene.py @@ -1523,7 +1523,7 @@ def _get_moments( phase_fac = -1 i_ball = 0 - for i_conn in range(-int(nx / 2) + 1, int((nx - 1) / 2) + 1): + for i_conn in range(-int(nx / 2), int((nx - 1) / 2) + 1): moments[:, 0, :, i_ball : i_ball + nz, :] = ( sliced_moment[:, i_conn, :, :, :] * (phase_fac) ** i_conn )