Skip to content
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

Paraview catalyst #1

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open

Paraview catalyst #1

wants to merge 50 commits into from

Conversation

benegee
Copy link
Owner

@benegee benegee commented Oct 28, 2024

Created for discussion.
We will finally want to merge this to trixi-framework/Trixi.jl

benegee and others added 30 commits September 16, 2024 11:23
…y works once implemented in paraviewcatalyst.jl)
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

JuliaFormatter

[JuliaFormatter] reported by reviewdog 🐶

x = (ndims_ == 2) ? vec(interpolation_node_coordinates[1, :, :, :]) : vec(interpolation_node_coordinates[1, :, :, :, :])


[JuliaFormatter] reported by reviewdog 🐶

y = (ndims_ == 2) ? vec(interpolation_node_coordinates[2, :, :, :]) : vec(interpolation_node_coordinates[2, :, :, :, :])


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims_ == 2) ? "quad" : "hex"


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsy * gsx) + (c_y * gsx) + c_x + 1]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_tr in 0:(gstr - 1)]...), :)


[JuliaFormatter] reported by reviewdog 🐶

connectivity = [0, 1, gsx + 1, gsx, gsy * gsx, gsy * gsx + 1, gsy * gsx + gsx + 1, gsy * gsx + gsx]
for c_x in 0:(gsx - 2), c_y in 0:(gsy - 2), c_z in 0:(gsz - 2), c_tr in 0:(gstr - 1)
if !(c_x == 0 && c_y == 0 && c_z == 0 && c_tr == 0)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x)


[JuliaFormatter] reported by reviewdog 🐶

end
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = connectivity


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(interpolated_data[:, i])


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(interpolated_data[:, i])


[JuliaFormatter] reported by reviewdog 🐶

function create_conduit_node_no_interpolation(integrator, mesh::TreeMesh, equations, solver, cache)


[JuliaFormatter] reported by reviewdog 🐶

node = ParaViewCatalyst.ConduitNode()


[JuliaFormatter] reported by reviewdog 🐶

unstructured_data = get_unstructured_data(Trixi.wrap_array(integrator.u, integrator.p), solution_variables_, mesh, equations, solver, cache)


[JuliaFormatter] reported by reviewdog 🐶

reshaped_data = (ndims(mesh) == 3) ? reshape(vcat([
unstructured_data[i,j,k,l,m]
for m in 1:uds[5] for k in uds[3] for j in 1:uds[2] for l in 1:uds[4] for i in 1:uds[1]
]...), :) : reshape(vcat([
unstructured_data[i,j,k,l]
for l in 1:uds[4] for j in 1:uds[2] for k in 1:uds[3] for i in 1:uds[1]
]...), :)


[JuliaFormatter] reported by reviewdog 🐶

zs = (ndims(mesh) == 3) ? collect(range(-1, 1, length = resolution + 1)) .* length_level_0 / 2 .+


[JuliaFormatter] reported by reviewdog 🐶

gsz =(ndims(mesh) == 3) ? size(zs)[1] : nothing


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims(mesh) == 2) ? "quad" : "hex"


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_y * gsx) + c_x
((c_y + 1) * gsx) + c_x
((c_y + 1) * gsx) + c_x + 1
(c_y * gsx) + c_x + 1]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2)]...), :)


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_z * gsy * gsx) + (c_y * gsx) + c_x
(c_z * gsy * gsx) + (c_y * gsx) + c_x + 1
(c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x
((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x
((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x + 1
((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_z in 0:(gsz - 2)]...), :)


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(unstructured_data[:, :, :, i])


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(unstructured_data[:, :, :, :, i])


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

function create_conduit_node_no_interpolation(integrator, mesh::P4estMesh, equations, solver, cache)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

unstructured_data = get_unstructured_data(Trixi.wrap_array(integrator.u, integrator.p), solution_variables_, mesh, equations, solver, cache)


[JuliaFormatter] reported by reviewdog 🐶

gsz =(ndims_ == 3) ? grid_size[4] : nothing
gstr =(ndims_ == 3) ? grid_size[5] : grid_size[4]


[JuliaFormatter] reported by reviewdog 🐶

x = (ndims_ == 2) ? vec(node_coordinates[1, :, :, :]) : vec(node_coordinates[1, :, :, :, :])


[JuliaFormatter] reported by reviewdog 🐶

y = (ndims_ == 2) ? vec(node_coordinates[2, :, :, :]) : vec(node_coordinates[2, :, :, :, :])


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims_ == 2) ? "quad" : "hex"


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsy * gsx) + (c_y * gsx) + c_x + 1]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_tr in 0:(gstr - 1)]...), :)


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_z in 0:(gsz - 2) for c_tr in 0:(gstr - 1)]...), :)


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(unstructured_data[:, :, :, i])


