-
Notifications
You must be signed in to change notification settings - Fork 29
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
Mix-match variables of different dimensions #212
Comments
A proper field abstraction might solve this problem. |
Should we do it? Do you have the capability @glwagner? |
I think it depends on the question here. If you're just trying to use the FourierFlows time-steppers then you don't need a Field abstraction. You could possibly support tuples of variables / RHS for the purpose of time-stepping, and then let module-writers handle broadcasting properly within |
As far as I can tell, you can implement support for tuples of solutions by dispatching on the time-stepper, eg: FourierFlows.jl/src/timesteppers.jl Lines 107 to 113 in 20a68da
for when The difference is between @. sol += clock.dt * (eq.L * sol + ts.N) and for (i, sol) in enumerate(sol_tuple)
@. sol += clock.dt * (eq.L[i] * sol + ts.N[i])
end |
so we need to dispatch separately for every time stepper? |
I don't know. It seems the simplest solution, unless you can figure out how to "double broadcast" these arithmetic operations. |
Basically you're asking whether you can write an operation so it does the same thing for a = rand(3, 3)
b = rand(3, 3)
very_general_arithmetic(a, b) or c = (x=rand(3, 3), y=rand(3, 3))
d = (x=rand(3, 3), y=rand(3, 3))
very_general_arithmetic(c, d) such an abstraction is possible for sure. But you'd have to design a new type (not vanilla |
OK, dispatching each time stepper would be good enough for now :) I'll draft a PR... |
You also don't have to support every single time-stepper at first. Can support just 1 or 2 and experiment with the interface, and then when we're happy that it makes sense generalize. |
Yes of course! Let's start with sane |
We should have the ability to solve coupled equations that involve variables of different dimensionality.
E.g., variables φ₁(x, t), φ₂(x, y, t) that evolve under
∂φ₁/∂t = - φ₁ + ∫φ₂(x, y', t) dy
∂φ₂/∂t = - φ₂ + f(x, y, t)
The text was updated successfully, but these errors were encountered: