UM-PEPL / HallThruster.jl

An open-source fluid Hall thruster code
Other
16 stars 9 forks source link

Some initial refactoring #122

Closed archermarx closed 4 months ago

archermarx commented 4 months ago

Addresses #121 in part, as well as making some other changes to the internals. The main goal of this is to remove the vestiges of DifferentialEquations.jl. Previously, we had used that library for timestepping, and the entire design of the code was based on that. However, that led to some awkward design choices. Now that we no longer use DifferentialEquations, I would like to restructure the code in a way that makes more sense. This PR is a draft for now.

What's changed

Still to come (in later PRs)

codecov-commenter commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.11%. Comparing base (9b9247a) to head (1e2619b).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122/graphs/tree.svg?width=650&height=150&src=pr&token=ADOlTglgOb&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) ```diff @@ Coverage Diff @@ ## main #122 +/- ## ========================================== - Coverage 87.22% 84.11% -3.11% ========================================== Files 36 36 Lines 2058 2008 -50 ========================================== - Hits 1795 1689 -106 - Misses 263 319 +56 ``` | [Files](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [src/HallThruster.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL0hhbGxUaHJ1c3Rlci5qbA==) | `100.00% <100.00%> (ø)` | | | [src/numerics/flux.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL251bWVyaWNzL2ZsdXguamw=) | `89.94% <100.00%> (-1.69%)` | :arrow_down: | | [src/numerics/limiters.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL251bWVyaWNzL2xpbWl0ZXJzLmps) | `96.29% <100.00%> (+0.14%)` | :arrow_up: | | [src/physics/fluid.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3BoeXNpY3MvZmx1aWQuamw=) | `100.00% <ø> (ø)` | | | [src/physics/gas.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3BoeXNpY3MvZ2FzLmps) | `100.00% <ø> (ø)` | | | [src/physics/thermal\_conductivity.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3BoeXNpY3MvdGhlcm1hbF9jb25kdWN0aXZpdHkuamw=) | `63.63% <ø> (ø)` | | | [src/simulation/boundaryconditions.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3NpbXVsYXRpb24vYm91bmRhcnljb25kaXRpb25zLmps) | `100.00% <100.00%> (ø)` | | | [src/simulation/configuration.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3NpbXVsYXRpb24vY29uZmlndXJhdGlvbi5qbA==) | `78.68% <100.00%> (+0.42%)` | :arrow_up: | | [src/simulation/electronenergy.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3NpbXVsYXRpb24vZWxlY3Ryb25lbmVyZ3kuamw=) | `96.59% <100.00%> (-0.04%)` | :arrow_down: | | [src/simulation/geometry.jl](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3NpbXVsYXRpb24vZ2VvbWV0cnkuamw=) | `95.58% <ø> (ø)` | | | ... and [8 more](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Last update [9b9247a...1e2619b](https://app.codecov.io/gh/UM-PEPL/HallThruster.jl/pull/122?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
archermarx commented 4 months ago

I'm gonna mark this ready for review. @DecBrick, could you take a look?

archermarx commented 4 months ago

Looks good so far aside from the comments below.

For future steps, with regards to the params structure, it may be good to have a method to be able to call all of its keys in a concise manner from a solution object to allow the user to be able to see what properties are saved. A native way to do this in Julia may exist, but I haven't encountered it so far.

i think fieldnames(typeof(sol.savevals[1])) would work, but i could add a saved_properties method that does that for you

DecBrick commented 4 months ago

Well it does, maybe not do a full method but make a note about that in the documentation as the documentation on what fields the object has may not always be up to date.

archermarx commented 4 months ago

I've added a HallThruster.saved_fields() function which will list all fields that get saved to sol.savevals. I've also updated the jupyter notebook to call this instead of using the static list of fields, and the docs so that this field is mentioned.