Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/parcels/_core/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ def check_fieldsets_in_kernels(self, kernel): # TODO v4: this can go into anoth
)
self.fieldset.add_context("RK45_tol", 10)
if self.fieldset.U.grid._mesh.is_spherical():
self.fieldset.RK45_tol /= (
self.fieldset.U.grid.deg2m
) # TODO does not account for zonal variation in meter -> degree conversion

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think this TODO is relevant anymore - we didn't do this in v3 either and it would require a major refactoring

self.fieldset.context["RK45_tol"] = self.fieldset.RK45_tol / self.fieldset.U.grid.deg2m
if not hasattr(self.fieldset, "RK45_min_dt"):
warnings.warn(
"Setting RK45 minimum timestep to 1 s. Use fieldset.add_context('RK45_min_dt', [timestep]) to change.",
Expand Down
7 changes: 4 additions & 3 deletions tests/test_advection.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,12 @@ def UpdateP(particles, fieldset): # pragma: no cover
(AdvectionRK45, 1e-3),
],
)
@pytest.mark.parametrize("mesh", ["flat", "spherical"])
@pytest.mark.parametrize("grid_type", ["A", "C"])
def test_peninsula_fieldset(kernel, rtol, grid_type):
def test_peninsula_fieldset(kernel, rtol, grid_type, mesh):
npart = 2
ds = peninsula_dataset(grid_type=grid_type)
fieldset = FieldSet.from_sgrid_conventions(ds, mesh="flat")
fieldset = FieldSet.from_sgrid_conventions(ds, mesh=mesh)

dt = np.timedelta64(30, "m")
runtime = np.timedelta64(23, "h")
Expand All @@ -412,7 +413,7 @@ def test_peninsula_fieldset(kernel, rtol, grid_type):

if kernel == AdvectionRK45:
fieldset.add_context("RK45_tol", rtol)
fieldset.add_context("RK45_min_dt", 1)
fieldset.add_context("RK45_min_dt", 10)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For a (slight) speedup of the tests

fieldset.add_context("RK45_max_dt", 24 * 60 * 60)

def UpdateP(particles, fieldset): # pragma: no cover
Expand Down