[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(unstructured_data[:, :, :, :, i])


[JuliaFormatter] reported by reviewdog 🐶

node = (visualization_callback.interpolation ?
create_conduit_node(integrator, mesh, equations, solver, cache, visualization_callback.nvisnodes) :
create_conduit_node_no_interpolation(integrator, mesh, equations, solver, cache))


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

# Create output data structure
data_vis = Array{Float64}(undef, n_nodes_out, n_nodes_out, n_elements, n_variables)
# For each variable, interpolate element data and store to global data structure
for v in 1:n_variables
# Reshape data array for use in interpolate_nodes function
@views reshaped_data = reshape(data_gl[:, :, :, v], 1, n_nodes_in, n_nodes_in, n_elements)
# Interpolate data to visualization nodes
for element_id in 1:n_elements
@views data_vis[:, :, element_id, v] .= reshape(
interpolate_nodes(reshaped_data[:, :, :, element_id], vandermonde, 1),
n_nodes_out, n_nodes_out)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

# Create output data structure
data_vis = Array{Float64}(undef, n_nodes_out, n_nodes_out, n_nodes_out, n_elements, n_variables)
# For each variable, interpolate element data and store to global data structure
for v in 1:n_variables
# Reshape data array for use in interpolate_nodes function
@views reshaped_data = reshape(data_gl[:, :, :, :, v],
1, n_nodes_in, n_nodes_in, n_nodes_in, n_elements)
# Interpolate data to visualization nodes
for element_id in 1:n_elements
@views data_vis[:, :, :, element_id, v] .= reshape(
interpolate_nodes(reshaped_data[:, :, :, :, element_id], vandermonde, 1),
n_nodes_out, n_nodes_out, n_nodes_out)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

error("Unsupported number of spatial dimensions: ", ndims_)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

vandermonde, n_vars) where T


[JuliaFormatter] reported by reviewdog 🐶

vandermonde, n_vars) where T


[JuliaFormatter] reported by reviewdog 🐶

n_nodes_in = size(vandermonde, 2)


[JuliaFormatter] reported by reviewdog 🐶

acc += vandermonde[i, ii] * vandermonde[j, jj] * vandermonde[k, kk] * data_in[v, ii, jj, kk]


[JuliaFormatter] reported by reviewdog 🐶

vandermonde, n_vars) where T


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

vandermonde, n_vars) where T


[JuliaFormatter] reported by reviewdog 🐶

n_nodes_in = size(vandermonde, 2)


[JuliaFormatter] reported by reviewdog 🐶

acc += vandermonde[i, ii] * data_in[v, ii, jj] * vandermonde[j, jj]


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

plot_data_creator
plot_creator
fig


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

if ndims(mesh) == 3 && visualization_callback.plot_data_creator == PlotData2D && visualization_callback.plot_creator == show_plot


[JuliaFormatter] reported by reviewdog 🐶

@trixi_timeit timer() "visualization initialize plot_data" plot_data = PlotData3D(u_ode, semi, solution_variables = solution_variables)


[JuliaFormatter] reported by reviewdog 🐶

@trixi_timeit timer() "visualization initialize volume" GLMakie.volume(visualization_callback.fig[intTo2DInt(v)...], plot_data.data[v], algorithm = :mip)


[JuliaFormatter] reported by reviewdog 🐶

@trixi_timeit timer() "visualization plot data" plot_data = plot_data_creator(u_ode, semi, solution_variables = solution_variables)


[JuliaFormatter] reported by reviewdog 🐶

@trixi_timeit timer() "visualization create plot" plot_creator(plot_data, variable_names;
show_mesh = show_mesh, plot_arguments = plot_arguments,
time = integrator.t, timestep = integrator.stats.naccept, fig = fig)


[JuliaFormatter] reported by reviewdog 🐶

cols = length(plots)
rows = 1


[JuliaFormatter] reported by reviewdog 🐶

cols = ceil(Int, sqrt(length(plots)))
rows = div(length(plots), cols, RoundUp)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

t = intTo2DInt(n-1)


[JuliaFormatter] reported by reviewdog 🐶

show_mesh = false, plot_arguments = Dict{Symbol, Any}(),
time = nothing, timestep = nothing, fig = nothing)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

levels,
length_level_0)


[JuliaFormatter] reported by reviewdog 🐶

function element2index3D(normalized_coordinates, levels, resolution, nvisnodes_per_level)


[JuliaFormatter] reported by reviewdog 🐶

lower_left_front_coordinate[1, element_id] = (normalized_coordinates[1, element_id] -
(nvisnodes - 1) / 2 * dx)
lower_left_front_coordinate[2, element_id] = (normalized_coordinates[2, element_id] -
(nvisnodes - 1) / 2 * dx)
lower_left_front_coordinate[3, element_id] = (normalized_coordinates[3, element_id] -
(nvisnodes - 1) / 2 * dx)


[JuliaFormatter] reported by reviewdog 🐶

lt = (x, y) -> x .< y .- dx / 2)


[JuliaFormatter] reported by reviewdog 🐶

lt = (x, y) -> x .< y .- dx / 2)
return transpose(hcat(id_x, id_y,id_z))


[JuliaFormatter] reported by reviewdog 🐶

@assert size(node_coordinates, 1) == 3 "only works in 3D"


[JuliaFormatter] reported by reviewdog 🐶

(cells_per_dimension[1] + 1) * (cells_per_dimension[3] + 1) + # y-direction
(cells_per_dimension[1] + 1) * (cells_per_dimension[2] + 1)) # z-direction


[JuliaFormatter] reported by reviewdog 🐶

x[i, line_index] = node_coordinates[1, end, 1, linear_indices[end, cell_y, cell_z]]
y[i, line_index] = node_coordinates[2, end, 1, linear_indices[end, cell_y, cell_z]]
z[i, line_index] = node_coordinates[3, end, 1, linear_indices[end, cell_y, cell_z]]


[JuliaFormatter] reported by reviewdog 🐶

x[i, line_index] = node_coordinates[1, 1, end, linear_indices[cell_x, end, cell_z]]
y[i, line_index] = node_coordinates[2, 1, end, linear_indices[cell_x, end, cell_z]]
z[i, line_index] = node_coordinates[3, 1, end, linear_indices[cell_x, end, cell_z]]


[JuliaFormatter] reported by reviewdog 🐶

x[i, line_index] = node_coordinates[1, 1, end, linear_indices[cell_x, cell_y, end]]
y[i, line_index] = node_coordinates[2, 1, end, linear_indices[cell_x, cell_y, end]]
z[i, line_index] = node_coordinates[3, 1, end, linear_indices[cell_x, cell_y, end]]

# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
stepsize_callback = StepsizeCallback(cfl = 1.6)

catalyst_callback = ParaViewCatalystCallback(interval=100)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
catalyst_callback = ParaViewCatalystCallback(interval=100)
catalyst_callback = ParaViewCatalystCallback(interval = 100)

# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
stepsize_callback = StepsizeCallback(cfl = 1.2)

catalyst_callback = ParaViewCatalystCallback(interval=100, interpolation=true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
catalyst_callback = ParaViewCatalystCallback(interval=100, interpolation=true)
catalyst_callback = ParaViewCatalystCallback(interval = 100, interpolation = true)

Comment on lines +23 to +24
rho = 1.0 + 0.1 * exp(-50 * ((lambda-1.0)^2/2.0 + (phi-0.4)^2)) +
0.08 * exp(-100 * ((lambda-0.8)^2/4.0 + (phi-0.5)^2))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
rho = 1.0 + 0.1 * exp(-50 * ((lambda-1.0)^2/2.0 + (phi-0.4)^2)) +
0.08 * exp(-100 * ((lambda-0.8)^2/4.0 + (phi-0.5)^2))
rho = 1.0 + 0.1 * exp(-50 * ((lambda - 1.0)^2 / 2.0 + (phi - 0.4)^2)) +
0.08 * exp(-100 * ((lambda - 0.8)^2 / 4.0 + (phi - 0.5)^2))

adapt_initial_condition = true,
adapt_initial_condition_only_refine = true)

catalyst_callback = ParaViewCatalystCallback(interval=100)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
catalyst_callback = ParaViewCatalystCallback(interval=100)
catalyst_callback = ParaViewCatalystCallback(interval = 100)

# Enable threading of the RK method for better performance on multiple threads
sol = solve(ode, RDPK3SpFSAL49(thread = OrdinaryDiffEq.True()); abstol = 1.0e-6,
reltol = 1.0e-6,
ode_default_options()..., callback = callbacks, maxiters=1e7);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
ode_default_options()..., callback = callbacks, maxiters=1e7);
ode_default_options()..., callback = callbacks, maxiters = 1e7);

end
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

return node
end

function create_conduit_node(integrator, mesh::P4estMesh, equations, solver, cache, nvisnodes)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
function create_conduit_node(integrator, mesh::P4estMesh, equations, solver, cache, nvisnodes)
function create_conduit_node(integrator, mesh::P4estMesh, equations, solver, cache,
nvisnodes)

varnames = Trixi.varnames(solution_variables_, equations)
timestep = integrator.stats.naccept


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

Comment on lines +222 to +225
nodes = collect(range(-1, 1, length=n_visnodes))
node_coordinates = Array{Float64, ndims_+2}(undef, ndims_, ntuple(_ -> n_visnodes, ndims_)..., Trixi.ncells(mesh))
interpolation_node_coordinates = calc_node_coordinates!(node_coordinates, mesh, nodes)
unstructured_data = get_unstructured_data(Trixi.wrap_array(integrator.u, integrator.p), solution_variables_, mesh, equations, solver, cache)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
nodes = collect(range(-1, 1, length=n_visnodes))
node_coordinates = Array{Float64, ndims_+2}(undef, ndims_, ntuple(_ -> n_visnodes, ndims_)..., Trixi.ncells(mesh))
interpolation_node_coordinates = calc_node_coordinates!(node_coordinates, mesh, nodes)
unstructured_data = get_unstructured_data(Trixi.wrap_array(integrator.u, integrator.p), solution_variables_, mesh, equations, solver, cache)
nodes = collect(range(-1, 1, length = n_visnodes))
node_coordinates = Array{Float64, ndims_ + 2}(undef, ndims_,
ntuple(_ -> n_visnodes,
ndims_)...,
Trixi.ncells(mesh))
interpolation_node_coordinates = calc_node_coordinates!(node_coordinates, mesh,
nodes)
unstructured_data = get_unstructured_data(Trixi.wrap_array(integrator.u,
integrator.p),
solution_variables_, mesh, equations,
solver, cache)

Comment on lines +233 to +234
gsz =(ndims_ == 3) ? grid_size[4] : nothing
gstr =(ndims_ == 3) ? grid_size[5] : grid_size[4]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
gsz =(ndims_ == 3) ? grid_size[4] : nothing
gstr =(ndims_ == 3) ? grid_size[5] : grid_size[4]
gsz = (ndims_ == 3) ? grid_size[4] : nothing
gstr = (ndims_ == 3) ? grid_size[5] : grid_size[4]

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

