refactor direct deposit for Mass Matrices. #6381
Open
+131
−107
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.
This PR makes a few modifications to the direct mass matrix deposition routine.
The switching between doing a full mass matrix deposition and just depositing the diagonal elements of the diagonal mass matrices for the preconditioner (PC) is now controlled with a template parameter just as it is in the villasenor deposition. This removes an if check inside hot loops.
The full mass matrices are deposited using the product of shape factors for current and field interpolation (
shape_J x shape_E). In other words, for each particle location where current J is deposited, the code loops over all field interpolation points E (the same locations used for J) and deposits the corresponding mass matrix contribution withshape_J x shape_E. In the current development branch, when only the diagonal elements of the diagonal mass matrices are used for the PC, the deposition still usesshape_J x shape_E, which is non-conservative. With this PR, when operating in this way, the deposition instead uses only the current deposition shape factor (shape_J). This makes the deposition conservative, consistent with the J deposition scheme. Mathematically, this is equivalent to depositing to all E-location for each J-location (as is done for the full mass matrices) and summing the contributions. @RemiLehe