-
Notifications
You must be signed in to change notification settings - Fork 13
Inner loop physics #681
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
Inner loop physics #681
Conversation
… that use the SIQN stepper
tommbendall
left a comment
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 for all of this Nell. I like the tests. There's a few things I'm suggesting tidying-up:
- some tweaks to the solver so that every term has a trial function
- removing the
copy_active_tracerslist
Note that the new solver will be reorganised by Alex in #648 !
| x_out: The output set of fields | ||
| """ | ||
|
|
||
| for name in self.non_solver_prognostics: |
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.
I think we want to keep this as non_solver_prognostics
gusto/solvers/linear_solvers.py
Outdated
| - beta_u * 0.5 * Dbar * bbar * div(w) * dx | ||
| - beta_u * 0.5 * Dbar * b * div(w) * dx | ||
| - beta_u * 0.5 * bbar * div(w*(D-Dbar)) * dx | ||
| + beta_u * 0.5 * jump((D-Dbar)*w, n) * avg(bbar) * dS |
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.
| + beta_u * 0.5 * jump((D-Dbar)*w, n) * avg(bbar) * dS | |
| + beta_u * 0.5 * jump((D)*w, n) * avg(bbar) * dS |
Alex pointed out to me that terms only involve reference values and no trial functions shouldn't be here
gusto/solvers/linear_solvers.py
Outdated
| inner(w, (u - u_in)) * dx | ||
| - beta_u * (D - Dbar) * div(w*bbar) * dx | ||
| + beta_u * jump(w*bbar, n) * avg(D-Dbar) * dS | ||
| - beta_u * 0.5 * Dbar * bbar * div(w) * dx |
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.
Alex pointed out to me that terms only involve reference values and no trial functions shouldn't be here
| - beta_u * 0.5 * Dbar * bbar * div(w) * dx |
gusto/solvers/linear_solvers.py
Outdated
| eqn = ( | ||
| # u equation | ||
| inner(w, (u - u_in)) * dx | ||
| - beta_u * (D - Dbar) * div(w*bbar) * dx |
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.
Alex pointed out to me that terms only involve reference values and no trial functions shouldn't be here
| - beta_u * (D - Dbar) * div(w*bbar) * dx | |
| - beta_u * (D) * div(w*bbar) * dx |
gusto/solvers/linear_solvers.py
Outdated
| # u equation | ||
| inner(w, (u - u_in)) * dx | ||
| - beta_u * (D - Dbar) * div(w*bbar) * dx | ||
| + beta_u * jump(w*bbar, n) * avg(D-Dbar) * dS |
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.
Alex pointed out to me that terms only involve reference values and no trial functions shouldn't be here
| + beta_u * jump(w*bbar, n) * avg(D-Dbar) * dS | |
| + beta_u * jump(w*bbar, n) * avg(D) * dS |
gusto/solvers/linear_solvers.py
Outdated
| + beta_u * jump(w*bbar, n) * avg(D-Dbar) * dS | ||
| - beta_u * 0.5 * Dbar * bbar * div(w) * dx | ||
| - beta_u * 0.5 * Dbar * b * div(w) * dx | ||
| - beta_u * 0.5 * bbar * div(w*(D-Dbar)) * dx |
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.
Alex pointed out to me that terms only involve reference values and no trial functions shouldn't be here
| - beta_u * 0.5 * bbar * div(w*(D-Dbar)) * dx |
gusto/solvers/linear_solvers.py
Outdated
|
|
||
| # Check that the third field is buoyancy | ||
| if not equation.field_names[2] == 'b': | ||
| raise NotImplementedError("Field 'b'must exist to use the moist thermal linear solver in the SIQN scheme") |
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.
| raise NotImplementedError("Field 'b'must exist to use the moist thermal linear solver in the SIQN scheme") | |
| raise NotImplementedError("Field 'b' must exist to use the moist thermal linear solver in the SIQN scheme") |
| self.setup_transporting_velocity(aux_scheme) | ||
|
|
||
| # Set up tracers to copy (those not included in the linear solve) | ||
| self.tracers_to_copy = [] |
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.
So I think I removed this list at some point -- could we remove all of these changes to add it back in?
I added a solver_prognostics argument to the SIQN stepper -- I think when we use the MoistSWLinearSolver, we should be using that argument and passing all of our variables
This PR adds the capability to evaluate physics schemes in the inner loop of the semi-implicit quasi-Newton time stepping scheme. Physics is evaluated both explicitly and implicitly, in a similar way to forcing. The parameter
physics_betacontrols the semi-implicit off-centring, where aphysics_betaof 1 is fully implicit and aphysics_betaof 0 is fully explicit.The PR also changes the names of the physics schemes lists, replacing the pre-existing
physics_schemeswithfinal_physics_schemes.Finally, the pull request introduces a moist shallow water linear solver,
MoistThermalSWSolver. This includes moisture in the linear solve stage and is necessary when doing physics in the inner loop. The solver is only suitable for use in a saturated atmosphere where the saturation function has the usual dependence on depth and buoyancy.These changes are tested with a new inner loop physics test that uses the moist solver.