From 3597a61ef5e4526d2eb7d1b4f345a32d3caada8f Mon Sep 17 00:00:00 2001 From: Anchal Gupta Date: Wed, 20 Mar 2024 14:50:44 -0700 Subject: [PATCH 1/4] Replacing OMAS with IMASDD everywhere Tested this but got following error: ``` (base) gupta@F-CJXNMY7L7 SD4SOLPS.jl % julia --project test/runtests.jl Test Summary: | Pass Total Time lightweight_utilities | 4 4 1.0s Test Summary: | Pass Total Time actuator | 2 2 1.7s core_profile_extension: Error During Test at /Users/gupta/Git/ProjectTorreyPines/SD4SOLPS.jl/test/runtests.jl:166 Got exception outside of a @test UndefVarError: `gradient` not defined Stacktrace: [1] extrapolate_core(edge_rho::Vector{Float64}, edge_quantity::Vector{Float64}, rho_output::Vector{Float64}) @ SD4SOLPS ~/Git/ProjectTorreyPines/SD4SOLPS.jl/src/supersize_profile.jl:58 [2] macro expansion @ ~/Git/ProjectTorreyPines/SD4SOLPS.jl/test/runtests.jl:171 [inlined] [3] macro expansion @ /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/Test/src/Test.jl:1498 [inlined] [4] top-level scope @ ~/Git/ProjectTorreyPines/SD4SOLPS.jl/test/runtests.jl:168 [5] include(mod::Module, _path::String) @ Base ./Base.jl:457 [6] exec_options(opts::Base.JLOptions) @ Base ./client.jl:307 [7] _start() @ Base ./client.jl:522 Test Summary: | Error Total Time core_profile_extension | 1 1 0.5s ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken. in expression starting at /Users/gupta/Git/ProjectTorreyPines/SD4SOLPS.jl/test/runtests.jl:165 ``` For testing, following versions of the pacjages were used (these are the points where IMASDD was used instead of OMAS): GGDUtils: https://github.com/ProjectTorreyPines/GGDUtils.jl/commit/b11ad1581718a7bf4a50c2551b2a2a7b84a3394e SOLPS2IMAS: https://github.com/ProjectTorreyPines/SOLPS2IMAS.jl/commit/f843e6a64ccd597e0eb77ab4f953c922614d99e4 The main issue is that OMAS.gradient() function is defined in https://github.com/ProjectTorreyPines/OMAS.jl/blob/master/src/math.jl but no such function exists in IMASDD. --- Project.toml | 2 +- makefile | 6 +++--- src/SD4SOLPS.jl | 4 ++-- src/repair_eq.jl | 6 +++--- src/supersize_profile.jl | 30 +++++++++++++++--------------- test/runtests.jl | 8 ++++---- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Project.toml b/Project.toml index a3e1890..889b1db 100644 --- a/Project.toml +++ b/Project.toml @@ -8,9 +8,9 @@ ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" Contour = "d38c429a-6771-53c6-b99e-75d170b6e991" EFIT = "cda752c5-6b03-55a3-9e33-132a441b0c17" GGDUtils = "b7b5e640-9b39-4803-84eb-376048795def" +IMASDD = "06b86afa-9f21-11ec-2ef8-e51b8960cfc5" Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -OMAS = "91cfaa06-6526-4804-8666-b540b3feef2f" PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab" PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" diff --git a/makefile b/makefile index 53b0b8f..0e366bd 100644 --- a/makefile +++ b/makefile @@ -14,17 +14,17 @@ env_with_cloned_repo r: @echo "Cloning the repositories and generating Manifest.toml" -dn=$(shell dirname $(shell pwd)); \ if [[ "$${dn:(-10)}" == ".julia/dev" ]]; then ext="" ; else ext=".jl";fi; \ - git clone "git@github.com:ProjectTorreyPines/OMAS.jl.git" ../OMAS$${ext}; \ + git clone "git@github.com:ProjectTorreyPines/IMASDD.jl.git" ../IMASDD$${ext}; \ git clone "git@github.com:ProjectTorreyPines/GGDUtils.jl.git" ../GGDUtils$${ext}; \ git clone "git@github.com:ProjectTorreyPines/SOLPS2IMAS.jl.git" ../SOLPS2IMAS$${ext}; \ - julia --project=. -e 'using Pkg; Pkg.rm(["OMAS", "GGDUtils", "SOLPS2IMAS", "EFIT"]); Pkg.develop(path="../OMAS'$${ext}'"); Pkg.develop(path="../GGDUtils'$${ext}'"); Pkg.develop(path="../SOLPS2IMAS'$${ext}'"); Pkg.add(url="git@github.com:JuliaFusion/EFIT.jl.git", rev="master"); Pkg.instantiate()' + julia --project=. -e 'using Pkg; Pkg.rm(["IMASDD", "GGDUtils", "SOLPS2IMAS", "EFIT"]); Pkg.develop(path="../IMASDD'$${ext}'"); Pkg.develop(path="../GGDUtils'$${ext}'"); Pkg.develop(path="../SOLPS2IMAS'$${ext}'"); Pkg.add(url="git@github.com:JuliaFusion/EFIT.jl.git", rev="master"); Pkg.instantiate()' env_with_git_url u: @echo "Pulling sample files using dvc" -dvc pull @echo "Creating Julia environment with the git urls without creating local clones" @echo "Generating Project.toml and Manifest.toml" - julia --project=. -e 'using Pkg; Pkg.rm(["OMAS", "GGDUtils", "SOLPS2IMAS", "EFIT"]); Pkg.add(url="git@github.com:ProjectTorreyPines/OMAS.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/GGDUtils.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/SOLPS2IMAS.jl.git", rev="master"); Pkg.add(url="git@github.com:JuliaFusion/EFIT.jl.git", rev="master"); Pkg.instantiate()' + julia --project=. -e 'using Pkg; Pkg.rm(["IMASDD", "GGDUtils", "SOLPS2IMAS", "EFIT"]); Pkg.add(url="git@github.com:ProjectTorreyPines/IMASDD.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/GGDUtils.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/SOLPS2IMAS.jl.git", rev="master"); Pkg.add(url="git@github.com:JuliaFusion/EFIT.jl.git", rev="master"); Pkg.instantiate()' clean: @echo "Deleting Manifest.toml" diff --git a/src/SD4SOLPS.jl b/src/SD4SOLPS.jl index ae713b3..129ce90 100644 --- a/src/SD4SOLPS.jl +++ b/src/SD4SOLPS.jl @@ -1,6 +1,6 @@ module SD4SOLPS -using OMAS: OMAS +using IMASDD: IMASDD using SOLPS2IMAS: SOLPS2IMAS using EFIT: EFIT using Interpolations: Interpolations @@ -287,7 +287,7 @@ function preparation( println("Extrapolated edge profiles (but not really (placeholder only))") if output_format == "json" - OMAS.imas2json(dd, filename * ".json") + IMASDD.imas2json(dd, filename * ".json") else throw(ArgumentError(string("Unrecognized output format: ", output_format))) end diff --git a/src/repair_eq.jl b/src/repair_eq.jl index 54e7937..ead09f8 100644 --- a/src/repair_eq.jl +++ b/src/repair_eq.jl @@ -17,7 +17,7 @@ export check_rho_1d Checks to see if rho exists and is valid in the equilibrium 1d profiles """ -function check_rho_1d(dd::OMAS.dd; time_slice::Int64=1, throw_on_fail::Bool=false) +function check_rho_1d(dd::IMASDD.dd; time_slice::Int64=1, throw_on_fail::Bool=false) rho = dd.equilibrium.time_slice[time_slice].profiles_1d.rho_tor_norm if length(rho) < 1 rho_okay = false @@ -48,11 +48,11 @@ function check_rho_1d(dd::OMAS.dd; time_slice::Int64=1, throw_on_fail::Bool=fals end """ - function add_rho_to_equilibrium(dd:OMAS.dd) + function add_rho_to_equilibrium(dd:IMASDD.dd) Adds equilibrium rho profile to the DD """ -function add_rho_to_equilibrium!(dd::OMAS.dd) +function add_rho_to_equilibrium!(dd::IMASDD.dd) nt = length(dd.equilibrium.time_slice) if nt < 1 println("No equilibrium time slices to work with; can't add rho") diff --git a/src/supersize_profile.jl b/src/supersize_profile.jl index b541c75..689d9cb 100644 --- a/src/supersize_profile.jl +++ b/src/supersize_profile.jl @@ -3,7 +3,7 @@ Utilities for extrapolating profiles """ # import CalculusWithJulia -using OMAS: OMAS +using IMASDD: IMASDD using Interpolations: Interpolations using GGDUtils: GGDUtils, get_grid_subset, add_subset_element!, get_subset_boundary, @@ -55,7 +55,7 @@ Concept: integrate it to get the profile of the quantity in question """ function extrapolate_core(edge_rho, edge_quantity, rho_output) - grad = OMAS.gradient(edge_rho, edge_quantity) + grad = IMASDD.gradient(edge_rho, edge_quantity) gf = grad[1] rf = edge_rho[1] gmid = -abs(gf) / 4.0 @@ -92,7 +92,7 @@ end #!format off """ fill_in_extrapolated_core_profile!( - dd::OMAS.dd, + dd::IMASDD.dd, quantity_name::String; method::String="simple", eq_time_idx::Int64=1, @@ -108,7 +108,7 @@ edge_profiles data to rho, calls the function that performs the extrapolation (w not a simple linear extrapolation but has some trickery to attempt to make a somewhat convincing profile shape), and writes the result to core_profiles. This involves a bunch of interpolations and stuff. -dd: an IMAS/OMAS data dictionary +dd: an IMAS data dictionary quantity_name: the name of a quantity in edge_profiles.profiles_2d and core_profiles.profiles_1d, such as "electrons.density" method: Extrapolation method. @@ -130,7 +130,7 @@ cell_subset_idx: index of the subset of cells to use for the extrapolation. The """ #!format on function fill_in_extrapolated_core_profile!( - dd::OMAS.dd, + dd::IMASDD.dd, quantity_name::String; method::String="simple", eq_time_idx::Int64=1, @@ -300,7 +300,7 @@ Returns: - normalized poloidal flux on the equilibrium grid - a linear interpolation of norm pol flux vs. R and Z, ready to be evaluated """ -function prep_flux_map(dd::OMAS.dd; eq_time_idx::Int64=1, eq_profiles_2d_idx::Int64=1) +function prep_flux_map(dd::IMASDD.dd; eq_time_idx::Int64=1, eq_profiles_2d_idx::Int64=1) eqt = dd.equilibrium.time_slice[eq_time_idx] p2 = eqt.profiles_2d[eq_profiles_2d_idx] r_eq = p2.grid.dim1 @@ -316,7 +316,7 @@ end #! format off """ mesh_psi_spacing( - dd::OMAS.dd; + dd::IMASDD.dd; eq_time_idx::Int64=1, eq_profiles_2d_idx::Int64=1, grid_ggd_idx::Int64=1, @@ -346,7 +346,7 @@ spacing_rule: "edge" or "mean" to make spacing of new cells (in psi_N) be the sa """ #! format on function mesh_psi_spacing( - dd::OMAS.dd; + dd::IMASDD.dd; eq_time_idx::Int64=1, eq_profiles_2d_idx::Int64=1, grid_ggd_idx::Int64=1, @@ -417,7 +417,7 @@ out to the most distant (in flux space) point on the limiting surface. Returns a vector of psi_N levels. """ function pick_extension_psi_range( - dd::OMAS.dd; + dd::IMASDD.dd; eq_time_idx::Int64=1, eq_profiles_2d_idx::Int64=1, grid_ggd_idx::Int64=1, @@ -553,7 +553,7 @@ function mesh_ext_follow_grad( end # Step along the paths of steepest descent to populate the mesh. - dpsindr, dpsindz = OMAS.gradient(r_eq, z_eq, psin_eq) + dpsindr, dpsindz = IMASDD.gradient(r_eq, z_eq, psin_eq) dpdr = Interpolations.linear_interpolation((r_eq, z_eq), dpsindr) dpdz = Interpolations.linear_interpolation((r_eq, z_eq), dpsindz) rlim = (minimum(r_eq), maximum(r_eq)) @@ -596,7 +596,7 @@ mesh_r: matrix of R values for the extended mesh mesh_z: matrix of Z values for the extended mesh """ function modify_mesh_ext_near_x!( - eqt::OMAS.equilibrium__time_slice, + eqt::IMASDD.equilibrium__time_slice, mesh_r::Matrix{Float64}, mesh_z::Matrix{Float64}, ) @@ -873,7 +873,7 @@ clear_cache: delete any existing cache file (for use in testing) """ #!format on function cached_mesh_extension!( - dd::OMAS.dd, + dd::IMASDD.dd, eqdsk_file::String, b2fgmtry::String; eq_time_idx::Int64=1, @@ -942,7 +942,7 @@ end Extends the mesh out into the SOL """ function mesh_extension_sol!( - dd::OMAS.dd; + dd::IMASDD.dd; eq_time_idx::Int64=1, eq_profiles_2d_idx::Int64=1, grid_ggd_idx::Int64=1, @@ -989,13 +989,13 @@ end """ fill_in_extrapolated_edge_profile!( - dd::OMAS.dd, quantity_name::String; method::String="simple", + dd::IMASDD.dd, quantity_name::String; method::String="simple", ) JUST A PLACEHOLDER FOR NOW. DOESN'T ACTUALLY WORK YET. """ function fill_in_extrapolated_edge_profile!( - dd::OMAS.dd, + dd::IMASDD.dd, quantity_name::String; method::String="simple", eq_time_idx::Int64=1, diff --git a/test/runtests.jl b/test/runtests.jl index e2551c1..a894f11 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ using SD4SOLPS: SD4SOLPS using SOLPS2IMAS: SOLPS2IMAS -using OMAS: OMAS +using IMASDD: IMASDD using EFIT: EFIT using Plots using Test @@ -289,7 +289,7 @@ if args["heavy_utilities"] # Test for sweeping 1D core profiles into 2D R,Z # (or anyway evaluating them at any R,Z location) - dd = OMAS.dd() + dd = IMASDD.dd() eqdsk_file = splitdir(pathof(SD4SOLPS))[1] * "/../sample/geqdsk_iter_small_sample" SD4SOLPS.geqdsk_to_imas!(eqdsk_file, dd) @@ -323,7 +323,7 @@ end if args["repair_eq"] @testset "repair_eq" begin # Prepare sample - dd = OMAS.dd() + dd = IMASDD.dd() eqdsk = splitdir(pathof(SD4SOLPS))[1] * "/../sample/geqdsk_iter_small_sample" SD4SOLPS.geqdsk_to_imas!(eqdsk, dd) # Make sure rho is missing @@ -355,7 +355,7 @@ if args["geqdsk_to_imas"] tslice = 1 for sample_file ∈ sample_files println(sample_file) - dd = OMAS.dd() + dd = IMASDD.dd() SD4SOLPS.geqdsk_to_imas!(sample_file, dd; time_index=tslice) eqt = dd.equilibrium.time_slice[tslice] From 864319e8f54f60afc389d157aac42b4e81340165 Mon Sep 17 00:00:00 2001 From: Anchal Gupta Date: Fri, 22 Mar 2024 17:59:07 -0700 Subject: [PATCH 2/4] Using readg() with set_time & conformed to IMASDD Using set_time for sample files where description is not in the standard format. Changes were made in the code to use ismissing in places to conform to requirements of IMASDD. In record_regular_mesh!(), the deepcopy of each element was replaced with deepcopy of the entire grid subset to improve speed. The test runtests.jl was updated to reflect the changes. All tests pass now with following versions: https://github.com/JuliaFusion/EFIT.jl/pull/8/commits/8580ca867807ebe512f186369236c566e8307f7c https://github.com/ProjectTorreyPines/IMASDD.jl/commit/6a6968a0ed7dcd27120af03d6c9e6a24067e30b2 https://github.com/ProjectTorreyPines/GGDUtils.jl/commit/b11ad1581718a7bf4a50c2551b2a2a7b84a3394e https://github.com/ProjectTorreyPines/SOLPS2IMAS.jl/commit/f843e6a64ccd597e0eb77ab4f953c922614d99e4 Note that EFIT version that was used has not been merged with its master branch yet at the time of this test. In conclusion, in future, OMAS can be removed now. --- sample/geqdsk_iter_small_sample | 2 +- src/SD4SOLPS.jl | 13 ++++++++++--- src/repair_eq.jl | 10 ++++++++-- src/supersize_profile.jl | 17 +++++------------ test/runtests.jl | 20 +++++++++++++++----- 5 files changed, 39 insertions(+), 23 deletions(-) diff --git a/sample/geqdsk_iter_small_sample b/sample/geqdsk_iter_small_sample index e51be73..a230a97 100644 --- a/sample/geqdsk_iter_small_sample +++ b/sample/geqdsk_iter_small_sample @@ -1,4 +1,4 @@ - EFITD 00/00/2008 #002296 0200ms Convert 0 65 65 + EFITD 00/00/2008 #002296 0200 0 65 65 0.624390220E+01 0.124878049E+02 0.619999981E+01 0.307804870E+01 0.200000050E+00 0.635000000E+01 0.580000000E+00 0.118000000E+02 0.000000000E+00 0.530000019E+01 0.150229038E+08 0.118000000E+02 0.000000000E+00 0.635000000E+01 0.000000000E+00 diff --git a/src/SD4SOLPS.jl b/src/SD4SOLPS.jl index 129ce90..8518739 100644 --- a/src/SD4SOLPS.jl +++ b/src/SD4SOLPS.jl @@ -68,13 +68,20 @@ end Transfers the equilibrium reconstruction in an EFIT-style gEQDSK file into the IMAS DD structure. """ -function geqdsk_to_imas!(eqdsk_file, dd; time_index=1) +function geqdsk_to_imas!(eqdsk_file, dd; set_time=nothing, time_index=1) # https://github.com/JuliaFusion/EFIT.jl/blob/master/src/io.jl - g = EFIT.readg(eqdsk_file) + g = EFIT.readg(eqdsk_file; set_time=set_time) # Copying ideas from OMFIT: omfit/omfit_classes/omfit_eqdsk.py / to_omas() eq = dd.equilibrium - resize!(eq.time_slice, 1) + if IMASDD.ismissing(eq, :time) + eq.time = Array{Float64}(undef, time_index) + end + eq.time[time_index] = g.time + if length(eq.time_slice) < time_index + resize!(eq.time_slice, time_index) + end eqt = eq.time_slice[time_index] + eqt.time = g.time # 0D gq = eqt.global_quantities diff --git a/src/repair_eq.jl b/src/repair_eq.jl index ead09f8..48e2100 100644 --- a/src/repair_eq.jl +++ b/src/repair_eq.jl @@ -71,8 +71,14 @@ function add_rho_to_equilibrium!(dd::IMASDD.dd) continue end end - if length(eqt.profiles_1d.phi) == 0 - resize!(eqt.profiles_1d.phi, n) + if ( + if IMASDD.ismissing(eqt.profiles_1d, :phi) + true + else + IMASDD.isempty(eqt.profiles_1d.phi) + end + ) + eqt.profiles_1d.phi = Array{Float64}(undef, n) psi2 = eqt.profiles_2d[1].psi req = collect(eqt.profiles_2d[1].grid.dim1) zeq = collect(eqt.profiles_2d[1].grid.dim2) diff --git a/src/supersize_profile.jl b/src/supersize_profile.jl index 689d9cb..5079098 100644 --- a/src/supersize_profile.jl +++ b/src/supersize_profile.jl @@ -231,10 +231,9 @@ function fill_in_extrapolated_core_profile!( ).(psi_for_quantity[in_bounds]) # Make sure the output 1D rho grid exists; create it if needed - if length(dd.core_profiles.profiles_1d[it].grid.rho_tor_norm) == 0 - resize!(dd.core_profiles.profiles_1d[it].grid.rho_tor_norm, 201) - # If you don't like this default, then you should write grid.rho_tor_norm before - # calling this function. + if IMASDD.ismissing(dd.core_profiles.profiles_1d[it].grid, :rho_tor_norm) + # If you don't like this default, then you should write grid.rho_tor_norm + # before calling this function. dd.core_profiles.profiles_1d[it].grid.rho_tor_norm = collect(LinRange(0, 1, 201)) end @@ -750,15 +749,9 @@ function record_regular_mesh!( # Preserve record of standard (non extended) mesh for i ∈ 1:5 - 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]) - end - std_sub.identifier.index = -i - std_sub.dimension = deepcopy(orig_sub.dimension) - std_sub.metric = deepcopy(orig_sub.metric) + grid_ggd.grid_subset[n_existing_subsets+i] = deepcopy(orig_sub) + grid_ggd.grid_subset[n_existing_subsets+i].identifier.index = -i end all_nodes_sub = get_grid_subset(grid_ggd, 1) all_edges_sub = get_grid_subset(grid_ggd, 2) diff --git a/test/runtests.jl b/test/runtests.jl index a894f11..3fcb573 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -183,8 +183,9 @@ if args["core_profile_extension"] @test isfile(b2time) @test isfile(b2mn) @test isfile(eqdsk) + eqdsk_time = parse(Float64, split(eqdsk, ".")[end]) / 1000.0 dd = SOLPS2IMAS.solps2imas(b2fgmtry, b2time; b2mn=b2mn) - SD4SOLPS.geqdsk_to_imas!(eqdsk, dd) + SD4SOLPS.geqdsk_to_imas!(eqdsk, dd; set_time=eqdsk_time) rho = dd.equilibrium.time_slice[1].profiles_1d.rho_tor_norm if !SD4SOLPS.check_rho_1d(dd; time_slice=1) @@ -219,8 +220,9 @@ if args["edge_profile_extension"] @testset "edge_profile_extension" begin # Test for getting mesh spacing b2fgmtry, b2time, b2mn, eqdsk = define_default_sample_set() + eqdsk_time = parse(Float64, split(eqdsk, ".")[end]) / 1000.0 dd = SOLPS2IMAS.solps2imas(b2fgmtry, b2time; b2mn=b2mn) - SD4SOLPS.geqdsk_to_imas!(eqdsk, dd) + SD4SOLPS.geqdsk_to_imas!(eqdsk, dd; set_time=eqdsk_time) dpsin = SD4SOLPS.mesh_psi_spacing(dd) @test dpsin > 0.0 @@ -298,8 +300,6 @@ if args["heavy_utilities"] resize!(dd.core_profiles.profiles_1d, prof_time_idx) n = 101 rho_n = Array(LinRange(0, 1.0, n)) - resize!(dd.core_profiles.profiles_1d[prof_time_idx].grid.rho_tor_norm, n) - resize!(dd.core_profiles.profiles_1d[prof_time_idx].electrons.density, n) dd.core_profiles.profiles_1d[prof_time_idx].grid.rho_tor_norm = rho_n dd.core_profiles.profiles_1d[prof_time_idx].electrons.density = make_test_profile(rho_n) @@ -356,7 +356,17 @@ if args["geqdsk_to_imas"] for sample_file ∈ sample_files println(sample_file) dd = IMASDD.dd() - SD4SOLPS.geqdsk_to_imas!(sample_file, dd; time_index=tslice) + if endswith(sample_file, "00") + eqdsk_time = parse(Float64, split(sample_file, ".")[end]) / 1000.0 + else + eqdsk_time = nothing + end + SD4SOLPS.geqdsk_to_imas!( + sample_file, + dd; + set_time=eqdsk_time, + time_index=tslice, + ) eqt = dd.equilibrium.time_slice[tslice] # global From c7c3c1e13cd2ff42b0a4cdada559f940ccfd5b78 Mon Sep 17 00:00:00 2001 From: Anchal Gupta Date: Fri, 22 Mar 2024 18:13:02 -0700 Subject: [PATCH 3/4] Putting back OMAS --- Project.toml | 1 + makefile | 5 +++-- src/SD4SOLPS.jl | 2 +- src/supersize_profile.jl | 2 +- test/runtests.jl | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index 889b1db..7c1d4a6 100644 --- a/Project.toml +++ b/Project.toml @@ -11,6 +11,7 @@ GGDUtils = "b7b5e640-9b39-4803-84eb-376048795def" IMASDD = "06b86afa-9f21-11ec-2ef8-e51b8960cfc5" Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +OMAS = "91cfaa06-6526-4804-8666-b540b3feef2f" PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab" PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" diff --git a/makefile b/makefile index 0e366bd..67cd50a 100644 --- a/makefile +++ b/makefile @@ -14,17 +14,18 @@ env_with_cloned_repo r: @echo "Cloning the repositories and generating Manifest.toml" -dn=$(shell dirname $(shell pwd)); \ if [[ "$${dn:(-10)}" == ".julia/dev" ]]; then ext="" ; else ext=".jl";fi; \ + git clone "git@github.com:ProjectTorreyPines/IMASDD.jl.git" ../OMAS$${ext}; \ git clone "git@github.com:ProjectTorreyPines/IMASDD.jl.git" ../IMASDD$${ext}; \ git clone "git@github.com:ProjectTorreyPines/GGDUtils.jl.git" ../GGDUtils$${ext}; \ git clone "git@github.com:ProjectTorreyPines/SOLPS2IMAS.jl.git" ../SOLPS2IMAS$${ext}; \ - julia --project=. -e 'using Pkg; Pkg.rm(["IMASDD", "GGDUtils", "SOLPS2IMAS", "EFIT"]); Pkg.develop(path="../IMASDD'$${ext}'"); Pkg.develop(path="../GGDUtils'$${ext}'"); Pkg.develop(path="../SOLPS2IMAS'$${ext}'"); Pkg.add(url="git@github.com:JuliaFusion/EFIT.jl.git", rev="master"); Pkg.instantiate()' + julia --project=. -e 'using Pkg; Pkg.rm(["OMAS", "IMASDD", "GGDUtils", "SOLPS2IMAS", "EFIT"]); Pkg.develop(path="../OMAS'$${ext}'"); Pkg.develop(path="../IMASDD'$${ext}'"); Pkg.develop(path="../GGDUtils'$${ext}'"); Pkg.develop(path="../SOLPS2IMAS'$${ext}'"); Pkg.add(url="git@github.com:JuliaFusion/EFIT.jl.git", rev="master"); Pkg.instantiate()' env_with_git_url u: @echo "Pulling sample files using dvc" -dvc pull @echo "Creating Julia environment with the git urls without creating local clones" @echo "Generating Project.toml and Manifest.toml" - julia --project=. -e 'using Pkg; Pkg.rm(["IMASDD", "GGDUtils", "SOLPS2IMAS", "EFIT"]); Pkg.add(url="git@github.com:ProjectTorreyPines/IMASDD.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/GGDUtils.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/SOLPS2IMAS.jl.git", rev="master"); Pkg.add(url="git@github.com:JuliaFusion/EFIT.jl.git", rev="master"); Pkg.instantiate()' + julia --project=. -e 'using Pkg; Pkg.rm(["OMAS", "IMASDD", "GGDUtils", "SOLPS2IMAS", "EFIT"]); Pkg.add(url="git@github.com:ProjectTorreyPines/OMAS.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/IMASDD.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/GGDUtils.jl.git", rev="master"); Pkg.add(url="git@github.com:ProjectTorreyPines/SOLPS2IMAS.jl.git", rev="master"); Pkg.add(url="git@github.com:JuliaFusion/EFIT.jl.git", rev="master"); Pkg.instantiate()' clean: @echo "Deleting Manifest.toml" diff --git a/src/SD4SOLPS.jl b/src/SD4SOLPS.jl index 8518739..75bfe79 100644 --- a/src/SD4SOLPS.jl +++ b/src/SD4SOLPS.jl @@ -1,6 +1,6 @@ module SD4SOLPS -using IMASDD: IMASDD +import OMAS as IMASDD using SOLPS2IMAS: SOLPS2IMAS using EFIT: EFIT using Interpolations: Interpolations diff --git a/src/supersize_profile.jl b/src/supersize_profile.jl index 5079098..e1c6a68 100644 --- a/src/supersize_profile.jl +++ b/src/supersize_profile.jl @@ -3,7 +3,7 @@ Utilities for extrapolating profiles """ # import CalculusWithJulia -using IMASDD: IMASDD +import OMAS as IMASDD using Interpolations: Interpolations using GGDUtils: GGDUtils, get_grid_subset, add_subset_element!, get_subset_boundary, diff --git a/test/runtests.jl b/test/runtests.jl index 3fcb573..70fd0ed 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ using SD4SOLPS: SD4SOLPS using SOLPS2IMAS: SOLPS2IMAS -using IMASDD: IMASDD +import OMAS as IMASDD using EFIT: EFIT using Plots using Test From c614b8bcca2bd26d25006a778478d82350f268f2 Mon Sep 17 00:00:00 2001 From: Anchal Gupta Date: Mon, 25 Mar 2024 10:18:27 -0700 Subject: [PATCH 4/4] Fix path error in OMAS installation --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 67cd50a..197d93b 100644 --- a/makefile +++ b/makefile @@ -14,7 +14,7 @@ env_with_cloned_repo r: @echo "Cloning the repositories and generating Manifest.toml" -dn=$(shell dirname $(shell pwd)); \ if [[ "$${dn:(-10)}" == ".julia/dev" ]]; then ext="" ; else ext=".jl";fi; \ - git clone "git@github.com:ProjectTorreyPines/IMASDD.jl.git" ../OMAS$${ext}; \ + git clone "git@github.com:ProjectTorreyPines/OMAS.jl.git" ../OMAS$${ext}; \ git clone "git@github.com:ProjectTorreyPines/IMASDD.jl.git" ../IMASDD$${ext}; \ git clone "git@github.com:ProjectTorreyPines/GGDUtils.jl.git" ../GGDUtils$${ext}; \ git clone "git@github.com:ProjectTorreyPines/SOLPS2IMAS.jl.git" ../SOLPS2IMAS$${ext}; \