Skip to content

More Efficient Forward Euler Advection + New Semi Lagrangian Advection#10

Open
coco-yeung wants to merge 17 commits into
mainfrom
v8
Open

More Efficient Forward Euler Advection + New Semi Lagrangian Advection#10
coco-yeung wants to merge 17 commits into
mainfrom
v8

Conversation

@coco-yeung
Copy link
Copy Markdown
Owner

@coco-yeung coco-yeung commented Mar 17, 2026

Two major changes ot advection are made in this PR:

  1. Separating the computation of interior and boundary points for forwardEulerAdvection

  2. Implementing Semi-Lagrangian advection

  3. Previously in forwardEulerAdvection, a point is checked every time wehter it is a boundary point or not. This was unnecessary as the position of the boundary indices do not change after advection, changes were made to store this information in a struct PointCache.

This resulted in the following performance gain:

version default (issl_rhi140) shear * 1.1 temperature - 5 rhi 120 w - 0.1
main (seconds) 710 767 1257 849 587
feature (seconds) 643 685 1122 770 532
change (%) -9.44 -10.64 -10.74 -9.31 -9.37
speedup 1.10 1.12 1.12 1.10 1.10
  1. 1D Semi-Lagrangian advection was implemented by first shifting the points by an integer number of grids, then using forward euler for the remaining time step -- first in the x direction then in the y direction.

Combined with 1), the total performance gain is:

version default (issl_rhi140) shear * 1.1 temperature - 5 rhi 120 w - 0.1
main (seconds) 710 767 1257 849 587
feature (seconds) 559 604 967 655 443
change (%) -21.27 -21.25 -23.07 -22.85 -24.53
speedup 1.27 1.27 1.30 1.30 1.33

This also resulted in the following change in ice mass:

version default (issl_rhi140) shear * 1.1 temperature - 5 rhi 120 w - 0.1
main (mass-hours) 182.5808 185.4461 156.3067 115.8116 287.3476
feature (mass-hours) 154.9470 156.6184 135.1328 98.7402 227.2016
change (%) -15.14 -15.55 -14.74 -13.55 -20.93

To demonstrate the validity of this change, we can look at the propagation of a simple square wave with dx = 0.1, dt = 0.5 :
Screenshot 2026-05-16 at 4 03 07 PM

Pure Forward Euler advection may lead to diffusive results, depending on the local velocity u:
Screenshot 2026-05-16 at 4 05 00 PM

Pure Semi Lagrangian advection is not diffusive, regardless of local velocity u:
Screenshot 2026-05-16 at 4 05 08 PM

coco-yeung and others added 2 commits May 16, 2026 15:27
* Caching point boundary condition

* fixing initialisation

* fix struct visibility

* Fix visibility issue again

* unused field in struct

* Split functions into boundary + interior

* fix segmentation fault

* remove brackets

* fix build errors

* fix functional bug

* New minmod function

* Fix const declaration

* slightly tweak logic

* fix non zero diff

* Added comments

* WIP

* WIP

* WIP

* WIP

* Works i think

* Fixed uninitialised memory

* One FE Iteration

* WIP

* WIP

* Framework set up: x then y advection

* builds but not behaving as expected

* fix bug

* Added comments and reverted FE changes

* Added comments

* Added comments

---------

Co-authored-by: Coco Yeung <coco.yeung22@imperial.ac.uk>
@coco-yeung coco-yeung changed the title V8 More Efficient Forward Euler Advection + New Semi Lagrangian Advection May 16, 2026
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