From e86cc89f9d35ee7acd086e9c518f496fd83a9586 Mon Sep 17 00:00:00 2001 From: Andrew Winters Date: Thu, 23 May 2024 08:29:21 +0200 Subject: [PATCH] add comments --- src/solvers/scratch_p4est.jl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/solvers/scratch_p4est.jl b/src/solvers/scratch_p4est.jl index 035f5d7..9cd2e43 100644 --- a/src/solvers/scratch_p4est.jl +++ b/src/solvers/scratch_p4est.jl @@ -342,8 +342,9 @@ end i_large = i_large_start j_large = j_large_start + # maybe similar(u_buffer) instead? Would avoid adding to the cache flux_buffer = cache.f_threaded[Threads.threadid()] - for i in eachnode(dg) + for node in eachnode(dg) # Get the proper normal_direction now that we are back computing on the large element normal_direction = Trixi.get_normal_direction(large_direction, contravariant_vectors, @@ -353,16 +354,18 @@ end # solution state to recover the physical flux at this point because the surface flux # has in-built mechanisms to avoid division by zero in dry regions whereas `Trixi.flux` # does not have such mechanisms to desingularize the velocity computation. - flux_buffer[:, i] = surface_flux(view(cache.mortars.u, 3, :, 1, i, mortar), - view(cache.mortars.u, 3, :, 1, i, mortar), - normal_direction, equations) + flux = surface_flux(view(cache.mortars.u, 3, :, 1, node, mortar), + view(cache.mortars.u, 3, :, 1, node, mortar), + normal_direction, equations) - noncons = nonconservative_flux(view(cache.mortars.u, 3, :, 1, i, mortar), - view(cache.mortars.u, 3, :, 1, i, mortar), + noncons = nonconservative_flux(view(cache.mortars.u, 3, :, 1, node, mortar), + view(cache.mortars.u, 3, :, 1, node, mortar), normal_direction, normal_direction, equations) - flux_buffer[:, i] += 0.5 * noncons + flux_plus_noncons = flux + 0.5 * noncons + + set_node_vars!(flux_buffer, flux_plus_noncons, equations, dg, node) i_large += i_large_step j_large += j_large_step