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

Implement SummaryCallback to print fancy output #45

Merged
merged 4 commits into from
Jan 10, 2023

Conversation

efaulhaber
Copy link
Member

We can now print output like this:

██████╗ ██╗██╗  ██╗██╗███████╗
██╔══██╗██║╚██╗██╔╝██║██╔════╝
██████╔╝██║ ╚███╔╝ ██║█████╗
██╔═══╝ ██║ ██╔██╗ ██║██╔══╝
██║     ██║██╔╝ ██╗██║███████╗
╚═╝     ╚═╝╚═╝  ╚═╝╚═╝╚══════╝

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Semidiscretization                                                                               │
│ ══════════════════                                                                               │
│ #spatial dimensions: ………………………… 2                                                                │
│ #containers: ……………………………………………… 4                                                                │
│ neighborhood_search: ………………………… SpatialHashingSearch                                             │
│ total #particles: ………………………………… 1211                                                             │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ FluidParticleContainer{2}                                                                        │
│ ═════════════════════════                                                                        │
│ #particles: ………………………………………………… 171                                                              │
│ density calculator: …………………………… ContinuityDensity                                                │
│ state equation: ……………………………………… StateEquationCole                                                │
│ smoothing kernel: ………………………………… SchoenbergCubicSplineKernel                                      │
│ viscosity: …………………………………………………… ArtificialViscosityMonaghan{Float64}(0.02, 0.0, 0.01)            │
│ acceleration: …………………………………………… [0.0, -9.81]                                                     │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ BoundaryParticleContainer{2}                                                                     │
│ ════════════════════════════                                                                     │
│ #particles: ………………………………………………… 435                                                              │
│ boundary model: ……………………………………… BoundaryModelDummyParticles(AdamiPressureExtrapolation)          │
│ movement function: ……………………………… nothing                                                          │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ BoundaryParticleContainer{2}                                                                     │
│ ════════════════════════════                                                                     │
│ #particles: ………………………………………………… 150                                                              │
│ boundary model: ……………………………………… BoundaryModelMonaghanKajtar                                      │
│ movement function: ……………………………… movement_function                                                │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ SolidParticleContainer{2}                                                                        │
│ ═════════════════════════                                                                        │
│ total #particles: ………………………………… 455                                                              │
│ #fixed particles: ………………………………… 5                                                                │
│ Lamé λ: …………………………………………………………… 1.0862068965517243e7                                             │
│ Lamé μ: …………………………………………………………… 1.206896551724138e6                                              │
│ smoothing kernel: ………………………………… SchoenbergCubicSplineKernel                                      │
│ acceleration: …………………………………………… [0.0, -9.81]                                                     │
│ boundary model: ……………………………………… BoundaryModelMonaghanKajtar                                      │
│ penalty force: ………………………………………… Nothing                                                          │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ AliveCallback                                                                                    │
│ ═════════════                                                                                    │
│ interval: ……………………………………………………… 1000                                                             │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ SolutionSavingCallback                                                                           │
│ ══════════════════════                                                                           │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Time integration                                                                                 │
│ ════════════════                                                                                 │
│ Start time: ………………………………………………… 0.0                                                              │
│ Final time: ………………………………………………… 0.1                                                              │
│ time integrator: …………………………………… RDPK3SpFSAL49                                                    │
│ adaptive: ……………………………………………………… true                                                             │
│ abstol: …………………………………………………………… 1.0e-6                                                           │
│ reltol: …………………………………………………………… 0.0001                                                           │
│ controller: ………………………………………………… PIDController(beta=[0.38, -0.18,…iter=default_dt_factor_limiter) │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Environment information                                                                          │
│ ═══════════════════════                                                                          │
│ #threads: ……………………………………………………… 24                                                               │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

#timesteps:   1000 │ Δt: 2.3556e-05 │ sim. time: 3.3364e-02 │ run time: 2.0059e+00 s
#timesteps:   2000 │ Δt: 3.1627e-05 │ sim. time: 6.4736e-02 │ run time: 3.9709e+00 s
#timesteps:   3000 │ Δt: 2.8635e-05 │ sim. time: 9.8436e-02 │ run time: 6.1214e+00 s
────────────────────────────────────────────────────────────────────────────────────────────────────
Pixie simulation finished.  Final time: 0.1  Time steps: 3047 (accepted), 3274 (total)
────────────────────────────────────────────────────────────────────────────────────────────────────

 ────────────────────────────────────────────────────────────────────────────────────────────
                  Pixie.jl                          Time                    Allocations      
                                           ───────────────────────   ────────────────────────
             Tot / % measured:                  6.21s /  94.5%            455MiB /  97.4%    

 Section                           ncalls     time    %tot     avg     alloc    %tot      avg
 ────────────────────────────────────────────────────────────────────────────────────────────
 rhs!                               29.5k    5.87s  100.0%   199μs    444MiB  100.0%  15.4KiB
   update containers and nhs        29.5k    4.20s   71.5%   142μs    367MiB   82.8%  12.7KiB
     update nhs                     29.5k    1.80s   30.7%  61.2μs    239MiB   53.8%  8.29KiB
     compute boundary pressure      29.5k    1.21s   20.6%  41.0μs   83.2MiB   18.8%  2.89KiB
     ~update containers and nhs~    29.5k    618ms   10.5%  20.9μs   38.2MiB    8.6%  1.33KiB
     precompute pk1                 29.5k    568ms    9.7%  19.3μs   6.75MiB    1.5%     240B
   container interaction            29.5k    1.43s   24.4%  48.6μs   66.1MiB   14.9%  2.30KiB
   velocity and gravity             29.5k    152ms    2.6%  5.15μs   10.3MiB    2.3%     368B
   reset ∂u/∂t                      29.5k   52.6ms    0.9%  1.78μs     0.00B    0.0%    0.00B
   ~rhs!~                           29.5k   33.5ms    0.6%  1.14μs   2.94KiB    0.0%    0.10B
 ────────────────────────────────────────────────────────────────────────────────────────────

@efaulhaber efaulhaber marked this pull request as ready for review January 9, 2023 11:54
@efaulhaber efaulhaber requested a review from LasNikas January 9, 2023 11:54
LasNikas
LasNikas previously approved these changes Jan 9, 2023
Copy link
Collaborator

@LasNikas LasNikas left a comment

Choose a reason for hiding this comment

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

Awesome! That is really helpful.
Just a few complementary remarks...

src/containers/fluid_container.jl Show resolved Hide resolved
src/containers/solid_container.jl Outdated Show resolved Hide resolved
@svchb
Copy link
Collaborator

svchb commented Jan 10, 2023

I think it would look nicer if items set to nothing are hidden.

Also the SolutionSavingCallback box is empty.

@efaulhaber
Copy link
Member Author

For the SolutionSavingCallback, I would like to show the saving interval, but AFAIK, that's not possible without explicitly storing it somewhere. I am planning to rewrite the callback soon anyway to write to VTK while the simulation is running instead of storing all the data in the RAM until the simulation finished.

For the Nothing part: I agree that not showing Nothing makes it cleaner, but I'm afraid that it might not be clear for users if, say, no penalty force is used or if this is just not printed. Therefore, I'd prefer to explicitly print that we are using no penalty force, no viscosity, etc.
@LasNikas which convention do you prefer?

@LasNikas
Copy link
Collaborator

I would also prefer to show Nothing to point out that it is enabled or not.
But why is there a upper and a lower case in nothing ? (see penalty force and movement function)

@sloede
Copy link
Member

sloede commented Jan 10, 2023

But why is there a upper and a lower case in nothing ?

Nothing is a singleton type, and its only value is nothing

@efaulhaber
Copy link
Member Author

For some attributes I printed the type name to just show StateEquationCole instead of StateEquationCole{Float64}(7, 1000, whatever).
For the movement function, I want to print the function, which in this case is just nothing.

@LasNikas LasNikas merged commit 841b27f into trixi-framework:main Jan 10, 2023
@efaulhaber efaulhaber deleted the summary-callback branch May 19, 2023 13:57
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.

4 participants