JuliaFormatter

[JuliaFormatter] reported by reviewdog 🐶

node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(unstructured_data[:, :, :, :, i])


[JuliaFormatter] reported by reviewdog 🐶

node = (visualization_callback.interpolation ?
create_conduit_node(integrator, mesh, equations, solver, cache, visualization_callback.nvisnodes) :
create_conduit_node_no_interpolation(integrator, mesh, equations, solver, cache))


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

# Create output data structure
data_vis = Array{Float64}(undef, n_nodes_out, n_nodes_out, n_elements, n_variables)
# For each variable, interpolate element data and store to global data structure
for v in 1:n_variables
# Reshape data array for use in interpolate_nodes function
@views reshaped_data = reshape(data_gl[:, :, :, v], 1, n_nodes_in, n_nodes_in, n_elements)
# Interpolate data to visualization nodes
for element_id in 1:n_elements
@views data_vis[:, :, element_id, v] .= reshape(
interpolate_nodes(reshaped_data[:, :, :, element_id], vandermonde, 1),
n_nodes_out, n_nodes_out)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

# Create output data structure
data_vis = Array{Float64}(undef, n_nodes_out, n_nodes_out, n_nodes_out, n_elements, n_variables)
# For each variable, interpolate element data and store to global data structure
for v in 1:n_variables
# Reshape data array for use in interpolate_nodes function
@views reshaped_data = reshape(data_gl[:, :, :, :, v],
1, n_nodes_in, n_nodes_in, n_nodes_in, n_elements)
# Interpolate data to visualization nodes
for element_id in 1:n_elements
@views data_vis[:, :, :, element_id, v] .= reshape(
interpolate_nodes(reshaped_data[:, :, :, :, element_id], vandermonde, 1),
n_nodes_out, n_nodes_out, n_nodes_out)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

error("Unsupported number of spatial dimensions: ", ndims_)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

vandermonde, n_vars) where T


[JuliaFormatter] reported by reviewdog 🐶

vandermonde, n_vars) where T


[JuliaFormatter] reported by reviewdog 🐶

n_nodes_in = size(vandermonde, 2)


[JuliaFormatter] reported by reviewdog 🐶

acc += vandermonde[i, ii] * vandermonde[j, jj] * vandermonde[k, kk] * data_in[v, ii, jj, kk]


[JuliaFormatter] reported by reviewdog 🐶

vandermonde, n_vars) where T


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

vandermonde, n_vars) where T


[JuliaFormatter] reported by reviewdog 🐶

n_nodes_in = size(vandermonde, 2)


[JuliaFormatter] reported by reviewdog 🐶

acc += vandermonde[i, ii] * data_in[v, ii, jj] * vandermonde[j, jj]


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

plot_data_creator
plot_creator
fig


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

if ndims(mesh) == 3 && visualization_callback.plot_data_creator == PlotData2D && visualization_callback.plot_creator == show_plot


[JuliaFormatter] reported by reviewdog 🐶

@trixi_timeit timer() "visualization initialize plot_data" plot_data = PlotData3D(u_ode, semi, solution_variables = solution_variables)


[JuliaFormatter] reported by reviewdog 🐶

@trixi_timeit timer() "visualization initialize volume" GLMakie.volume(visualization_callback.fig[intTo2DInt(v)...], plot_data.data[v], algorithm = :mip)


[JuliaFormatter] reported by reviewdog 🐶

@trixi_timeit timer() "visualization plot data" plot_data = plot_data_creator(u_ode, semi, solution_variables = solution_variables)


[JuliaFormatter] reported by reviewdog 🐶

@trixi_timeit timer() "visualization create plot" plot_creator(plot_data, variable_names;
show_mesh = show_mesh, plot_arguments = plot_arguments,
time = integrator.t, timestep = integrator.stats.naccept, fig = fig)


[JuliaFormatter] reported by reviewdog 🐶

cols = length(plots)
rows = 1


[JuliaFormatter] reported by reviewdog 🐶

