We present a scheme that spatially couples two gyrokinetic codes using first-principles. Coupled equations are presented and a necessary and sufficient condition for ensuring accuracy is derived. This new scheme couples both the field and the particle distribution function. The coupling of the distribution function is only performed once every few time-steps, using a five-dimensional (5D) grid to communicate the distribution function between the two codes. This 5D grid interface enables the coupling of different types of codes and models, such as particle and continuum codes, or delta-f and total-f models. Transferring information from the 5D grid to the marker particle weights is achieved using a new resampling technique. Demonstration of the coupling scheme is shown using two XGC gyrokinetic simulations for both the core and edge. We also apply the coupling scheme to two continuum simulations for a one-dimensional advection–diffusion problem.
In simulations of partial differential equations using particle-in-cell (PIC) methods, it is often advantageous to resample the particle distribution function to increase simulation accuracy, reduce compute cost, and/or avoid numerical instabilities. We introduce an algorithm for particle resampling called Moment Preserving Contrained Resampling (MPCR). The general algorithm partitions the system space into smaller subsets and is designed to conserve any number of particle and grid quantities with a high degree of accuracy (i.e. machine accuracy). The resampling scheme can be integrated into any PIC code. The advantages of MPCR, including performance, accuracy, and stability, are presented by examining several numerical tests, including a use-case study in gyrokinetic fusion plasma simulations. The tests demonstrate that while the computational cost of MPCR is negligible compared to the nascent particle evolution in PIC methods, periodic particle resampling yields a significant improvement in the accuracy and stability of the results.
We consider numerical methods for initial value problems that employ a two stage approach consisting of solution on a relatively coarse discretization followed by solution on a relatively fine discretization. Examples include adaptive error control, parallel-in-time solution schemes, and efficient solution of adjoint problems for computing a posteriori error estimates. We describe a general formulation of two stage computations then perform a general a posteriori error analysis based on computable residuals and solution of an adjoint problem. The analysis accommodates various variations in the two stage computation and in formulation of the adjoint problems. We apply the analysis to compute "dual-weighted" a posteriori error estimates, to develop novel algorithms for efficient solution that take into account cancellation of error, and to the Parareal Algorithm. We test the various results using several numerical examples.