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

Apply spline to the mass conserving temperature #659

Merged

Conversation

lhy11009
Copy link
Contributor

In this PR, I applied a spline to the mass-conserving temperature. Previously, there was a high-order discontinuity at the coldest part of the slab. This additional treatment would generate a continuous profile by the spline operation.

To show the effect, below is the visualization of a slab temperature (from the new test mass_conserving_slab_temperature_spline.wb).
The line features show 2 profiles across the slab.
mass_conserving_spline_new_T

One free variable is the number of points on the spline.
To maintain the minimum temperature in the slab, one point is always pinned on the coldest point of the slab.
In addition to that, an equal number of points are chosen on both sides (default is 5).
A profile at 500 km depth (the deeper one in the first plot) is chosen to show the temperature profile from different numbers of spline points.

tmass_conserving_slab_temperature_spline

n = 2 there is a strong smoothing effect on the slab's internal temperature.

n = 5, the spline only affects the center of the slab as designated.
As other parts of the profile are already continuous, the spline would follow the analytic profile.

n = 10, there is little effect on the temperature profile.

@lhy11009
Copy link
Contributor Author

@MFraters I see there are file differences not from the modification I committed in "File Changed". I only modified the source/world_builder/features/subducting_plate_models/temperature/mass_conserving.cc and the include/world_builder/features/subducting_plate_models/temperature/mass_conserving.h

Copy link

codecov bot commented Feb 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.31%. Comparing base (91c6b19) to head (b0d99ad).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #659      +/-   ##
==========================================
+ Coverage   98.28%   98.31%   +0.03%     
==========================================
  Files         107      107              
  Lines        7341     7358      +17     
==========================================
+ Hits         7215     7234      +19     
+ Misses        126      124       -2     
Files Coverage Δ
...ucting_plate_models/temperature/mass_conserving.cc 99.57% <100.00%> (+0.49%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91c6b19...b0d99ad. Read the comment docs.

Copy link

github-actions bot commented Feb 18, 2024

Benchmark Main Feature Difference (99.9% CI)
Slab interpolation simple none 1.022 ± 0.009 (s=463) 1.023 ± 0.007 (s=420) -0.1% .. +0.3%
Slab interpolation curved simple none 1.018 ± 0.007 (s=470) 1.021 ± 0.005 (s=416) +0.2% .. +0.4%
Spherical slab interpolation simple none 1.171 ± 0.006 (s=408) 1.168 ± 0.006 (s=364) -0.4% .. -0.2%
Slab interpolation simple curved CMS 1.058 ± 0.004 (s=416) 1.056 ± 0.003 (s=438) -0.3% .. -0.1%
Spherical slab interpolation simple CMS 1.561 ± 0.012 (s=282) 1.560 ± 0.013 (s=297) -0.3% .. +0.2%
Spherical fault interpolation simple none 1.178 ± 0.006 (s=390) 1.178 ± 0.008 (s=376) -0.2% .. +0.1%
Cartesian min max surface 2.318 ± 0.020 (s=189) 2.302 ± 0.036 (s=203) -1.1% .. -0.3%
Spherical min max surface 7.235 ± 0.027 (s=61) 7.215 ± 0.031 (s=66) -0.5% .. -0.0%

@MFraters
Copy link
Member

Thanks for this pull request! I think it would be good for @mibillen to take a first look at it, given that she is more familiar with the mass conserving temperature model

@MFraters I see there are file differences not from the modification I committed in "File Changed". I only modified the source/world_builder/features/subducting_plate_models/temperature/mass_conserving.cc and the include/world_builder/features/subducting_plate_models/temperature/mass_conserving.h

I assume you also added the test files? As for the doc/world_builder_declarations files, for now don't worry about them. You can remove them from you commits for now if you want. They will be mostly cleaned up in #652, althoug, because you are adding an option, these files will change in the end.

Copy link
Contributor

@mibillen mibillen left a comment

Choose a reason for hiding this comment

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

Just a few comments to clarify and then this can be merged. This is a very clean straightforward change to the code and the extra "cost" to calculate the spline is minimal due to the way you implemented this with the get_temperatures_analytic function.

Copy link
Member

@MFraters MFraters left a comment

Choose a reason for hiding this comment

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

This is cool functionality, thanks for implementing this! This looks good to me, so when you addressed Magali's comments and rebased the code, I think it is good to merge.

@lhy11009 lhy11009 force-pushed the mass_conserving_spline_new branch 3 times, most recently from e52488f to 2e411cc Compare February 27, 2024 22:52
@lhy11009
Copy link
Contributor Author

I have addressed Magali's comments and rebased them.

@@ -1168,7 +1180,11 @@
"items": {
"type": "array",
"minItems": 1,
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look correct. Can you run ctest -R generate_declarations_and_schema and check in the new result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed this. But this is from the conflict I get from rebase. I am not sure why this happens:

Auto-merging doc/world_builder_declarations.schema.json
CONFLICT (content): Merge conflict in doc/world_builder_declarations.schema.json
Auto-merging doc/world_builder_declarations_closed.md
CONFLICT (content): Merge conflict in doc/world_builder_declarations_closed.md
Auto-merging doc/world_builder_declarations_open.md
CONFLICT (content): Merge conflict in doc/world_builder_declarations_open.md

@MFraters
Copy link
Member

also, do not forget to add a changlog entry, either here or in a follow up pull request.

@lhy11009 lhy11009 force-pushed the mass_conserving_spline_new branch from 2e411cc to b0d99ad Compare February 28, 2024 03:56
@lhy11009
Copy link
Contributor Author

Fix the conflicts and add change log.

@MFraters
Copy link
Member

Thanks!

@MFraters MFraters added the ready to merge Pull request is ready to merge. May be waiting for tests to complete or other reviews. label Feb 28, 2024
@MFraters MFraters merged commit 141e825 into GeodynamicWorldBuilder:main Feb 28, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull request is ready to merge. May be waiting for tests to complete or other reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants