Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibolm committed Jan 8, 2025
1 parent 1aae059 commit f8b0563
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
7 changes: 3 additions & 4 deletions src/callbacks_step/amr_fv2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function coarsen_elements!(u::AbstractArray{<:Any, 2}, element_id,
acc += get_node_vars(old_u, equations, solver, upper_right_id) #* reverse_upper[1, 1] * reverse_upper[1, 1]

# Update value
set_node_vars!(u, 1/4 * acc, equations, solver, element_id)
set_node_vars!(u, 1 / 4 * acc, equations, solver, element_id)
end

# Coarsen and refine elements in the FV solver based on a difference list.
Expand Down Expand Up @@ -128,10 +128,9 @@ function adapt!(u_ode::AbstractVector, adaptor, mesh::T8codeMesh{2}, equations,

while old_index <= old_nelems && new_index <= new_nelems
if difference[old_index] > 0 # Refine.
# TODO: Weiß t8code jetzt hiervon schon? wie bekomme ich die elemente gesplittet in T8code?

# Refine element and store solution directly in new data structure.
refine_element!(u, new_index, old_u, old_index, adaptor, equations, solver)
refine_element!(u, new_index, old_u, old_index, adaptor,
equations, solver)

# Increment `old_index` on the original mesh and the `new_index`
# on the refined mesh with the number of children, i.e., T8_CHILDREN = 4
Expand Down
12 changes: 8 additions & 4 deletions src/meshes/t8code_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1848,11 +1848,15 @@ function fill_mesh_info_fv!(mesh::T8codeMesh, interfaces, boundaries, mortars,
mortars.neighbor_ids[end, local_num_mortars] = current_index + 1

if orientation == 0
mortars.neighbor_ids[1, local_num_mortars] = neighbor_ielements[1] + 1
mortars.neighbor_ids[2, local_num_mortars] = neighbor_ielements[2] + 1
mortars.neighbor_ids[1, local_num_mortars] = neighbor_ielements[1] +
1
mortars.neighbor_ids[2, local_num_mortars] = neighbor_ielements[2] +
1
else
mortars.neighbor_ids[1, local_num_mortars] = neighbor_ielements[2] + 1
mortars.neighbor_ids[2, local_num_mortars] = neighbor_ielements[1] + 1
mortars.neighbor_ids[1, local_num_mortars] = neighbor_ielements[2] +
1
mortars.neighbor_ids[2, local_num_mortars] = neighbor_ielements[1] +
1
end

mortars.faces[end, local_num_mortars] = iface + 1
Expand Down
8 changes: 4 additions & 4 deletions src/solvers/fv_t8code/containers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function reinitialize_containers!(mesh::T8codeMesh, equations, solver::FV, cache
cache.communication_data, mesh, equations, solver)
end


return nothing
end

Expand Down Expand Up @@ -426,12 +425,13 @@ function init_reconstruction_stencil!(elements, interfaces, boundaries, mortars,
# TODO: How to handle periodic boundaries?
length_face_small = elements.face_areas[face_element_small, element_small]
# Not at boundary
if sqrt(sum(abs.(face_midpoint_element_large - face_midpoint_element_small).^2)) < length_face_small
if sqrt(sum(abs.(face_midpoint_element_large - face_midpoint_element_small) .^
2)) < length_face_small
distance = midpoint_element_small .- midpoint_element_large
else # At boundary
# TODO: See above
distance = (face_midpoint_element_large .- midpoint_element_large) .+
(midpoint_element_small .- face_midpoint_element_small)
(midpoint_element_small .- face_midpoint_element_small)
end
append!(reconstruction_stencil[element_large], element_small)
push!(reconstruction_distance[element_large], distance)
Expand Down Expand Up @@ -589,7 +589,7 @@ function Base.resize!(mortars::T8codeFVMortarContainer, capacity)

resize!(_faces, (2^(n_dims - 1) + 1) * capacity)
mortars.faces = unsafe_wrap(Array, pointer(_faces),
(2^(n_dims - 1) + 1, capacity))
(2^(n_dims - 1) + 1, capacity))

return nothing
end
Expand Down
17 changes: 12 additions & 5 deletions src/solvers/fv_t8code/fv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -859,13 +859,19 @@ function prolong2mortars!(cache, mesh::T8codeMesh{2}, equations, solver::FV)
face_midpoint_element_small = domain_data[element_small].face_midpoints[face_element_small]
midpoint_element_small = domain_data[element_small].midpoint

vector_element_large = face_midpoint_element_large .- midpoint_element_large
vector_element_small = face_midpoint_element_small .- midpoint_element_small
vector_element_large = face_midpoint_element_large .-
midpoint_element_large
vector_element_small = face_midpoint_element_small .-
midpoint_element_small
for v in eachvariable(equations)
gradient_v_element_large = gradient_data[element_large].reconstruction_gradient_limited[v]
gradient_v_element_small = gradient_data[element_small].reconstruction_gradient_limited[v]
mortars.u[2, v, position, mortar] = solution_data[element_large].u[v] + dot(gradient_v_element_large, vector_element_large)
mortars.u[1, v, position, mortar] = solution_data[element_small].u[v] + dot(gradient_v_element_small, vector_element_small)
mortars.u[2, v, position, mortar] = solution_data[element_large].u[v] +
dot(gradient_v_element_large,
vector_element_large)
mortars.u[1, v, position, mortar] = solution_data[element_small].u[v] +
dot(gradient_v_element_small,
vector_element_small)
end
end
else
Expand All @@ -876,7 +882,8 @@ function prolong2mortars!(cache, mesh::T8codeMesh{2}, equations, solver::FV)
return nothing
end

function calc_mortar_flux!(du, mesh::T8codeMesh, nonconservative_terms::False, equations, solver::FV, cache)
function calc_mortar_flux!(du, mesh::T8codeMesh, nonconservative_terms::False,
equations, solver::FV, cache)
(; surface_flux) = solver
(; elements, mortars) = cache

Expand Down

0 comments on commit f8b0563

Please sign in to comment.