Skip to content

Conversation

@GeorgeR227
Copy link
Collaborator

This file is meant to demonstrate Decapodes support of implicit solvers. The physics are the Brusselator dynamics, with an increased diffusion rate to increase stiffness. For high enough diffusion rates, the implicit solver will noticeably outperform the explicit solver.

Based on the Brusselator dynamics. Diffusion has been upped to increase the stiffness and favor implicit solvers.
@GeorgeR227
Copy link
Collaborator Author

When running this script with diffusion constant α = 0.05, the runtimes are as follows.
Implicit: 22.056553 seconds (7.46 M allocations: 2.087 GiB, 10.35% gc time, 8.05% compilation time)
Explicit: 51.936507 seconds (10.68 M allocations: 131.740 GiB, 51.47% gc time, 1.76% compilation time)

Solver stats are shown below, demonstrating how the explicit solver requires around 2 orders of magnitude more function evaluations than the implicit and around the same order of accepted steps.
Implicit:

SciMLBase.DEStats
Number of function 1 evaluations:                  858
Number of function 2 evaluations:                  0
Number of W matrix evaluations:                    87
Number of linear solves:                           617
Number of Jacobians created:                       2
Number of nonlinear solver iterations:             607
Number of nonlinear solver convergence failures:   0
Number of fixed-point solver iterations:                     0
Number of fixed-point solver convergence failures:           0
Number of rootfind condition calls:                0
Number of accepted steps:                          187
Number of rejected steps:                          25

Explicit:

SciMLBase.DEStats
Number of function 1 evaluations:                  83121
Number of function 2 evaluations:                  0
Number of W matrix evaluations:                    0
Number of linear solves:                           0
Number of Jacobians created:                       0
Number of nonlinear solver iterations:             0
Number of nonlinear solver convergence failures:   0
Number of fixed-point solver iterations:                     0
Number of fixed-point solver convergence failures:           0
Number of rootfind condition calls:                0
Number of accepted steps:                          13852
Number of rejected steps:                          1

@GeorgeR227
Copy link
Collaborator Author

The implicit physics look like,
brusselator_implicit

while the explicit physics look very similar,
brusselator_explicit

Point2D = Point2{Float64}
Point3D = Point3{Float64}

Brusselator = @decapode begin
Copy link
Member

Choose a reason for hiding this comment

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

Using the Brusselator exported from the main library is probably a good pattern for our docs examples that are focusing on a different solver configuration rather than the physics themselves.

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