Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing v.0.2.0 #31

Merged
merged 14 commits into from
Jan 19, 2024
Merged

Releasing v.0.2.0 #31

merged 14 commits into from
Jan 19, 2024

Conversation

anchal-physics
Copy link
Collaborator

@anchal-physics anchal-physics commented Jan 17, 2024

Feature changes

  • SOLPS mesh can be extended out to fill the whole area upto the device walls.
    • Some cells still lie outside limiter surface.
  • geqdsk_to_imas records X-points to DD after EFIT finds them

Internal changes

  • Uses GGDUtils (v.0.2.1) for subset tools as they have been moved out of SOLPS2IMAS in v.0.2.0

eldond and others added 11 commits November 3, 2023 13:04
- Find gridlines by starting at inner boundary of existing mesh and following
  gradients of psi_N. Stop at regular intervals to get nodes in the new mesh.
- Modify steepest descent path near secondary X-point
  - The path that is probably meant to go through the secondary X-point will
    miss the secondary X-point if there's any numerical error (so, always)
  - Instead, find the X-point (a proposed change to EFIT.jl does this, but
    we can move that function back to SD4SOLPS if EFIT.jl doesn't accept it)
    and draw a line from the secondary X-point to the closest vertex on the
    inner edge of the mesh, replacing the whacky curved path that almost
    hits the X-point.
- At this point, some of the cells are outside the limiting surface
- Add documentation to edge mesh extension functions
- JSON instead of YAML: turning the matrices back into matrices is easier this way
- Fix indexing of spaces
- Clean up loops
- Reduce some function interfaces
@anchal-physics anchal-physics requested a review from eldond January 17, 2024 20:13
Copy link
Collaborator

@eldond eldond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is failing and we have to determine if the mesh extension cell connection bug (seen in GGDUtils example notebook plots) is still present, and if so, fix it.

Test failure:

est Summary:          | Pass  Total   Time
core_profile_extension |    9      9  17.8s
Slice #1 already has a rho_tor_norm profile; skipping
Rho has been added to the equilibrium
cleared ext mesh cache: /home/eldond/.julia/dev/SD4SOLPS/src/../data/__home__eldond__.julia__dev__SD4SOLPS__src__..__sample__ITER_Lore_2296_00000__EQDSK__g002296.00200___home__eldond__.julia__dev__SD4SOLPS__src__..__sample__ITER_Lore_2296_00000__EQDSK__g002296.00200.mesh_ext.json
there are 1 secondary x points
# deleted edges = 9636
edge_profile_extension: Test Failed at /home/eldond/.julia/dev/SD4SOLPS/test/runtests.jl:252
  Expression: all(all_indices .== all_indices_reconstruct)

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.9.4+0.x64.linux.gnu/share/julia/stdlib/v1.9/Test/src/Test.jl:478 [inlined]
 [2] macro expansion
   @ ~/.julia/dev/SD4SOLPS/test/runtests.jl:252 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.9.4+0.x64.linux.gnu/share/julia/stdlib/v1.9/Test/src/Test.jl:1498 [inlined]
 [4] top-level scope
   @ ~/.julia/dev/SD4SOLPS/test/runtests.jl:223
Test Summary:          | Pass  Fail  Total   Time
edge_profile_extension |   20     1     21  21.8s
ERROR: LoadError: Some tests did not pass: 20 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/eldond/.julia/dev/SD4SOLPS/test/runtests.jl:220

add_subset_element!(all_nodes_sub, space_idx, node_dim, node_idx)

# Edges
if (i > 1) & (i != cut) # i-1 to i in the npol direction
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, or a place like it, is probably where the error in the mesh extension is entering. The error is visible in the example notebooks for GGDUtils and SynthDiag.

end

# Cells
if (i > 1) & (i != cut) & (j > 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another possible oopsie location for connecting the extended mesh

if isfile(cached_ext_name)
# md = YAML.load_file(cached_ext_name)
md = JSON.parsefile(cached_ext_name)
pfr_transition = md["pfr_transition"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh, I could have cached an error. I'm not sure if I set an expiration for caches.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that note, the sample files might've been generated by a buggy version and saved, whereas the current version might be okay. Beyond where the bug is, I'm not sure WHEN the bug is.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the bug is still present, it remains that the sample files were written with the bug active and so are problematic, but we just merged new versions of the affected repos. Whoops.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is because the error was cached. I see this issue in fresh clones of the repo. The GGDUtils plotting recipe does not do any calculations. The misconnected cells are present in the ids so it is plotting them.

# connections should be nice and simple.
# The PFR flag needs to be respected; pfr nodes don't connect to non-pfr nodes
pfr = rzpi.(mesh_r[:, 1], mesh_z[:, 1]) .< 1
pfr_transition = argmax(abs.(diff(pfr)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be an off by one indexing issue here.

@anchal-physics
Copy link
Collaborator Author

The test is failing because the EFIT package registered with Julia registry is not up to date with the EFIT git repo where x_point code is present. To resolve this issue, in your SD4SOLPS directory, do following:

% julia --project=./
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.2 (2023-07-05)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> ]
(SD4SOLPS) pkg> rm EFIT
...
(SD4SOLPS) pkg> add "[email protected]:JuliaFusion/EFIT.jl.git"#master
...
(SD4SOLPS) pkg> instantiate
(SD4SOLPS) # press backspace (delete on mac) to get out
julia> exit()

This should fix the issue in the test case.

@anchal-physics
Copy link
Collaborator Author

Since this repo is not a dependency of any other repo, all other version upgrades are still valid and this mesh extension issue does not affect them.

@eldond
Copy link
Collaborator

eldond commented Jan 18, 2024

Since this repo is not a dependency of any other repo, all other version upgrades are still valid and this mesh extension issue does not affect them.

But they have, within them, links to DVC repos at specific commits, right? Or are the DVC repos not set to specific commits and you can update them? Anyway, the sample files that are in there now are wrong.

@eldond
Copy link
Collaborator

eldond commented Jan 18, 2024

The test is failing because the EFIT package registered with Julia registry is not up to date with the EFIT git repo where x_point code is present. To resolve this issue, in your SD4SOLPS directory, do following:

% julia --project=./
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.2 (2023-07-05)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> ]
(SD4SOLPS) pkg> rm EFIT
...
(SD4SOLPS) pkg> add "[email protected]:JuliaFusion/EFIT.jl.git"#master
...
(SD4SOLPS) pkg> instantiate
(SD4SOLPS) # press backspace (delete on mac) to get out
julia> exit()

This should fix the issue in the test case.

That did not fix it. Maybe it's because I updated to julia 1.9.4

eldond
eldond previously approved these changes Jan 18, 2024
Copy link
Collaborator

@eldond eldond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. Test passes. All I have to do is check out the right branch.

The other branch I'm developing has the fix to the extended mesh split. I DID fix it, but it hasn't made it to dev yet, so of course you don't have it. All right, go ahead with this for now, unless you want to cherry-pick cd641ae

* makefile has been added to allow easier creation of working environment
* README has been updated to guide the user through the process of creating a working environment and added links to setup and demonstration wiki.
Adding documentation with example, installation instructions
@anchal-physics anchal-physics merged commit d4f7166 into master Jan 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants