Setting up field data
Let's see an example of creating a blank set of dual node data and filling it with something:
julia> w = Nodes(Dual,(5,4))
Nodes{Dual, 5, 4, Float64, Matrix{Float64}} data Printing in grid orientation (lower left is (1,1)) 4×5 Matrix{Float64}: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
julia> w .= reshape(1:20,5,4)
Nodes{Dual, 5, 4, Float64, Matrix{Float64}} data Printing in grid orientation (lower left is (1,1)) 4×5 Matrix{Float64}: 16.0 17.0 18.0 19.0 20.0 11.0 12.0 13.0 14.0 15.0 6.0 7.0 8.0 9.0 10.0 1.0 2.0 3.0 4.0 5.0
Other data types on the same grid can be set up in similar fashion. To ensure that they have a size that is consistent with the dual node data w
, we can use this in place of the size:
julia> q = Edges(Primal,w);
julia> q.u[2,3] = 1;
julia> q
Edges{Primal, 5, 4, Float64, Vector{Float64}} data u (in grid orientation) 3×5 Matrix{Float64}: 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 v (in grid orientation) 4×4 Matrix{Float64}: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0