Skip to content

Conversation

@SouthEndMusic
Copy link
Contributor

@SouthEndMusic SouthEndMusic commented Dec 10, 2025

Issue addressed

Fixes #745, split out from #735.

Explanation

Some of the changes include:

  • Defining global constants for code clarity
  • Avoiding allocations
  • Simplifying logic
  • Using optimized functions, e.g. cbrt(x) instead of x^0.33 (which leads to some small changes in the results)
  • Renaming amount fields to more explanatory names
  • Missing @test statements
  • Using the same gravitational acceleration for sediment and local inertial flow (which leads to some small changes in the results)

Checklist

  • Updated tests or added new tests
  • Branch is up to date with master
  • Tests & pre-commit hooks pass
  • Updated documentation if needed
  • Updated changelog.qmd if needed

const VERSION =
VersionNumber(TOML.parsefile(joinpath(@__DIR__, "..", "Project.toml"))["version"])

g_gravity = 9.81 # m s⁻²
Copy link
Member

Choose a reason for hiding this comment

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

It will produce better code if this is marked as const. Not aware of plans to run Wflow on other planets, otherwise g_gravity::Float64 = 9.81 will also get most benefits.

Copy link
Contributor Author

@SouthEndMusic SouthEndMusic Dec 10, 2025

Choose a reason for hiding this comment

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

Gravity_anomalies_on_Earth

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see you are turning into a proper earth scientist.

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.

Performance: avoid unnecessary heap allocations

3 participants