cols = ceil(Int, sqrt(length(plots)))
rows = div(length(plots), cols, RoundUp)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

t = intTo2DInt(n-1)


[JuliaFormatter] reported by reviewdog 🐶

show_mesh = false, plot_arguments = Dict{Symbol, Any}(),
time = nothing, timestep = nothing, fig = nothing)


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

levels,
length_level_0)


[JuliaFormatter] reported by reviewdog 🐶

function element2index3D(normalized_coordinates, levels, resolution, nvisnodes_per_level)


[JuliaFormatter] reported by reviewdog 🐶

lower_left_front_coordinate[1, element_id] = (normalized_coordinates[1, element_id] -
(nvisnodes - 1) / 2 * dx)
lower_left_front_coordinate[2, element_id] = (normalized_coordinates[2, element_id] -
(nvisnodes - 1) / 2 * dx)
lower_left_front_coordinate[3, element_id] = (normalized_coordinates[3, element_id] -
(nvisnodes - 1) / 2 * dx)


[JuliaFormatter] reported by reviewdog 🐶

lt = (x, y) -> x .< y .- dx / 2)


[JuliaFormatter] reported by reviewdog 🐶

lt = (x, y) -> x .< y .- dx / 2)
return transpose(hcat(id_x, id_y,id_z))


[JuliaFormatter] reported by reviewdog 🐶

@assert size(node_coordinates, 1) == 3 "only works in 3D"


[JuliaFormatter] reported by reviewdog 🐶

(cells_per_dimension[1] + 1) * (cells_per_dimension[3] + 1) + # y-direction
(cells_per_dimension[1] + 1) * (cells_per_dimension[2] + 1)) # z-direction


[JuliaFormatter] reported by reviewdog 🐶

x[i, line_index] = node_coordinates[1, end, 1, linear_indices[end, cell_y, cell_z]]
y[i, line_index] = node_coordinates[2, end, 1, linear_indices[end, cell_y, cell_z]]
z[i, line_index] = node_coordinates[3, end, 1, linear_indices[end, cell_y, cell_z]]


[JuliaFormatter] reported by reviewdog 🐶

x[i, line_index] = node_coordinates[1, 1, end, linear_indices[cell_x, end, cell_z]]
y[i, line_index] = node_coordinates[2, 1, end, linear_indices[cell_x, end, cell_z]]
z[i, line_index] = node_coordinates[3, 1, end, linear_indices[cell_x, end, cell_z]]


[JuliaFormatter] reported by reviewdog 🐶

x[i, line_index] = node_coordinates[1, 1, end, linear_indices[cell_x, cell_y, end]]
y[i, line_index] = node_coordinates[2, 1, end, linear_indices[cell_x, cell_y, end]]
z[i, line_index] = node_coordinates[3, 1, end, linear_indices[cell_x, cell_y, end]]

node["catalyst/state/time"] = timestep
node["catalyst/channels/input/type"] = "mesh"
node["catalyst/channels/input/data/coordsets/coords/type"] = "explicit"
x = (ndims_ == 2) ? vec(interpolation_node_coordinates[1, :, :, :]) : vec(interpolation_node_coordinates[1, :, :, :, :])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
x = (ndims_ == 2) ? vec(interpolation_node_coordinates[1, :, :, :]) : vec(interpolation_node_coordinates[1, :, :, :, :])
x = (ndims_ == 2) ? vec(interpolation_node_coordinates[1, :, :, :]) :
vec(interpolation_node_coordinates[1, :, :, :, :])

node["catalyst/channels/input/data/coordsets/coords/type"] = "explicit"
x = (ndims_ == 2) ? vec(interpolation_node_coordinates[1, :, :, :]) : vec(interpolation_node_coordinates[1, :, :, :, :])
node["catalyst/channels/input/data/coordsets/coords/values/x"] = x
y = (ndims_ == 2) ? vec(interpolation_node_coordinates[2, :, :, :]) : vec(interpolation_node_coordinates[2, :, :, :, :])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
y = (ndims_ == 2) ? vec(interpolation_node_coordinates[2, :, :, :]) : vec(interpolation_node_coordinates[2, :, :, :, :])
y = (ndims_ == 2) ? vec(interpolation_node_coordinates[2, :, :, :]) :
vec(interpolation_node_coordinates[2, :, :, :, :])

