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

Changing construction of the first guess and coefficient matrices in NLTE solver #2201

Merged
merged 80 commits into from
May 3, 2023

Conversation

sonachitchyan
Copy link
Member

📝 Description

Type: 🪲 bugfix | 🚀 feature | ☣️ breaking change | 🚦 testing | 📝 documentation | 🎢 infrastructure

This PR makes sure that thewayt coefficient matrices and the first guess of NLTE solver are constructed is able to work both with and without NLTE excitation species.

Also, link issues affected by this pull request by using the keywords: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

📌 Resources

Examples, notebooks, and links to useful references.

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

@codecov
Copy link

codecov bot commented Feb 1, 2023

Codecov Report

Merging #2201 (017b01e) into master (eda1a46) will increase coverage by 0.19%.
The diff coverage is 86.02%.

❗ Current head 017b01e differs from pull request most recent head ebb36f1. Consider uploading reports for the commit ebb36f1 to get more accurate results

@@            Coverage Diff             @@
##           master    #2201      +/-   ##
==========================================
+ Coverage   71.76%   71.96%   +0.19%     
==========================================
  Files         133      137       +4     
  Lines       12344    12514     +170     
==========================================
+ Hits         8859     9006     +147     
- Misses       3485     3508      +23     
Impacted Files Coverage Δ
tardis/analysis.py 32.40% <ø> (ø)
tardis/base.py 75.00% <ø> (ø)
tardis/io/atom_data/atom_web_download.py 38.09% <0.00%> (-1.91%) ⬇️
tardis/plasma/properties/property_collections.py 100.00% <ø> (ø)
tardis/plasma/tests/test_nlte_solver.py 100.00% <ø> (+0.91%) ⬆️
.../montecarlo/montecarlo_numba/nonhomologous_grid.py 48.00% <48.00%> (ø)
tardis/io/util.py 77.05% <50.00%> (-3.45%) ⬇️
tardis/plasma/standard_plasmas.py 84.21% <66.66%> (-1.78%) ⬇️
...dis/plasma/properties/nlte_rate_equation_solver.py 96.57% <89.74%> (-2.02%) ⬇️
tardis/io/parsers/arepo.py 69.78% <90.00%> (+3.43%) ⬆️
... and 12 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sonachitchyan sonachitchyan changed the title Changing constuction of thefirst guess and coefficient matrices in NLTE solver Changing constuction of the first guess and coefficient matrices in NLTE solver Feb 1, 2023
@Rodot- Rodot- added the plasma label Feb 20, 2023
@sonachitchyan sonachitchyan marked this pull request as ready for review February 22, 2023 19:25
Copy link
Contributor

@chvogl chvogl left a comment

Choose a reason for hiding this comment

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

This already looks really good! We should be able to merge this after some minor changes.

tardis/plasma/properties/nlte_rate_equation_solver.py Outdated Show resolved Hide resolved
tardis/plasma/properties/nlte_rate_equation_solver.py Outdated Show resolved Hide resolved
tardis/plasma/properties/nlte_rate_equation_solver.py Outdated Show resolved Hide resolved
tardis/plasma/properties/nlte_rate_equation_solver.py Outdated Show resolved Hide resolved
Matrix with excitation-deexcitation rates(should be added to NLTE rate matrix for excitation treatment).
NOTE: only works with ONE ion number treated in NLTE excitation AT ONCE.
"""
number_of_shells = beta_sobolev.shape[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

I still think it would be better to have this method operate on a single shell. I don't think we want to set up multiple rate matrices at once. The main advantage would be that is simplifies the code. However, since it likely will not affect the performance, we can also leave it as it is.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can leave it for now, and when we have the full implementation, see if switching it slows down the code

Copy link
Member Author

Choose a reason for hiding this comment

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

make an issue

Copy link
Contributor

Choose a reason for hiding this comment

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

.

tardis/plasma/properties/nlte_rate_equation_solver.py Outdated Show resolved Hide resolved
tardis/plasma/properties/nlte_rate_equation_solver.py Outdated Show resolved Hide resolved
tardis/plasma/tests/test_nlte_excitation.py Outdated Show resolved Hide resolved
@sonachitchyan sonachitchyan requested a review from chvogl April 26, 2023 17:06
Rodot-
Rodot- previously approved these changes Apr 26, 2023
Copy link
Contributor

@chvogl chvogl left a comment

Choose a reason for hiding this comment

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

Looks great.

tardis/plasma/properties/nlte_rate_equation_solver.py Outdated Show resolved Hide resolved
Matrix with excitation-deexcitation rates(should be added to NLTE rate matrix for excitation treatment).
NOTE: only works with ONE ion number treated in NLTE excitation AT ONCE.
"""
number_of_shells = beta_sobolev.shape[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

.

tardis/plasma/properties/nlte_rate_equation_solver.py Outdated Show resolved Hide resolved
Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>
@sonachitchyan sonachitchyan requested review from Rodot- and chvogl May 3, 2023 15:51
@andrewfullard andrewfullard merged commit 3cea409 into master May 3, 2023
light2802 pushed a commit to light2802/tardis that referenced this pull request May 27, 2023
…NLTE solver (tardis-sn#2201)

* implementing nlte_excitation

* ran black

* fixed a typo

* got rid of unnecessary lines

* rewrote tests

* made a change on assigning the config values to plasma properties

* fixed the tests

* Update tardis/io/tests/test_config_reader.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* restructured the first guess for NLTE solver to be compatible with NLTE excitation too

* ran black

* modified the existing rates to change when treating species with NLTE excitation

* nlte not implemented, remove from rate_matrix_index

* ran black

* fixed an issue with one of the tests

* attempt of adding bound bound interaction coefficients

* fixed an issue with bound bound rates matrix

* added docstrings

* ran black

* changed one of the methods to static

* added test for bound bound rates part of the matrix

* ran black

* added docstrings to nlteexcitationdata

* got rid of unnecessary import

* added a new parameter to the docsting of the method

* got rid of the number conservation row for the bound-bound matrix as it will be added on in the overall matrix construction

* ran black

* remodified the tests

* fixed a loop issue

* added a todo comment

* renamed a function

* updated a docstring

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* got rid of t_electrons

* resolved an issue with tests

* added additional information into a docstring

* added a docstring

* got rid of unnecessary grouping of rates

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Wolfgang Kerzendorf <wkerzendorf@gmail.com>

* fixing a minor issue in tests

* separated nlte excitation coefficients

* running black

* separating beta sobolev related stuff from the rest of the bound bound matrix

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* factored prepare_bound_bound_rate_matrix

* removed an unnecessary function for excitation rates

* removed unnecessary method for concatinating rates for NLTE excitation

* ran black on nlte_rate_equation_solver

* got rid of an unnecessary method

* fixed a typo

* small fixed

* modified the j_blues and beta_sobolevs used in the tests

* running black once again

* adding rate_matrix_index to first guess docstring

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* Update tardis/plasma/tests/test_nlte_excitation.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* fixed a typo

* switched from using the atomic_data_levels to number_of_levels

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* fixed the issue with tests

* ran black once again

* left a comment for future generations of NLTE youth

* ran black once again

* Update tardis/plasma/properties/nlte_rate_equation_solver.py

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>

* got rid of an unnecessary argument

---------

Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>
Co-authored-by: Wolfgang Kerzendorf <wkerzendorf@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants