Skip to content

Conversation

@JustinRayAngus
Copy link
Contributor

@JustinRayAngus JustinRayAngus commented Nov 30, 2025

This PR adds the ability to dynamically limit the time step based on the particle CFL when using the theta implicit EM solver, which treats light waves implicitly. This would be a one line PR if it wasn't for one subtlety described below.

The call to UpdateDtFromParticleSpeeds() in the WarpX::Evolve() routine occurs prior to the call to OneStep(). For many of the time-advance methods, including the implicit ones, OneStep() first performs collisions and then the PIC advance. However, to be meaningful, the call to UpdateDtFromParticleSpeeds() should occur just before the PIC advance. This PR swaps the order of calls inside OneStep() for the implicit methods to do the PIC advance before collisions. This ordering is actually more common in my experience, and I wonder if the ordering should be swapped for other time-advance methods as well. @roelof-groenewald @ax3l @RemiLehe

@JustinRayAngus JustinRayAngus requested a review from EZoni November 30, 2025 23:28
@JustinRayAngus JustinRayAngus added the component: implicit solvers Anything related to implicit solvers label Nov 30, 2025
@ax3l ax3l self-requested a review December 2, 2025 23:32
@EZoni
Copy link
Member

EZoni commented Dec 3, 2025

As far as CI goes, I see only two tests whose checksums need to be reset:

  • New checksums file test_1d_theta_implicit_planar_pinch.json:
{
  "lev=0": {
    "Bx": 2.347554229130745,
    "By": 2.254227700454954,
    "Bz": 0.0,
    "Ex": 551393126.2574284,
    "Ey": 491617943.23209137,
    "Ez": 714658615.6303692,
    "divE": 7016314161711.369,
    "jx": 18692954464.699497,
    "jy": 20177259050.167336,
    "jz": 12721426909.097504,
    "rho": 62.123763388017494
  },
  "deuterium": {
    "particle_momentum_x": 4.035760123452947e-19,
    "particle_momentum_y": 4.004963598310352e-19,
    "particle_momentum_z": 4.0782810816965124e-19,
    "particle_position_x": 163.6336698244632,
    "particle_weight": 1.4999875e+21
  },
  "electrons": {
    "particle_momentum_x": 6.6030232424328065e-21,
    "particle_momentum_y": 6.60813358729526e-21,
    "particle_momentum_z": 6.559430730541378e-21,
    "particle_position_x": 163.63367200208899,
    "particle_weight": 1.4999875e+21
  }
}
  • New checksums file test_2d_theta_implicit_planar_pinch.json:
{
  "lev=0": {
    "Bx": 9.275768517413653,
    "By": 19.472307474063484,
    "Bz": 11.610979590557633,
    "Ex": 4177113295.3698635,
    "Ey": 2879051080.583498,
    "Ez": 4181787135.040885,
    "divE": 47250533638439.05,
    "jx": 91271135865.5671,
    "jy": 115116958556.87042,
    "jz": 142255859953.87067,
    "rho": 418.1507147637307
  },
  "deuterium": {
    "particle_momentum_x": 3.2203338208705e-18,
    "particle_momentum_y": 3.2127841653787054e-18,
    "particle_momentum_z": 3.2284163892421025e-18,
    "particle_position_x": 1309.3091292829426,
    "particle_position_y": 96.00796866051637,
    "particle_weight": 1.6501375e+18
  },
  "electrons": {
    "particle_momentum_x": 5.297572837196199e-20,
    "particle_momentum_y": 5.298600055672404e-20,
    "particle_momentum_z": 5.276908853465337e-20,
    "particle_position_x": 1309.3090771126394,
    "particle_position_y": 96.00571854694559,
    "particle_weight": 1.6501375e+18
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: implicit solvers Anything related to implicit solvers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants