diff --git a/NOTICE.md b/NOTICE.md index e9d1ffb..0b3a153 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -1,9 +1,9 @@ -GGDUtils.jl +FusionSyntheticDiagnostics.jl ========= -The purpose of this NOTICE file is to provide legal notices and acknowledgments that must be displayed to users in any derivative works or distributions. This file does not alter the terms of the Apache 2.0 license that governs the use and distribution of the SynthDiag.jl package. +The purpose of this NOTICE file is to provide legal notices and acknowledgments that must be displayed to users in any derivative works or distributions. This file does not alter the terms of the Apache 2.0 license that governs the use and distribution of the FusionSyntheticDiagnostics.jl package. -GGDUtils.jl was originally developed under the ProjectTorreyPines by the Magnetic Fusion Energy group at General Atomics. +FusionSyntheticDiagnostics.jl was originally developed under the ProjectTorreyPines by the Magnetic Fusion Energy group at General Atomics. If this software contributes to an academic publication, please cite it as follows: A. Gupta, D. Eldon, H. Anand, A. Dautt-Silva, S. De Pascuale, J. Lore, O. Meneghini, and J.S. Park, "Plasma boundary control development using a time-dependent scrape-off layer model in closed-loop simulations", Nucl. Mater. Energy, manuscript in preparation for PSI conference (2024). diff --git a/Project.toml b/Project.toml index 839f381..729b402 100644 --- a/Project.toml +++ b/Project.toml @@ -1,4 +1,4 @@ -name = "SynthDiag" +name = "FusionSyntheticDiagnostics" uuid = "c6e34158-aa22-49e4-bb12-15cbcb518ce6" authors = ["Anchal Gupta "] version = "1.0.3" @@ -7,8 +7,8 @@ version = "1.0.3" ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" -GGDUtils = "b7b5e640-9b39-4803-84eb-376048795def" -IMAS = "13ead8c1-b7d1-41bb-a6d0-5b8b65ed587a" +IMASdd = "c5a45a97-b3f9-491c-b9a7-aa88c3bc0067" +IMASggd = "b7b5e640-9b39-4803-84eb-376048795def" Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" LsqFit = "2fda8390-95c7-5789-9bda-21331edee243" PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab" @@ -23,8 +23,8 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" ArgParse = "1" DSP = "0.7.9" DelimitedFiles = "1.9.1" -GGDUtils = "1.0.3" -IMAS = "1.2.2" +IMASdd = "2" +IMASggd = "2" Interpolations = "0.15.1" LsqFit = "0.15.0" PhysicalConstants = "0.2.3" @@ -32,4 +32,4 @@ Plots = "1.40.3" QuadGK = "2.9.4" StaticArrays = "1.9.2" Statistics = "1.9.0" -julia = ">= 1.10" +julia = "1.10" diff --git a/README.md b/README.md index c49ad0f..2fd9ba1 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,16 @@ -# SynthDiag.jl +# FusionSyntheticDiagnostics.jl -![Format Check](https://github.com/ProjectTorreyPines/SynthDiag.jl/actions/workflows/format_check.yml/badge.svg) -![Docs](https://github.com/ProjectTorreyPines/SynthDiag.jl/actions/workflows/make_docs.yml/badge.svg) -![Tests](https://github.com/ProjectTorreyPines/SynthDiag.jl/actions/workflows/test.yml/badge.svg) +![Format Check](https://github.com/ProjectTorreyPines/FusionSyntheticDiagnostics.jl/actions/workflows/format_check.yml/badge.svg) +![Docs](https://github.com/ProjectTorreyPines/FusionSyntheticDiagnostics.jl/actions/workflows/make_docs.yml/badge.svg) +![Tests](https://github.com/ProjectTorreyPines/FusionSyntheticDiagnostics.jl/actions/workflows/test.yml/badge.svg) -Package that defines synthetic diagnostics to generate sensor data based on plasma profile and syntehtic actuators. For installation and usage instructions, see the [online documentation](https://projecttorreypines.github.io/SynthDiag.jl/stable). For documentation on under development branch, see [dev online documentation](https://projecttorreypines.github.io/SynthDiag.jl/dev). +Package that defines synthetic diagnostics to generate sensor data based on plasma profile and synthetic actuators for fusion devices. For installation and usage instructions, see the [online documentation](https://projecttorreypines.github.io/FusionSyntheticDiagnostics.jl/stable). For documentation on under development branch, see [dev online documentation](https://projecttorreypines.github.io/FusionSyntheticDiagnostics.jl/dev). ## Installation -SynthDiag is registered with public repository [FuseRegistry](https://github.com/ProjectTorreyPines/FuseRegistry.jl/). First [install Julia](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#juliaup---julia-version-manager), then: +First [install Julia](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#juliaup---julia-version-manager), then: ```julia using Pkg -Pkg.Registry.add(RegistrySpec(url="https://github.com/ProjectTorreyPines/FuseRegistry.jl.git")) -Pkg.Registry.add("General") -Pkg.add("SynthDiag") +Pkg.add("FusionSyntheticDiagnostics") ``` \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index b105a20..6d3f1bc 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,15 +1,15 @@ using Documenter -using SynthDiag +using FusionSyntheticDiagnostics makedocs(; - modules=[SynthDiag], + modules=[FusionSyntheticDiagnostics], format=Documenter.HTML(), - sitename="SynthDiag", + sitename="FusionSyntheticDiagnostics", checkdocs=:none, ) deploydocs(; - repo="github.com/ProjectTorreyPines/SynthDiag.jl.git", + repo="github.com/ProjectTorreyPines/FusionSyntheticDiagnostics.jl.git", target="build", branch="gh-pages", devbranch="master", diff --git a/docs/src/index.md b/docs/src/index.md index b944b0d..6051b5b 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,5 +1,5 @@ -# SynthDiag.jl +# FusionSyntheticDiagnostics.jl ```@contents Pages = ["index.md"] @@ -8,13 +8,11 @@ Depth = 5 ## Installation -SynthDiag is registered with public repository [FuseRegistry](https://github.com/ProjectTorreyPines/FuseRegistry.jl/). First [install Julia](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#juliaup---julia-version-manager), then: +First [install Julia](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#juliaup---julia-version-manager), then: ```julia using Pkg -Pkg.Registry.add(RegistrySpec(url="https://github.com/ProjectTorreyPines/FuseRegistry.jl.git")) -Pkg.Registry.add("General") -Pkg.add("SynthDiag") +Pkg.add("FusionSyntheticDiagnostics") ``` ## Synthetic Diagnostics @@ -48,13 +46,13 @@ Gas valves can be added using IMAS compatible `JSON` file that describes the met add_gas_injection! compute_gas_injection compute_gas_injection! -SynthDiag.get_lpf -SynthDiag.dribble -SynthDiag.downsample_smooth -SynthDiag.find_delay +FusionSyntheticDiagnostics.get_lpf +FusionSyntheticDiagnostics.dribble +FusionSyntheticDiagnostics.downsample_smooth +FusionSyntheticDiagnostics.find_delay get_gas_injection_response -SynthDiag.gi_model -SynthDiag.int_gi_model +FusionSyntheticDiagnostics.gi_model +FusionSyntheticDiagnostics.int_gi_model get_required_gas_cmd ``` diff --git a/examples/plotting_interferometer.ipynb b/examples/plotting_interferometer.ipynb index f839164..0fb473c 100644 --- a/examples/plotting_interferometer.ipynb +++ b/examples/plotting_interferometer.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Plotting interferometer using GGDUtils\n", + "# Plotting interferometer using IMASggd\n", " \n", " For running this notebook, you need to install package IJulia in your home environment (that is messy, but that is the only way I know right now). So in your terminal:\n", " ```\n", @@ -25,8 +25,7 @@ "using Pkg\n", "Pkg.activate(\"./\")\n", "Pkg.add(\"IMASdd\")\n", - "Pkg.Registry.add(RegistrySpec(url=\"https://github.com/ProjectTorreyPines/FuseRegistry.jl.git\"))\n", - "Pkg.add(\"GGDUtils\")\n", + "Pkg.add(\"IMASggd\")\n", "Pkg.add(\"Plots\")" ] }, @@ -37,7 +36,7 @@ "outputs": [], "source": [ "using IMASdd\n", - "using GGDUtils\n", + "using IMASggd\n", "using Plots" ] }, @@ -218,7 +217,7 @@ "source": [ "gr()\n", "\n", - "n_e = GGDUtils.get_prop_with_grid_subset_index(ids.edge_profiles.ggd[1].electrons.density, -5)\n", + "n_e = IMASggd.get_prop_with_grid_subset_index(ids.edge_profiles.ggd[1].electrons.density, -5)\n", "plot(ids.edge_profiles.grid_ggd, n_e, colorbar_title=\"Electrons density / m^(-3)\", left_margin=10Plots.pt)\n", "plot!(space)\n", "plot!(ids.interferometer, legend=true, size=[635, 900]) # Adding a size comment to make plot aspect ratio better" diff --git a/src/SynthDiag.jl b/src/FusionSyntheticDiagnostics.jl similarity index 66% rename from src/SynthDiag.jl rename to src/FusionSyntheticDiagnostics.jl index 52b0602..f139714 100644 --- a/src/SynthDiag.jl +++ b/src/FusionSyntheticDiagnostics.jl @@ -1,6 +1,6 @@ -module SynthDiag +module FusionSyntheticDiagnostics -using IMAS: IMAS +import IMASdd as IMAS include("$(@__DIR__)/noise.jl") @@ -12,4 +12,4 @@ include("$(@__DIR__)/langmuir_probes.jl") include("$(@__DIR__)/gas_injection.jl") -end # module SynthDiag +end # module FusionSyntheticDiagnostics diff --git a/src/gas_injection.jl b/src/gas_injection.jl index 331b618..49c45a5 100644 --- a/src/gas_injection.jl +++ b/src/gas_injection.jl @@ -27,7 +27,8 @@ function add_gas_injection!( verbose::Bool=false, )::IMAS.dd if endswith(config, ".json") - config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) + config_dict = convert_strings_to_symbols(IMAS.JSON.parsefile(config)) # Use with import IMASdd as IMAS + # config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) # Use with using IMAS: IMAS add_gas_injection!(config_dict, ids; overwrite=overwrite, verbose=verbose) else error("Only JSON files are supported.") @@ -106,9 +107,9 @@ end Compute the gas flow rate based on the command signal in the all gas valves. """ function compute_gas_injection!( - ids::IMAS.dd; + ids::IMAS.dd{T}; valves::Dict{String, Dict{Symbol, Any}}=Dict{String, Dict{Symbol, Any}}(), -)::Array{Vector{Float64}} +)::Array{Vector{Float64}} where {T} if IMAS.ismissing(ids.gas_injection, :latency) global_latency = 0.0 elseif IMAS.isempty(ids.gas_injection.latency) diff --git a/src/interferometer.jl b/src/interferometer.jl index c615b2e..20035e4 100644 --- a/src/interferometer.jl +++ b/src/interferometer.jl @@ -1,7 +1,7 @@ using StaticArrays import PhysicalConstants.CODATA2018: c_0, ε_0, m_e, m_u, e import QuadGK: quadgk, BatchIntegrand -import GGDUtils: interp, get_grid_subset, get_subset_boundary, subset_do, get_TPS_mats +import IMASggd: interp, get_grid_subset, get_subset_boundary, subset_do, get_TPS_mats export add_interferometer!, compute_interferometer!, compute_interferometer @@ -23,7 +23,8 @@ function add_interferometer!( overwrite::Bool=false, verbose::Bool=false, rtol::Float64=1e-3, n_e_gsi::Int=5, )::IMAS.dd if endswith(config, ".json") - config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) + config_dict = convert_strings_to_symbols(IMAS.JSON.parsefile(config)) # Use with import IMASdd as IMAS + # config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) # Use with using IMAS as IMAS add_interferometer!( config_dict, ids; diff --git a/src/langmuir_probes.jl b/src/langmuir_probes.jl index ad340b9..decd28b 100644 --- a/src/langmuir_probes.jl +++ b/src/langmuir_probes.jl @@ -1,4 +1,4 @@ -import GGDUtils: interp, get_types_with +import IMASggd: interp, get_types_with import PhysicalConstants.CODATA2018: m_e, m_u, e export add_langmuir_probes!, compute_langmuir_probes!, langmuir_probe_current @@ -20,7 +20,8 @@ function add_langmuir_probes!( overwrite=false, verbose=false, kwargs..., )::IMAS.dd if endswith(config, ".json") - config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) + config_dict = convert_strings_to_symbols(IMAS.JSON.parsefile(config)) # Use with import IMASdd as IMAS + # config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) # Use with using IMAS: IMAS add_langmuir_probes!( config_dict, ids; diff --git a/test/runtests.jl b/test/runtests.jl index f65bf37..0114a82 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,8 @@ -using SynthDiag: IMAS, add_interferometer!, add_langmuir_probes!, add_gas_injection!, +using FusionSyntheticDiagnostics: IMAS, add_interferometer!, add_langmuir_probes!, + add_gas_injection!, compute_gas_injection!, get_gas_injection_response, Noise, OverwriteAttemptError, langmuir_probe_current -using IMAS: json2imas +using IMASdd: json2imas using Test using Printf using Plots diff --git a/test/speedtest.jl b/test/speedtest.jl index 0d656ab..5c8bb22 100644 --- a/test/speedtest.jl +++ b/test/speedtest.jl @@ -1,7 +1,8 @@ -using SynthDiag: add_interferometer!, add_langmuir_probes!, Noise, +using FusionSyntheticDiagnostics: IMAS, add_interferometer!, add_langmuir_probes!, + Noise, OverwriteAttemptError, add_gas_injection!, compute_gas_injection, get_gas_injection_response -using SynthDiag.IMAS: json2imas, dd +import IMASdd: json2imas using DelimitedFiles: readdlm println("-----------------------------------------------------------------------------") @@ -45,7 +46,7 @@ print("add_langmuir_probes!() time (true runtime): ") println("-----------------------------------------------------------------------------") config = "$(@__DIR__)/../src/default_gas_injection.json" excitation(t) = 0.6 -ids = dd(); +ids = IMAS.dd(); add_gas_injection!(config, ids) ttotal = 5 nt = Int(ttotal * 1000) + 1 @@ -89,8 +90,9 @@ ids.gas_injection.valve[1].response_curve = gasd_resp_curve gasd_model[:time_constant] = 0.3 gasd_model[:damping] = 0.8 -valves = Dict("GASD" => gasd_model) - +valves = Dict{String, Dict{Symbol, Any}}("GASD" => gasd_model) +println(typeof(ids)) +println(typeof(valves)) print("compute_gas_injection() time with compilation: ") @time compute_gas_injection(ids; valves=valves)