-
Notifications
You must be signed in to change notification settings - Fork 10
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
update implicit solver interface #542
Conversation
dfab428
to
d60e2b2
Compare
8536daf
to
6248969
Compare
627e577
to
8f897bd
Compare
41defca
to
ec37455
Compare
@@ -1,5 +1,4 @@ | |||
export make_tendency_jacobian, | |||
make_update_jacobian, AbstractTridiagonalW, ∂tendencyBC∂Y | |||
export make_tendency_jacobian, make_update_jacobian, set_dfluxBCdY! |
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 wonder if this should have a clearer name, or if we need this function at all. We can get rid of this function if we move the update_aux!
and update_boundary_fluxes!
function calls that make_tendency_jacobian
does before it calls update jacobian into update_jacobian.
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.
Good point! I think it makes more sense to get rid of make_tendency_jacobian
, and just have make_update_jacobian
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 realized that now we're updating the aux and boundary fluxes in exp_tendency!
, imp_tendency!
, and update_jacobian!
. I think this is fine for now, but we might want to avoid recomputing these multiple times per timestep. Dennis mentioned that ClimaTimeSteppers has the capability to take in an update cache function, which will be called once per timestep (Atmos leverages this to call set_precomputed_quantities!
as few times as possible)., so we could later on switch to using that as a performance improvement
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.
After removing tendency_jacobian!
, we can't directly compare the jacobian entries in test/shared_utilities/implicit_timestepping/richards_model.jl
, since update_jacobian!
also calls update_aux
and boundary_fluxes
. I wonder if it's still worth keeping separate functions for cleaner structure and more granular testing
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.
This looks good! I left a couple of minor comments. nice job @juliasloan25 @dennisYatunin !!
1d27737
to
26f468a
Compare
failing because of a change introduced in CliMA/ClimaCore.jl#1653 - need to debug this |
6b963c1
to
bc6ac87
Compare
fixed in CliMA/ClimaCore.jl#1750 |
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 great! thank you!!
e4bc924
to
032fa3d
Compare
032fa3d
to
1afb820
Compare
Purpose
Update implicit solver interface for RichardsModel to use
ClimaCore.MatrixFields
.Comparing the buildkite timing to the most recent
main
build, the RichardsModels runs see a ~25% speedup from this PR.closes #528
#602 has to be merged first for update to ClimaCore v0.14
To Do
Content
thomas_algorithm
handling multiple vars
dtopBCdY
(extendboundary_vars
,boundary_var_domain_names
,boundary_var_types
, etc forMoistureStateBC
)dtendencyBCdY
(except multiply by dz factor)dtendencyBCdY
: update in place, rename toset_dfluxBCdY!
, multiply by dz factordtheta_resdtheta
setting: add if/else branch where if default use expression currently in code; ifp.soil.dtopBCdtheta
exists, adddtopBCdtheta
term beforediv
applied (useOperators.SetBoundaryOperators
, then construct Bidiagonal(?)Matrix of zeros with this BC)Status 4/17/24
The implicit solver has been updated and works on CPU. It doesn't work on GPU because of a couple of problems. First, one of the operators produces a non-
isbits
object. This is because the space is not being stripped out of the input object, which should happen via a call tostrip_space
. We need to extendadapt_structure
for theSetBoundaryOperator
type (and perhaps other operator types too), but even with that the solver fails on GPU.It seems like the second bug may be from FT not being inferred correctly when it crosses the function boundary from
make_update_jacobian
toupdate_jacobian!