Skip to content

Commit

Permalink
Updating the name of the get_grid_subset (old get_grid_subset_witg_in…
Browse files Browse the repository at this point in the history
…dex)
  • Loading branch information
+Alicia Dautt-Silva authored and anchal-physics committed Mar 20, 2024
1 parent de5a689 commit 243f324
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion example/simple_demo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ n_e = GGDUtils.get_prop_with_grid_subset_index(
plot(dd.edge_profiles.grid_ggd, n_e; colorbar_title="Electrons density / m^(-3)")
plot!(
space,
GGDUtils.get_grid_subset_with_index(grid_ggd, 16);
GGDUtils.get_grid_subset(grid_ggd, 16);
linecolor=:black,
linewidth=2,
linestyle=:solid,
Expand Down
42 changes: 21 additions & 21 deletions src/supersize_profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Utilities for extrapolating profiles
using OMAS: OMAS
using Interpolations: Interpolations
using GGDUtils:
GGDUtils, get_grid_subset_with_index, add_subset_element!, get_subset_boundary,
GGDUtils, get_grid_subset, add_subset_element!, get_subset_boundary,
project_prop_on_subset!, get_subset_centers
using PolygonOps: PolygonOps
using JSON: JSON
Expand Down Expand Up @@ -143,9 +143,9 @@ function fill_in_extrapolated_core_profile!(
grid_ggd = dd.edge_profiles.grid_ggd[grid_ggd_idx]
space = grid_ggd.space[space_idx]
cell_subset =
get_grid_subset_with_index(grid_ggd, cell_subset_idx)
get_grid_subset(grid_ggd, cell_subset_idx)
midplane_subset =
get_grid_subset_with_index(grid_ggd, 11)
get_grid_subset(grid_ggd, 11)

if length(midplane_subset.element) < 1
throw(
Expand Down Expand Up @@ -383,7 +383,7 @@ function mesh_psi_spacing(
grid_ggd = dd.edge_profiles.grid_ggd[grid_ggd_idx]
space = grid_ggd.space[space_idx]
midplane_subset =
get_grid_subset_with_index(grid_ggd, 11)
get_grid_subset(grid_ggd, 11)
midplane_cell_centers = get_subset_centers(space, midplane_subset)
r_mesh = [midplane_cell_centers[i][1] for i eachindex(midplane_cell_centers)]
z_mesh = [midplane_cell_centers[i][2] for i eachindex(midplane_cell_centers)]
Expand Down Expand Up @@ -434,7 +434,7 @@ function pick_extension_psi_range(
# Use ggd mesh to find inner limit of contouring project
grid_ggd = dd.edge_profiles.grid_ggd[grid_ggd_idx]
space = grid_ggd.space[space_idx]
midplane_subset = get_grid_subset_with_index(grid_ggd, 11)
midplane_subset = get_grid_subset(grid_ggd, 11)
midplane_cell_centers = get_subset_centers(space, midplane_subset)
psin_midplane = rzpi.(midplane_cell_centers[end][1], midplane_cell_centers[end][2])

Expand Down Expand Up @@ -478,11 +478,11 @@ Returns a tuple with vectors of R and Z starting points.
function pick_mesh_ext_starting_points(grid_ggd, space)
# Choose starting points for the orthogonal (to the contour) gridlines
# Use the existing cells of the standard mesh
all_cell_subset = get_grid_subset_with_index(grid_ggd, 5)
all_cell_subset = get_grid_subset(grid_ggd, 5)
all_border_edges = get_subset_boundary(space, all_cell_subset)
core_edges = get_grid_subset_with_index(grid_ggd, 15)
outer_target = get_grid_subset_with_index(grid_ggd, 13)
inner_target = get_grid_subset_with_index(grid_ggd, 14)
core_edges = get_grid_subset(grid_ggd, 15)
outer_target = get_grid_subset(grid_ggd, 13)
inner_target = get_grid_subset(grid_ggd, 14)
ci = [ele.object[1].index for ele core_edges.element]
oi = [ele.object[1].index for ele outer_target.element]
ii = [ele.object[1].index for ele inner_target.element]
Expand Down Expand Up @@ -742,16 +742,16 @@ function record_regular_mesh!(
grid_ggd.grid_subset[n_existing_subsets+i].identifier.index =
new_subset_indices[i]
end
ext_nodes_sub = get_grid_subset_with_index(grid_ggd, -201)
ext_edges_sub = get_grid_subset_with_index(grid_ggd, -202)
ext_xedges_sub = get_grid_subset_with_index(grid_ggd, -203)
ext_yedges_sub = get_grid_subset_with_index(grid_ggd, -204)
ext_cells_sub = get_grid_subset_with_index(grid_ggd, -205)
ext_nodes_sub = get_grid_subset(grid_ggd, -201)
ext_edges_sub = get_grid_subset(grid_ggd, -202)
ext_xedges_sub = get_grid_subset(grid_ggd, -203)
ext_yedges_sub = get_grid_subset(grid_ggd, -204)
ext_cells_sub = get_grid_subset(grid_ggd, -205)

# Preserve record of standard (non extended) mesh
for i 1:5
std_sub = get_grid_subset_with_index(grid_ggd, -i)
orig_sub = get_grid_subset_with_index(grid_ggd, i)
std_sub = get_grid_subset(grid_ggd, -i)
orig_sub = get_grid_subset(grid_ggd, i)
resize!(std_sub.element, length(orig_sub.element))
for j 1:length(orig_sub.element)
std_sub.element[j] = deepcopy(orig_sub.element[j])
Expand All @@ -760,11 +760,11 @@ function record_regular_mesh!(
std_sub.dimension = deepcopy(orig_sub.dimension)
std_sub.metric = deepcopy(orig_sub.metric)
end
all_nodes_sub = get_grid_subset_with_index(grid_ggd, 1)
all_edges_sub = get_grid_subset_with_index(grid_ggd, 2)
all_xedges_sub = get_grid_subset_with_index(grid_ggd, 3)
all_yedges_sub = get_grid_subset_with_index(grid_ggd, 4)
all_cells_sub = get_grid_subset_with_index(grid_ggd, 5)
all_nodes_sub = get_grid_subset(grid_ggd, 1)
all_edges_sub = get_grid_subset(grid_ggd, 2)
all_xedges_sub = get_grid_subset(grid_ggd, 3)
all_yedges_sub = get_grid_subset(grid_ggd, 4)
all_cells_sub = get_grid_subset(grid_ggd, 5)

nodes = resize!(o0.object, n_nodes)
edges = resize!(o1.object, n_edges)
Expand Down
10 changes: 5 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using Test
using Unitful: Unitful
using Interpolations: Interpolations
using ArgParse: ArgParse
using GGDUtils: GGDUtils, get_grid_subset_with_index
using GGDUtils: GGDUtils, get_grid_subset

function parse_commandline()
s = ArgParse.ArgParseSettings(; description="Run tests. Default is all tests.")
Expand Down Expand Up @@ -229,17 +229,17 @@ if args["edge_profile_extension"]
grid_ggd = dd.edge_profiles.grid_ggd[grid_ggd_idx]
extended_subs = 1:5
orig_subs = [
deepcopy(get_grid_subset_with_index(grid_ggd, i)) for
deepcopy(get_grid_subset(grid_ggd, i)) for
i extended_subs
]
cfn = SD4SOLPS.cached_mesh_extension!(dd, eqdsk, b2fgmtry; clear_cache=true)
println("cleared ext mesh cache: ", cfn)
SD4SOLPS.cached_mesh_extension!(dd, eqdsk, b2fgmtry; grid_ggd_idx=grid_ggd_idx)
for j extended_subs
orig_sub = orig_subs[j]
std_sub = get_grid_subset_with_index(grid_ggd, -j)
all_sub = get_grid_subset_with_index(grid_ggd, j)
ext_sub = get_grid_subset_with_index(grid_ggd, -200 - j)
std_sub = get_grid_subset(grid_ggd, -j)
all_sub = get_grid_subset(grid_ggd, j)
ext_sub = get_grid_subset(grid_ggd, -200 - j)
orig_indices = [ele.object[1].index for ele orig_sub.element]
std_indices = [ele.object[1].index for ele std_sub.element]
all_indices = [ele.object[1].index for ele all_sub.element]
Expand Down

0 comments on commit 243f324

Please sign in to comment.