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

Update number of shells in SimulationState #2504

Merged
merged 14 commits into from
Feb 7, 2024

Conversation

DeerWhale
Copy link
Contributor

@DeerWhale DeerWhale commented Jan 18, 2024

📝 Description

Type: 🪲 bugfix | 🚦 testing

Updated the no_of_shells in SimulationState to be the number of active shells, which affect the dimensionality of csvy models when the inner boundary velocity is set to be a value in between the first and last shell.

From there, found some other similar bugs that would cause issue for csvy models that has v_inner_bounday in the middle, including:

  • The geometric dilution factor: the r_boundary_inner in this equation should be the radius of the first shell has v <= v_inner_boundary (Note: if directly change to v_inner_active[0] will cause error on the first w value, since v_middle[0] can be smaller than v_inner_active[0])
  • The packet_source radius should start at r_inner_active[0] not the raw r_inner[0], which caused the issue that there is no packet escaping if the csvy model has deep inactive shells

Another modification is in DiluteBlackBodyRadiationFieldState" -- include the geometry input, so only check the assertion on dilution factor >0 for active shells (for cases that v_inner is in the middle, the raw dilution factors contains nan values.)

📌 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.

@DeerWhale DeerWhale changed the title Update no of active shell Update number of shells in SimulationState Jan 18, 2024
composition = Composition(
density, nuclide_mass_fraction, atom_data.atom_data.mass.copy()
)

Copy link
Contributor Author

@DeerWhale DeerWhale Jan 24, 2024

Choose a reason for hiding this comment

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

This modification is just to delete the duplicated codes

Copy link

codecov bot commented Jan 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (234c586) 68.13% compared to head (3969d9c) 68.20%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2504      +/-   ##
==========================================
+ Coverage   68.13%   68.20%   +0.06%     
==========================================
  Files         166      166              
  Lines       13961    13972      +11     
==========================================
+ Hits         9513     9530      +17     
+ Misses       4448     4442       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DeerWhale DeerWhale force-pushed the update_no_of_active_shell branch from 79122de to 4e0d0c7 Compare January 28, 2024 04:32
jvshields
jvshields previously approved these changes Jan 29, 2024
@andrewfullard
Copy link
Contributor

Unfortunately this will need a small rebase

@DeerWhale DeerWhale requested a review from jvshields February 6, 2024 22:10
@DeerWhale DeerWhale force-pushed the update_no_of_active_shell branch from eb782ce to 372e618 Compare February 7, 2024 03:57
@DeerWhale
Copy link
Contributor Author

Unfortunately this will need a small rebase

Rebased to upstream/master now.

…radiationfield to be active shells only, this way one can change the v_inner on fly
1 - (geometry.r_inner[0] ** 2 / geometry.r_middle**2).to(1).value
1
- (
geometry.r_inner[geometry.v_inner_boundary_index] ** 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be geometry.r_inner_active[0]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried that but since r_inner_active[0] is overwrite by the v_inner_boundary value (which can be values in between the discrete shells), sometimes it can be a bigger value than the first element in r_middle, which cause the first w to be nan, and fails the assertion in the diluteBBradiationField.

1
- (
geometry.r_inner[geometry.v_inner_boundary_index] ** 2
/ geometry.r_middle**2
Copy link
Contributor

Choose a reason for hiding this comment

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

Double check that r_middle is correct here (matching the active radii)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

r_middle is the raw shells, but if we would like to keep the raw shape of the shells in radiationfield, then we should use r_middle I think.

geometry is not None
): # check the active shells only (this is used when setting up the radiation_field_state)
assert np.all(
t_radiative[
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this fixes the issue, but we probably ought to be setting the estimators shape as the active shells from the start.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is actually already being taken of, since the estimators only use the active shells, the simulation_state slice the active shells from the "raw" radiation_field_state.

@DeerWhale DeerWhale merged commit 4db9043 into tardis-sn:master Feb 7, 2024
12 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.

3 participants