You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the discussion in the Trixi Student's slack channel & the advantages of a TVD spatial discretization, I think it's a good idea to the implement constant polynomials.
As mentioned in the Slack discussion, this is not really possible using Gauss-Lobatto nodes but rather Gauss-Legendre.
That said, doing this properly requires IMO the implementation of this new basis and in principle a completely new approach, shifting from nodal to modal.
An advantage of the modal approach is also the possibility to realize relatively easily limiting for linear polynomials.
I already tried hacking this into the existing code
Changes in Trixi.jl/src/solvers/dgsem/basis_lobatto_legendre.jl
# From FLUXO (but really from blue book by Kopriva)
function gauss_lobatto_nodes_weights(n_nodes::Integer)
# From Kopriva's book
n_iterations = 10
tolerance = 1e-15
# Initialize output
nodes = zeros(n_nodes)
weights = zeros(n_nodes)
# Get polynomial degree for convenience
N = n_nodes - 1
+ if N > 0
# Calculate values at boundary
nodes[1] = -1.0
nodes[end] = 1.0
weights[1] = 2 / (N * (N + 1))
weights[end] = weights[1]
# Calculate interior values
if N > 1
cont1 = pi/N
cont2 = 3/(8 * N * pi)
# Use symmetry -> only left side is computed
for i in 1:(div(N + 1, 2) - 1)
# Calculate node
# Initial guess for Newton method
nodes[i+1] = -cos(cont1*(i+0.25) - cont2/(i+0.25))
# Newton iteration to find root of Legendre polynomial (= integration node)
for k in 0:n_iterations
q, qder, _ = calc_q_and_l(N, nodes[i+1])
dx = -q/qder
nodes[i+1] += dx
if abs(dx) < tolerance * abs(nodes[i+1])
break
end
end
# Calculate weight
_, _, L = calc_q_and_l(N, nodes[i+1])
weights[i+1] = weights[1] / L^2
# Set nodes and weights according to symmetry properties
nodes[N+1-i] = -nodes[i+1]
weights[N+1-i] = weights[i+1]
end
end
# If odd number of nodes, set center node to origin (= 0.0) and calculate weight
if n_nodes % 2 == 1
_, _, L = calc_q_and_l(N, 0)
nodes[div(N, 2) + 1] = 0.0
weights[div(N, 2) + 1] = weights[1] / L^2
end
+ else # N = 0: Use Gauss-LEGENDRE (NOT Lobatto; Fallback case)+ # https://en.wikipedia.org/wiki/Gaussian_quadrature#Gauss%E2%80%93Legendre_quadrature+ #nodes[1] = 0.0+ #weights[1] = 2.0++ # Some dummy values (apparently not used)+ nodes[1] = 42.0+ weights[1] = 42.0+ end
return nodes, weights
end
but it is a bit difficult to actually judge whether that is valid.
Reason for this is that the convergence for the elixir_euler_convergence_pure_fv.jl testcase is roughly order 1 in $L^2$ norm, but not in $L^\infty$:
Following the discussion in the Trixi Student's slack channel & the advantages of a TVD spatial discretization, I think it's a good idea to the implement constant polynomials.
As mentioned in the Slack discussion, this is not really possible using Gauss-Lobatto nodes but rather Gauss-Legendre.
That said, doing this properly requires IMO the implementation of this new basis and in principle a completely new approach, shifting from nodal to modal.
An advantage of the modal approach is also the possibility to realize relatively easily limiting for linear polynomials.
I already tried hacking this into the existing code
Changes in Trixi.jl/src/solvers/dgsem/basis_lobatto_legendre.jl
but it is a bit difficult to actually judge whether that is valid.$L^2$ norm, but not in $L^\infty$ :
Reason for this is that the convergence for the elixir_euler_convergence_pure_fv.jl testcase is roughly order 1 in
Small convergence study
This is done by changing the number of gridcells
What is promising, however, is that the oscillations present in the$N\geq 1$ case are gone:
For constant polynomials the computation of the Volume Term can/should be omitted.
The text was updated successfully, but these errors were encountered: