firedrakeproject / gusto

Three dimensional atmospheric dynamical core using the Gung Ho numerics.
http://firedrakeproject.org/gusto/
MIT License
12 stars 11 forks source link

Thermal linear solver fixes #477

Closed nhartney closed 8 months ago

nhartney commented 8 months ago

This PR makes three changes to the ThermalSWSolver class in linear_solvers.py.

  1. Checks that buoyancy is one of the fields in the equations set when using the ThermalSWSolver. The solver should only be used in equations sets with a thermal field and this will raise a NotImplementedError if the solver is being used and there is no buoyancy field.
  2. Checks that a reference profile for buoyancy has been set. The solver will still work without a reference buoyancy profile but will work on the basis that the reference buoyancy is zero. This will log a warning to the user that no buoyancy reference profile has been set and to set one if the profile should be a non-zero one.
  3. Considers bbar to be in the DG space and discretises the terms involving derivatives of bbar in the thermal linear solver using integration by parts.
nhartney commented 8 months ago

Looks good! Please just update PR description now that we are not interpolating b to the CG space (and carefully check where this line has gone!)

I think it looks like the line isn't there because it is comparing to what is on main rather than comparing to previous commits on this branch. The lines do appear in the commit history of the branch.