Implicit, Fokker-Planck, self collisions for ion species (squashed) - #383
Merged
Conversation
It should do this as the 'anyv' subblocks are subblocks of the shared-memory block that is synchronized by _block_synchronize(), so every subblock is synchronized. Done by calling _anyv_subblock_synchronize() - although this is mildly inefficient (MPI.Barrier() gets called twice), it is only used for debugging so this should be OK.
Use `comm_anyv_subblock[]` instead of the incorrect `comm_block[]`.
9 tasks
johnomotani
added a commit
that referenced
this pull request
Jul 13, 2025
This came from #327 originally, which turned out not to be needed.
johnomotani
added a commit
that referenced
this pull request
Jul 14, 2025
Revert removal of NCDatasets from CI, accidentally merged in #383
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #353 - squashed to clean up git history.
The aim of this PR is to provide the ability to advance the equation
with the implicit, backward-Euler timestepping method, i.e., solve
using the
newton_solve!()functionality provided by @johnomotani. This feature is integrated into the main time advance functions of moment_kinetics so that the implicit implementation of the collision operator can be used with one of the IMEX time advance schemes also provided by @johnomotani.An example input file that uses an IMEX advance to solve the equation (1) above is provided in
examples/fokker-planck/fokker-planck-relaxation-implicit.toml. Note the addition of the input section[fokker_planck_collisions_nonlinear_solver]which provides the flags fornewton_solve!(), and note the presence of a new@enumfor selecting the type of ion advance, e.g.,A separate set of inputs is provided for the ion collision non-linear solve as for the electron non-linear solve in case different default inputs are necessary. At this time I have not tested implicit ion collisions alongside implicit kinetic electrons, but it is plausible that different defaults could be convenient for fast simulations. The list of possible
kinetic_ion_solveroptions are given here https://github.com/mabarnes/moment_kinetics/blob/11e4f651bce559643aa2f179efb630fdf1c3cec2/moment_kinetics/src/input_structs.jl#L51-L65.A series of test scripts have been developed in the building of this feature. In
test_scripts/ImplicitCollisionsTest.jlwe have the test scriptstest_implicit_collisions()https://github.com/mabarnes/moment_kinetics/blob/11e4f651bce559643aa2f179efb630fdf1c3cec2/test_scripts/ImplicitCollisionsTest.jl#L63-L75 andtest_implicit_collisions_wrapper()https://github.com/mabarnes/moment_kinetics/blob/11e4f651bce559643aa2f179efb630fdf1c3cec2/test_scripts/ImplicitCollisionsTest.jl#L217-L230, which can be used to solve equation one with backward-Euler and the initial conditionAn example function call to step with one timestep of backward-Euler would be
I have also extended the coverage of the automatic test scripts
moment_kinetics/test/fokker_planck_tests.jlandmoment_kinetics/test/fokker_planck_time_evolution_tests.jl. The changes inmoment_kinetics/test/fokker_planck_tests.jltestwith$F_0$ a specified distribution function, usually chosen to be $F_i$ at the last timestep;
The changes in
moment_kinetics/test/fokker_planck_time_evolution_tests.jlmoment_kinetics,In summary, this PR
newton_solve!()to support iterations in theanyvregion layout,Before merging, I still need to add
vperp.bc="zero-impose-regularity", which is not supported.set_defaults_and_check_values!()and make[fokker_planck_collisions.nonlinear_solver]a standalone namelist which is read directly from the input TOML insetup_fp_nl_solve(). The functionsetup_fp_nl_solve()should contain any Fokker-Planck specific defaults for the nonlinear solver. Remove thenonlinear_solvermember fromfkpl_collisions_input.nl_solver_params.ion_fp_collisionsin suitable timestep checks.Before merging this PR I would request feedback on
vpa,vperp,zadvection are required