-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
…paraview-catalyst
…y works once implemented in paraviewcatalyst.jl)
…nt and catalyst callback
… of more mesh types
…t state (not working)
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.
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 259 to 264 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 270 to 280 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 282 to 283 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 327 to 333 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 381 to 386 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 392 to 401 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 448 to 449 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 474 to 479 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 485 to 494 in 098e2bc
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 524 to 526 in 098e2bc
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 🐶
end |
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 554 to 566 in 098e2bc
# 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 🐶
end |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 570 to 583 in 098e2bc
# 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 🐶
end |
[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 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 13 to 15 in 098e2bc
plot_data_creator | |
plot_creator | |
fig |
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 132 in 098e2bc
if ndims(mesh) == 3 && visualization_callback.plot_data_creator == PlotData2D && visualization_callback.plot_creator == show_plot |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 137 in 098e2bc
@trixi_timeit timer() "visualization initialize plot_data" plot_data = PlotData3D(u_ode, semi, solution_variables = solution_variables) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 143 in 098e2bc
@trixi_timeit timer() "visualization initialize volume" GLMakie.volume(visualization_callback.fig[intTo2DInt(v)...], plot_data.data[v], algorithm = :mip) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 177 in 098e2bc
@trixi_timeit timer() "visualization plot data" plot_data = plot_data_creator(u_ode, semi, solution_variables = solution_variables) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 185 to 187 in 098e2bc
@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 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 231 to 232 in 098e2bc
cols = length(plots) | |
rows = 1 |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 234 to 235 in 098e2bc
cols = ceil(Int, sqrt(length(plots))) | |
rows = div(length(plots), cols, RoundUp) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 251 in 098e2bc
return (1,1) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 253 in 098e2bc
t = intTo2DInt(n-1) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 264 to 265 in 098e2bc
show_mesh = false, plot_arguments = Dict{Symbol, Any}(), | |
time = nothing, timestep = nothing, fig = nothing) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/recipes_plots.jl
Lines 60 to 61 in 098e2bc
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 377 to 378 in 098e2bc
levels, | |
length_level_0) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Line 1467 in 098e2bc
function element2index3D(normalized_coordinates, levels, resolution, nvisnodes_per_level) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1478 to 1483 in 098e2bc
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 🐶
Trixi.jl/src/visualization/utilities.jl
Line 1505 in 098e2bc
lt = (x, y) -> x .< y .- dx / 2) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1507 to 1508 in 098e2bc
lt = (x, y) -> x .< y .- dx / 2) | |
return transpose(hcat(id_x, id_y,id_z)) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Line 1619 in 098e2bc
@assert size(node_coordinates, 1) == 3 "only works in 3D" |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1625 to 1626 in 098e2bc
(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 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1649 to 1651 in 098e2bc
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 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1668 to 1670 in 098e2bc
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 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1687 to 1689 in 098e2bc
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) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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) |
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.
[JuliaFormatter] reported by reviewdog 🐶
catalyst_callback = ParaViewCatalystCallback(interval=100, interpolation=true) | |
catalyst_callback = ParaViewCatalystCallback(interval = 100, interpolation = true) |
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)) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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); |
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.
[JuliaFormatter] reported by reviewdog 🐶
ode_default_options()..., callback = callbacks, maxiters=1e7); | |
ode_default_options()..., callback = callbacks, maxiters = 1e7); |
end | ||
end | ||
end | ||
|
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.
[JuliaFormatter] reported by reviewdog 🐶
return node | ||
end | ||
|
||
function create_conduit_node(integrator, mesh::P4estMesh, equations, solver, cache, nvisnodes) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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 | ||
|
||
|
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.
[JuliaFormatter] reported by reviewdog 🐶
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) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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) |
gsz =(ndims_ == 3) ? grid_size[4] : nothing | ||
gstr =(ndims_ == 3) ? grid_size[5] : grid_size[4] |
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.
[JuliaFormatter] reported by reviewdog 🐶
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] |
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.
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 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 524 to 526 in 9b9e986
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 🐶
end |
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 554 to 566 in 9b9e986
# 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 🐶
end |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/paraview_catalyst.jl
Lines 570 to 583 in 9b9e986
# 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 🐶
end |
[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 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 13 to 15 in 9b9e986
plot_data_creator | |
plot_creator | |
fig |
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 132 in 9b9e986
if ndims(mesh) == 3 && visualization_callback.plot_data_creator == PlotData2D && visualization_callback.plot_creator == show_plot |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 137 in 9b9e986
@trixi_timeit timer() "visualization initialize plot_data" plot_data = PlotData3D(u_ode, semi, solution_variables = solution_variables) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 143 in 9b9e986
@trixi_timeit timer() "visualization initialize volume" GLMakie.volume(visualization_callback.fig[intTo2DInt(v)...], plot_data.data[v], algorithm = :mip) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 177 in 9b9e986
@trixi_timeit timer() "visualization plot data" plot_data = plot_data_creator(u_ode, semi, solution_variables = solution_variables) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 185 to 187 in 9b9e986
@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 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 231 to 232 in 9b9e986
cols = length(plots) | |
rows = 1 |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 234 to 235 in 9b9e986
cols = ceil(Int, sqrt(length(plots))) | |
rows = div(length(plots), cols, RoundUp) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 251 in 9b9e986
return (1,1) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Line 253 in 9b9e986
t = intTo2DInt(n-1) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/callbacks_step/visualization.jl
Lines 264 to 265 in 9b9e986
show_mesh = false, plot_arguments = Dict{Symbol, Any}(), | |
time = nothing, timestep = nothing, fig = nothing) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/recipes_plots.jl
Lines 60 to 61 in 9b9e986
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 377 to 378 in 9b9e986
levels, | |
length_level_0) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Line 1467 in 9b9e986
function element2index3D(normalized_coordinates, levels, resolution, nvisnodes_per_level) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1478 to 1483 in 9b9e986
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 🐶
Trixi.jl/src/visualization/utilities.jl
Line 1505 in 9b9e986
lt = (x, y) -> x .< y .- dx / 2) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1507 to 1508 in 9b9e986
lt = (x, y) -> x .< y .- dx / 2) | |
return transpose(hcat(id_x, id_y,id_z)) |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Line 1619 in 9b9e986
@assert size(node_coordinates, 1) == 3 "only works in 3D" |
[JuliaFormatter] reported by reviewdog 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1625 to 1626 in 9b9e986
(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 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1649 to 1651 in 9b9e986
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 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1668 to 1670 in 9b9e986
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 🐶
Trixi.jl/src/visualization/utilities.jl
Lines 1687 to 1689 in 9b9e986
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, :, :, :, :]) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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, :, :, :, :]) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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" |
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.
[JuliaFormatter] reported by reviewdog 🐶
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" |
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)]...), :) |
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.
[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)]...), :) | |
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)]...), | |
:) |
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) |
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.
[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) | |
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, :, :, :, :]) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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" |
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.
[JuliaFormatter] reported by reviewdog 🐶
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" |
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)]...), :) |
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.
[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)]...), :) | |
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 * 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)]...), :) |
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.
[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)]...), :) | |
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]) |
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.
[JuliaFormatter] reported by reviewdog 🐶
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]) |
Created for discussion.
We will finally want to merge this to trixi-framework/Trixi.jl