Skip to content

RunningAverage#347

Merged
JLeliaert merged 6 commits into3.11from
feature/runningAverage
Nov 29, 2024
Merged

RunningAverage#347
JLeliaert merged 6 commits into3.11from
feature/runningAverage

Conversation

@JonathanMaes
Copy link
Copy Markdown
Contributor

This PR adds 3 new functions for manipulating (custom) Quantitys:

  • RunningAverage(): tracks the running average over time of a given Quantity (for each cell individually, so this function also returns a full Quantity). The averaging takes the time step into account: when advancing a time step $$dt$$, the average will be updated based on the previous average $$a(t)$$ and the value $$q(t+dt)$$ of the quantity after the step :

    $$a(t+dt) = \frac{t \cdot a(t) + dt \cdot q(t+dt)}{t+dt}$$

  • Sum() and SumVector(): the total of the Quantity, summed over all cells in the simulation grid.

    • Sum() returns a scalar float64 and can be used for both scalar and vector quantities. For a vector quantity, all components will be added together.
    • SumVector() returns a data.Vector and can only be used for vector quantities.

@JLeliaert JLeliaert merged commit 01f1534 into 3.11 Nov 29, 2024
@JLeliaert JLeliaert deleted the feature/runningAverage branch November 29, 2024 15:13
@JonathanMaes JonathanMaes mentioned this pull request Dec 3, 2024
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.

2 participants