-
Notifications
You must be signed in to change notification settings - Fork 195
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
FieldTimeSeries for time-dependent boundary condition #3233
Conversation
How would we make this work with |
Hmm yeah |
Hmmm yeah, do |
|
||
return compute!(Field(fts[t₂] * (time - t₁) + fts[t₁] * (t₂ - time))) | ||
t = (t₂ - t₁) / (fts.times[t₂] - fts.times[t₁]) * time + t₁ | ||
return compute!(Field(fts[t₂] * (t - t₁) + fts[t₁] * (t₂ - t))) | ||
end | ||
|
||
# Linear time interpolation | ||
function Base.getindex(fts::FieldTimeSeries, i::Int, j::Int, k::Int, time::Float64) | ||
Ntimes = length(fts.time) | ||
t₁, t₂ = index_binary_search(fts.times, time, Ntimes) |
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.
t₁, t₂ = index_binary_search(fts.times, time, Ntimes) | |
n₁, n₂ = index_binary_search(fts.times, time, Ntimes) |
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.
most places we use n
for the time index
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.
hmm maybe we can extend index_binary_search
to work for x::AbstactRange
. Might make sense to call it "search_index_bracket" after that or something.
at the moment for chunked arrays the user can change with
So at the moment the chunked field does not "auto-load". I am not sure whether it is better to autoload or not. |
import Oceananigans.Solvers: poisson_eigenvalues, solve! | ||
import Oceananigans.Architectures: architecture | ||
|
||
|
||
struct DistributedFFTBasedPoissonSolver{P, F, L, λ, S, I} | ||
struct DistributedFFTBasedPoissonSolver{P, F, L, λ, S, I} <: AbstractSolver |
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.
What's the point of AbstractSolver?
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.
It was a test I was doing, I found a better way to solve the same problem
What is remaining to do on this PR? Do you need help @simone-silvestri ? |
Should be ready. Maybe a couple of tests |
Should be ready to go |
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 suggest simplifying the validation test to use FieldTimeSeries
just for the top temperature boundary condition. Also, making path
and name
properties of FieldTimeSeries
so they aren't replicated for each backend.
…ns.jl into ss/time-interpolate-fts
…ns.jl into ss/time-interpolate-fts
Suggestions implemented! I ll merge this PR |
The intention of this PR is to extend the capability of
FieldTimesSeries
such that it can be used in time-dependent boundary conditions and forcing.This PR develops over 2 main points, but it is still a work in progress so suggestions are welcome
set!
ing theOnDisk
flavor of a field time series so that it aligns with the format of our jld2 output writer. In this way, it is possible to easily format BC from different file types (such as binary or text) to be used with Oceananigans.An example of this is:
This will generate a file called
testfile.jld2
with the following structurewhich can be easily read by the other field time series types.
OnDisk
will not do. On the other hand, we might not want all fields in memory as if we are dealing with forcings that might overwhelm the memory (especially on the GPU). So the proposal is to implement aChunked
abstraction that only keeps in memory a "chunk" of the data. The details of this implementation are still open do be decided, especially if we want an automatic update of the chunk if we index into an index not existing in memory or if we want the user to be responsible in updating the data in memory through something like a callbackThis is not final and all open to suggestions/changes/improvement
maybe interesting for @yuchenma23