I'd expect it to be a BinaryOperation?
using Oceananigans, Oceananigans.Grids,Oceananigans.Diagnostics, Oceananigans.AbstractOperations
grid = RegularCartesianGrid(size=(16, 16, 16), extent=(1, 1, 1))
model = IncompressibleModel(grid=grid)
u, v, w = model.velocities
T, S = model.tracers
wT = w*T
````
MultiaryOperation at (Cell, Cell, Face)
โโโ grid: RegularCartesianGrid{Float64,Periodic,Periodic,Bounded,OffsetArrays.OffsetArray{Float64,1,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}
โ โโโ size: (16, 16, 16)
โ โโโ domain: x โ [0.0, 1.0], y โ [0.0, 1.0], z โ [-1.0, 0.0625]
โโโ tree:
Seems that when the fields are at different locations you get a MultiaryOperation and when it's the same location you get a BinaryOperation:
julia> u*T
MultiaryOperation at (Face, Cell, Cell)
โโโ grid: RegularCartesianGrid{Float64,Periodic,Periodic,Bounded,OffsetArrays.OffsetArray{Float64,1,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}
โ โโโ size: (16, 16, 16)
โ โโโ domain: x โ [0.0, 1.0], y โ [0.0, 1.0], z โ [-1.0, 0.0625]
โโโ tree:
* at (Face, Cell, Cell)
โโโ OffsetArray{Float64, 3, Array{Float64,3}}
โโโ OffsetArray{Float64, 3, Array{Float64,3}}
julia> u*v
MultiaryOperation at (Face, Cell, Cell)
โโโ grid: RegularCartesianGrid{Float64,Periodic,Periodic,Bounded,OffsetArrays.OffsetArray{Float64,1,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}
โ โโโ size: (16, 16, 16)
โ โโโ domain: x โ [0.0, 1.0], y โ [0.0, 1.0], z โ [-1.0, 0.0625]
โโโ tree:
* at (Face, Cell, Cell)
โโโ OffsetArray{Float64, 3, Array{Float64,3}}
โโโ OffsetArray{Float64, 3, Array{Float64,3}}
julia> T*S
BinaryOperation at (Cell, Cell, Cell)
โโโ grid: RegularCartesianGrid{Float64,Periodic,Periodic,Bounded,OffsetArrays.OffsetArray{Float64,1,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}
โ โโโ size: (16, 16, 16)
โ โโโ domain: x โ [0.0, 1.0], y โ [0.0, 1.0], z โ [-1.0, 0.0625]
โโโ tree:
* at (Cell, Cell, Cell) via identity
โโโ OffsetArray{Float64, 3, Array{Float64,3}}
โโโ OffsetArray{Float64, 3, Array{Float64,3}}
julia> v*v
BinaryOperation at (Cell, Face, Cell)
โโโ grid: RegularCartesianGrid{Float64,Periodic,Periodic,Bounded,OffsetArrays.OffsetArray{Float64,1,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}
โ โโโ size: (16, 16, 16)
โ โโโ domain: x โ [0.0, 1.0], y โ [0.0, 1.0], z โ [-1.0, 0.0625]
โโโ tree:
* at (Cell, Face, Cell) via identity
โโโ OffsetArray{Float64, 3, Array{Float64,3}}
โโโ OffsetArray{Float64, 3, Array{Float64,3}}
Possibly we need to change the definition of MultiaryOperation to a, b, c, d.... I guess there can be Varargs of length zero?
Relevant lines are
If two fields are at the same location, that scenario may possibly get shortcut by this method:
I guess there can be
Varargsof length zero?
Yup looks like it
julia> f(s, x...) = @show x
f (generic function with 1 method)
julia> f(ฯ);
x = ()
julia> f(ฯ, "โซ", "โ");
x = ("โซ", "โ")
That should be an easy fix. Not sure, but BinaryOperation might be preferred over mulitiary because it avoids the ntuple magic unrolling.