Finding the time step in the surface tracer flux #2921
francispoulin
started this conversation in
General
Replies: 1 comment 2 replies
-
One solution is to create a reference to the time-step: Δt = Ref(Δt) To access the value you write Then the value must be updated in a callback function that captures the reference in a global variable: update_Δt(sim) = Δt[] = sim.Δt The callbacks are executed in the order they are added, so you need to update the time step after the time step wizard is called: simulation.callbacks[:wizard] = Callback(time_step_wizard, IterationInterval(10))
simulation.callbacks[:update_dt] = Callback(update_Δt, IterationInterval(10)) Make sure the callback that updates the time step and the callback for the wizard are called on the same schedule. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Building on the Ocean Wind Mixing and Convection example, we are trying to specify a surface temperature flux that depends on the time step. If we have a fixed time step, this is easy and below is an example of that. But if we use the time step wizard, which we want to, it becomes a bit harder.
Is there a way to find out the current time step in a function that we use to specify the tracer flux boundary conditions?
Beta Was this translation helpful? Give feedback.
All reactions