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

Terminator #9

Merged
merged 13 commits into from
Aug 2, 2024
Merged

Terminator #9

merged 13 commits into from
Aug 2, 2024

Conversation

ta440
Copy link
Collaborator

@ta440 ta440 commented Nov 3, 2023

This runs the Terminator Toy Test (Lauritzen et al. 2014) using the terminator_toy physics scheme and the SplitPrescribedTransport timestepper. A dry density field of two Gaussians is advected using a Nair Lauritzen non-divergent flow profile. There is also the interaction of two chemical species (X and X2) through very stiff ODEs which are solved using a Backwards Euler method.

The dry density profile is the Gaussian setup from Nair-Lauritzen. Here are the initial (t=0days) and final (t=12days) states at ref_level=4:

terminator_toy_rf4rho_d_t_day0 0
terminator_toy_rf4rho_d_t_day12 0

We can examine the distributions of the species during the simulation (t=0,6,12 days, ref_level=3)

Species X:
terminator_toy_testX_t_day0 0
terminator_toy_testX_t_day6 0
terminator_toy_testX_t_day12 0

Species X2:
terminator_toy_testX2_t_day0 0
terminator_toy_testX2_t_day6 0
terminator_toy_testX2_t_day12 0

There should be conservation of the total mixing ratio, Xt = X +2X2, between the two interacting species. Additionally, there should be conservation of the tracer density, which is the product of the dry density and the total species mass, rho_X = rho_d*X_t. This is examined using the 'TracerDensity' diagnostic.

Here is the normalised change in the total tracer density over time (ref_level=3):

tracer_density_change_reflev3

@ta440 ta440 assigned ta440 and unassigned ta440 Nov 3, 2023
@ta440 ta440 marked this pull request as draft November 13, 2023 17:26
@ta440 ta440 marked this pull request as ready for review November 16, 2023 23:09
Copy link
Collaborator

@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.

Sorry it has taken so embarrassingly long for me to review this Tim!! And even more sorry because I'm asking for changes, which are basically just some lint things.

The test looks good and it will be great to have this as something that we can easily run.


# Set up a non-divergent, time-varying, velocity field
def u_t(t):
u_zonal = k*(sin(lamda - 2*pi*t/T)**2)*sin(2*theta)*cos(pi*t/T) + ((2*pi*R)/T)*cos(theta)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you make sure that the indentation is 4 spaces here?


# Equation
V = domain.spaces("HDiv")
eqn = CoupledTransportEquation(domain, active_tracers=tracers, Vu = V)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the spaces around the equals sign!

physics_schemes = [(TerminatorToy(eqn, k1=k1, k2=k2, species1_name='X',
species2_name='X2'), terminator_stepper)]

# Set up two Gaussian bumps for the initial density field
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the other examples I've been trying to put the initial conditions near the end, so that all of the model objects are set up close together. Would you be able to move the initial conditions to near the end of the file?

This doesn't quite work when there is a prescribed velocity which still needs specifying before the time stepper, but still works for the tracers

@@ -0,0 +1,153 @@
from gusto import *
from firedrake import IcosahedralSphereMesh, Constant, ge, le, exp, cos, \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are the ge and le variables used? Could they be removed? The same might go for other things that have been imported


# Set dump_nc = True to use tomplot.
output = OutputParameters(dirname=dirname,
dumpfreq = dumpfreq,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you remove the spaces from around the equals signs here?

@tommbendall
Copy link
Collaborator

Merging in despite test failures, and will fix lint here in a following PR

@tommbendall tommbendall merged commit 2bac21e into main Aug 2, 2024
2 of 3 checks passed
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