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

Precompute A^-1/n and A^-n in DislocationCreep and DiffusionCreep #207

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

albert-de-montserrat
Copy link
Member

@albert-de-montserrat albert-de-montserrat commented Jul 13, 2024

Computing A^-1/n or A^-n is really expensive, particularly during the pseudo-transient iterations where this is redundantly done thousands of times. In this PR we just precompute and store those values in the correspondent structs.

It results in a ~30% speedup in JustRelax.jl (example for a 64x64 model)

  • Main branch:
julia> @b compute_viscosity!($(stokes, phase_ratios, args0, rheology, viscosity_cutoff)...)
    332.667 μs (21 allocs: 8.328 KiB)
  • This branch
julia> @b compute_viscosity!($(stokes, phase_ratios, args0, rheology, viscosity_cutoff)...)
    255.375 μs (21 allocs: 8.328 KiB)

TODO: units make it type unstable in some Julia versions

@albert-de-montserrat albert-de-montserrat changed the title Precompute A^-1/n and A^-n in DislocationCreep and DiffusionCreep Precompute A^-1/n and A^-n in DislocationCreep and DiffusionCreep Jul 13, 2024
Copy link

codecov bot commented Jul 13, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.

Files Patch % Lines
src/CreepLaw/DislocationCreep.jl 84.61% 2 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

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.

1 participant