Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
014fa21
adde tokagridgen tool to gkeyll version which has tools under gkeyll …
mp5650 Oct 20, 2025
784d169
small fixes so now the code can be built from a clean installation to…
mp5650 Oct 20, 2025
05a2115
small bug fix
mp5650 Oct 20, 2025
ef2a87c
wpsi input is now a relative width between 0 to 1 that is normalized …
mp5650 Oct 20, 2025
766cf29
improved comments for widths
mp5650 Oct 20, 2025
f6d2e87
output files are now written into a <name>_geometry folder for better…
mp5650 Oct 20, 2025
e0ddb60
tokagridgen tool now writes name_fpol.gkyl, name_psi.gkyl, and name_q…
mp5650 Oct 22, 2025
38fd4a3
removed write out of _fpol and _q gkyl files since only _psi.gkyl is …
mp5650 Oct 22, 2025
41179ea
tokagridgen tool writes out a name_settings.gkyl file which has in it…
mp5650 Oct 22, 2025
10c5732
Delete tokagridgen-plot.py
mp5650 Dec 18, 2025
c68ebe5
adde tokagridgen tool to gkeyll version which has tools under gkeyll …
mp5650 Oct 20, 2025
36b54d5
small fixes so now the code can be built from a clean installation to…
mp5650 Oct 20, 2025
3a0801d
small bug fix
mp5650 Oct 20, 2025
d17e518
wpsi input is now a relative width between 0 to 1 that is normalized …
mp5650 Oct 20, 2025
fefdf61
improved comments for widths
mp5650 Oct 20, 2025
883ac35
output files are now written into a <name>_geometry folder for better…
mp5650 Oct 20, 2025
e24663b
tokagridgen tool now writes name_fpol.gkyl, name_psi.gkyl, and name_q…
mp5650 Oct 22, 2025
763ba59
removed write out of _fpol and _q gkyl files since only _psi.gkyl is …
mp5650 Oct 22, 2025
87a32f2
tokagridgen tool writes out a name_settings.gkyl file which has in it…
mp5650 Oct 22, 2025
d5cabd4
Delete tokagridgen-plot.py
mp5650 Dec 18, 2025
17cd506
Merge origin/tokagridgen-tool to include 10 commits
mp5650 Dec 18, 2025
98e8119
Fixed tokagridgen flags notes
mp5650 Feb 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gkeyll/Makefile-gkeyll
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ OBJS := $(SRCS:%=../$(BUILD_DIR)/gkeyll/%.o)
DEPS := $(OBJS:.o=.d)

EXT_INCS := -I${MPI_INC_DIR} -I${LUA_INC_DIR} -I${LAPACK_INC} -I${SUPERLU_INC}
APP_LW_INCS := -I../core/apps -I../moments/apps -I../vlasov/apps -I../pkpm/apps -I../gyrokinetic/apps
APP_LW_INCS := -I../core/apps -I../core/zero -I../moments/apps -I../moments/zero -I../vlasov/apps -I../vlasov/zero -I../pkpm/apps -I../pkpm/zero -I../gyrokinetic/apps -I../gyrokinetic/zero

CORE_INCS := -I../core/minus -I../core/zero

Expand Down
2 changes: 2 additions & 0 deletions gkeyll/gkeyll.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ static struct tool_description tool_list[] = {
{"multimomlinear", "multimomlinear.lua",
"Linear dispersion solver for multi-moment, multifluid equations"},
{"eqdskreader", "eqdskreader.lua", "Read eqdsk file, writing data to files"},
{"mirrorgridgen", "mirrorgridgen.lua", "Generate grid for use in mirror simulations"},
{"tokagridgen", "tokagridgen.lua", "Generate grid for use in tokamak simulations"},
{0, 0}
};

Expand Down
65 changes: 65 additions & 0 deletions gkeyll/lua/Tool/gkylt_tokagridgen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#pragma once

#include <stdbool.h>
#include <gkyl_gk_block_geom.h>
#include <gkyl_gyrokinetic_multib.h>

// Forward declarations
struct gkyl_gk_block_geom;
struct gkyl_gk_block_geom_info_lite;
// Moved from gkyl_toka_grid_gen.h to reduce headers
enum gkyl_toka_grid_gen_null_points {
GKYL_TOKA_GRID_GEN_SINGLE_NULL, // Single Null Configuration
GKYL_TOKA_GRID_GEN_DOUBLE_NULL, // Double Null Configuration
};


// Function pointer type for plate functions
typedef void (*plate_func_t)(double s, double* RZ);

struct gkylt_tokagridgen_inp {
enum gkyl_toka_grid_gen_null_points toka_type; //Tokamak configuration

double wpsi[4]; // Width of psi for different regions
int cell_count[6]; // number of cells in computational space

// Plate function pointers - these will be set from Lua input
plate_func_t plate_func_lower_outer;
plate_func_t plate_func_upper_outer;
plate_func_t plate_func_lower_inner;
plate_func_t plate_func_upper_inner;

// Region-specific parameters (conditional based on toka_type)
// For double_null: lower_PF[6], outer_SOL[7], inner_SOL[6], core[5]
// For single_null: lower_PF[8], SOL[7], core[8]
double lower_PF[8]; // lower private flux region parameters (max size for both types)
double outer_SOL[7]; // outer scrape-off layer parameters (DN only)
double inner_SOL[6]; // inner scrape-off layer parameters (DN only)
double SOL[7]; // scrape-off layer parameters (SN only)
double core[7]; // core region parameters (max size for both types)

const char *geqdsk_path; // name for file with psi(R,Z)
const char *out_prefix; // output prefix
const char *name; // application name
bool use_half_domain; // flag to indicate if half domain should be used (DN only)
};

// Settings struct to return metadata
struct gkylt_tokagridgen_settings {
enum gkyl_toka_grid_gen_null_points toka_type;
bool use_half_domain;
double psisep;
};

// Return struct containing both bgeom and settings
struct gkylt_tokagridgen_output {
struct gkyl_gk_block_geom* bgeom;
struct gkylt_tokagridgen_settings settings;
};

struct gkylt_tokagridgen_output gkylt_tokagridgen(const struct gkylt_tokagridgen_inp *tginp);

// Lite accessor to export safe block geometry info to Lua
void gkyl_gk_block_geom_get_block_lite(const struct gkyl_gk_block_geom *bgeom,
int bidx, struct gkyl_gk_block_geom_info_lite *out);

Loading
Loading