-
Notifications
You must be signed in to change notification settings - Fork 8
Update coupler stepping logic so that fluxes are exchanged as often as possible #1794
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
Changes from 17 commits
f417cc9
e95665d
9cba02d
7f59c43
8750dd5
0a257cb
41a7fae
828c177
428a6cc
e7b4c59
afeb5a5
e015b4a
ffe0cec
a26c176
31987bd
496e21a
e4ccf56
724303e
bc0fdd7
3a9f648
1e4cd9a
61c914e
b0757b9
668ab29
45272d4
b74c828
1a5fb22
6769935
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -311,12 +311,30 @@ function Interfacer.update_field!( | |
| Interfacer.remap!(sim.integrator.p.bucket.turbulent_fluxes.vapor_flux, field ./ ρ_liq) # TODO: account for sublimation | ||
| end | ||
|
|
||
| function Interfacer.step!(sim::BucketSimulation, t) | ||
| while float(sim.integrator.t) < float(t) | ||
| Interfacer.step!(sim.integrator) | ||
| # Don't step if we haven't reached a step boundary | ||
| # (This can happen if the coupler dt is less than this model's) | ||
| function Interfacer.step!(sim::BucketSimulation, t::Float64) | ||
| model_t = Float64(sim.integrator.t) | ||
| Δt = t - model_t | ||
|
daverumph marked this conversation as resolved.
|
||
| model_dt = Float64(sim.integrator.dt) | ||
| if isapprox(Δt, model_dt) || Δt > model_dt | ||
| while Float64(sim.integrator.t) < t | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better to use a I think that would avoid an infinite loop in case the condition where
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rounding won't work correctly if Δt is not an even multiple of model_dt, but the coupler does enforce that condition. I'll make the change. |
||
| Interfacer.step!(sim.integrator) | ||
| end | ||
| end | ||
| return nothing | ||
|
daverumph marked this conversation as resolved.
|
||
| end | ||
|
|
||
| function Interfacer.step!(sim::BucketSimulation, t::ITime) | ||
| Δt = t - sim.integrator.t | ||
| if Δt >= sim.integrator.dt | ||
| while sim.integrator.t < t | ||
| Interfacer.step!(sim.integrator) | ||
| end | ||
| end | ||
| return nothing | ||
| end | ||
|
|
||
| Interfacer.close_output_writers(sim::BucketSimulation) = | ||
| isnothing(sim.output_writer) || close(sim.output_writer) | ||
|
|
||
|
|
||
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 revert this to keep the previous behavior?
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.
The point of this PR is to improve the behavior, not keep it. The previous coupler time step is less accurate because land/atmos flux exchange only occurs every 30 minutes.