#creating a topology
node["catalyst/channels/input/data/topologies/mesh/type"] = "unstructured"
node["catalyst/channels/input/data/topologies/mesh/coordset"] = "coords"
node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims_ == 2) ? "quad" : "hex"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims_ == 2) ? "quad" : "hex"
node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims_ == 2) ?
"quad" : "hex"

Comment on lines +259 to +264
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsy * gsx) + (c_y * gsx) + c_x + 1]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_tr in 0:(gstr - 1)]...), :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsy * gsx) + (c_y * gsx) + c_x + 1]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_tr in 0:(gstr - 1)]...), :)
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([[(c_tr *
gsy *
gsx) +
(c_y *
gsx) +
c_x
(c_tr *
gsy *
gsx) +
((c_y +
1) *
gsx) +
c_x
(c_tr *
gsy *
gsx) +
((c_y +
1) *
gsx) +
c_x +
1
(c_tr *
gsy *
gsx) +
(c_y *
gsx) +
c_x +
1]
for c_x in 0:(gsx - 2)
for c_y in 0:(gsy - 2)
for c_tr in 0:(gstr - 1)]...),
:)

Comment on lines +270 to +280
connectivity = [0, 1, gsx + 1, gsx, gsy * gsx, gsy * gsx + 1, gsy * gsx + gsx + 1, gsy * gsx + gsx]
for c_x in 0:(gsx - 2), c_y in 0:(gsy - 2), c_z in 0:(gsz - 2), c_tr in 0:(gstr - 1)
if !(c_x == 0 && c_y == 0 && c_z == 0 && c_tr == 0)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
connectivity = [0, 1, gsx + 1, gsx, gsy * gsx, gsy * gsx + 1, gsy * gsx + gsx + 1, gsy * gsx + gsx]
for c_x in 0:(gsx - 2), c_y in 0:(gsy - 2), c_z in 0:(gsz - 2), c_tr in 0:(gstr - 1)
if !(c_x == 0 && c_y == 0 && c_z == 0 && c_tr == 0)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1)
push!(connectivity, (c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x)
connectivity = [
0,
1,
gsx + 1,
gsx,
gsy * gsx,
gsy * gsx + 1,
gsy * gsx + gsx + 1,
gsy * gsx + gsx
]
for c_x in 0:(gsx - 2), c_y in 0:(gsy - 2), c_z in 0:(gsz - 2),
c_tr in 0:(gstr - 1)
if !(c_x == 0 && c_y == 0 && c_z == 0 && c_tr == 0)
push!(connectivity,
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) +
c_x)
push!(connectivity,
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) +
c_x + 1)
push!(connectivity,
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) +
((c_y + 1) * gsx) + c_x + 1)
push!(connectivity,
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) +
((c_y + 1) * gsx) + c_x)
push!(connectivity,
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) +
(c_y * gsx) + c_x)
push!(connectivity,
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) +
(c_y * gsx) + c_x + 1)
push!(connectivity,
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) +
((c_y + 1) * gsx) + c_x + 1)
push!(connectivity,
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) +
((c_y + 1) * gsx) + c_x)
end

node["catalyst/channels/input/data/coordsets/coords/type"] = "explicit"
x = (ndims_ == 2) ? vec(node_coordinates[1, :, :, :]) : vec(node_coordinates[1, :, :, :, :])
node["catalyst/channels/input/data/coordsets/coords/values/x"] = x
y = (ndims_ == 2) ? vec(node_coordinates[2, :, :, :]) : vec(node_coordinates[2, :, :, :, :])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
y = (ndims_ == 2) ? vec(node_coordinates[2, :, :, :]) : vec(node_coordinates[2, :, :, :, :])
y = (ndims_ == 2) ? vec(node_coordinates[2, :, :, :]) :
vec(node_coordinates[2, :, :, :, :])

