Skip to content
Snippets Groups Projects

make shock tube and blast wave tests run for SRHD when using MDA AV

Merged Florian Atteneder requested to merge fa/srhd-sod-shocktube into main
1 file
+ 19
5
Compare changes
  • Side-by-side
  • Inline
+ 19
5
@@ -41,7 +41,7 @@ function compute_viscosity!(
# h = L / (K * N)
h = L / K
u = reshape(u, layout(mesh))
u = dg1d.vreshape(u, layout(mesh))
uhat = invV * u # modal coefficients
# perfect decay modal coefficients, added to enhance sensitivity to
@@ -65,19 +65,33 @@ function compute_viscosity!(
rng_N = 1:N
data_x = @. - log(rng_N)
mod_uh = zeros(Float64, N)
skylined_mod_uh = zeros(Float64, N)
data_y = zeros(Float64, N)
for j in 1:K
# (3.11)
# only consider coefficients 2:Np (which corresponds to 1:N), because
# the 1st (0th) one corresponds to a constant mode that is irrelevant
# for the smoothness esimation.
mod_uh = @. sqrt( uhat[2:end,j]^2 + cellnorm2_u[j] * vhat^2 )
@. mod_uh = sqrt( uhat[2:end,j]^2 + cellnorm2_u[j] * vhat^2 )
# (3.12)
# max(1,N-1) inserted to avoid a 0:end range which can happen when only using two points
skylined_mod_uh = [ maximum(mod_uh[min(n,max(1,N-1)):end]) for n in 1:N ]
# skylined_mod_uh = [ maximum(mod_uh[min(n,max(1,N-1)):end]) for n in 1:N ]
for n = 1:N
skylined_mod_uh[n] = @views maximum(mod_uh[min(n,max(1,N-1)):end])
end
# data points in log scale
data_y = @. log(skylined_mod_uh)
data_y[isinf.(data_y)] .= -20.0
# data_y = @. log(skylined_mod_uh)
@. data_y = log(skylined_mod_uh)
for n = 1:N
y = data_y[n]
if isinf(y)
data_y[n] = -20.0
end
end
# data_y[isinf.(data_y)] .= -20.0
_, _, tau = dg1d.least_sqr_linear(data_x, data_y)
isnan(tau) && error("undesired nan encountered")
Loading