-
Notifications
You must be signed in to change notification settings - Fork 13
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
Tracer conservative transport #469
Conversation
…Almost working (but we don't have consistency!)
New explicit Runge-Kutta schemes
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.
Thanks so much Tim. I think this looks really good and it's very exciting to have this working.
I've got two very small requests. I think it would also be helpful to have @atb1995 look over the changes to time discretisation to ensure that he's happy
gusto/transport_methods.py
Outdated
# Extract associated density variable: | ||
# This does assume the same ordering of tracers and fields... | ||
tracer_idx = self.equation.field_names.index(variable) | ||
tracer = self.equation.active_tracers[tracer_idx] |
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.
Is there a way that we can avoid this assumption?
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.
These two lines have been replaced with: tracer = next(x for x in self.equation.active_tracers if x.name == variable)
.
…mal flow BCs Co-authored-by: Thomas Bendall <[email protected]>
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.
Looks good! Just a couple of minor comments
gusto/time_discretisation.py
Outdated
if self.limiter is not None: | ||
self.limiter.apply(self.field_i[stage]) | ||
|
||
# Obtain field_ip1 = field_n - dt* sum_m{c_im*F[field_m]} |
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.
Switch to a_im
to be in keeping with previous comments
gusto/time_discretisation.py
Outdated
for stage in range(self.nStages): | ||
r = self.residual.label_map( | ||
lambda t: t.has_label(time_derivative), | ||
map_if_true=replace_subject(self.field_i[0], old_idx=self.idx), | ||
map_if_false=replace_subject(self.field_i[0], old_idx=self.idx)) |
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.
for stage in range(self.nStages): | |
r = self.residual.label_map( | |
lambda t: t.has_label(time_derivative), | |
map_if_true=replace_subject(self.field_i[0], old_idx=self.idx), | |
map_if_false=replace_subject(self.field_i[0], old_idx=self.idx)) | |
for stage in range(self.nStages): | |
r = self.residual.label_map( | |
all_terms, | |
map_if_true=replace_subject(self.field_i[0], old_idx=self.idx)) |
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.
Thanks Tim, this is fantastic!
This pull request enables the conservative transport of tracers.
Mixing ratios are transported using a conservative equation, as opposed to the previous advective version. This is requires an additional transport equation type (
tracer_conservative
), form (tracer_conservative_form
) and upwind transport method (upwind_tracer_conservative form
). A reference density needs to be specified when using this transport form.The equation class
CoupledTransportEquation
has been changed to generate the correct mass terms when usingtracer_conservative
. A conservative transport test of this equation has been added tointegration-tests/equations/test_coupled_transport.py
.To work with the
tracer_conservative
form timestepping equation, the explicit multistage schemes need to have the gradient evaluation divided by the reference density. TheExplicitMultistage
class now has an additional option ofincrement_form
, which defaults toTrue
, but should be set toFalse
for use with the conservative transport scheme. A test of this scheme is added.