#creating a topology
node["catalyst/channels/input/data/topologies/mesh/type"] = "unstructured"
node["catalyst/channels/input/data/topologies/mesh/coordset"] = "coords"
node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims_ == 2) ? "quad" : "hex"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims_ == 2) ? "quad" : "hex"
node["catalyst/channels/input/data/topologies/mesh/elements/shape"] = (ndims_ == 2) ?
"quad" : "hex"

Comment on lines +474 to +479
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsy * gsx) + (c_y * gsx) + c_x + 1]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_tr in 0:(gstr - 1)]...), :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsy * gsx) + (c_y * gsx) + c_x + 1]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_tr in 0:(gstr - 1)]...), :)
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([[(c_tr *
gsy *
gsx) +
(c_y *
gsx) +
c_x
(c_tr *
gsy *
gsx) +
((c_y +
1) *
gsx) +
c_x
(c_tr *
gsy *
gsx) +
((c_y +
1) *
gsx) +
c_x +
1
(c_tr *
gsy *
gsx) +
(c_y *
gsx) +
c_x +
1]
for c_x in 0:(gsx - 2)
for c_y in 0:(gsy - 2)
for c_tr in 0:(gstr - 1)]...),
:)

Comment on lines +485 to +494
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_z in 0:(gsz - 2) for c_tr in 0:(gstr - 1)]...), :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([
[(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + (c_y * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + (c_z * gsy * gsx) + ((c_y + 1) * gsx) + c_x
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + (c_y * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x + 1
(c_tr * gsz * gsy * gsx) + ((c_z + 1) * gsy * gsx) + ((c_y + 1) * gsx) + c_x]
for c_x in 0:(gsx - 2) for c_y in 0:(gsy - 2) for c_z in 0:(gsz - 2) for c_tr in 0:(gstr - 1)]...), :)
node["catalyst/channels/input/data/topologies/mesh/elements/connectivity"] = reshape(vcat([[(c_tr *
gsz *
gsy *
gsx) +
(c_z *
gsy *
gsx) +
(c_y *
gsx) +
c_x
(c_tr *
gsz *
gsy *
gsx) +
(c_z *
gsy *
gsx) +
(c_y *
gsx) +
c_x +
1
(c_tr *
gsz *
gsy *
gsx) +
(c_z *
gsy *
gsx) +
((c_y +
1) *
gsx) +
c_x +
1
(c_tr *
gsz *
gsy *
gsx) +
(c_z *
gsy *
gsx) +
((c_y +
1) *
gsx) +
c_x
(c_tr *
gsz *
gsy *
gsx) +
((c_z +
1) *
gsy *
gsx) +
(c_y *
gsx) +
c_x
(c_tr *
gsz *
gsy *
gsx) +
((c_z +
1) *
gsy *
gsx) +
(c_y *
gsx) +
c_x +
1
(c_tr *
gsz *
gsy *
gsx) +
((c_z +
1) *
gsy *
gsx) +
((c_y +
1) *
gsx) +
c_x +
1
(c_tr *
gsz *
gsy *
gsx) +
((c_z +
1) *
gsy *
gsx) +
((c_y +
1) *
gsx) +
c_x]
for c_x in 0:(gsx - 2)
for c_y in 0:(gsy - 2)
for c_z in 0:(gsz - 2)
for c_tr in 0:(gstr - 1)]...),
:)

node["catalyst/channels/input/data/fields/" * varnames[i] * "/topology"] = "mesh"
node["catalyst/channels/input/data/fields/" * varnames[i] * "/volume_dependent"] = "false"
if ndims(mesh) == 2
node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(unstructured_data[:, :, :, i])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(unstructured_data[:, :, :, i])
node["catalyst/channels/input/data/fields/" * varnames[i] * "/values"] = vec(unstructured_data[:,
:,
:,
i])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants