Skip to content

Conversation

Longyu975
Copy link
Contributor

Implemented the Crank-Nicolson implicit method to improve energy conservation
Added substepping and LAX scan to reduce runtime.
Adjusted input parameters for Landau damping

Copy link

codecov bot commented Jun 19, 2025

Codecov Report

Attention: Patch coverage is 38.18182% with 68 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
jaxincell/_algorithms.py 35.35% 63 Missing and 1 partial ⚠️
jaxincell/_simulation.py 70.00% 2 Missing and 1 partial ⚠️
jaxincell/_plot.py 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
jaxincell/_diagnostics.py 100.00% <ø> (ø)
jaxincell/_plot.py 5.84% <0.00%> (ø)
jaxincell/_simulation.py 88.40% <70.00%> (-0.84%) ⬇️
jaxincell/_algorithms.py 35.35% <35.35%> (ø)

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements an implicit Crank-Nicolson time evolution method with Picard iterations and particle substepping to improve energy conservation and streamline runtime. Key changes include adding CN_step and its supporting parameters to the simulation workflow, updating the simulation function to select between Boris and implicit methods based on a new parameter, and modifying example inputs to use the implicit scheme.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
jaxincell/_simulation.py Adds new parameters and branches to support implicit Crank-Nicolson via CN_step
jaxincell/_algorithms.py Introduces the CN_step function with Picard iterations and substepping logic
examples/Landau_damping.py Updates simulation and solver parameters to employ the implicit time evolution algorithm
example_input.toml Adjusts solver parameters and total steps to reflect the new implicit method configuration
Comments suppressed due to low confidence (1)

jaxincell/_simulation.py:138

  • Please update the function docstring to document the newly added parameters 'number_of_Picard_iterations_implicit_CN' and 'number_of_particle_substeps_implicit_CN' for better clarity.
                                ,number_of_Picard_iterations_implicit_CN=7, number_of_particle_substeps_implicit_CN=2):

Copy link
Collaborator

@rogeriojorge rogeriojorge left a comment

Choose a reason for hiding this comment

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

Code looks good, except the new variable names for the inputs that include _x, _y or _z. I'll run the new code and benchmarks later to make sure the results are the same.

@Longyu975 Longyu975 merged commit 7c8e7fb into main Jun 24, 2025
5 of 6 checks passed
@Longyu975 Longyu975 deleted the lma/enegy_conservation_to_main branch June 24, 2025 08:35
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