Skip to content

Conversation

@VeckoTheGecko
Copy link
Contributor

@VeckoTheGecko VeckoTheGecko commented Jul 29, 2025

This PR is part of a significant changeset as outlined in #2107 . As there are a lot of related parts, its a bit of a larger PR.

This PR looks to:

  • Remove dead code.
  • Provide a single execution path for compiling kernels via function objects (an execution path that is compatible with numba).
    • Currently its possible to compile kernels from function objects, as well as dynamically by accessing the user context and providing code strings/ast .
  • Run kernels sequentially instead of combining them together.

Changes:

  • Removal of BaseKernel class
  • Remove particle.delete() (this is a breaking change)
  • Store particle_dlon, particle_dlat, particle_ddepth (this is a breaking change)
  • Remove Kernel.funccode , Kernel.py_ast, Kernel.funcvars from internals and init
  • Remove Kernel.funcname from init
  • see commit log for additional minor changes

Future work:

  • decouple kernel init from fieldset and particle type (fieldset and particle type is only needed at compilation time)
  • remove _positionupdate_kernels_added state variable (easier to do this another way)

Breaking changes are recorded in v3to4-breaking-changes.md so that we have an overview during development (the purpose of this doc currently is only for breaking changes we intend to propogate to v4 of Parcels so that we can use this as a basis for the migration guide. For things that are currently breaking changes or things where its uncertain where we'll land, I propose we use the issue tracker instead).

I have one test failure in this branch on tests/v4/test_advection.py::test_moving_eddy[RK45-1e-05] - still need to investigate.

Removing base class to make refactoring easier. Interaction kernel support will be implmented at a later date
Looks like the implementation doesn't work (old code from v3) and also isn't very maintainable.

This was to support seeing if kernels had changed, and then recompiling them so that pset.execute wasn't slow.

This can be implemented in v4 in a maintainable way - but this isn't a priority for now.
- Update Kernel init to take list of functions
- Remove AST component of Kernels
- Update merge to combine list of kernel functions
- Add tests
Functionality is no longer desired
Flagged by test_pset_stop_simulation
@VeckoTheGecko VeckoTheGecko requested review from erikvansebille and removed request for erikvansebille July 29, 2025 15:34
Copy link
Member

@erikvansebille erikvansebille left a comment

Choose a reason for hiding this comment

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

Great clean-up effort!

@VeckoTheGecko VeckoTheGecko marked this pull request as ready for review July 30, 2025 09:47
@VeckoTheGecko VeckoTheGecko merged commit bef8ee3 into v4-dev Jul 30, 2025
5 of 6 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Parcels development Jul 30, 2025
@VeckoTheGecko VeckoTheGecko deleted the 2107-split-kernels branch July 30, 2025 11:34
erikvansebille added a commit that referenced this pull request Aug 1, 2025
This fixes the failing RK45 test introduced in #2123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants