-
Notifications
You must be signed in to change notification settings - Fork 0
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
Terminator #9
Conversation
There was a problem hiding this 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.
transport/terminator_toy.py
Outdated
|
||
# 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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
transport/terminator_toy.py
Outdated
@@ -0,0 +1,153 @@ | |||
from gusto import * | |||
from firedrake import IcosahedralSphereMesh, Constant, ge, le, exp, cos, \ |
There was a problem hiding this comment.
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
transport/terminator_toy.py
Outdated
|
||
# Set dump_nc = True to use tomplot. | ||
output = OutputParameters(dirname=dirname, | ||
dumpfreq = dumpfreq, |
There was a problem hiding this comment.
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?
Merging in despite test failures, and will fix lint here in a following PR |
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:
We can examine the distributions of the species during the simulation (t=0,6,12 days, ref_level=3)
Species X:
Species X2:
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):