Skip to content

Use split packages for Fokker Planck collision operator - #388

Open
mrhardman wants to merge 20 commits into
masterfrom
use-split-packages-for-FP
Open

Use split packages for Fokker Planck collision operator#388
mrhardman wants to merge 20 commits into
masterfrom
use-split-packages-for-FP

Conversation

@mrhardman

@mrhardman mrhardman commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Attempt to use FokkerPlanck to provide the collision operator. This PR will hopefully reduce code volume in various modules without losing functionality.

The main features of this PR are to:

  • Replace functions related to Fokker Planck collisions with those from the external package
  • Update tests where changes were required due to minor differences in numerical implementation in the external package.
  • Remove test scripts and other code that are now featured in the external package.
  • Provide an interface to Fokker Planck collisions that will function for any element-based tensor product grid in moment kinetics (Chebyshev and Gauss-Legendre grids should both function).
  • Use LagrangePolynomials for methods requiring Lagrange polynomials.
  • Use FiniteElementMatrices where appropriate to provide elemental matrices for weak methods (localised only to the gauss_legendre.jl module for now, but other developers could now merge gauss_legendre.jl and chebyshev.jl, with some careful thought).

N.B.

  • This package removes support for velocity-space shared-memory MPI for collisions. This is argued to not be critical as the spatial parallelisation is 1) retained and 2) embarrassingly parallel and 3) likely to require at least ngrid*ngrid cores on the local node to be fully parallelised. For ngrid=5, it is easy to imagine that we could break the domain into blocks of sized ~20 core shared-memory regions and only parallelise over space.

@mrhardman

Copy link
Copy Markdown
Collaborator Author

Closes #220.

Tested with

```
julia> include("test_scripts/chebyshev_radau_test.jl")
julia> chebyshevradau_test(ngrid=17,discretization="gausslegendre_pseudospectral")
```
with output as follows.
```
f(y) = exp(-4 y) test
exact df: -4.0 num df: -3.9999975421403935 abs(err): 2.4578596065083502e-6
f(y) = exp(-y^2) test
exact df: 0.0 num df: 1.1835285762413992e-5 abs(err): 1.1835285762413992e-5
exact f[0]: 0.9997752682206045 num f[0]: 0.999775517763114 abs(err): 2.495425095450088e-7
f(y) = sin(y) test
exact df: 1.0 num df: 1.0000000000000098 abs(err): 9.769962616701378e-15
f(y) = y + y^2 + y^3 test
exact df: 1.0 num df: 1.0000000000001137 abs(err): 1.1368683772161603e-13
```
… that Lobatto and Radau points are covered by the same function.
@mrhardman
mrhardman marked this pull request as ready for review August 4, 2025 10:31
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.

Support Chebyshev Grids for collision operator and other weak form operations

1 participant