Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for Terminator Toy and SplitPrescribedTransport #465

Merged
merged 11 commits into from
Dec 14, 2023

Conversation

ta440
Copy link
Collaborator

@ta440 ta440 commented Nov 21, 2023

This pull request follows up on PR#457 to add the following tests:

  1. A test for the Terminator Toy physics scheme. The aim of this test is to ensure that the coupled ODEs for the species interaction are being solved as expected. As such, the test takes very large time steps in a case with no flow, starting from X(0) = 4e-6, X2(0)=0. The analytical steady state for this case is given in the Lauritzen paper:
steady_state_lauritzen_picture An error norm is computed relative to this analytical solution. As we aren't running sufficiently long to reach this state, the test ensures that the system is moving towards this state and that the normalised difference between the numerical and steady-state fields is less than 0.25.
  1. A test of the prescribed wind velocity feature of SplitPrescribedTransport. This is implemented as an additional parameterised option in the test_prescribed_transport.py file.

  2. Using SplitPrescribedTransport within the test_precipitation physics test.

@ta440 ta440 changed the title SplitPrescribedTransport test of transporting velocity Tests for Terminator Toy and SplitPrescribedTransport Nov 21, 2023
@ta440 ta440 marked this pull request as ready for review November 22, 2023 22:40
@@ -37,7 +37,7 @@ def run_wind_drag(dirname, implicit_formulation):
eqn = CompressibleEulerEquations(domain, parameters)

# I/O
output = OutputParameters(dirname=dirname+"/surface_fluxes",
output = OutputParameters(dirname=dirname+"/wind_drag",
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing this!

Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

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

Thanks again Tim for doing this.

I think the terminator toy test looks sensible. I had a couple of suggestions to slightly simplify it. The other changes look good.

species2_name='X2'), BackwardEuler(domain))]

# Set up a non-divergent, time-varying, velocity field
def u_t(t):
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the wind is zero, do we need a function prescribing the velocity? Or could we just set the initial velocity to zero?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can't find a way to get the prescribed_transporting_velocity to work without giving it a function.

# Make the mesh and domain
R = 6371220.
mesh = IcosahedralSphereMesh(radius=R,
refinement_level=3, degree=2)
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is just a test and the spatial discretisation is not important, could we use a coarser grid? e.g. refinement level 2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good point. Using a refinement level of 2 still successfully tests the ODEs moving the system towards the steady state, although I will need to halve the timestep size and slacken the tolerance on the test (error less than 0.4) to adjust.

X_field = stepper.fields("X")
X2_field = stepper.fields("X2")

# Assert that the physics scheme has sufficiently moved
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a sensible test to me!

Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

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

As everything is passing I think this is now ready! Thanks Tim

@tommbendall tommbendall merged commit cd62890 into main Dec 14, 2023
4 checks passed
@tommbendall tommbendall deleted the terminator_tests branch December 28, 2023 12:39
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