From 562d79e87e15a306b862edb78f1e3fcc4d819e74 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 12 Dec 2023 17:24:30 +0100 Subject: [PATCH 01/55] Introduce NaNMath for unsafe sqrt and log --- Project.toml | 2 + src/Trixi.jl | 2 + src/auxiliary/math.jl | 4 +- src/callbacks_step/averaging_dg2d.jl | 4 +- src/equations/compressible_euler_1d.jl | 54 ++++++------ src/equations/compressible_euler_2d.jl | 84 +++++++++---------- src/equations/compressible_euler_3d.jl | 76 ++++++++--------- .../compressible_euler_multicomponent_1d.jl | 8 +- .../compressible_euler_multicomponent_2d.jl | 8 +- src/equations/hyperbolic_diffusion_1d.jl | 4 +- src/equations/hyperbolic_diffusion_2d.jl | 12 +-- src/equations/hyperbolic_diffusion_3d.jl | 6 +- src/equations/ideal_glm_mhd_1d.jl | 14 ++-- src/equations/ideal_glm_mhd_2d.jl | 30 +++---- src/equations/ideal_glm_mhd_3d.jl | 32 +++---- .../ideal_glm_mhd_multicomponent_1d.jl | 10 +-- .../ideal_glm_mhd_multicomponent_2d.jl | 12 +-- src/equations/polytropic_euler_2d.jl | 16 ++-- src/equations/shallow_water_1d.jl | 28 +++---- src/equations/shallow_water_2d.jl | 58 ++++++------- src/equations/shallow_water_quasi_1d.jl | 6 +- src/equations/shallow_water_two_layer_1d.jl | 6 +- src/equations/shallow_water_two_layer_2d.jl | 10 +-- .../flux_differencing_compressible_euler.jl | 4 +- .../dg_2d_compressible_euler.jl | 4 +- .../dg_3d_compressible_euler.jl | 4 +- .../dgsem_tree/dg_2d_compressible_euler.jl | 4 +- .../dgsem_tree/dg_3d_compressible_euler.jl | 4 +- 28 files changed, 255 insertions(+), 251 deletions(-) diff --git a/Project.toml b/Project.toml index ace71a50d8b..84ea33ec22b 100644 --- a/Project.toml +++ b/Project.toml @@ -17,8 +17,10 @@ LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e" LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" Octavian = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" +OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" P4est = "7d669430-f675-4ae7-b43e-fab78ec5a902" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" diff --git a/src/Trixi.jl b/src/Trixi.jl index b8110cf5bdd..8f7d475668e 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -88,6 +88,8 @@ import SummationByPartsOperators: integrate, semidiscretize, Quad, Hex, Tet, Wedge using StartUpDG: RefElemData, MeshData, AbstractElemShape +import NaNMath + # TODO: include_optimized # This should be used everywhere (except to `include("interpolations.jl")`) # once the upstream issue https://github.com/timholy/Revise.jl/issues/634 diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 38ea0bda8c8..f1a8ea0f0b7 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -59,7 +59,7 @@ Given ε = 1.0e-4, we use the following algorithm. if f2 < epsilon_f2 return (x + y) / @evalpoly(f2, 2, 2/3, 2/5, 2/7) else - return (y - x) / log(y / x) + return (y - x) / NaNMath.log(y / x) end end @@ -79,7 +79,7 @@ multiplication. if f2 < epsilon_f2 return @evalpoly(f2, 2, 2/3, 2/5, 2/7) / (x + y) else - return log(y / x) / (y - x) + return NaNMath.log(y / x) / (y - x) end end diff --git a/src/callbacks_step/averaging_dg2d.jl b/src/callbacks_step/averaging_dg2d.jl index 959a5655d96..7999c999ba5 100644 --- a/src/callbacks_step/averaging_dg2d.jl +++ b/src/callbacks_step/averaging_dg2d.jl @@ -68,8 +68,8 @@ function calc_mean_values!(mean_values, averaging_callback_cache, u, u_prev, rho, v1, v2, p = u_node_prim rho_prev, v1_prev, v2_prev, p_prev = u_prev_node_prim - c = sqrt(equations.gamma * p / rho) - c_prev = sqrt(equations.gamma * p_prev / rho_prev) + c = NaNMath.sqrt(equations.gamma * p / rho) + c_prev = NaNMath.sqrt(equations.gamma * p_prev / rho_prev) # Calculate the contribution to the mean values using the trapezoidal rule vorticity_mean[i, j, element] += integration_constant * diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index 05c38ce791d..de61e8ace6b 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -230,7 +230,7 @@ are available in the paper: # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = sqrt(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = NaNMath.sqrt(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -240,7 +240,7 @@ are available in the paper: B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + sqrt(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + NaNMath.sqrt(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -449,7 +449,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) lambda1 = v1 lambda2 = v1 + a @@ -475,7 +475,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) lambda1 = v1 lambda2 = v1 + a @@ -544,7 +544,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -566,7 +566,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -632,7 +632,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -659,7 +659,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -690,11 +690,11 @@ end v1_ll = rho_v1_ll / rho_ll v_mag_ll = abs(v1_ll) p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * v_mag_ll^2) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v_mag_rr = abs(v1_rr) p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * v_mag_rr^2) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) λ_max = max(v_mag_ll, v_mag_rr) + max(c_ll, c_rr) end @@ -705,8 +705,8 @@ end rho_ll, v1_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, p_rr = cons2prim(u_rr, equations) - λ_min = v1_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) return λ_min, λ_max end @@ -717,8 +717,8 @@ end rho_ll, v1_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, p_rr = cons2prim(u_rr, equations) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) λ_min = min(v1_ll - c_ll, v1_rr - c_rr) λ_max = max(v1_ll + c_ll, v1_rr + c_rr) @@ -742,20 +742,20 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, v1_ll = rho_v1_ll / rho_ll e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * v1_ll^2) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * v1_rr^2) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr vel_L = v1_ll vel_R = v1_rr @@ -764,7 +764,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) + c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) @@ -833,22 +833,22 @@ Compactly summarized: # `u_ll[3]` is total energy `rho_e_ll` on the left H_ll = (u_ll[3] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) # `u_rr[3]` is total energy `rho_e_rr` on the right H_rr = (u_rr[3] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v_roe = (sqrt_rho_ll * v_ll + sqrt_rho_rr * v_rr) * inv_sum_sqrt_rho v_roe_mag = v_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -865,7 +865,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 1 / 2 * rho * v1^2) - c = sqrt(equations.gamma * p / rho) + c = NaNMath.sqrt(equations.gamma * p / rho) return (abs(v1) + c,) end @@ -887,7 +887,7 @@ end v1 = rho_v1 / rho v_square = v1^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - equations.gamma * log(rho) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -951,7 +951,7 @@ end p = (equations.gamma - 1) * (cons[3] - 1 / 2 * (cons[2]^2) / cons[1]) # Thermodynamic entropy - s = log(p) - equations.gamma * log(cons[1]) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) return s end diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index a992f99eaf4..55a0e085cca 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -308,7 +308,7 @@ Should be used together with [`UnstructuredMesh2D`](@ref). # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = sqrt(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = NaNMath.sqrt(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -318,7 +318,7 @@ Should be used together with [`UnstructuredMesh2D`](@ref). B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + sqrt(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + NaNMath.sqrt(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -719,7 +719,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -767,7 +767,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -857,7 +857,7 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho if orientation == 1 @@ -887,7 +887,7 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho if orientation == 1 @@ -943,9 +943,9 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho - lambda = 0.5 * (sqrt(v1^2 + v2^2) + a) + lambda = 0.5 * (NaNMath.sqrt(v1^2 + v2^2) + a) if orientation == 1 #lambda = 0.5 * (abs(v1) + a) @@ -970,9 +970,9 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho - lambda = 0.5 * (sqrt(v1^2 + v2^2) + a) + lambda = 0.5 * (NaNMath.sqrt(v1^2 + v2^2) + a) if orientation == 1 #lambda = 0.5 * (abs(v1) + a) @@ -1006,8 +1006,8 @@ end v_rr = v2_rr end # Calculate sound speeds - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -1022,12 +1022,12 @@ end v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2]) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) # right v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2]) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end @@ -1039,11 +1039,11 @@ end rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) else # y-direction - λ_min = v2_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v2_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v2_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v2_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) end return λ_min, λ_max @@ -1059,8 +1059,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - sqrt(equations.gamma * p_ll / rho_ll) * norm_ - λ_max = v_normal_rr + sqrt(equations.gamma * p_rr / rho_rr) * norm_ + λ_min = v_normal_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ + λ_max = v_normal_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ return λ_min, λ_max end @@ -1071,8 +1071,8 @@ end rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1093,8 +1093,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -1166,21 +1166,21 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, v2_ll = rho_v2_ll / rho_ll e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * (v1_ll^2 + v2_ll^2)) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v2_rr = rho_v2_rr / rho_rr e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * (v1_rr^2 + v2_rr^2)) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr if orientation == 1 # x-direction vel_L = v1_ll @@ -1196,7 +1196,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) + c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) sMu_L = Ssl - vel_L @@ -1275,15 +1275,15 @@ of the numerical flux. # `u_ll[4]` is total energy `rho_e_ll` on the left H_ll = (u_ll[4] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) # `u_rr[4]` is total energy `rho_e_rr` on the right H_rr = (u_rr[4] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1291,7 +1291,7 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -1337,15 +1337,15 @@ of the numerical flux. # `u_ll[4]` is total energy `rho_e_ll` on the left H_ll = (u_ll[4] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ # `u_rr[4]` is total energy `rho_e_rr` on the right H_rr = (u_rr[4] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1354,7 +1354,7 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -1369,7 +1369,7 @@ end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations2D) rho, v1, v2, p = cons2prim(u, equations) - c = sqrt(equations.gamma * p / rho) + c = NaNMath.sqrt(equations.gamma * p / rho) return abs(v1) + c, abs(v2) + c end @@ -1393,7 +1393,7 @@ end v2 = rho_v2 / rho v_square = v1^2 + v2^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - equations.gamma * log(rho) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1483,7 +1483,7 @@ end p = (equations.gamma - 1) * (cons[4] - 1 / 2 * (cons[2]^2 + cons[3]^2) / cons[1]) # Thermodynamic entropy - s = log(p) - equations.gamma * log(cons[1]) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) return s end diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index fc56f58025b..47cdbe8b692 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -310,7 +310,7 @@ Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = sqrt(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = NaNMath.sqrt(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -320,7 +320,7 @@ Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + sqrt(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + NaNMath.sqrt(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -797,7 +797,7 @@ end v3 = rho_v3 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2 + rho_v3 * v3)) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -868,7 +868,7 @@ end v3 = rho_v3 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2 + rho_v3 * v3)) - a = sqrt(equations.gamma * p / rho) + a = NaNMath.sqrt(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -1044,8 +1044,8 @@ end v_rr = v3_rr end # Calculate sound speeds - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -1060,12 +1060,12 @@ end v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + v3_ll * normal_direction[3]) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) # right v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + v3_rr * normal_direction[3]) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end @@ -1077,14 +1077,14 @@ end rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) elseif orientation == 2 # y-direction - λ_min = v2_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v2_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v2_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v2_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) else # z-direction - λ_min = v3_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v3_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v3_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v3_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) end return λ_min, λ_max @@ -1102,8 +1102,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - sqrt(equations.gamma * p_ll / rho_ll) * norm_ - λ_max = v_normal_rr + sqrt(equations.gamma * p_rr / rho_rr) * norm_ + λ_min = v_normal_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ + λ_max = v_normal_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ return λ_min, λ_max end @@ -1114,8 +1114,8 @@ end rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1139,8 +1139,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + @@ -1210,7 +1210,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * (v1_ll^2 + v2_ll^2 + v3_ll^2)) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v2_rr = rho_v2_rr / rho_rr @@ -1218,15 +1218,15 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * (v1_rr^2 + v2_rr^2 + v3_rr^2)) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr if orientation == 1 # x-direction vel_L = v1_ll @@ -1249,7 +1249,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) + c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) sMu_L = Ssl - vel_L @@ -1344,15 +1344,15 @@ of the numerical flux. # `u_ll[5]` is total energy `rho_e_ll` on the left H_ll = (u_ll[5] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) # `u_rr[5]` is total energy `rho_e_rr` on the right H_rr = (u_rr[5] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1361,7 +1361,7 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -1412,15 +1412,15 @@ of the numerical flux. # `u_ll[5]` is total energy `rho_e_ll` on the left H_ll = (u_ll[5] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ # `u_rr[5]` is total energy `rho_e_rr` on the right H_rr = (u_rr[5] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1431,7 +1431,7 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -1446,7 +1446,7 @@ end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations3D) rho, v1, v2, v3, p = cons2prim(u, equations) - c = sqrt(equations.gamma * p / rho) + c = NaNMath.sqrt(equations.gamma * p / rho) return abs(v1) + c, abs(v2) + c, abs(v3) + c end @@ -1473,7 +1473,7 @@ end v3 = rho_v3 / rho v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - equations.gamma * log(rho) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1546,7 +1546,7 @@ end p = pressure(u, equations) # Thermodynamic entropy - s = log(p) - equations.gamma * log(rho) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) return s end diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index 8ddb0dcd08f..e1ba067025a 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -400,8 +400,8 @@ end p_ll = (gamma_ll - 1) * (rho_e_ll - 1 / 2 * rho_ll * v_ll^2) p_rr = (gamma_rr - 1) * (rho_e_rr - 1 / 2 * rho_rr * v_rr^2) - c_ll = sqrt(gamma_ll * p_ll / rho_ll) - c_rr = sqrt(gamma_rr * p_rr / rho_rr) + c_ll = NaNMath.sqrt(gamma_ll * p_ll / rho_ll) + c_rr = NaNMath.sqrt(gamma_rr * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -415,7 +415,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 1 / 2 * rho * (v1^2)) - c = sqrt(gamma * p / rho) + c = NaNMath.sqrt(gamma * p / rho) return (abs(v1) + c,) end @@ -477,7 +477,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - gamma * log(rho) - log(gas_constant) + s = NaNMath.log(p) - gamma * NaNMath.log(rho) - log(gas_constant) rho_p = rho / p T = (rho_e - 0.5 * rho * v_square) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(gas_constant * diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index 940d88b1aa5..619ce30c718 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -558,9 +558,9 @@ end # Compute the sound speeds on the left and right p_ll = (gamma_ll - 1) * (rho_e_ll - 1 / 2 * (rho_v1_ll^2 + rho_v2_ll^2) / rho_ll) - c_ll = sqrt(gamma_ll * p_ll / rho_ll) + c_ll = NaNMath.sqrt(gamma_ll * p_ll / rho_ll) p_rr = (gamma_rr - 1) * (rho_e_rr - 1 / 2 * (rho_v1_rr^2 + rho_v2_rr^2) / rho_rr) - c_rr = sqrt(gamma_rr * p_rr / rho_rr) + c_rr = NaNMath.sqrt(gamma_rr * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -575,7 +575,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 1 / 2 * rho * (v1^2 + v2^2)) - c = sqrt(gamma * p / rho) + c = NaNMath.sqrt(gamma * p / rho) return (abs(v1) + c, abs(v2) + c) end @@ -662,7 +662,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - gamma * log(rho) - log(gas_constant) + s = NaNMath.log(p) - gamma * NaNMath.log(rho) - log(gas_constant) rho_p = rho / p T = (rho_e - 0.5 * rho * v_square) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(gas_constant * diff --git a/src/equations/hyperbolic_diffusion_1d.jl b/src/equations/hyperbolic_diffusion_1d.jl index 39a555e7c72..abcf97cea4c 100644 --- a/src/equations/hyperbolic_diffusion_1d.jl +++ b/src/equations/hyperbolic_diffusion_1d.jl @@ -165,13 +165,13 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations1D) - λ_max = sqrt(equations.nu * equations.inv_Tr) + λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) end @inline have_constant_speed(::HyperbolicDiffusionEquations1D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations1D) - return sqrt(eq.nu * eq.inv_Tr) + return NaNMath.sqrt(eq.nu * eq.inv_Tr) end # Convert conservative variables to primitive diff --git a/src/equations/hyperbolic_diffusion_2d.jl b/src/equations/hyperbolic_diffusion_2d.jl index 511d1b8935d..336bfd20243 100644 --- a/src/equations/hyperbolic_diffusion_2d.jl +++ b/src/equations/hyperbolic_diffusion_2d.jl @@ -162,12 +162,12 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations2D) - sqrt(equations.nu * equations.inv_Tr) + NaNMath.sqrt(equations.nu * equations.inv_Tr) end @inline function max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations::HyperbolicDiffusionEquations2D) - sqrt(equations.nu * equations.inv_Tr) * norm(normal_direction) + NaNMath.sqrt(equations.nu * equations.inv_Tr) * norm(normal_direction) end @inline function flux_godunov(u_ll, u_rr, orientation::Integer, @@ -180,7 +180,7 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = sqrt(equations.nu * equations.inv_Tr) + λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) if orientation == 1 # x-direction f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) @@ -203,10 +203,10 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = sqrt(equations.nu * equations.inv_Tr) + λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) * - sqrt(normal_direction[1]^2 + normal_direction[2]^2) + NaNMath.sqrt(normal_direction[1]^2 + normal_direction[2]^2) f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) * normal_direction[1] f3 = 1 / 2 * (f_ll[3] + f_rr[3]) - @@ -218,7 +218,7 @@ end @inline have_constant_speed(::HyperbolicDiffusionEquations2D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations2D) - λ = sqrt(eq.nu * eq.inv_Tr) + λ = NaNMath.sqrt(eq.nu * eq.inv_Tr) return λ, λ end diff --git a/src/equations/hyperbolic_diffusion_3d.jl b/src/equations/hyperbolic_diffusion_3d.jl index ed807511b67..c27d89c2ba6 100644 --- a/src/equations/hyperbolic_diffusion_3d.jl +++ b/src/equations/hyperbolic_diffusion_3d.jl @@ -170,7 +170,7 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations3D) - λ_max = sqrt(equations.nu * equations.inv_Tr) + λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) end @inline function flux_godunov(u_ll, u_rr, orientation::Integer, @@ -183,7 +183,7 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = sqrt(equations.nu * equations.inv_Tr) + λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) if orientation == 1 # x-direction f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) @@ -205,7 +205,7 @@ end @inline have_constant_speed(::HyperbolicDiffusionEquations3D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations3D) - λ = sqrt(eq.nu * eq.inv_Tr) + λ = NaNMath.sqrt(eq.nu * eq.inv_Tr) return λ, λ, λ end diff --git a/src/equations/ideal_glm_mhd_1d.jl b/src/equations/ideal_glm_mhd_1d.jl index 5a523daf3f6..c7f68694d22 100644 --- a/src/equations/ideal_glm_mhd_1d.jl +++ b/src/equations/ideal_glm_mhd_1d.jl @@ -518,7 +518,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) - s = log(p) - equations.gamma * log(rho) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) rho_p = rho / p w1 = (equations.gamma - s) / (equations.gamma - 1) - 0.5 * rho_p * v_square @@ -578,14 +578,14 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = equations.gamma * p / rho - sqrt_rho = sqrt(rho) + sqrt_rho = NaNMath.sqrt(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end @@ -626,8 +626,8 @@ as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -656,7 +656,7 @@ as given by # finally compute the average wave speed and set the output velocity # Ignore orientation since it is always "1" in 1D c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) + a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) return v1_roe, c_f_roe @@ -671,7 +671,7 @@ end 1 / 2 * (cons[6]^2 + cons[7]^2 + cons[8]^2)) # Thermodynamic entropy - s = log(p) - equations.gamma * log(cons[1]) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index 43d1991e34b..9b80c26fe24 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -1046,7 +1046,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = log(p) - equations.gamma * log(rho) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1139,17 +1139,17 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = sqrt(rho) + sqrt_rho = NaNMath.sqrt(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end @@ -1164,7 +1164,7 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = sqrt(rho) + sqrt_rho = NaNMath.sqrt(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho @@ -1175,7 +1175,7 @@ end b2 * normal_direction[2])^2 / norm_squared c_f = sqrt((0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * norm_squared) return c_f end @@ -1217,8 +1217,8 @@ as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -1247,13 +1247,13 @@ as given by # finally compute the average wave speed and set the output velocity (depends on orientation) if orientation == 1 # x-direction c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = NaNMath.sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe else # y-direction c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe @@ -1289,8 +1289,8 @@ end p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -1324,7 +1324,7 @@ end B2_roe * normal_direction[2])^2 / norm_squared c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) + a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + v2_roe * normal_direction[2]) @@ -1343,7 +1343,7 @@ end 1 / 2 * cons[9]^2) # Thermodynamic entropy - s = log(p) - equations.gamma * log(cons[1]) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 321e501b051..0fb03e1dcfd 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -967,7 +967,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = log(p) - equations.gamma * log(rho) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1032,20 +1032,20 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = sqrt(rho) + sqrt_rho = NaNMath.sqrt(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) elseif orientation == 2 # y-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) else # z-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b3^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b3^2)) end return c_f end @@ -1060,7 +1060,7 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = sqrt(rho) + sqrt_rho = NaNMath.sqrt(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho @@ -1073,7 +1073,7 @@ end b3 * normal_direction[3])^2 / norm_squared c_f = sqrt((0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * norm_squared) return c_f end @@ -1114,8 +1114,8 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -1144,19 +1144,19 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by # finally compute the average wave speed and set the output velocity (depends on orientation) if orientation == 1 # x-direction c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe elseif orientation == 2 # y-direction c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe else # z-direction c_a_roe = B3_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v3_roe @@ -1192,8 +1192,8 @@ end p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = NaNMath.sqrt(rho_ll) + sqrt_rho_rr = NaNMath.sqrt(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -1229,7 +1229,7 @@ end B3_roe * normal_direction[3])^2 / norm_squared c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) + a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + @@ -1249,7 +1249,7 @@ end 1 / 2 * cons[9]^2) # Thermodynamic entropy - s = log(p) - equations.gamma * log(cons[1]) + s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index dad7c27e86c..cc051f5f873 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -423,7 +423,7 @@ end v_square = v1^2 + v2^2 + v3^2 gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) - s = log(p) - gamma * log(rho) + s = NaNMath.log(p) - gamma * NaNMath.log(rho) rho_p = rho / p # Multicomponent stuff @@ -436,9 +436,9 @@ end T = (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(-1.0 * - (cv[i] * log(T) - + (cv[i] * NaNMath.log(T) - gas_constants[i] * - log(u[i + 7])) + + NaNMath.log(u[i + 7])) + gas_constants[i] + cv[i] - (v_square / (2 * T)) @@ -500,14 +500,14 @@ end gamma = totalgamma(cons, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = gamma * p / rho - sqrt_rho = sqrt(rho) + sqrt_rho = NaNMath.sqrt(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index a3a50c0485f..5dd01b0f350 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -593,7 +593,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = log(p) - gamma * log(rho) + s = NaNMath.log(p) - gamma * NaNMath.log(rho) rho_p = rho / p # Multicomponent stuff @@ -607,9 +607,9 @@ end (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(-1.0 * - (cv[i] * log(T) - + (cv[i] * NaNMath.log(T) - gas_constants[i] * - log(u[i + 8])) + + NaNMath.log(u[i + 8])) + gas_constants[i] + cv[i] - (v_square / (2 * T)) @@ -664,17 +664,17 @@ end p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) a_square = gamma * p / rho - sqrt_rho = sqrt(rho) + sqrt_rho = NaNMath.sqrt(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 if direction == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end diff --git a/src/equations/polytropic_euler_2d.jl b/src/equations/polytropic_euler_2d.jl index f5d2f7b0bad..5e593739043 100644 --- a/src/equations/polytropic_euler_2d.jl +++ b/src/equations/polytropic_euler_2d.jl @@ -241,8 +241,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - lambda_min = v_normal_ll - sqrt(equations.gamma * p_ll / rho_ll) * norm_ - lambda_max = v_normal_rr + sqrt(equations.gamma * p_rr / rho_rr) * norm_ + lambda_min = v_normal_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ + lambda_max = v_normal_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ return lambda_min, lambda_max end @@ -256,8 +256,8 @@ end p_ll = equations.kappa * rho_ll^equations.gamma p_rr = equations.kappa * rho_rr^equations.gamma - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -281,8 +281,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -296,7 +296,7 @@ end @inline function max_abs_speeds(u, equations::PolytropicEulerEquations2D) rho, v1, v2 = cons2prim(u, equations) - c = sqrt(equations.gamma * equations.kappa * rho^(equations.gamma - 1)) + c = NaNMath.sqrt(equations.gamma * equations.kappa * rho^(equations.gamma - 1)) return abs(v1) + c, abs(v2) + c end @@ -321,7 +321,7 @@ end p = pressure(u, equations) # Form of the internal energy depends on gas type if equations.gamma == 1.0 # isothermal gas - internal_energy = equations.kappa * log(rho) + internal_energy = equations.kappa * NaNMath.log(rho) else # equations.gamma > 1 # polytropic gas internal_energy = equations.kappa * rho^(equations.gamma - 1) / (equations.gamma - 1.0) diff --git a/src/equations/shallow_water_1d.jl b/src/equations/shallow_water_1d.jl index 25ce0fa79fe..2bcc39c5aa0 100644 --- a/src/equations/shallow_water_1d.jl +++ b/src/equations/shallow_water_1d.jl @@ -593,8 +593,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = sqrt(equations.gravity * h_ll) - c_rr = sqrt(equations.gravity * h_rr) + c_ll = NaNMath.sqrt(equations.gravity * h_ll) + c_rr = NaNMath.sqrt(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -640,8 +640,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - λ_min = v_ll - sqrt(equations.gravity * h_ll) - λ_max = v_rr + sqrt(equations.gravity * h_rr) + λ_min = v_ll - NaNMath.sqrt(equations.gravity * h_ll) + λ_max = v_rr + NaNMath.sqrt(equations.gravity * h_rr) return λ_min, λ_max end @@ -670,8 +670,8 @@ Further details on this hydrostatic reconstruction and its motivation can be fou h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - a_ll = sqrt(equations.gravity * h_ll) - a_rr = sqrt(equations.gravity * h_rr) + a_ll = NaNMath.sqrt(equations.gravity * h_ll) + a_rr = NaNMath.sqrt(equations.gravity * h_rr) λ_min = min(v_ll - a_ll, v_rr - a_rr, zero(eltype(u_ll))) λ_max = max(v_ll + a_ll, v_rr + a_rr, zero(eltype(u_ll))) @@ -687,8 +687,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - c_ll = sqrt(equations.gravity * h_ll) - c_rr = sqrt(equations.gravity * h_rr) + c_ll = NaNMath.sqrt(equations.gravity * h_ll) + c_rr = NaNMath.sqrt(equations.gravity * h_rr) λ_min = min(v_ll - c_ll, v_rr - c_rr) λ_max = max(v_ll + c_ll, v_rr + c_rr) @@ -703,8 +703,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - c_ll = sqrt(equations.gravity * h_ll) - c_rr = sqrt(equations.gravity * h_rr) + c_ll = NaNMath.sqrt(equations.gravity * h_ll) + c_rr = NaNMath.sqrt(equations.gravity * h_rr) v_roe, c_roe = calc_wavespeed_roe(u_ll, u_rr, orientation, equations) @@ -718,7 +718,7 @@ end h = waterheight(u, equations) v = velocity(u, equations) - c = equations.gravity * sqrt(h) + c = equations.gravity * NaNMath.sqrt(h) return (abs(v) + c,) end @@ -806,10 +806,10 @@ Or equation (9.17) in [this lecture notes](https://metaphor.ethz.ch/x/2019/hs/40 v_rr = velocity(u_rr, equations) h_roe = 0.5 * (h_ll + h_rr) - c_roe = sqrt(equations.gravity * h_roe) + c_roe = NaNMath.sqrt(equations.gravity * h_roe) - h_ll_sqrt = sqrt(h_ll) - h_rr_sqrt = sqrt(h_rr) + h_ll_sqrt = NaNMath.sqrt(h_ll) + h_rr_sqrt = NaNMath.sqrt(h_rr) v_roe = (h_ll_sqrt * v_ll + h_rr_sqrt * v_rr) / (h_ll_sqrt + h_rr_sqrt) diff --git a/src/equations/shallow_water_2d.jl b/src/equations/shallow_water_2d.jl index e75c92a27d0..5023d268067 100644 --- a/src/equations/shallow_water_2d.jl +++ b/src/equations/shallow_water_2d.jl @@ -922,8 +922,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = sqrt(equations.gravity * h_ll) - c_rr = sqrt(equations.gravity * h_rr) + c_ll = NaNMath.sqrt(equations.gravity * h_ll) + c_rr = NaNMath.sqrt(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -939,8 +939,8 @@ end # Compute the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = sqrt(equations.gravity * h_ll) - c_rr = sqrt(equations.gravity * h_rr) + c_ll = NaNMath.sqrt(equations.gravity * h_ll) + c_rr = NaNMath.sqrt(equations.gravity * h_rr) # The normal velocities are already scaled by the norm return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) @@ -988,11 +988,11 @@ end v1_rr, v2_rr = velocity(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - sqrt(equations.gravity * h_ll) - λ_max = v1_rr + sqrt(equations.gravity * h_rr) + λ_min = v1_ll - NaNMath.sqrt(equations.gravity * h_ll) + λ_max = v1_rr + NaNMath.sqrt(equations.gravity * h_rr) else # y-direction - λ_min = v2_ll - sqrt(equations.gravity * h_ll) - λ_max = v2_rr + sqrt(equations.gravity * h_rr) + λ_min = v2_ll - NaNMath.sqrt(equations.gravity * h_ll) + λ_max = v2_rr + NaNMath.sqrt(equations.gravity * h_rr) end return λ_min, λ_max @@ -1010,8 +1010,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - sqrt(equations.gravity * h_ll) * norm_ - λ_max = v_normal_rr + sqrt(equations.gravity * h_rr) * norm_ + λ_min = v_normal_ll - NaNMath.sqrt(equations.gravity * h_ll) * norm_ + λ_max = v_normal_rr + NaNMath.sqrt(equations.gravity * h_rr) * norm_ return λ_min, λ_max end @@ -1042,8 +1042,8 @@ the reference below. The definition of the wave speeds are given in Equation (2. h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - a_ll = sqrt(equations.gravity * h_ll) - a_rr = sqrt(equations.gravity * h_rr) + a_ll = NaNMath.sqrt(equations.gravity * h_ll) + a_rr = NaNMath.sqrt(equations.gravity * h_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - a_ll, v1_rr - a_rr, zero(eltype(u_ll))) @@ -1068,8 +1068,8 @@ end norm_ = norm(normal_direction) - a_ll = sqrt(equations.gravity * h_ll) * norm_ - a_rr = sqrt(equations.gravity * h_rr) * norm_ + a_ll = NaNMath.sqrt(equations.gravity * h_ll) * norm_ + a_rr = NaNMath.sqrt(equations.gravity * h_rr) * norm_ λ_min = min(v_normal_ll - a_ll, v_normal_rr - a_rr, zero(eltype(u_ll))) λ_max = max(v_normal_ll + a_ll, v_normal_rr + a_rr, zero(eltype(u_ll))) @@ -1085,8 +1085,8 @@ end h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - c_ll = sqrt(equations.gravity * h_ll) - c_rr = sqrt(equations.gravity * h_rr) + c_ll = NaNMath.sqrt(equations.gravity * h_ll) + c_rr = NaNMath.sqrt(equations.gravity * h_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1107,8 +1107,8 @@ end v1_rr, v2_rr = velocity(u_rr, equations) norm_ = norm(normal_direction) - c_ll = sqrt(equations.gravity * h_ll) * norm_ - c_rr = sqrt(equations.gravity * h_rr) * norm_ + c_ll = NaNMath.sqrt(equations.gravity * h_ll) * norm_ + c_rr = NaNMath.sqrt(equations.gravity * h_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -1127,8 +1127,8 @@ end h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - c_ll = sqrt(equations.gravity * h_ll) - c_rr = sqrt(equations.gravity * h_rr) + c_ll = NaNMath.sqrt(equations.gravity * h_ll) + c_rr = NaNMath.sqrt(equations.gravity * h_rr) if orientation == 1 # x-direction v_roe, c_roe = calc_wavespeed_roe(u_ll, u_rr, orientation, equations) @@ -1152,8 +1152,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt(equations.gravity * h_ll) * norm_ - c_rr = sqrt(equations.gravity * h_rr) * norm_ + c_ll = NaNMath.sqrt(equations.gravity * h_ll) * norm_ + c_rr = NaNMath.sqrt(equations.gravity * h_rr) * norm_ v_normal_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2]) v_normal_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2]) @@ -1169,7 +1169,7 @@ end h = waterheight(u, equations) v1, v2 = velocity(u, equations) - c = equations.gravity * sqrt(h) + c = equations.gravity * NaNMath.sqrt(h) return abs(v1) + c, abs(v2) + c end @@ -1260,10 +1260,10 @@ slides 8 and 9. v1_rr, v2_rr = velocity(u_rr, equations) h_roe = 0.5 * (h_ll + h_rr) - c_roe = sqrt(equations.gravity * h_roe) + c_roe = NaNMath.sqrt(equations.gravity * h_roe) - h_ll_sqrt = sqrt(h_ll) - h_rr_sqrt = sqrt(h_rr) + h_ll_sqrt = NaNMath.sqrt(h_ll) + h_rr_sqrt = NaNMath.sqrt(h_rr) if orientation == 1 # x-direction v_roe = (h_ll_sqrt * v1_ll + h_rr_sqrt * v1_rr) / (h_ll_sqrt + h_rr_sqrt) @@ -1284,10 +1284,10 @@ end norm_ = norm(normal_direction) h_roe = 0.5 * (h_ll + h_rr) - c_roe = sqrt(equations.gravity * h_roe) * norm_ + c_roe = NaNMath.sqrt(equations.gravity * h_roe) * norm_ - h_ll_sqrt = sqrt(h_ll) - h_rr_sqrt = sqrt(h_rr) + h_ll_sqrt = NaNMath.sqrt(h_ll) + h_rr_sqrt = NaNMath.sqrt(h_rr) v1_roe = (h_ll_sqrt * v1_ll + h_rr_sqrt * v1_rr) / (h_ll_sqrt + h_rr_sqrt) v2_roe = (h_ll_sqrt * v2_ll + h_rr_sqrt * v2_rr) / (h_ll_sqrt + h_rr_sqrt) diff --git a/src/equations/shallow_water_quasi_1d.jl b/src/equations/shallow_water_quasi_1d.jl index d3935f0e75f..6ee8ebadbbc 100644 --- a/src/equations/shallow_water_quasi_1d.jl +++ b/src/equations/shallow_water_quasi_1d.jl @@ -215,8 +215,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = sqrt(equations.gravity * h_ll) - c_rr = sqrt(equations.gravity * h_rr) + c_ll = NaNMath.sqrt(equations.gravity * h_ll) + c_rr = NaNMath.sqrt(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -236,7 +236,7 @@ end h = waterheight(u, equations) v = velocity(u, equations) - c = equations.gravity * sqrt(h) + c = equations.gravity * NaNMath.sqrt(h) return (abs(v) + c,) end diff --git a/src/equations/shallow_water_two_layer_1d.jl b/src/equations/shallow_water_two_layer_1d.jl index 42ff393593e..2b441206b85 100644 --- a/src/equations/shallow_water_two_layer_1d.jl +++ b/src/equations/shallow_water_two_layer_1d.jl @@ -393,8 +393,8 @@ end # Calculate the wave celerity on the left and right h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = NaNMath.sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = NaNMath.sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) return (max(abs(v_m_ll) + c_ll, abs(v_m_rr) + c_rr)) end @@ -416,7 +416,7 @@ end # Calculate averaged velocity of both layers v_m = (h_v_upper + h_v_lower) / (h_upper + h_lower) - c = sqrt(equations.gravity * (h_upper + h_lower)) + c = NaNMath.sqrt(equations.gravity * (h_upper + h_lower)) return (abs(v_m) + c) end diff --git a/src/equations/shallow_water_two_layer_2d.jl b/src/equations/shallow_water_two_layer_2d.jl index a31d881f2ef..131167b5380 100644 --- a/src/equations/shallow_water_two_layer_2d.jl +++ b/src/equations/shallow_water_two_layer_2d.jl @@ -628,8 +628,8 @@ end h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = NaNMath.sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = NaNMath.sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) return (max(abs(v_m_ll), abs(v_m_rr)) + max(c_ll, c_rr)) end @@ -664,8 +664,8 @@ end h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = NaNMath.sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = NaNMath.sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) # The normal velocities are already scaled by the norm return max(abs(v_m_ll), abs(v_m_rr)) + max(c_ll, c_rr) * norm(normal_direction) @@ -693,7 +693,7 @@ end h_upper, h_lower = waterheight(u, equations) v1_upper, v2_upper, v1_lower, v2_lower = velocity(u, equations) - c = sqrt(equations.gravity * (h_upper + h_lower)) + c = NaNMath.sqrt(equations.gravity * (h_upper + h_lower)) return (max(abs(v1_m) + c, abs(v1_upper), abs(v1_lower)), max(abs(v2_m) + c, abs(v2_upper), abs(v2_lower))) end diff --git a/src/solvers/dgmulti/flux_differencing_compressible_euler.jl b/src/solvers/dgmulti/flux_differencing_compressible_euler.jl index 70a29bc73f2..747ae84ebbc 100644 --- a/src/solvers/dgmulti/flux_differencing_compressible_euler.jl +++ b/src/solvers/dgmulti/flux_differencing_compressible_euler.jl @@ -37,7 +37,7 @@ function cons2entropy!(entropy_var_values::StructArray, v2 = rho_v2 / rho v_square = v1^2 + v2^2 p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - gamma * log(rho) + s = NaNMath.log(p) - gamma * NaNMath.log(rho) rho_p = rho / p w1_values[i] = (gamma - s) * inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -121,7 +121,7 @@ function cons2entropy!(entropy_var_values::StructArray, v3 = rho_v3 / rho v_square = v1^2 + v2^2 + v3^2 p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - gamma * log(rho) + s = NaNMath.log(p) - gamma * NaNMath.log(rho) rho_p = rho / p w1_values[i] = (gamma - s) * inv_gamma_minus_one - 0.5 * rho_p * v_square diff --git a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl index 43f70da4750..93708267cc9 100644 --- a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl @@ -265,8 +265,8 @@ end u_prim[i, j, 2] = v1 u_prim[i, j, 3] = v2 u_prim[i, j, 4] = p - u_prim[i, j, 5] = log(rho) - u_prim[i, j, 6] = log(p) + u_prim[i, j, 5] = NaNMath.log(rho) + u_prim[i, j, 6] = NaNMath.log(p) end # x direction diff --git a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl index 64a3456b940..c3faa817d50 100644 --- a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl @@ -393,8 +393,8 @@ end u_prim[i, j, k, 3] = v2 u_prim[i, j, k, 4] = v3 u_prim[i, j, k, 5] = p - u_prim[i, j, k, 6] = log(rho) - u_prim[i, j, k, 7] = log(p) + u_prim[i, j, k, 6] = NaNMath.log(rho) + u_prim[i, j, k, 7] = NaNMath.log(p) end # x direction diff --git a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl index 50b1e8cb5b4..8b0d23f97d7 100644 --- a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl @@ -264,8 +264,8 @@ end u_prim[i, j, 2] = v1 u_prim[i, j, 3] = v2 u_prim[i, j, 4] = p - u_prim[i, j, 5] = log(rho) - u_prim[i, j, 6] = log(p) + u_prim[i, j, 5] = NaNMath.log(rho) + u_prim[i, j, 6] = NaNMath.log(p) end # x direction diff --git a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl index ec3647ed649..8ef92ab08a8 100644 --- a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl @@ -304,8 +304,8 @@ end u_prim[i, j, k, 3] = v2 u_prim[i, j, k, 4] = v3 u_prim[i, j, k, 5] = p - u_prim[i, j, k, 6] = log(rho) - u_prim[i, j, k, 7] = log(p) + u_prim[i, j, k, 6] = NaNMath.log(rho) + u_prim[i, j, k, 7] = NaNMath.log(p) end # x direction From 291b916d5fdc2996df0241edff2470db8cfcf649 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 12 Dec 2023 17:51:49 +0100 Subject: [PATCH 02/55] performance measurements --- examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl | 11 +++-------- src/equations/compressible_euler_2d.jl | 5 ++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl index d32c2e51b06..6cf097adf82 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl @@ -35,7 +35,8 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation end initial_condition = initial_condition_blast_wave -surface_flux = flux_lax_friedrichs +#surface_flux = flux_lax_friedrichs +surface_flux = flux_hllc volume_flux = flux_ranocha basis = LobattoLegendreBasis(3) indicator_sc = IndicatorHennemannGassner(equations, basis, @@ -69,11 +70,6 @@ analysis_callback = AnalysisCallback(semi, interval = analysis_interval) alive_callback = AliveCallback(analysis_interval = analysis_interval) -save_solution = SaveSolutionCallback(interval = 100, - save_initial_solution = true, - save_final_solution = true, - solution_variables = cons2prim) - amr_indicator = IndicatorHennemannGassner(semi, alpha_max = 0.5, alpha_min = 0.001, @@ -90,8 +86,7 @@ amr_callback = AMRCallback(semi, amr_controller, stepsize_callback = StepsizeCallback(cfl = 0.9) callbacks = CallbackSet(summary_callback, - analysis_callback, alive_callback, - save_solution, + alive_callback, amr_callback, stepsize_callback) ############################################################################### diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 55a0e085cca..1fd59af9d26 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -615,6 +615,7 @@ See also """ @inline function flux_ranocha(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations2D) + @trixi_timeit timer() "flux_ranocha" begin # Unpack left and right state rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) @@ -647,7 +648,7 @@ See also (velocity_square_avg + inv_rho_p_mean * equations.inv_gamma_minus_one) + 0.5 * (p_ll * v2_rr + p_rr * v2_ll) end - + end return SVector(f1, f2, f3, f4) end @@ -1158,6 +1159,7 @@ Signal speeds: [DOI: 10.1137/S1064827593260140](https://doi.org/10.1137/S1064827 """ function flux_hllc(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations2D) + @trixi_timeit timer() "flux_hllc" begin # Calculate primitive variables and speed of sound rho_ll, rho_v1_ll, rho_v2_ll, rho_e_ll = u_ll rho_rr, rho_v1_rr, rho_v2_rr, rho_e_rr = u_rr @@ -1249,6 +1251,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, f4 = f_rr[4] + Ssr * (UStar4 - rho_e_rr) end end + end return SVector(f1, f2, f3, f4) end From 0b68235800330c2e6ea2d37eb7e87e2da0fa22ec Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 12 Dec 2023 20:37:31 +0100 Subject: [PATCH 03/55] implement log myself --- src/auxiliary/math.jl | 8 ++++++-- src/equations/compressible_euler_1d.jl | 4 ++-- src/equations/compressible_euler_2d.jl | 4 ++-- src/equations/compressible_euler_3d.jl | 4 ++-- src/equations/compressible_euler_multicomponent_1d.jl | 2 +- src/equations/compressible_euler_multicomponent_2d.jl | 2 +- src/equations/ideal_glm_mhd_1d.jl | 4 ++-- src/equations/ideal_glm_mhd_2d.jl | 4 ++-- src/equations/ideal_glm_mhd_3d.jl | 4 ++-- src/equations/ideal_glm_mhd_multicomponent_1d.jl | 6 +++--- src/equations/ideal_glm_mhd_multicomponent_2d.jl | 6 +++--- src/equations/polytropic_euler_2d.jl | 2 +- .../dgmulti/flux_differencing_compressible_euler.jl | 4 ++-- src/solvers/dgsem_structured/dg_2d_compressible_euler.jl | 4 ++-- src/solvers/dgsem_structured/dg_3d_compressible_euler.jl | 4 ++-- src/solvers/dgsem_tree/dg_2d_compressible_euler.jl | 4 ++-- src/solvers/dgsem_tree/dg_3d_compressible_euler.jl | 4 ++-- 17 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index f1a8ea0f0b7..c68e8ad4c22 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,6 +5,10 @@ @muladd begin #! format: noindent +# < 0 suffices since log(0) = -Inf +log_(x::T) where {T<:AbstractFloat} = x < 0.0 ? T(NaN) : Base.log(x) +log_(x::Real) = log(float(x)) + """ ln_mean(x, y) @@ -59,7 +63,7 @@ Given ε = 1.0e-4, we use the following algorithm. if f2 < epsilon_f2 return (x + y) / @evalpoly(f2, 2, 2/3, 2/5, 2/7) else - return (y - x) / NaNMath.log(y / x) + return (y - x) / log_(y / x) end end @@ -79,7 +83,7 @@ multiplication. if f2 < epsilon_f2 return @evalpoly(f2, 2, 2/3, 2/5, 2/7) / (x + y) else - return NaNMath.log(y / x) / (y - x) + return log_(y / x) / (y - x) end end diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index de61e8ace6b..b4042f05c35 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -887,7 +887,7 @@ end v1 = rho_v1 / rho v_square = v1^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) + s = log_(p) - equations.gamma * log_(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -951,7 +951,7 @@ end p = (equations.gamma - 1) * (cons[3] - 1 / 2 * (cons[2]^2) / cons[1]) # Thermodynamic entropy - s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) + s = log_(p) - equations.gamma * log_(cons[1]) return s end diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 1fd59af9d26..2b66433974b 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1396,7 +1396,7 @@ end v2 = rho_v2 / rho v_square = v1^2 + v2^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) + s = log_(p) - equations.gamma * log_(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1486,7 +1486,7 @@ end p = (equations.gamma - 1) * (cons[4] - 1 / 2 * (cons[2]^2 + cons[3]^2) / cons[1]) # Thermodynamic entropy - s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) + s = log_(p) - equations.gamma * log_(cons[1]) return s end diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 47cdbe8b692..5831a09a4af 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1473,7 +1473,7 @@ end v3 = rho_v3 / rho v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) + s = log_(p) - equations.gamma * log_(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1546,7 +1546,7 @@ end p = pressure(u, equations) # Thermodynamic entropy - s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) + s = log_(p) - equations.gamma * log_(rho) return s end diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index e1ba067025a..dcb1ec13a69 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -477,7 +477,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = NaNMath.log(p) - gamma * NaNMath.log(rho) - log(gas_constant) + s = log_(p) - gamma * log_(rho) - log(gas_constant) rho_p = rho / p T = (rho_e - 0.5 * rho * v_square) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(gas_constant * diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index 619ce30c718..e49b7de24e4 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -662,7 +662,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = NaNMath.log(p) - gamma * NaNMath.log(rho) - log(gas_constant) + s = log_(p) - gamma * log_(rho) - log(gas_constant) rho_p = rho / p T = (rho_e - 0.5 * rho * v_square) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(gas_constant * diff --git a/src/equations/ideal_glm_mhd_1d.jl b/src/equations/ideal_glm_mhd_1d.jl index c7f68694d22..c52521a4a29 100644 --- a/src/equations/ideal_glm_mhd_1d.jl +++ b/src/equations/ideal_glm_mhd_1d.jl @@ -518,7 +518,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) - s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) + s = log_(p) - equations.gamma * log_(rho) rho_p = rho / p w1 = (equations.gamma - s) / (equations.gamma - 1) - 0.5 * rho_p * v_square @@ -671,7 +671,7 @@ end 1 / 2 * (cons[6]^2 + cons[7]^2 + cons[8]^2)) # Thermodynamic entropy - s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) + s = log_(p) - equations.gamma * log_(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index 9b80c26fe24..463b5c2079f 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -1046,7 +1046,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) + s = log_(p) - equations.gamma * log_(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1343,7 +1343,7 @@ end 1 / 2 * cons[9]^2) # Thermodynamic entropy - s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) + s = log_(p) - equations.gamma * log_(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 0fb03e1dcfd..6523692d1fc 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -967,7 +967,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = NaNMath.log(p) - equations.gamma * NaNMath.log(rho) + s = log_(p) - equations.gamma * log_(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1249,7 +1249,7 @@ end 1 / 2 * cons[9]^2) # Thermodynamic entropy - s = NaNMath.log(p) - equations.gamma * NaNMath.log(cons[1]) + s = log_(p) - equations.gamma * log_(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index cc051f5f873..6630d8d085a 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -423,7 +423,7 @@ end v_square = v1^2 + v2^2 + v3^2 gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) - s = NaNMath.log(p) - gamma * NaNMath.log(rho) + s = log_(p) - gamma * log_(rho) rho_p = rho / p # Multicomponent stuff @@ -436,9 +436,9 @@ end T = (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(-1.0 * - (cv[i] * NaNMath.log(T) - + (cv[i] * log_(T) - gas_constants[i] * - NaNMath.log(u[i + 7])) + + log_(u[i + 7])) + gas_constants[i] + cv[i] - (v_square / (2 * T)) diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index 5dd01b0f350..5a13e0cb139 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -593,7 +593,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = NaNMath.log(p) - gamma * NaNMath.log(rho) + s = log_(p) - gamma * log_(rho) rho_p = rho / p # Multicomponent stuff @@ -607,9 +607,9 @@ end (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(-1.0 * - (cv[i] * NaNMath.log(T) - + (cv[i] * log_(T) - gas_constants[i] * - NaNMath.log(u[i + 8])) + + log_(u[i + 8])) + gas_constants[i] + cv[i] - (v_square / (2 * T)) diff --git a/src/equations/polytropic_euler_2d.jl b/src/equations/polytropic_euler_2d.jl index 5e593739043..ae171ad35f3 100644 --- a/src/equations/polytropic_euler_2d.jl +++ b/src/equations/polytropic_euler_2d.jl @@ -321,7 +321,7 @@ end p = pressure(u, equations) # Form of the internal energy depends on gas type if equations.gamma == 1.0 # isothermal gas - internal_energy = equations.kappa * NaNMath.log(rho) + internal_energy = equations.kappa * log_(rho) else # equations.gamma > 1 # polytropic gas internal_energy = equations.kappa * rho^(equations.gamma - 1) / (equations.gamma - 1.0) diff --git a/src/solvers/dgmulti/flux_differencing_compressible_euler.jl b/src/solvers/dgmulti/flux_differencing_compressible_euler.jl index 747ae84ebbc..8432c518cd5 100644 --- a/src/solvers/dgmulti/flux_differencing_compressible_euler.jl +++ b/src/solvers/dgmulti/flux_differencing_compressible_euler.jl @@ -37,7 +37,7 @@ function cons2entropy!(entropy_var_values::StructArray, v2 = rho_v2 / rho v_square = v1^2 + v2^2 p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = NaNMath.log(p) - gamma * NaNMath.log(rho) + s = log_(p) - gamma * log_(rho) rho_p = rho / p w1_values[i] = (gamma - s) * inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -121,7 +121,7 @@ function cons2entropy!(entropy_var_values::StructArray, v3 = rho_v3 / rho v_square = v1^2 + v2^2 + v3^2 p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = NaNMath.log(p) - gamma * NaNMath.log(rho) + s = log_(p) - gamma * log_(rho) rho_p = rho / p w1_values[i] = (gamma - s) * inv_gamma_minus_one - 0.5 * rho_p * v_square diff --git a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl index 93708267cc9..2b2b9bef436 100644 --- a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl @@ -265,8 +265,8 @@ end u_prim[i, j, 2] = v1 u_prim[i, j, 3] = v2 u_prim[i, j, 4] = p - u_prim[i, j, 5] = NaNMath.log(rho) - u_prim[i, j, 6] = NaNMath.log(p) + u_prim[i, j, 5] = log_(rho) + u_prim[i, j, 6] = log_(p) end # x direction diff --git a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl index c3faa817d50..ef3c70e11cb 100644 --- a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl @@ -393,8 +393,8 @@ end u_prim[i, j, k, 3] = v2 u_prim[i, j, k, 4] = v3 u_prim[i, j, k, 5] = p - u_prim[i, j, k, 6] = NaNMath.log(rho) - u_prim[i, j, k, 7] = NaNMath.log(p) + u_prim[i, j, k, 6] = log_(rho) + u_prim[i, j, k, 7] = log_(p) end # x direction diff --git a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl index 8b0d23f97d7..123fdef9c74 100644 --- a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl @@ -264,8 +264,8 @@ end u_prim[i, j, 2] = v1 u_prim[i, j, 3] = v2 u_prim[i, j, 4] = p - u_prim[i, j, 5] = NaNMath.log(rho) - u_prim[i, j, 6] = NaNMath.log(p) + u_prim[i, j, 5] = log_(rho) + u_prim[i, j, 6] = log_(p) end # x direction diff --git a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl index 8ef92ab08a8..2dd23f47439 100644 --- a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl @@ -304,8 +304,8 @@ end u_prim[i, j, k, 3] = v2 u_prim[i, j, k, 4] = v3 u_prim[i, j, k, 5] = p - u_prim[i, j, k, 6] = NaNMath.log(rho) - u_prim[i, j, k, 7] = NaNMath.log(p) + u_prim[i, j, k, 6] = log_(rho) + u_prim[i, j, k, 7] = log_(p) end # x direction From dc839f700607caf4eca4221278a2580eeba1a94f Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 13 Dec 2023 18:19:57 +0100 Subject: [PATCH 04/55] Try out different log implementation --- src/auxiliary/math.jl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index c68e8ad4c22..793ec17a0f0 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,9 +5,18 @@ @muladd begin #! format: noindent + # < 0 suffices since log(0) = -Inf -log_(x::T) where {T<:AbstractFloat} = x < 0.0 ? T(NaN) : Base.log(x) -log_(x::Real) = log(float(x)) +#log_(x::T) where {T<:AbstractFloat} = x < 0.0 ? T(NaN) : Base.log(x) +#log_(x::Real) = log(float(x)) # Not sure if this is needed + + +function log_(x::AbstractFloat) + if x < 0 + return convert(typeof(x), NaN) + end + return Base.log(x) +end """ ln_mean(x, y) From 9f3be79a82b4961cdc8ceb7e945f9e44b928a424 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 18 Dec 2023 15:26:08 +0100 Subject: [PATCH 05/55] remove NaNMath, own implementation --- Project.toml | 1 - src/Trixi.jl | 2 - src/auxiliary/math.jl | 12 +-- src/callbacks_step/averaging_dg2d.jl | 4 +- src/equations/compressible_euler_1d.jl | 50 +++++------ src/equations/compressible_euler_2d.jl | 86 +++++++++---------- src/equations/compressible_euler_3d.jl | 72 ++++++++-------- .../compressible_euler_multicomponent_1d.jl | 6 +- .../compressible_euler_multicomponent_2d.jl | 6 +- src/equations/hyperbolic_diffusion_1d.jl | 4 +- src/equations/hyperbolic_diffusion_2d.jl | 12 +-- src/equations/hyperbolic_diffusion_3d.jl | 6 +- src/equations/ideal_glm_mhd_1d.jl | 10 +-- src/equations/ideal_glm_mhd_2d.jl | 26 +++--- src/equations/ideal_glm_mhd_3d.jl | 28 +++--- .../ideal_glm_mhd_multicomponent_1d.jl | 4 +- .../ideal_glm_mhd_multicomponent_2d.jl | 6 +- src/equations/polytropic_euler_2d.jl | 14 +-- src/equations/shallow_water_1d.jl | 28 +++--- src/equations/shallow_water_2d.jl | 58 ++++++------- src/equations/shallow_water_quasi_1d.jl | 6 +- src/equations/shallow_water_two_layer_1d.jl | 6 +- src/equations/shallow_water_two_layer_2d.jl | 10 +-- 23 files changed, 221 insertions(+), 236 deletions(-) diff --git a/Project.toml b/Project.toml index 84ea33ec22b..1655068530d 100644 --- a/Project.toml +++ b/Project.toml @@ -17,7 +17,6 @@ LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e" LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" Octavian = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" diff --git a/src/Trixi.jl b/src/Trixi.jl index 8f7d475668e..b8110cf5bdd 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -88,8 +88,6 @@ import SummationByPartsOperators: integrate, semidiscretize, Quad, Hex, Tet, Wedge using StartUpDG: RefElemData, MeshData, AbstractElemShape -import NaNMath - # TODO: include_optimized # This should be used everywhere (except to `include("interpolations.jl")`) # once the upstream issue https://github.com/timholy/Revise.jl/issues/634 diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 793ec17a0f0..5801955342b 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,18 +5,10 @@ @muladd begin #! format: noindent - +sqrt_(x::T) where {T<:AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) # < 0 suffices since log(0) = -Inf -#log_(x::T) where {T<:AbstractFloat} = x < 0.0 ? T(NaN) : Base.log(x) -#log_(x::Real) = log(float(x)) # Not sure if this is needed - +log_(x::T) where {T<:AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.log(x) -function log_(x::AbstractFloat) - if x < 0 - return convert(typeof(x), NaN) - end - return Base.log(x) -end """ ln_mean(x, y) diff --git a/src/callbacks_step/averaging_dg2d.jl b/src/callbacks_step/averaging_dg2d.jl index 7999c999ba5..d6f4b300e6e 100644 --- a/src/callbacks_step/averaging_dg2d.jl +++ b/src/callbacks_step/averaging_dg2d.jl @@ -68,8 +68,8 @@ function calc_mean_values!(mean_values, averaging_callback_cache, u, u_prev, rho, v1, v2, p = u_node_prim rho_prev, v1_prev, v2_prev, p_prev = u_prev_node_prim - c = NaNMath.sqrt(equations.gamma * p / rho) - c_prev = NaNMath.sqrt(equations.gamma * p_prev / rho_prev) + c = sqrt_(equations.gamma * p / rho) + c_prev = sqrt_(equations.gamma * p_prev / rho_prev) # Calculate the contribution to the mean values using the trapezoidal rule vorticity_mean[i, j, element] += integration_constant * diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index b4042f05c35..cc728e0fef4 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -230,7 +230,7 @@ are available in the paper: # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = NaNMath.sqrt(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = sqrt_(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -240,7 +240,7 @@ are available in the paper: B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + NaNMath.sqrt(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + sqrt_(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -449,7 +449,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) lambda1 = v1 lambda2 = v1 + a @@ -475,7 +475,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) lambda1 = v1 lambda2 = v1 + a @@ -544,7 +544,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -566,7 +566,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -632,7 +632,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -659,7 +659,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -690,11 +690,11 @@ end v1_ll = rho_v1_ll / rho_ll v_mag_ll = abs(v1_ll) p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * v_mag_ll^2) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v_mag_rr = abs(v1_rr) p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * v_mag_rr^2) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) λ_max = max(v_mag_ll, v_mag_rr) + max(c_ll, c_rr) end @@ -705,8 +705,8 @@ end rho_ll, v1_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, p_rr = cons2prim(u_rr, equations) - λ_min = v1_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + sqrt_(equations.gamma * p_rr / rho_rr) return λ_min, λ_max end @@ -717,8 +717,8 @@ end rho_ll, v1_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, p_rr = cons2prim(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) λ_min = min(v1_ll - c_ll, v1_rr - c_rr) λ_max = max(v1_ll + c_ll, v1_rr + c_rr) @@ -742,20 +742,20 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, v1_ll = rho_v1_ll / rho_ll e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * v1_ll^2) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * v1_rr^2) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr vel_L = v1_ll vel_R = v1_rr @@ -764,7 +764,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - ekin_roe)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) @@ -833,22 +833,22 @@ Compactly summarized: # `u_ll[3]` is total energy `rho_e_ll` on the left H_ll = (u_ll[3] + p_ll) / rho_ll - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # `u_rr[3]` is total energy `rho_e_rr` on the right H_rr = (u_rr[3] + p_rr) / rho_rr - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v_roe = (sqrt_rho_ll * v_ll + sqrt_rho_rr * v_rr) * inv_sum_sqrt_rho v_roe_mag = v_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -865,7 +865,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 1 / 2 * rho * v1^2) - c = NaNMath.sqrt(equations.gamma * p / rho) + c = sqrt_(equations.gamma * p / rho) return (abs(v1) + c,) end diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 2b66433974b..5e577baf8f7 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -308,7 +308,7 @@ Should be used together with [`UnstructuredMesh2D`](@ref). # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = NaNMath.sqrt(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = sqrt_(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -318,7 +318,7 @@ Should be used together with [`UnstructuredMesh2D`](@ref). B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + NaNMath.sqrt(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + sqrt_(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -614,8 +614,7 @@ See also [Proceedings of ICOSAHOM 2018](https://doi.org/10.1007/978-3-030-39647-3_42) """ @inline function flux_ranocha(u_ll, u_rr, orientation::Integer, - equations::CompressibleEulerEquations2D) - @trixi_timeit timer() "flux_ranocha" begin + equations::CompressibleEulerEquations2D) # Unpack left and right state rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) @@ -648,7 +647,6 @@ See also (velocity_square_avg + inv_rho_p_mean * equations.inv_gamma_minus_one) + 0.5 * (p_ll * v2_rr + p_rr * v2_ll) end - end return SVector(f1, f2, f3, f4) end @@ -720,7 +718,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -768,7 +766,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -858,7 +856,7 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho if orientation == 1 @@ -888,7 +886,7 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho if orientation == 1 @@ -944,9 +942,9 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho - lambda = 0.5 * (NaNMath.sqrt(v1^2 + v2^2) + a) + lambda = 0.5 * (sqrt_(v1^2 + v2^2) + a) if orientation == 1 #lambda = 0.5 * (abs(v1) + a) @@ -971,9 +969,9 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho - lambda = 0.5 * (NaNMath.sqrt(v1^2 + v2^2) + a) + lambda = 0.5 * (sqrt_(v1^2 + v2^2) + a) if orientation == 1 #lambda = 0.5 * (abs(v1) + a) @@ -1007,8 +1005,8 @@ end v_rr = v2_rr end # Calculate sound speeds - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -1023,12 +1021,12 @@ end v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2]) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # right v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2]) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end @@ -1040,11 +1038,11 @@ end rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + sqrt_(equations.gamma * p_rr / rho_rr) else # y-direction - λ_min = v2_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v2_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v2_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v2_rr + sqrt_(equations.gamma * p_rr / rho_rr) end return λ_min, λ_max @@ -1060,8 +1058,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ - λ_max = v_normal_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ + λ_min = v_normal_ll - sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + λ_max = v_normal_rr + sqrt_(equations.gamma * p_rr / rho_rr) * norm_ return λ_min, λ_max end @@ -1072,8 +1070,8 @@ end rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1094,8 +1092,8 @@ end norm_ = norm(normal_direction) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -1159,7 +1157,6 @@ Signal speeds: [DOI: 10.1137/S1064827593260140](https://doi.org/10.1137/S1064827 """ function flux_hllc(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations2D) - @trixi_timeit timer() "flux_hllc" begin # Calculate primitive variables and speed of sound rho_ll, rho_v1_ll, rho_v2_ll, rho_e_ll = u_ll rho_rr, rho_v1_rr, rho_v2_rr, rho_e_rr = u_rr @@ -1168,21 +1165,21 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, v2_ll = rho_v2_ll / rho_ll e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * (v1_ll^2 + v2_ll^2)) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v2_rr = rho_v2_rr / rho_rr e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * (v1_rr^2 + v2_rr^2)) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr if orientation == 1 # x-direction vel_L = v1_ll @@ -1198,7 +1195,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - ekin_roe)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) sMu_L = Ssl - vel_L @@ -1251,7 +1248,6 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, f4 = f_rr[4] + Ssr * (UStar4 - rho_e_rr) end end - end return SVector(f1, f2, f3, f4) end @@ -1278,15 +1274,15 @@ of the numerical flux. # `u_ll[4]` is total energy `rho_e_ll` on the left H_ll = (u_ll[4] + p_ll) / rho_ll - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # `u_rr[4]` is total energy `rho_e_rr` on the right H_rr = (u_rr[4] + p_rr) / rho_rr - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1294,7 +1290,7 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -1340,15 +1336,15 @@ of the numerical flux. # `u_ll[4]` is total energy `rho_e_ll` on the left H_ll = (u_ll[4] + p_ll) / rho_ll - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ # `u_rr[4]` is total energy `rho_e_rr` on the right H_rr = (u_rr[4] + p_rr) / rho_rr - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1357,7 +1353,7 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -1372,7 +1368,7 @@ end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations2D) rho, v1, v2, p = cons2prim(u, equations) - c = NaNMath.sqrt(equations.gamma * p / rho) + c = sqrt_(equations.gamma * p / rho) return abs(v1) + c, abs(v2) + c end diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 5831a09a4af..3eeb0674bf1 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -310,7 +310,7 @@ Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = NaNMath.sqrt(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = sqrt_(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -320,7 +320,7 @@ Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + NaNMath.sqrt(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + sqrt_(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -797,7 +797,7 @@ end v3 = rho_v3 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2 + rho_v3 * v3)) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -868,7 +868,7 @@ end v3 = rho_v3 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2 + rho_v3 * v3)) - a = NaNMath.sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -1044,8 +1044,8 @@ end v_rr = v3_rr end # Calculate sound speeds - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -1060,12 +1060,12 @@ end v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + v3_ll * normal_direction[3]) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # right v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + v3_rr * normal_direction[3]) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end @@ -1077,14 +1077,14 @@ end rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + sqrt_(equations.gamma * p_rr / rho_rr) elseif orientation == 2 # y-direction - λ_min = v2_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v2_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v2_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v2_rr + sqrt_(equations.gamma * p_rr / rho_rr) else # z-direction - λ_min = v3_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v3_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v3_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v3_rr + sqrt_(equations.gamma * p_rr / rho_rr) end return λ_min, λ_max @@ -1102,8 +1102,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ - λ_max = v_normal_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ + λ_min = v_normal_ll - sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + λ_max = v_normal_rr + sqrt_(equations.gamma * p_rr / rho_rr) * norm_ return λ_min, λ_max end @@ -1114,8 +1114,8 @@ end rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1139,8 +1139,8 @@ end norm_ = norm(normal_direction) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + @@ -1210,7 +1210,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * (v1_ll^2 + v2_ll^2 + v3_ll^2)) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v2_rr = rho_v2_rr / rho_rr @@ -1218,15 +1218,15 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * (v1_rr^2 + v2_rr^2 + v3_rr^2)) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr if orientation == 1 # x-direction vel_L = v1_ll @@ -1249,7 +1249,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - ekin_roe)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) sMu_L = Ssl - vel_L @@ -1344,15 +1344,15 @@ of the numerical flux. # `u_ll[5]` is total energy `rho_e_ll` on the left H_ll = (u_ll[5] + p_ll) / rho_ll - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # `u_rr[5]` is total energy `rho_e_rr` on the right H_rr = (u_rr[5] + p_rr) / rho_rr - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1361,7 +1361,7 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -1412,15 +1412,15 @@ of the numerical flux. # `u_ll[5]` is total energy `rho_e_ll` on the left H_ll = (u_ll[5] + p_ll) / rho_ll - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ # `u_rr[5]` is total energy `rho_e_rr` on the right H_rr = (u_rr[5] + p_rr) / rho_rr - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1431,7 +1431,7 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = NaNMath.sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 @@ -1446,7 +1446,7 @@ end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations3D) rho, v1, v2, v3, p = cons2prim(u, equations) - c = NaNMath.sqrt(equations.gamma * p / rho) + c = sqrt_(equations.gamma * p / rho) return abs(v1) + c, abs(v2) + c, abs(v3) + c end diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index dcb1ec13a69..e8007487994 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -400,8 +400,8 @@ end p_ll = (gamma_ll - 1) * (rho_e_ll - 1 / 2 * rho_ll * v_ll^2) p_rr = (gamma_rr - 1) * (rho_e_rr - 1 / 2 * rho_rr * v_rr^2) - c_ll = NaNMath.sqrt(gamma_ll * p_ll / rho_ll) - c_rr = NaNMath.sqrt(gamma_rr * p_rr / rho_rr) + c_ll = sqrt_(gamma_ll * p_ll / rho_ll) + c_rr = sqrt_(gamma_rr * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -415,7 +415,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 1 / 2 * rho * (v1^2)) - c = NaNMath.sqrt(gamma * p / rho) + c = sqrt_(gamma * p / rho) return (abs(v1) + c,) end diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index e49b7de24e4..351529521ca 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -558,9 +558,9 @@ end # Compute the sound speeds on the left and right p_ll = (gamma_ll - 1) * (rho_e_ll - 1 / 2 * (rho_v1_ll^2 + rho_v2_ll^2) / rho_ll) - c_ll = NaNMath.sqrt(gamma_ll * p_ll / rho_ll) + c_ll = sqrt_(gamma_ll * p_ll / rho_ll) p_rr = (gamma_rr - 1) * (rho_e_rr - 1 / 2 * (rho_v1_rr^2 + rho_v2_rr^2) / rho_rr) - c_rr = NaNMath.sqrt(gamma_rr * p_rr / rho_rr) + c_rr = sqrt_(gamma_rr * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -575,7 +575,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 1 / 2 * rho * (v1^2 + v2^2)) - c = NaNMath.sqrt(gamma * p / rho) + c = sqrt_(gamma * p / rho) return (abs(v1) + c, abs(v2) + c) end diff --git a/src/equations/hyperbolic_diffusion_1d.jl b/src/equations/hyperbolic_diffusion_1d.jl index abcf97cea4c..869b49c7979 100644 --- a/src/equations/hyperbolic_diffusion_1d.jl +++ b/src/equations/hyperbolic_diffusion_1d.jl @@ -165,13 +165,13 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations1D) - λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) + λ_max = sqrt_(equations.nu * equations.inv_Tr) end @inline have_constant_speed(::HyperbolicDiffusionEquations1D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations1D) - return NaNMath.sqrt(eq.nu * eq.inv_Tr) + return sqrt_(eq.nu * eq.inv_Tr) end # Convert conservative variables to primitive diff --git a/src/equations/hyperbolic_diffusion_2d.jl b/src/equations/hyperbolic_diffusion_2d.jl index 336bfd20243..37fa89ce15d 100644 --- a/src/equations/hyperbolic_diffusion_2d.jl +++ b/src/equations/hyperbolic_diffusion_2d.jl @@ -162,12 +162,12 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations2D) - NaNMath.sqrt(equations.nu * equations.inv_Tr) + sqrt_(equations.nu * equations.inv_Tr) end @inline function max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations::HyperbolicDiffusionEquations2D) - NaNMath.sqrt(equations.nu * equations.inv_Tr) * norm(normal_direction) + sqrt_(equations.nu * equations.inv_Tr) * norm(normal_direction) end @inline function flux_godunov(u_ll, u_rr, orientation::Integer, @@ -180,7 +180,7 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) + λ_max = sqrt_(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) if orientation == 1 # x-direction f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) @@ -203,10 +203,10 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) + λ_max = sqrt_(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) * - NaNMath.sqrt(normal_direction[1]^2 + normal_direction[2]^2) + sqrt_(normal_direction[1]^2 + normal_direction[2]^2) f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) * normal_direction[1] f3 = 1 / 2 * (f_ll[3] + f_rr[3]) - @@ -218,7 +218,7 @@ end @inline have_constant_speed(::HyperbolicDiffusionEquations2D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations2D) - λ = NaNMath.sqrt(eq.nu * eq.inv_Tr) + λ = sqrt_(eq.nu * eq.inv_Tr) return λ, λ end diff --git a/src/equations/hyperbolic_diffusion_3d.jl b/src/equations/hyperbolic_diffusion_3d.jl index c27d89c2ba6..1f8d2940e1d 100644 --- a/src/equations/hyperbolic_diffusion_3d.jl +++ b/src/equations/hyperbolic_diffusion_3d.jl @@ -170,7 +170,7 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations3D) - λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) + λ_max = sqrt_(equations.nu * equations.inv_Tr) end @inline function flux_godunov(u_ll, u_rr, orientation::Integer, @@ -183,7 +183,7 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = NaNMath.sqrt(equations.nu * equations.inv_Tr) + λ_max = sqrt_(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) if orientation == 1 # x-direction f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) @@ -205,7 +205,7 @@ end @inline have_constant_speed(::HyperbolicDiffusionEquations3D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations3D) - λ = NaNMath.sqrt(eq.nu * eq.inv_Tr) + λ = sqrt_(eq.nu * eq.inv_Tr) return λ, λ, λ end diff --git a/src/equations/ideal_glm_mhd_1d.jl b/src/equations/ideal_glm_mhd_1d.jl index c52521a4a29..98d780aed46 100644 --- a/src/equations/ideal_glm_mhd_1d.jl +++ b/src/equations/ideal_glm_mhd_1d.jl @@ -578,14 +578,14 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = equations.gamma * p / rho - sqrt_rho = NaNMath.sqrt(rho) + sqrt_rho = sqrt_(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end @@ -626,8 +626,8 @@ as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -656,7 +656,7 @@ as given by # finally compute the average wave speed and set the output velocity # Ignore orientation since it is always "1" in 1D c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) + a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) return v1_roe, c_f_roe diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index 463b5c2079f..3abe6c51303 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -1139,17 +1139,17 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = NaNMath.sqrt(rho) + sqrt_rho = sqrt_(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end @@ -1164,7 +1164,7 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = NaNMath.sqrt(rho) + sqrt_rho = sqrt_(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho @@ -1175,7 +1175,7 @@ end b2 * normal_direction[2])^2 / norm_squared c_f = sqrt((0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * norm_squared) return c_f end @@ -1217,8 +1217,8 @@ as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -1247,13 +1247,13 @@ as given by # finally compute the average wave speed and set the output velocity (depends on orientation) if orientation == 1 # x-direction c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = NaNMath.sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe else # y-direction c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe @@ -1289,8 +1289,8 @@ end p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -1324,7 +1324,7 @@ end B2_roe * normal_direction[2])^2 / norm_squared c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) + a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + v2_roe * normal_direction[2]) diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 6523692d1fc..6f8636a1278 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -1032,20 +1032,20 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = NaNMath.sqrt(rho) + sqrt_rho = sqrt_(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) elseif orientation == 2 # y-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) else # z-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b3^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b3^2)) end return c_f end @@ -1060,7 +1060,7 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = NaNMath.sqrt(rho) + sqrt_rho = sqrt_(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho @@ -1073,7 +1073,7 @@ end b3 * normal_direction[3])^2 / norm_squared c_f = sqrt((0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * norm_squared) return c_f end @@ -1114,8 +1114,8 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -1144,19 +1144,19 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by # finally compute the average wave speed and set the output velocity (depends on orientation) if orientation == 1 # x-direction c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe elseif orientation == 2 # y-direction c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe else # z-direction c_a_roe = B3_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - + a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v3_roe @@ -1192,8 +1192,8 @@ end p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = NaNMath.sqrt(rho_ll) - sqrt_rho_rr = NaNMath.sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add @@ -1229,7 +1229,7 @@ end B3_roe * normal_direction[3])^2 / norm_squared c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = NaNMath.sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) + a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index 6630d8d085a..ffca32d80ba 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -500,14 +500,14 @@ end gamma = totalgamma(cons, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = gamma * p / rho - sqrt_rho = NaNMath.sqrt(rho) + sqrt_rho = sqrt_(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index 5a13e0cb139..5ef9c0aa56b 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -664,17 +664,17 @@ end p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) a_square = gamma * p / rho - sqrt_rho = NaNMath.sqrt(rho) + sqrt_rho = sqrt_(rho) b1 = B1 / sqrt_rho b2 = B2 / sqrt_rho b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 if direction == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * NaNMath.sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end diff --git a/src/equations/polytropic_euler_2d.jl b/src/equations/polytropic_euler_2d.jl index ae171ad35f3..f0473d53a6d 100644 --- a/src/equations/polytropic_euler_2d.jl +++ b/src/equations/polytropic_euler_2d.jl @@ -241,8 +241,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - lambda_min = v_normal_ll - NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ - lambda_max = v_normal_rr + NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ + lambda_min = v_normal_ll - sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + lambda_max = v_normal_rr + sqrt_(equations.gamma * p_rr / rho_rr) * norm_ return lambda_min, lambda_max end @@ -256,8 +256,8 @@ end p_ll = equations.kappa * rho_ll^equations.gamma p_rr = equations.kappa * rho_rr^equations.gamma - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -281,8 +281,8 @@ end norm_ = norm(normal_direction) - c_ll = NaNMath.sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = NaNMath.sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -296,7 +296,7 @@ end @inline function max_abs_speeds(u, equations::PolytropicEulerEquations2D) rho, v1, v2 = cons2prim(u, equations) - c = NaNMath.sqrt(equations.gamma * equations.kappa * rho^(equations.gamma - 1)) + c = sqrt_(equations.gamma * equations.kappa * rho^(equations.gamma - 1)) return abs(v1) + c, abs(v2) + c end diff --git a/src/equations/shallow_water_1d.jl b/src/equations/shallow_water_1d.jl index 2bcc39c5aa0..d79c8fb0b65 100644 --- a/src/equations/shallow_water_1d.jl +++ b/src/equations/shallow_water_1d.jl @@ -593,8 +593,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) - c_rr = NaNMath.sqrt(equations.gravity * h_rr) + c_ll = sqrt_(equations.gravity * h_ll) + c_rr = sqrt_(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -640,8 +640,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - λ_min = v_ll - NaNMath.sqrt(equations.gravity * h_ll) - λ_max = v_rr + NaNMath.sqrt(equations.gravity * h_rr) + λ_min = v_ll - sqrt_(equations.gravity * h_ll) + λ_max = v_rr + sqrt_(equations.gravity * h_rr) return λ_min, λ_max end @@ -670,8 +670,8 @@ Further details on this hydrostatic reconstruction and its motivation can be fou h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - a_ll = NaNMath.sqrt(equations.gravity * h_ll) - a_rr = NaNMath.sqrt(equations.gravity * h_rr) + a_ll = sqrt_(equations.gravity * h_ll) + a_rr = sqrt_(equations.gravity * h_rr) λ_min = min(v_ll - a_ll, v_rr - a_rr, zero(eltype(u_ll))) λ_max = max(v_ll + a_ll, v_rr + a_rr, zero(eltype(u_ll))) @@ -687,8 +687,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) - c_rr = NaNMath.sqrt(equations.gravity * h_rr) + c_ll = sqrt_(equations.gravity * h_ll) + c_rr = sqrt_(equations.gravity * h_rr) λ_min = min(v_ll - c_ll, v_rr - c_rr) λ_max = max(v_ll + c_ll, v_rr + c_rr) @@ -703,8 +703,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) - c_rr = NaNMath.sqrt(equations.gravity * h_rr) + c_ll = sqrt_(equations.gravity * h_ll) + c_rr = sqrt_(equations.gravity * h_rr) v_roe, c_roe = calc_wavespeed_roe(u_ll, u_rr, orientation, equations) @@ -718,7 +718,7 @@ end h = waterheight(u, equations) v = velocity(u, equations) - c = equations.gravity * NaNMath.sqrt(h) + c = equations.gravity * sqrt_(h) return (abs(v) + c,) end @@ -806,10 +806,10 @@ Or equation (9.17) in [this lecture notes](https://metaphor.ethz.ch/x/2019/hs/40 v_rr = velocity(u_rr, equations) h_roe = 0.5 * (h_ll + h_rr) - c_roe = NaNMath.sqrt(equations.gravity * h_roe) + c_roe = sqrt_(equations.gravity * h_roe) - h_ll_sqrt = NaNMath.sqrt(h_ll) - h_rr_sqrt = NaNMath.sqrt(h_rr) + h_ll_sqrt = sqrt_(h_ll) + h_rr_sqrt = sqrt_(h_rr) v_roe = (h_ll_sqrt * v_ll + h_rr_sqrt * v_rr) / (h_ll_sqrt + h_rr_sqrt) diff --git a/src/equations/shallow_water_2d.jl b/src/equations/shallow_water_2d.jl index 5023d268067..4307c3ebf4c 100644 --- a/src/equations/shallow_water_2d.jl +++ b/src/equations/shallow_water_2d.jl @@ -922,8 +922,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) - c_rr = NaNMath.sqrt(equations.gravity * h_rr) + c_ll = sqrt_(equations.gravity * h_ll) + c_rr = sqrt_(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -939,8 +939,8 @@ end # Compute the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) - c_rr = NaNMath.sqrt(equations.gravity * h_rr) + c_ll = sqrt_(equations.gravity * h_ll) + c_rr = sqrt_(equations.gravity * h_rr) # The normal velocities are already scaled by the norm return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) @@ -988,11 +988,11 @@ end v1_rr, v2_rr = velocity(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - NaNMath.sqrt(equations.gravity * h_ll) - λ_max = v1_rr + NaNMath.sqrt(equations.gravity * h_rr) + λ_min = v1_ll - sqrt_(equations.gravity * h_ll) + λ_max = v1_rr + sqrt_(equations.gravity * h_rr) else # y-direction - λ_min = v2_ll - NaNMath.sqrt(equations.gravity * h_ll) - λ_max = v2_rr + NaNMath.sqrt(equations.gravity * h_rr) + λ_min = v2_ll - sqrt_(equations.gravity * h_ll) + λ_max = v2_rr + sqrt_(equations.gravity * h_rr) end return λ_min, λ_max @@ -1010,8 +1010,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - NaNMath.sqrt(equations.gravity * h_ll) * norm_ - λ_max = v_normal_rr + NaNMath.sqrt(equations.gravity * h_rr) * norm_ + λ_min = v_normal_ll - sqrt_(equations.gravity * h_ll) * norm_ + λ_max = v_normal_rr + sqrt_(equations.gravity * h_rr) * norm_ return λ_min, λ_max end @@ -1042,8 +1042,8 @@ the reference below. The definition of the wave speeds are given in Equation (2. h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - a_ll = NaNMath.sqrt(equations.gravity * h_ll) - a_rr = NaNMath.sqrt(equations.gravity * h_rr) + a_ll = sqrt_(equations.gravity * h_ll) + a_rr = sqrt_(equations.gravity * h_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - a_ll, v1_rr - a_rr, zero(eltype(u_ll))) @@ -1068,8 +1068,8 @@ end norm_ = norm(normal_direction) - a_ll = NaNMath.sqrt(equations.gravity * h_ll) * norm_ - a_rr = NaNMath.sqrt(equations.gravity * h_rr) * norm_ + a_ll = sqrt_(equations.gravity * h_ll) * norm_ + a_rr = sqrt_(equations.gravity * h_rr) * norm_ λ_min = min(v_normal_ll - a_ll, v_normal_rr - a_rr, zero(eltype(u_ll))) λ_max = max(v_normal_ll + a_ll, v_normal_rr + a_rr, zero(eltype(u_ll))) @@ -1085,8 +1085,8 @@ end h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) - c_rr = NaNMath.sqrt(equations.gravity * h_rr) + c_ll = sqrt_(equations.gravity * h_ll) + c_rr = sqrt_(equations.gravity * h_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1107,8 +1107,8 @@ end v1_rr, v2_rr = velocity(u_rr, equations) norm_ = norm(normal_direction) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) * norm_ - c_rr = NaNMath.sqrt(equations.gravity * h_rr) * norm_ + c_ll = sqrt_(equations.gravity * h_ll) * norm_ + c_rr = sqrt_(equations.gravity * h_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -1127,8 +1127,8 @@ end h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) - c_rr = NaNMath.sqrt(equations.gravity * h_rr) + c_ll = sqrt_(equations.gravity * h_ll) + c_rr = sqrt_(equations.gravity * h_rr) if orientation == 1 # x-direction v_roe, c_roe = calc_wavespeed_roe(u_ll, u_rr, orientation, equations) @@ -1152,8 +1152,8 @@ end norm_ = norm(normal_direction) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) * norm_ - c_rr = NaNMath.sqrt(equations.gravity * h_rr) * norm_ + c_ll = sqrt_(equations.gravity * h_ll) * norm_ + c_rr = sqrt_(equations.gravity * h_rr) * norm_ v_normal_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2]) v_normal_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2]) @@ -1169,7 +1169,7 @@ end h = waterheight(u, equations) v1, v2 = velocity(u, equations) - c = equations.gravity * NaNMath.sqrt(h) + c = equations.gravity * sqrt_(h) return abs(v1) + c, abs(v2) + c end @@ -1260,10 +1260,10 @@ slides 8 and 9. v1_rr, v2_rr = velocity(u_rr, equations) h_roe = 0.5 * (h_ll + h_rr) - c_roe = NaNMath.sqrt(equations.gravity * h_roe) + c_roe = sqrt_(equations.gravity * h_roe) - h_ll_sqrt = NaNMath.sqrt(h_ll) - h_rr_sqrt = NaNMath.sqrt(h_rr) + h_ll_sqrt = sqrt_(h_ll) + h_rr_sqrt = sqrt_(h_rr) if orientation == 1 # x-direction v_roe = (h_ll_sqrt * v1_ll + h_rr_sqrt * v1_rr) / (h_ll_sqrt + h_rr_sqrt) @@ -1284,10 +1284,10 @@ end norm_ = norm(normal_direction) h_roe = 0.5 * (h_ll + h_rr) - c_roe = NaNMath.sqrt(equations.gravity * h_roe) * norm_ + c_roe = sqrt_(equations.gravity * h_roe) * norm_ - h_ll_sqrt = NaNMath.sqrt(h_ll) - h_rr_sqrt = NaNMath.sqrt(h_rr) + h_ll_sqrt = sqrt_(h_ll) + h_rr_sqrt = sqrt_(h_rr) v1_roe = (h_ll_sqrt * v1_ll + h_rr_sqrt * v1_rr) / (h_ll_sqrt + h_rr_sqrt) v2_roe = (h_ll_sqrt * v2_ll + h_rr_sqrt * v2_rr) / (h_ll_sqrt + h_rr_sqrt) diff --git a/src/equations/shallow_water_quasi_1d.jl b/src/equations/shallow_water_quasi_1d.jl index 6ee8ebadbbc..8b0b82ac1b4 100644 --- a/src/equations/shallow_water_quasi_1d.jl +++ b/src/equations/shallow_water_quasi_1d.jl @@ -215,8 +215,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * h_ll) - c_rr = NaNMath.sqrt(equations.gravity * h_rr) + c_ll = sqrt_(equations.gravity * h_ll) + c_rr = sqrt_(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -236,7 +236,7 @@ end h = waterheight(u, equations) v = velocity(u, equations) - c = equations.gravity * NaNMath.sqrt(h) + c = equations.gravity * sqrt_(h) return (abs(v) + c,) end diff --git a/src/equations/shallow_water_two_layer_1d.jl b/src/equations/shallow_water_two_layer_1d.jl index 2b441206b85..38e1240c2ac 100644 --- a/src/equations/shallow_water_two_layer_1d.jl +++ b/src/equations/shallow_water_two_layer_1d.jl @@ -393,8 +393,8 @@ end # Calculate the wave celerity on the left and right h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = NaNMath.sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = sqrt_(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = sqrt_(equations.gravity * (h_upper_rr + h_lower_rr)) return (max(abs(v_m_ll) + c_ll, abs(v_m_rr) + c_rr)) end @@ -416,7 +416,7 @@ end # Calculate averaged velocity of both layers v_m = (h_v_upper + h_v_lower) / (h_upper + h_lower) - c = NaNMath.sqrt(equations.gravity * (h_upper + h_lower)) + c = sqrt_(equations.gravity * (h_upper + h_lower)) return (abs(v_m) + c) end diff --git a/src/equations/shallow_water_two_layer_2d.jl b/src/equations/shallow_water_two_layer_2d.jl index 131167b5380..c8c9a510620 100644 --- a/src/equations/shallow_water_two_layer_2d.jl +++ b/src/equations/shallow_water_two_layer_2d.jl @@ -628,8 +628,8 @@ end h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = NaNMath.sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = sqrt_(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = sqrt_(equations.gravity * (h_upper_rr + h_lower_rr)) return (max(abs(v_m_ll), abs(v_m_rr)) + max(c_ll, c_rr)) end @@ -664,8 +664,8 @@ end h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = NaNMath.sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = NaNMath.sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = sqrt_(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = sqrt_(equations.gravity * (h_upper_rr + h_lower_rr)) # The normal velocities are already scaled by the norm return max(abs(v_m_ll), abs(v_m_rr)) + max(c_ll, c_rr) * norm(normal_direction) @@ -693,7 +693,7 @@ end h_upper, h_lower = waterheight(u, equations) v1_upper, v2_upper, v1_lower, v2_lower = velocity(u, equations) - c = NaNMath.sqrt(equations.gravity * (h_upper + h_lower)) + c = sqrt_(equations.gravity * (h_upper + h_lower)) return (max(abs(v1_m) + c, abs(v1_upper), abs(v1_lower)), max(abs(v2_m) + c, abs(v2_upper), abs(v2_lower))) end From f6de17137a3d810751526b1d203bd6766d5c0c15 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 18 Dec 2023 15:38:13 +0100 Subject: [PATCH 06/55] remove unrelated --- Project.toml | 1 - examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 1655068530d..ace71a50d8b 100644 --- a/Project.toml +++ b/Project.toml @@ -19,7 +19,6 @@ MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" Octavian = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" P4est = "7d669430-f675-4ae7-b43e-fab78ec5a902" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl index 6cf097adf82..d32c2e51b06 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl @@ -35,8 +35,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation end initial_condition = initial_condition_blast_wave -#surface_flux = flux_lax_friedrichs -surface_flux = flux_hllc +surface_flux = flux_lax_friedrichs volume_flux = flux_ranocha basis = LobattoLegendreBasis(3) indicator_sc = IndicatorHennemannGassner(equations, basis, @@ -70,6 +69,11 @@ analysis_callback = AnalysisCallback(semi, interval = analysis_interval) alive_callback = AliveCallback(analysis_interval = analysis_interval) +save_solution = SaveSolutionCallback(interval = 100, + save_initial_solution = true, + save_final_solution = true, + solution_variables = cons2prim) + amr_indicator = IndicatorHennemannGassner(semi, alpha_max = 0.5, alpha_min = 0.001, @@ -86,7 +90,8 @@ amr_callback = AMRCallback(semi, amr_controller, stepsize_callback = StepsizeCallback(cfl = 0.9) callbacks = CallbackSet(summary_callback, - alive_callback, + analysis_callback, alive_callback, + save_solution, amr_callback, stepsize_callback) ############################################################################### From 829c992312e00be295779e2a416582a3f4a67275 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 18 Dec 2023 15:48:13 +0100 Subject: [PATCH 07/55] Update src/equations/compressible_euler_2d.jl --- src/equations/compressible_euler_2d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 5e577baf8f7..36e3943382d 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -614,7 +614,7 @@ See also [Proceedings of ICOSAHOM 2018](https://doi.org/10.1007/978-3-030-39647-3_42) """ @inline function flux_ranocha(u_ll, u_rr, orientation::Integer, - equations::CompressibleEulerEquations2D) + equations::CompressibleEulerEquations2D) # Unpack left and right state rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) From 83e8b1e74ce174ceb63a6c1e39d7e97673b64476 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 18 Dec 2023 15:51:14 +0100 Subject: [PATCH 08/55] NaNSqrt for quasi 1d CEE --- src/equations/compressible_euler_quasi_1d.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/equations/compressible_euler_quasi_1d.jl b/src/equations/compressible_euler_quasi_1d.jl index 0a543277ee4..c2cb8f6bdb5 100644 --- a/src/equations/compressible_euler_quasi_1d.jl +++ b/src/equations/compressible_euler_quasi_1d.jl @@ -243,13 +243,13 @@ end v1_ll = a_rho_v1_ll / a_rho_ll v_mag_ll = abs(v1_ll) p_ll = (equations.gamma - 1) * (e_ll - 0.5 * rho_ll * v_mag_ll^2) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) rho_rr = a_rho_rr / a_rr e_rr = a_e_rr / a_rr v1_rr = a_rho_v1_rr / a_rho_rr v_mag_rr = abs(v1_rr) p_rr = (equations.gamma - 1) * (e_rr - 0.5 * rho_rr * v_mag_rr^2) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) λ_max = max(v_mag_ll, v_mag_rr) + max(c_ll, c_rr) end @@ -260,7 +260,7 @@ end v1 = a_rho_v1 / a_rho e = a_e / a p = (equations.gamma - 1) * (e - 0.5 * rho * v1^2) - c = sqrt(equations.gamma * p / rho) + c = sqrt_(equations.gamma * p / rho) return (abs(v1) + c,) end From 9931e04dc8dcc9052caeddff2da2b48ab009bfd0 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 18 Dec 2023 16:06:01 +0100 Subject: [PATCH 09/55] fmt --- src/auxiliary/math.jl | 5 ++--- src/equations/ideal_glm_mhd_2d.jl | 4 ++-- src/equations/ideal_glm_mhd_3d.jl | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 5801955342b..3dbeb865fe3 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,10 +5,9 @@ @muladd begin #! format: noindent -sqrt_(x::T) where {T<:AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +sqrt_(x::T) where {T <: AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) # < 0 suffices since log(0) = -Inf -log_(x::T) where {T<:AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.log(x) - +log_(x::T) where {T <: AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.log(x) """ ln_mean(x, y) diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index 3abe6c51303..6ddf7419316 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -1248,13 +1248,13 @@ as given by if orientation == 1 # x-direction c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe else # y-direction c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe end diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 6f8636a1278..8a939f83318 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -1145,19 +1145,19 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by if orientation == 1 # x-direction c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe elseif orientation == 2 # y-direction c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe else # z-direction c_a_roe = B3_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v3_roe end From 72fdb4a0fe0e1814a50da32302dd8c5672ae5b9c Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 18 Dec 2023 16:36:25 +0100 Subject: [PATCH 10/55] Update src/auxiliary/math.jl --- src/auxiliary/math.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 3dbeb865fe3..3b87c152534 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,7 +5,8 @@ @muladd begin #! format: noindent -sqrt_(x::T) where {T <: AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +# AbstractFloat clashes with ForwardDiff.Dual +sqrt_(x::T) where {T <: Real} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) # < 0 suffices since log(0) = -Inf log_(x::T) where {T <: AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.log(x) From ea9d3948a305e2ba45a34c504e9998a44236dcf2 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 18 Dec 2023 16:37:21 +0100 Subject: [PATCH 11/55] Update src/auxiliary/math.jl --- src/auxiliary/math.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 3b87c152534..5e5c326edc2 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -8,7 +8,8 @@ # AbstractFloat clashes with ForwardDiff.Dual sqrt_(x::T) where {T <: Real} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) # < 0 suffices since log(0) = -Inf -log_(x::T) where {T <: AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.log(x) +# `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` +log_(x::T) where {T <: Real} = x < zero(x) ? oftype(x, NaN) : Base.log(x) """ ln_mean(x, y) From 8941e033112e6454093796f18a167c442b2abbb5 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 18 Dec 2023 16:37:38 +0100 Subject: [PATCH 12/55] Update src/auxiliary/math.jl --- src/auxiliary/math.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 5e5c326edc2..4ac59ca1a81 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,7 +5,7 @@ @muladd begin #! format: noindent -# AbstractFloat clashes with ForwardDiff.Dual +# `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` sqrt_(x::T) where {T <: Real} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) # < 0 suffices since log(0) = -Inf # `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` From cac51a3a25f11e7d69e5cdcffddfd415f7709101 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 19 Dec 2023 12:17:48 +0100 Subject: [PATCH 13/55] for comparison --- src/auxiliary/math.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 3dbeb865fe3..0f2e4af9610 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,9 +5,11 @@ @muladd begin #! format: noindent -sqrt_(x::T) where {T <: AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +#sqrt_(x::T) where {T <: Real} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +sqrt_(x) = Base.sqrt(x) # < 0 suffices since log(0) = -Inf -log_(x::T) where {T <: AbstractFloat} = x < zero(x) ? oftype(x, NaN) : Base.log(x) +#log_(x::T) where {T <: Real} = x < zero(x) ? oftype(x, NaN) : Base.log(x) +log_(x) = Base.log(x) """ ln_mean(x, y) From ead190b9eb923a0fab2cac97deb53e9ef6236c74 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Tue, 19 Dec 2023 17:11:28 +0100 Subject: [PATCH 14/55] Update src/auxiliary/math.jl Co-authored-by: Hendrik Ranocha --- src/auxiliary/math.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index ce5619f1147..a2d607b2264 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -6,7 +6,7 @@ #! format: noindent # `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` -sqrt_(x::T) where {T <: Real} = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) #sqrt_(x) = Base.sqrt(x) # < 0 suffices since log(0) = -Inf # `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` From d1131e65b3593f9937efa34d2ceb36c27b8948ca Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Tue, 19 Dec 2023 17:11:39 +0100 Subject: [PATCH 15/55] Update src/auxiliary/math.jl Co-authored-by: Hendrik Ranocha --- src/auxiliary/math.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index a2d607b2264..6cb1580c7ca 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -10,7 +10,7 @@ sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) #sqrt_(x) = Base.sqrt(x) # < 0 suffices since log(0) = -Inf # `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` -log_(x::T) where {T <: Real} = x < zero(x) ? oftype(x, NaN) : Base.log(x) +log_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) #log_(x) = Base.log(x) """ From 8c7efd4f7caceed51d214d33cb059c22e2261dcd Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 10 Jan 2024 14:14:38 +0100 Subject: [PATCH 16/55] llvm version log --- src/auxiliary/math.jl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 6cb1580c7ca..25950a66181 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -6,12 +6,17 @@ #! format: noindent # `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` -sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) -#sqrt_(x) = Base.sqrt(x) +#sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +@inline sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt_llvm(x) +#@inline sqrt_(x) = Base.sqrt(x) # For benchmarking + # < 0 suffices since log(0) = -Inf # `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` -log_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) -#log_(x) = Base.log(x) +@inline log_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) +# See https://github.com/JuliaLang/julia/issues/8869#issuecomment-596165947 +@inline log_(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64, ), x) +@inline log_(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32, ), x) +#@inline log_(x) = Base.log(x) # For benchmarking """ ln_mean(x, y) From 91f5d3c059c1ec1fe07a9cc4a406bee9840de213 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 10 Jan 2024 17:34:54 +0100 Subject: [PATCH 17/55] Catch ints in sqrt_ --- src/auxiliary/math.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 25950a66181..7a5d4982cb4 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -6,8 +6,9 @@ #! format: noindent # `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` -#sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) -@inline sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt_llvm(x) +@inline sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +# sqrt_llvm returns garbage for ints, prevent that from happening +@inline sqrt_(x::Union{Float64, Float32}) = Base.sqrt_llvm(x) #@inline sqrt_(x) = Base.sqrt(x) # For benchmarking # < 0 suffices since log(0) = -Inf From a9523d4fc559feaead51044ea145f97b3b57e7f1 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 10 Jan 2024 22:53:14 +0100 Subject: [PATCH 18/55] Use sqrt_ log_ everywhere --- .../elixir_shallow_water_quasi_1d.jl | 2 +- .../elixir_advection_diffusion_nonperiodic.jl | 8 +- ...lixir_euler_rayleigh_taylor_instability.jl | 2 +- .../dgmulti_2d/elixir_mhd_reflective_wall.jl | 2 +- .../elixir_navierstokes_convergence.jl | 16 +-- .../elixir_navierstokes_convergence_curved.jl | 16 +-- .../elixir_shallowwater_source_terms.jl | 2 +- .../elixir_navierstokes_convergence.jl | 8 +- .../elixir_navierstokes_convergence_curved.jl | 8 +- ...ixir_advection_amr_solution_independent.jl | 2 +- ...xir_advection_diffusion_nonperiodic_amr.jl | 8 +- ..._advection_diffusion_nonperiodic_curved.jl | 8 +- .../elixir_euler_blast_wave_amr.jl | 2 +- .../elixir_euler_double_mach_amr.jl | 2 +- examples/p4est_2d_dgsem/elixir_euler_sedov.jl | 2 +- .../p4est_2d_dgsem/elixir_mhd_alfven_wave.jl | 2 +- examples/p4est_2d_dgsem/elixir_mhd_rotor.jl | 4 +- .../elixir_navierstokes_convergence.jl | 16 +-- ...ir_navierstokes_convergence_nonperiodic.jl | 16 +-- .../elixir_shallowwater_source_terms.jl | 2 +- .../elixir_euler_baroclinic_instability.jl | 4 +- examples/p4est_3d_dgsem/elixir_euler_sedov.jl | 2 +- .../elixir_mhd_shockcapturing_amr.jl | 2 +- .../elixir_navierstokes_blast_wave_amr.jl | 2 +- .../elixir_navierstokes_convergence.jl | 8 +- ...ir_navierstokes_taylor_green_vortex_amr.jl | 2 +- .../elixir_eulergravity_sedov_blast_wave.jl | 2 +- .../elixir_advection_shockcapturing.jl | 4 +- ...lixir_euler_rayleigh_taylor_instability.jl | 2 +- .../structured_2d_dgsem/elixir_euler_sedov.jl | 2 +- .../elixir_mhd_alfven_wave.jl | 12 +-- examples/structured_2d_dgsem/elixir_mhd_ec.jl | 2 +- .../elixir_shallowwater_conical_island.jl | 4 +- .../elixir_shallowwater_parabolic_bowl.jl | 2 +- .../elixir_shallowwater_source_terms.jl | 2 +- .../structured_3d_dgsem/elixir_euler_sedov.jl | 2 +- ...ixir_advection_amr_solution_independent.jl | 2 +- .../t8code_2d_dgsem/elixir_euler_sedov.jl | 2 +- .../t8code_2d_dgsem/elixir_mhd_alfven_wave.jl | 2 +- examples/t8code_2d_dgsem/elixir_mhd_rotor.jl | 4 +- .../elixir_shallowwater_source_terms.jl | 2 +- .../elixir_mhd_ryujones_shock_tube.jl | 2 +- .../elixir_navierstokes_convergence_walls.jl | 10 +- ...ixir_navierstokes_convergence_walls_amr.jl | 10 +- ...xir_shallow_water_quasi_1d_source_terms.jl | 2 +- .../elixir_shallowwater_beach.jl | 6 +- .../elixir_shallowwater_parabolic_bowl.jl | 2 +- .../elixir_shallowwater_source_terms.jl | 2 +- ...xir_shallowwater_source_terms_dirichlet.jl | 2 +- ...lixir_shallowwater_twolayer_convergence.jl | 2 +- ..._shallowwater_well_balanced_nonperiodic.jl | 2 +- .../elixir_acoustics_gauss_wall.jl | 2 +- ...ixir_advection_amr_solution_independent.jl | 2 +- .../elixir_advection_diffusion_nonperiodic.jl | 8 +- .../tree_2d_dgsem/elixir_euler_blast_wave.jl | 2 +- .../elixir_euler_blast_wave_amr.jl | 2 +- .../elixir_euler_blast_wave_pure_fv.jl | 2 +- ...euler_blast_wave_sc_subcell_nonperiodic.jl | 2 +- .../tree_2d_dgsem/elixir_euler_blob_amr.jl | 4 +- .../tree_2d_dgsem/elixir_euler_blob_mortar.jl | 4 +- .../tree_2d_dgsem/elixir_euler_positivity.jl | 2 +- .../elixir_euler_sedov_blast_wave.jl | 2 +- ...lixir_euler_sedov_blast_wave_sc_subcell.jl | 2 +- .../elixir_euler_shockcapturing_subcell.jl | 2 +- .../tree_2d_dgsem/elixir_euler_vortex_amr.jl | 2 +- .../elixir_eulermulti_shock_bubble.jl | 2 +- ...ck_bubble_shockcapturing_subcell_minmax.jl | 2 +- ...ubble_shockcapturing_subcell_positivity.jl | 2 +- .../elixir_linearizedeuler_gauss_wall.jl | 2 +- .../tree_2d_dgsem/elixir_mhd_alfven_wave.jl | 2 +- .../elixir_mhd_alfven_wave_mortar.jl | 2 +- .../tree_2d_dgsem/elixir_mhd_blast_wave.jl | 4 +- examples/tree_2d_dgsem/elixir_mhd_rotor.jl | 4 +- .../elixir_mhd_shockcapturing_subcell.jl | 4 +- .../elixir_mhdmulti_convergence.jl | 2 +- .../tree_2d_dgsem/elixir_mhdmulti_rotor.jl | 4 +- .../elixir_navierstokes_convergence.jl | 16 +-- .../elixir_shallowwater_conical_island.jl | 4 +- .../tree_2d_dgsem/elixir_shallowwater_ec.jl | 2 +- .../elixir_shallowwater_parabolic_bowl.jl | 2 +- .../elixir_shallowwater_source_terms.jl | 2 +- ...xir_shallowwater_source_terms_dirichlet.jl | 2 +- ...lixir_shallowwater_twolayer_convergence.jl | 2 +- ...xir_shallowwater_twolayer_well_balanced.jl | 2 +- .../elixir_advection_diffusion_nonperiodic.jl | 8 +- .../tree_3d_dgsem/elixir_euler_blob_amr.jl | 4 +- .../elixir_euler_sedov_blast_wave.jl | 2 +- .../elixir_navierstokes_convergence.jl | 8 +- .../elixir_acoustics_gauss_wall.jl | 2 +- .../elixir_euler_sedov.jl | 2 +- .../unstructured_2d_dgsem/elixir_mhd_ec.jl | 4 +- .../elixir_shallowwater_ec.jl | 2 +- .../elixir_shallowwater_ec_shockcapturing.jl | 2 +- ...ixir_shallowwater_three_mound_dam_break.jl | 6 +- .../elixir_shallowwater_twolayer_dam_break.jl | 2 +- ...xir_shallowwater_twolayer_well_balanced.jl | 2 +- ...xir_shallowwater_wall_bc_shockcapturing.jl | 2 +- ext/TrixiMakieExt.jl | 2 +- src/auxiliary/mpi.jl | 4 +- src/auxiliary/special_elixirs.jl | 2 +- src/callbacks_step/analysis_dg1d.jl | 4 +- src/callbacks_step/analysis_dg2d.jl | 4 +- src/callbacks_step/analysis_dg2d_parallel.jl | 4 +- src/callbacks_step/analysis_dg3d.jl | 4 +- src/callbacks_step/analysis_dg3d_parallel.jl | 2 +- src/callbacks_step/analysis_dgmulti.jl | 4 +- src/callbacks_step/visualization.jl | 6 +- src/equations/compressible_euler_1d.jl | 2 +- src/equations/compressible_euler_2d.jl | 100 +++++++++--------- src/equations/compressible_euler_3d.jl | 92 ++++++++-------- .../compressible_euler_multicomponent_1d.jl | 10 +- .../compressible_euler_multicomponent_2d.jl | 12 +-- src/equations/ideal_glm_mhd_1d.jl | 8 +- src/equations/ideal_glm_mhd_2d.jl | 16 +-- src/equations/ideal_glm_mhd_3d.jl | 22 ++-- .../ideal_glm_mhd_multicomponent_1d.jl | 10 +- .../ideal_glm_mhd_multicomponent_2d.jl | 8 +- src/equations/lattice_boltzmann_2d.jl | 2 +- src/equations/lattice_boltzmann_3d.jl | 2 +- src/equations/polytropic_euler_2d.jl | 2 +- src/equations/shallow_water_1d.jl | 12 +-- src/equations/shallow_water_2d.jl | 14 +-- src/equations/shallow_water_quasi_1d.jl | 4 +- src/equations/shallow_water_two_layer_1d.jl | 4 +- src/equations/shallow_water_two_layer_2d.jl | 6 +- src/meshes/p4est_mesh.jl | 2 +- src/semidiscretization/semidiscretization.jl | 2 +- src/solvers/dgmulti/shock_capturing.jl | 2 +- src/solvers/dgsem/basis_lobatto_legendre.jl | 6 +- src/solvers/dgsem_tree/indicators.jl | 2 +- src/solvers/dgsem_tree/indicators_1d.jl | 2 +- src/solvers/dgsem_tree/indicators_2d.jl | 2 +- .../dgsem_unstructured/containers_2d.jl | 8 +- src/solvers/fdsbp_tree/fdsbp_1d.jl | 2 +- src/solvers/fdsbp_tree/fdsbp_2d.jl | 2 +- src/solvers/fdsbp_tree/fdsbp_3d.jl | 2 +- src/solvers/fdsbp_unstructured/fdsbp_2d.jl | 2 +- src/visualization/recipes_plots.jl | 2 +- src/visualization/utilities.jl | 2 +- test/test_dgmulti_1d.jl | 2 +- test/test_dgmulti_2d.jl | 2 +- test/test_dgmulti_3d.jl | 12 +-- test/test_mpi_tree.jl | 2 +- test/test_special_elixirs.jl | 12 +-- test/test_tree_1d.jl | 2 +- test/test_trixi.jl | 2 +- 146 files changed, 407 insertions(+), 407 deletions(-) diff --git a/examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl b/examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl index 85741f9dbd3..524275a1a62 100644 --- a/examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl +++ b/examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl @@ -19,7 +19,7 @@ dg = DGMulti(polydeg = 4, element_type = Line(), approximation_type = SBP(), cells_per_dimension = (8,) mesh = DGMultiMesh(dg, cells_per_dimension, - coordinates_min = (0.0,), coordinates_max = (sqrt(2),), + coordinates_min = (0.0,), coordinates_max = (sqrt_(2),), periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; source_terms = source_terms_convergence_test) diff --git a/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl b/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl index d2f11f18507..82bd46dabcf 100644 --- a/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl +++ b/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl @@ -18,10 +18,10 @@ equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations) function initial_condition_erikkson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # Note: this requires epsilon < 0.6 due to the sqrt - lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl b/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl index 49c8b28eaf8..2bacf9f0125 100644 --- a/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl +++ b/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl @@ -42,7 +42,7 @@ defined below. smoothed_heaviside(x, left, right) = left + 0.5 * (1 + tanh(slope * x)) * (right - left) rho = smoothed_heaviside(x[2] - 0.5, 2.0, 1.0) - c = sqrt(equations.gamma * p / rho) + c = sqrt_(equations.gamma * p / rho) # the velocity is multiplied by sin(pi*y)^6 as in Remacle et al. 2003 to ensure that the # initial condition satisfies reflective boundary conditions at the top/bottom boundaries. v = -0.025 * c * cos(8 * pi * x[1]) * sin(pi * x[2])^6 diff --git a/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl b/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl index 11670288526..050497764f5 100644 --- a/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl +++ b/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl @@ -21,7 +21,7 @@ function initial_condition_perturbation(x, t, equations::IdealGlmMhdEquations2D) # the pressure and magnetic field are chosen to be strongly # magnetized, such that p / ||B||^2 ≈ 0.01. B1 = 0.0 - B2 = 40.0 / sqrt(4.0 * pi) + B2 = 40.0 / sqrt_(4.0 * pi) B3 = 0.0 psi = 0.0 diff --git a/examples/dgmulti_2d/elixir_navierstokes_convergence.jl b/examples/dgmulti_2d/elixir_navierstokes_convergence.jl index 38cf3d7984b..75398d66684 100644 --- a/examples/dgmulti_2d/elixir_navierstokes_convergence.jl +++ b/examples/dgmulti_2d/elixir_navierstokes_convergence.jl @@ -40,7 +40,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -75,19 +75,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl b/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl index 87ffd0e0995..f7331a1ff3e 100644 --- a/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl +++ b/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl @@ -48,7 +48,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -83,19 +83,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl b/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl index f7120d8091b..f29bb257f4a 100644 --- a/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl +++ b/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl @@ -16,7 +16,7 @@ dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = SBP(), cells_per_dimension = (8, 8) mesh = DGMultiMesh(dg, cells_per_dimension, - coordinates_min = (0.0, 0.0), coordinates_max = (sqrt(2), sqrt(2)), + coordinates_min = (0.0, 0.0), coordinates_max = (sqrt_(2), sqrt_(2)), periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; diff --git a/examples/dgmulti_3d/elixir_navierstokes_convergence.jl b/examples/dgmulti_3d/elixir_navierstokes_convergence.jl index 5fa0ad7ce60..1707dcc10db 100644 --- a/examples/dgmulti_3d/elixir_navierstokes_convergence.jl +++ b/examples/dgmulti_3d/elixir_navierstokes_convergence.jl @@ -42,7 +42,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) - v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * + v1 = A2 * sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t) v2 = v1 v3 = v1 @@ -73,12 +73,12 @@ end # Define auxiliary functions for the strange function of the y variable # to make expressions easier to read - g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) - g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + + g = log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) + g_y = (A3 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0)) g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) - - A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) + A3^2 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) # Density and its derivatives rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) diff --git a/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl b/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl index c58d78d2581..6038dcf0c13 100644 --- a/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl +++ b/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl @@ -50,7 +50,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) - v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * + v1 = A2 * sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t) v2 = v1 v3 = v1 @@ -81,12 +81,12 @@ end # Define auxiliary functions for the strange function of the y variable # to make expressions easier to read - g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) - g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + + g = log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) + g_y = (A3 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0)) g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) - - A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) + A3^2 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) # Density and its derivatives rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) diff --git a/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl index 5a2537be4e6..502a9f70911 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -63,7 +63,7 @@ function periodic_distance_2d(coordinates, center, domain_length) dx = coordinates .- center dx_shifted = abs.(dx .% domain_length) dx_periodic = min.(dx_shifted, domain_length .- dx_shifted) - return sqrt(sum(dx_periodic .^ 2)) + return sqrt_(sum(dx_periodic .^ 2)) end #This takes a cells coordinates and transforms them into the coordinates of a parent-cell it originally refined from. diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl index f87c0e056ca..64ef05da574 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl @@ -30,10 +30,10 @@ mesh = P4estMesh(trees_per_dimension, function initial_condition_eriksson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt - lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl index 5497f13aa65..0f3005ee3f3 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl @@ -18,10 +18,10 @@ equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations) function initial_condition_eriksson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt - lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl index 0ca4fdc2eb7..98dbc7d4bf3 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl @@ -22,7 +22,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl index 92928146d7b..90c2c49d5fe 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl @@ -23,7 +23,7 @@ See Section IV c on the paper below for details. """ @inline function initial_condition_double_mach_reflection(x, t, equations::CompressibleEulerEquations2D) - if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt(3) + if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt_(3) phi = pi / 6 sin_phi, cos_phi = sincos(phi) diff --git a/examples/p4est_2d_dgsem/elixir_euler_sedov.jl b/examples/p4est_2d_dgsem/elixir_euler_sedov.jl index 539ddb45395..0b3453e3705 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_sedov.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl index b2b402a25f6..62fa80df816 100644 --- a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -18,7 +18,7 @@ solver = DGSEM(polydeg = 4, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2.0), sqrt(2.0)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) trees_per_dimension = (8, 8) mesh = P4estMesh(trees_per_dimension, diff --git a/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl b/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl index 380db487356..1aff490f450 100644 --- a/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl @@ -20,7 +20,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) # domain must be [0, 1] x [0, 1], γ = 1.4 dx = x[1] - 0.5 dy = x[2] - 0.5 - r = sqrt(dx^2 + dy^2) + r = sqrt_(dx^2 + dy^2) f = (0.115 - r) / 0.015 if r <= 0.1 rho = 10.0 @@ -37,7 +37,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) end v3 = 0.0 p = 1.0 - B1 = 5.0 / sqrt(4.0 * pi) + B1 = 5.0 / sqrt_(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl index 54ec09d2be8..bee43f282e8 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl @@ -40,7 +40,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -75,19 +75,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl index b4177fe8538..c3c32ced373 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl @@ -40,7 +40,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -75,19 +75,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl index c7922fd3b75..8e9e1c81cd9 100644 --- a/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl @@ -21,7 +21,7 @@ solver = DGSEM(polydeg = 3, # Get the P4estMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) # minimum coordinates (min(x), min(y)) -coordinates_max = (sqrt(2.0), sqrt(2.0)) # maximum coordinates (max(x), max(y)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) # maximum coordinates (max(x), max(y)) # Create P4estMesh with 8 x 8 trees and 16 x 16 elements trees_per_dimension = (8, 8) diff --git a/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl b/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl index 0274a89aec7..6186f02629a 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl @@ -132,7 +132,7 @@ function basic_state_baroclinic_instability_longitudinal_velocity(lon, lat, z) big_u = gravitational_acceleration / radius_earth * k * temperature * inttau2 * (temp3^(k - 1) - temp3^(k + 1)) temp5 = radius_earth * cos(lat) - u = -angular_velocity * temp5 + sqrt(angular_velocity^2 * temp5^2 + temp5 * big_u) + u = -angular_velocity * temp5 + sqrt_(angular_velocity^2 * temp5^2 + temp5 * big_u) # Hydrostatic pressure p = surface_pressure * @@ -173,7 +173,7 @@ function perturbation_stream_function(lon, lat, z) sin_, cos_ = sincos(0.5 * pi * great_circle_distance_by_a / perturbation_radius) # Common factor for both u and v - factor = 16 / (3 * sqrt(3)) * perturbed_wind_amplitude * perttaper * cos_^3 * sin_ + factor = 16 / (3 * sqrt_(3)) * perturbed_wind_amplitude * perttaper * cos_^3 * sin_ u_perturbation = -factor * (-sin(perturbation_lat) * cos(lat) + cos(perturbation_lat) * sin(lat) * cos(lon - perturbation_lon)) / diff --git a/examples/p4est_3d_dgsem/elixir_euler_sedov.jl b/examples/p4est_3d_dgsem/elixir_euler_sedov.jl index 8df95a3cc21..a2a13d65b9c 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_sedov.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_sedov.jl @@ -21,7 +21,7 @@ function initial_condition_medium_sedov_blast_wave(x, t, x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl index 3941a40b2e4..14489a0d7b9 100644 --- a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl @@ -22,7 +22,7 @@ function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations3D) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) delta_0 = 0.1 r_0 = 0.3 diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl index 5df89fbcdf2..f4c6b9f564f 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl @@ -23,7 +23,7 @@ function initial_condition_3d_blast_wave(x, t, equations::CompressibleEulerEquat u_o = 0.0 rc = 0.5 - r = sqrt(x[1]^2 + x[2]^2 + x[3]^2) + r = sqrt_(x[1]^2 + x[2]^2 + x[3]^2) if r < rc rho = rho_c v1 = u_c diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl index c640b255b05..6c0c1d4010b 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl @@ -43,7 +43,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) - v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * + v1 = A2 * sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t) v2 = v1 v3 = v1 @@ -74,12 +74,12 @@ end # Define auxiliary functions for the strange function of the y variable # to make expressions easier to read - g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) - g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + + g = log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) + g_y = (A3 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0)) g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) - - A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) + A3^2 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) # Density and its derivatives rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl index c15227a1c29..cebc3e70260 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl @@ -39,7 +39,7 @@ initial_condition = initial_condition_taylor_green_vortex @inline function vel_mag(u, equations::CompressibleEulerEquations3D) rho, rho_v1, rho_v2, rho_v3, _ = u - return sqrt(rho_v1^2 + rho_v2^2 + rho_v3^2) / rho + return sqrt_(rho_v1^2 + rho_v2^2 + rho_v3^2) / rho end volume_flux = flux_ranocha diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl index b7be2320228..a789e093eda 100644 --- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl +++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl @@ -20,7 +20,7 @@ Should be used together with [`boundary_condition_sedov_self_gravity`](@ref). """ function initial_condition_sedov_self_gravity(x, t, equations::CompressibleEulerEquations2D) # Set up polar coordinates - r = sqrt(x[1]^2 + x[2]^2) + r = sqrt_(x[1]^2 + x[2]^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000 r0 = 0.125 # = 4.0 * smallest dx (for domain length=8 and max-ref=8) diff --git a/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl b/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl index 96566bc2373..451475e9674 100644 --- a/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl +++ b/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl @@ -29,13 +29,13 @@ function initial_condition_composite(x, t, equations::LinearScalarAdvectionEquat end if x_ > -0.8 && x_ < -0.6 - value = exp(-log(2.0) * (x_ + 0.7)^2 / 0.0009) + value = exp(-log_(2.0) * (x_ + 0.7)^2 / 0.0009) elseif x_ > -0.4 && x_ < -0.2 value = 1.0 elseif x_ > 0.0 && x_ < 0.2 value = 1.0 - abs(10.0 * (x_ - 0.1)) elseif x_ > 0.4 && x_ < 0.6 - value = sqrt(1.0 - 100.0 * (x_ - 0.5)^2) + value = sqrt_(1.0 - 100.0 * (x_ - 0.5)^2) else value = 0.0 end diff --git a/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl b/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl index 6c254e8bd8b..277af463396 100644 --- a/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl +++ b/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl @@ -42,7 +42,7 @@ defined below. smoothed_heaviside(x, left, right) = left + 0.5 * (1 + tanh(slope * x)) * (right - left) rho = smoothed_heaviside(x[2] - 0.5, 2.0, 1.0) - c = sqrt(equations.gamma * p / rho) + c = sqrt_(equations.gamma * p / rho) # the velocity is multiplied by sin(pi*y)^6 as in Remacle et al. 2003 to ensure that the # initial condition satisfies reflective boundary conditions at the top/bottom boundaries. v = -0.025 * c * cos(8 * pi * x[1]) * sin(pi * x[2])^6 diff --git a/examples/structured_2d_dgsem/elixir_euler_sedov.jl b/examples/structured_2d_dgsem/elixir_euler_sedov.jl index 42094d7191c..c9e103ec003 100644 --- a/examples/structured_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/structured_2d_dgsem/elixir_euler_sedov.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl index e8f2b2ecc3a..04a8252a192 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -21,16 +21,16 @@ solver = DGSEM(polydeg = 3, function mapping(xi_, eta_) # Transform input variables between -1 and 1 onto [0, sqrt(2)] # Note, we use the domain [0, sqrt(2)]^2 for the Alfvén wave convergence test case - xi = 0.5 * sqrt(2) * xi_ + 0.5 * sqrt(2) - eta = 0.5 * sqrt(2) * eta_ + 0.5 * sqrt(2) + xi = 0.5 * sqrt_(2) * xi_ + 0.5 * sqrt_(2) + eta = 0.5 * sqrt_(2) * eta_ + 0.5 * sqrt_(2) y = eta + - sqrt(2) / 12 * (cos(1.5 * pi * (2 * xi - sqrt(2)) / sqrt(2)) * - cos(0.5 * pi * (2 * eta - sqrt(2)) / sqrt(2))) + sqrt_(2) / 12 * (cos(1.5 * pi * (2 * xi - sqrt_(2)) / sqrt_(2)) * + cos(0.5 * pi * (2 * eta - sqrt_(2)) / sqrt_(2))) x = xi + - sqrt(2) / 12 * (cos(0.5 * pi * (2 * xi - sqrt(2)) / sqrt(2)) * - cos(2 * pi * (2 * y - sqrt(2)) / sqrt(2))) + sqrt_(2) / 12 * (cos(0.5 * pi * (2 * xi - sqrt_(2)) / sqrt_(2)) * + cos(2 * pi * (2 * y - sqrt_(2)) / sqrt_(2))) return SVector(x, y) end diff --git a/examples/structured_2d_dgsem/elixir_mhd_ec.jl b/examples/structured_2d_dgsem/elixir_mhd_ec.jl index a6c31744ca5..ecc1b1a3c18 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_ec.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_ec.jl @@ -14,7 +14,7 @@ function initial_condition_shifted_weak_blast_wave(x, t, equations::IdealGlmMhdE inicenter = (1.5, 1.5) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) # Calculate primitive variables diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl b/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl index e65ed19221e..d27a638b048 100644 --- a/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl +++ b/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl @@ -26,14 +26,14 @@ function initial_condition_conical_island(x, t, equations::ShallowWaterEquations v2 = 0.0 x1, x2 = x - b = max(0.1, 1.0 - 4.0 * sqrt(x1^2 + x2^2)) + b = max(0.1, 1.0 - 4.0 * sqrt_(x1^2 + x2^2)) # use a logistic function to transfer water height value smoothly L = equations.H0 # maximum of function x0 = 0.3 # center point of function k = -25.0 # sharpness of transfer - H = max(b, L / (1.0 + exp(-k * (sqrt(x1^2 + x2^2) - x0)))) + H = max(b, L / (1.0 + exp(-k * (sqrt_(x1^2 + x2^2) - x0)))) # It is mandatory to shift the water level at dry areas to make sure the water height h # stays positive. The system would not be stable for h set to a hard 0 due to division by h in diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl index bc198f18835..69aaa5f3c7b 100644 --- a/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl +++ b/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl @@ -32,7 +32,7 @@ function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations a = 1.0 h_0 = 0.1 sigma = 0.5 - ω = sqrt(2 * equations.gravity * h_0) / a + ω = sqrt_(2 * equations.gravity * h_0) / a v1 = -sigma * ω * sin(ω * t) v2 = sigma * ω * cos(ω * t) diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl index 48fe37b9996..f14851b5f0a 100644 --- a/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl @@ -15,7 +15,7 @@ solver = DGSEM(polydeg = 3, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2.0), sqrt(2.0)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) cells_per_dimension = (8, 8) diff --git a/examples/structured_3d_dgsem/elixir_euler_sedov.jl b/examples/structured_3d_dgsem/elixir_euler_sedov.jl index 1f2d9d2eeb6..64286044684 100644 --- a/examples/structured_3d_dgsem/elixir_euler_sedov.jl +++ b/examples/structured_3d_dgsem/elixir_euler_sedov.jl @@ -21,7 +21,7 @@ function initial_condition_medium_sedov_blast_wave(x, t, x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl index 653bab41e2d..c193c16f268 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -62,7 +62,7 @@ function periodic_distance_2d(coordinates, center, domain_length) dx = coordinates .- center dx_shifted = abs.(dx .% domain_length) dx_periodic = min.(dx_shifted, domain_length .- dx_shifted) - return sqrt(sum(dx_periodic .^ 2)) + return sqrt_(sum(dx_periodic .^ 2)) end # This takes a cells coordinates and transforms them into the coordinates of a diff --git a/examples/t8code_2d_dgsem/elixir_euler_sedov.jl b/examples/t8code_2d_dgsem/elixir_euler_sedov.jl index 965d794f8dc..3b153ce3dd0 100644 --- a/examples/t8code_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/t8code_2d_dgsem/elixir_euler_sedov.jl @@ -17,7 +17,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) # Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl index 1e2362a123c..05c7e8ebd95 100644 --- a/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -15,7 +15,7 @@ solver = DGSEM(polydeg = 4, surface_flux = (flux_hlle, flux_nonconservative_powe volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2.0), sqrt(2.0)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) mapping = Trixi.coordinates2mapping(coordinates_min, coordinates_max) diff --git a/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl b/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl index 9a4bd99e444..fae61bd5991 100644 --- a/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl @@ -19,7 +19,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) # domain must be [0, 1] x [0, 1], γ = 1.4 dx = x[1] - 0.5 dy = x[2] - 0.5 - r = sqrt(dx^2 + dy^2) + r = sqrt_(dx^2 + dy^2) f = (0.115 - r) / 0.015 if r <= 0.1 rho = 10.0 @@ -36,7 +36,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) end v3 = 0.0 p = 1.0 - B1 = 5.0 / sqrt(4.0 * pi) + B1 = 5.0 / sqrt_(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl index b2d5097036f..63c606862b6 100644 --- a/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl @@ -20,7 +20,7 @@ solver = DGSEM(polydeg = 3, # Get the P4estMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) # minimum coordinates (min(x), min(y)) -coordinates_max = (sqrt(2.0), sqrt(2.0)) # maximum coordinates (max(x), max(y)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) # maximum coordinates (max(x), max(y)) mapping = Trixi.coordinates2mapping(coordinates_min, coordinates_max) diff --git a/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl index a7d7689a806..940eafc8fae 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl @@ -28,7 +28,7 @@ function initial_condition_ryujones_shock_tube(x, t, equations::IdealGlmMhdEquat v2 = x[1] <= 0.5 ? 0.01 : 0.0 v3 = x[1] <= 0.5 ? 0.5 : 0.0 p = x[1] <= 0.5 ? 0.95 : 1.0 - inv_sqrt4pi = 1.0 / sqrt(4 * pi) + inv_sqrt4pi = 1.0 / sqrt_(4 * pi) B1 = 2 * inv_sqrt4pi B2 = x[1] <= 0.5 ? 3.6 * inv_sqrt4pi : 4.0 * inv_sqrt4pi B3 = B1 diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl index 40030d53345..8574dd86590 100644 --- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl +++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl @@ -39,7 +39,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * cos(pi_x) * cos(pi_t) - v1 = log(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t) + v1 = log_(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t) p = rho^2 return prim2cons(SVector(rho, v1, p), equations) @@ -70,12 +70,12 @@ end rho_x = -pi * A * sin(pi_x) * cos(pi_t) rho_xx = -pi * pi * A * cos(pi_x) * cos(pi_t) - v1 = log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t) - v1_t = -pi * log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t) - v1_x = (A * log(x + 2.0) * exp(-A * (x - 1.0)) + + v1 = log_(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t) + v1_t = -pi * log_(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t) + v1_x = (A * log_(x + 2.0) * exp(-A * (x - 1.0)) + (1.0 - exp(-A * (x - 1.0))) / (x + 2.0)) * cos(pi_t) v1_xx = ((2.0 * A * exp(-A * (x - 1.0)) / (x + 2.0) - - A * A * log(x + 2.0) * exp(-A * (x - 1.0)) - + A * A * log_(x + 2.0) * exp(-A * (x - 1.0)) - (1.0 - exp(-A * (x - 1.0))) / ((x + 2.0) * (x + 2.0))) * cos(pi_t)) p = rho * rho diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl index e833155a68e..0a35b77cb14 100644 --- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl +++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl @@ -39,7 +39,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * cos(pi_x) * cos(pi_t) - v1 = log(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t) + v1 = log_(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t) p = rho^2 return prim2cons(SVector(rho, v1, p), equations) @@ -70,12 +70,12 @@ end rho_x = -pi * A * sin(pi_x) * cos(pi_t) rho_xx = -pi * pi * A * cos(pi_x) * cos(pi_t) - v1 = log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t) - v1_t = -pi * log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t) - v1_x = (A * log(x + 2.0) * exp(-A * (x - 1.0)) + + v1 = log_(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t) + v1_t = -pi * log_(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t) + v1_x = (A * log_(x + 2.0) * exp(-A * (x - 1.0)) + (1.0 - exp(-A * (x - 1.0))) / (x + 2.0)) * cos(pi_t) v1_xx = ((2.0 * A * exp(-A * (x - 1.0)) / (x + 2.0) - - A * A * log(x + 2.0) * exp(-A * (x - 1.0)) - + A * A * log_(x + 2.0) * exp(-A * (x - 1.0)) - (1.0 - exp(-A * (x - 1.0))) / ((x + 2.0) * (x + 2.0))) * cos(pi_t)) p = rho * rho diff --git a/examples/tree_1d_dgsem/elixir_shallow_water_quasi_1d_source_terms.jl b/examples/tree_1d_dgsem/elixir_shallow_water_quasi_1d_source_terms.jl index 72747c669e2..ce763f8d6e8 100644 --- a/examples/tree_1d_dgsem/elixir_shallow_water_quasi_1d_source_terms.jl +++ b/examples/tree_1d_dgsem/elixir_shallow_water_quasi_1d_source_terms.jl @@ -22,7 +22,7 @@ solver = DGSEM(polydeg = 3, surface_flux = surface_flux, # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt(2.0) +coordinates_max = sqrt_(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl b/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl index 378079ca334..db2354a153c 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl @@ -25,8 +25,8 @@ found in section 5.2 of the paper: function initial_condition_beach(x, t, equations::ShallowWaterEquations1D) D = 1 delta = 0.02 - gamma = sqrt((3 * delta) / (4 * D)) - x_a = sqrt((4 * D) / (3 * delta)) * acosh(sqrt(20)) + gamma = sqrt_((3 * delta) / (4 * D)) + x_a = sqrt_((4 * D) / (3 * delta)) * acosh(sqrt_(20)) f = D + 40 * delta * sech(gamma * (8 * x[1] - x_a))^2 @@ -38,7 +38,7 @@ function initial_condition_beach(x, t, equations::ShallowWaterEquations1D) v = 0.0 else H = f - v = sqrt(equations.gravity / D) * H + v = sqrt_(equations.gravity / D) * H end # It is mandatory to shift the water level at dry areas to make sure the water height h diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl index a586562af7e..f0843934209 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl @@ -32,7 +32,7 @@ function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations a = 1 h_0 = 0.1 sigma = 0.5 - ω = sqrt(2 * equations.gravity * h_0) / a + ω = sqrt_(2 * equations.gravity * h_0) / a v = -sigma * ω * sin(ω * t) diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl index af596a377f8..3ef354cd03e 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl @@ -21,7 +21,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt(2.0) +coordinates_max = sqrt_(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl index cbc98a30f9f..bdbcc9ea402 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl @@ -23,7 +23,7 @@ solver = DGSEM(polydeg = 3, surface_flux = surface_flux, # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt(2.0) +coordinates_max = sqrt_(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl index e6a01849852..3f111241e4d 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl @@ -22,7 +22,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt(2.0) +coordinates_max = sqrt_(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl index e55fffc101e..0ded3ff3dbe 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl @@ -33,7 +33,7 @@ solver = DGSEM(polydeg = 4, surface_flux = (flux_hll, flux_nonconservative_fjord # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt(2.0) +coordinates_max = sqrt_(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl b/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl index 918c0831fcd..190e4aba0ac 100644 --- a/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl +++ b/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl @@ -28,7 +28,7 @@ A Gaussian pulse, used in the `gauss_wall` example elixir in combination with function initial_condition_gauss_wall(x, t, equations::AcousticPerturbationEquations2D) v1_prime = 0.0 v2_prime = 0.0 - p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25) + p_prime = exp(-log_(2) * (x[1]^2 + (x[2] - 25)^2) / 25) prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...) diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl index 03a213689ec..00e5a3463a4 100644 --- a/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -58,7 +58,7 @@ function periodic_distance_2d(coordinates, center, domain_length) dx = coordinates .- center dx_shifted = abs.(dx .% domain_length) dx_periodic = min.(dx_shifted, domain_length .- dx_shifted) - return sqrt(sum(dx_periodic .^ 2)) + return sqrt_(sum(dx_periodic .^ 2)) end #This takes a cells coordinates and transforms them into the coordinates of a parent-cell it originally refined from. diff --git a/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl index 8da542b0b5d..c949e3bede9 100644 --- a/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl @@ -30,10 +30,10 @@ mesh = TreeMesh(coordinates_min, coordinates_max, function initial_condition_eriksson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt - lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl index ccd7b54086b..25d77105717 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl index d32c2e51b06..aeea654c6c7 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl index a2392d05e5a..bc802c0c33a 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl index 209aa2ae352..8d20ebaf833 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl index 2b3659017a3..b8569e2af2d 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl @@ -31,7 +31,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D) tau_kh = 1.0 tau_cr = tau_kh / 1.6 # crushing time # determine background velocity - velx0 = 2 * R * sqrt(Chi) / tau_cr + velx0 = 2 * R * sqrt_(Chi) / tau_cr vely0 = 0.0 Ma0 = 2.7 # background flow Mach number Ma=v/c c = velx0 / Ma0 # sound speed @@ -40,7 +40,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D) # initial center of the blob inicenter = [-15, 0] x_rel = x - inicenter - r = sqrt(x_rel[1]^2 + x_rel[2]^2) + r = sqrt_(x_rel[1]^2 + x_rel[2]^2) # steepness of the tanh transition zone slope = 2 # density blob diff --git a/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl b/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl index 8bd5db00c9a..787fb699780 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl @@ -31,7 +31,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D) tau_kh = 1.0 tau_cr = tau_kh / 1.6 # crushing time # determine background velocity - velx0 = 2 * R * sqrt(Chi) / tau_cr + velx0 = 2 * R * sqrt_(Chi) / tau_cr vely0 = 0.0 Ma0 = 2.7 # background flow Mach number Ma=v/c c = velx0 / Ma0 # sound speed @@ -40,7 +40,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D) # initial center of the blob inicenter = [-15, 0] x_rel = x - inicenter - r = sqrt(x_rel[1]^2 + x_rel[2]^2) + r = sqrt_(x_rel[1]^2 + x_rel[2]^2) # steepness of the tanh transition zone slope = 2 # density blob diff --git a/examples/tree_2d_dgsem/elixir_euler_positivity.jl b/examples/tree_2d_dgsem/elixir_euler_positivity.jl index 6fec4c1bf9b..78c625bc142 100644 --- a/examples/tree_2d_dgsem/elixir_euler_positivity.jl +++ b/examples/tree_2d_dgsem/elixir_euler_positivity.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl index 5b8959b97d1..1cbaa9736f0 100644 --- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl index c1ba3d96962..227ae0507df 100644 --- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl index 44e63a0872e..c5a0d4e74aa 100644 --- a/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl index e9831c95526..8677721536b 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl @@ -54,7 +54,7 @@ end function periodic_distance_2d(coordinates, center, domain_length) dx = @. abs(coordinates - center) dx_periodic = @. min(dx, domain_length - dx) - return sqrt(sum(abs2, dx_periodic)) + return sqrt_(sum(abs2, dx_periodic)) end end # module TrixiExtension diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl index c6ed07dcda1..4dc07dffd88 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl @@ -52,7 +52,7 @@ function initial_condition_shock_bubble(x, t, inicenter = SVector(zero(delta), zero(delta)) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) if (x[1] > 0.50) # Set up Region III diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl index 4b606502ebe..fd06631b52a 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl @@ -52,7 +52,7 @@ function initial_condition_shock_bubble(x, t, inicenter = SVector(zero(delta), zero(delta)) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) if (x[1] > 0.50) # Set up Region III diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl index 78ff47e255f..df6cf0a8559 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl @@ -52,7 +52,7 @@ function initial_condition_shock_bubble(x, t, inicenter = SVector(zero(delta), zero(delta)) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) if (x[1] > 0.50) # Set up Region III diff --git a/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl b/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl index fad03fab6ef..9e418f3dccc 100644 --- a/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl +++ b/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl @@ -23,7 +23,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, function initial_condition_gauss_wall(x, t, equations::LinearizedEulerEquations2D) v1_prime = 0.0 v2_prime = 0.0 - rho_prime = p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25) + rho_prime = p_prime = exp(-log_(2) * (x[1]^2 + (x[2] - 25)^2) / 25) return SVector(rho_prime, v1_prime, v2_prime, p_prime) end initial_condition = initial_condition_gauss_wall diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl index 377a07e947e..84adfc8ddd6 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -15,7 +15,7 @@ solver = DGSEM(polydeg = 3, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2.0), sqrt(2.0)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, n_cells_max = 10_000) diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl index 0200b591844..0f1311c4315 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl @@ -16,7 +16,7 @@ solver = DGSEM(polydeg = 3, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2.0), sqrt(2.0)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) refinement_patches = ((type = "box", coordinates_min = 0.25 .* coordinates_max, coordinates_max = 0.75 .* coordinates_max),) mesh = TreeMesh(coordinates_min, coordinates_max, diff --git a/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl b/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl index a0909ca7580..61efa73edda 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl @@ -18,7 +18,7 @@ An MHD blast wave taken from function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D) # setup taken from Derigs et al. DMV article (2018) # domain must be [-0.5, 0.5] x [-0.5, 0.5], γ = 1.4 - r = sqrt(x[1]^2 + x[2]^2) + r = sqrt_(x[1]^2 + x[2]^2) f = (0.1 - r) / 0.01 if r <= 0.09 p = 1000.0 @@ -31,7 +31,7 @@ function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D) v1 = 0.0 v2 = 0.0 v3 = 0.0 - B1 = 100.0 / sqrt(4.0 * pi) + B1 = 100.0 / sqrt_(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/tree_2d_dgsem/elixir_mhd_rotor.jl b/examples/tree_2d_dgsem/elixir_mhd_rotor.jl index 3109b1ce303..d9b90dc1f02 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_rotor.jl @@ -19,7 +19,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) # domain must be [0, 1] x [0, 1], γ = 1.4 dx = x[1] - 0.5 dy = x[2] - 0.5 - r = sqrt(dx^2 + dy^2) + r = sqrt_(dx^2 + dy^2) f = (0.115 - r) / 0.015 if r <= 0.1 rho = 10.0 @@ -36,7 +36,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) end v3 = 0.0 p = 1.0 - B1 = 5.0 / sqrt(4.0 * pi) + B1 = 5.0 / sqrt_(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl b/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl index fe9ad92467f..42b09fa3613 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl @@ -19,7 +19,7 @@ This setup needs a positivity limiter for the density. function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D) # setup taken from Derigs et al. DMV article (2018) # domain must be [-0.5, 0.5] x [-0.5, 0.5], γ = 1.4 - r = sqrt(x[1]^2 + x[2]^2) + r = sqrt_(x[1]^2 + x[2]^2) pmax = 10.0 pmin = 1.0 @@ -38,7 +38,7 @@ function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D) v1 = 0.0 v2 = 0.0 v3 = 0.0 - B1 = 1.0 / sqrt(4.0 * pi) + B1 = 1.0 / sqrt_(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl index 4f1f8c5f2b7..326d7755b7b 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl @@ -16,7 +16,7 @@ solver = DGSEM(polydeg = 3, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2), sqrt(2)) +coordinates_max = (sqrt_(2), sqrt_(2)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, n_cells_max = 10_000) diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl index 5ca21cc5e9c..3d28531760c 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl @@ -17,7 +17,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdMulticomponentEquat # domain must be [0, 1] x [0, 1], γ = 1.4 dx = x[1] - 0.5 dy = x[2] - 0.5 - r = sqrt(dx^2 + dy^2) + r = sqrt_(dx^2 + dy^2) f = (0.115 - r) / 0.015 if r <= 0.1 rho1 = 10.0 @@ -37,7 +37,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdMulticomponentEquat end v3 = 0.0 p = 1.0 - B1 = 5.0 / sqrt(4.0 * pi) + B1 = 5.0 / sqrt_(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl b/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl index b0c8678baad..a8b12883598 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl @@ -40,7 +40,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -75,19 +75,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl b/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl index 349b3741869..7604be705f5 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl @@ -27,14 +27,14 @@ function initial_condition_conical_island(x, t, equations::ShallowWaterEquations v2 = 0.0 x1, x2 = x - b = max(0.1, 1.0 - 4.0 * sqrt(x1^2 + x2^2)) + b = max(0.1, 1.0 - 4.0 * sqrt_(x1^2 + x2^2)) # use a logistic function to transfer water height value smoothly L = equations.H0 # maximum of function x0 = 0.3 # center point of function k = -25.0 # sharpness of transfer - H = max(b, L / (1.0 + exp(-k * (sqrt(x1^2 + x2^2) - x0)))) + H = max(b, L / (1.0 + exp(-k * (sqrt_(x1^2 + x2^2) - x0)))) # It is mandatory to shift the water level at dry areas to make sure the water height h # stays positive. The system would not be stable for h set to a hard 0 due to division by h in diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl b/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl index bc528ae7756..a3fb76cefc9 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl @@ -53,7 +53,7 @@ function initial_condition_ec_discontinuous_bottom(x, t, element_id, inicenter = SVector(0.7, 0.7) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl index 2008019cc31..848ad7080b5 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl @@ -32,7 +32,7 @@ function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations a = 1.0 h_0 = 0.1 sigma = 0.5 - ω = sqrt(2 * equations.gravity * h_0) / a + ω = sqrt_(2 * equations.gravity * h_0) / a v1 = -sigma * ω * sin(ω * t) v2 = sigma * ω * cos(ω * t) diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl index c92e885c161..5748767ba22 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl @@ -21,7 +21,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2.0), sqrt(2.0)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl index f7544b1e32e..1c6ab7d6482 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl @@ -23,7 +23,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2.0), sqrt(2.0)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl index 790916e4467..59f1cb85716 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl @@ -22,7 +22,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt(2.0), sqrt(2.0)) +coordinates_max = (sqrt_(2.0), sqrt_(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 20_000, diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl index 264c26390fe..09596ecd795 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl @@ -19,7 +19,7 @@ function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEq v1_lower = 0.0 v2_lower = 0.0 b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? - 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] + + 0.2 * (cos(4 * pi * sqrt_((x[1] - 0.5)^2 + (x[2] + -0.5)^2)) + 1) : 0.0) return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), diff --git a/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl b/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl index 4c30406680a..26e531ad23a 100644 --- a/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl +++ b/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl @@ -30,10 +30,10 @@ mesh = TreeMesh(coordinates_min, coordinates_max, function initial_condition_eriksson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt - lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl b/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl index 0ce886620cc..8da4325930b 100644 --- a/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl +++ b/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl @@ -31,7 +31,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations3D) tau_kh = 1.0 tau_cr = tau_kh / 1.6 # crushing time # determine background velocity - v1 = 2 * R * sqrt(Chi) / tau_cr + v1 = 2 * R * sqrt_(Chi) / tau_cr v2 = 0.0 v3 = 0.0 Ma0 = 2.7 # background flow Mach number Ma=v/c @@ -41,7 +41,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations3D) # initial center of the blob inicenter = [-15, 0, 0] x_rel = x - inicenter - r = sqrt(x_rel[1]^2 + x_rel[2]^2 + x_rel[3]^2) + r = sqrt_(x_rel[1]^2 + x_rel[2]^2 + x_rel[3]^2) # steepness of the tanh transition zone slope = 2 # density blob diff --git a/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl index 87774ada266..dfc9c0443b9 100644 --- a/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl +++ b/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl @@ -20,7 +20,7 @@ Should be used together with [`boundary_condition_sedov_self_gravity`](@ref). """ function initial_condition_sedov_self_gravity(x, t, equations::CompressibleEulerEquations3D) # Calculate radius as distance from origin - r = sqrt(x[1]^2 + x[2]^2 + x[3]^2) + r = sqrt_(x[1]^2 + x[2]^2 + x[3]^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.25 # = 4.0 * smallest dx (for domain length=8 and max-ref=7) diff --git a/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl b/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl index 3ada9503c6a..c70eb99efab 100644 --- a/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl @@ -43,7 +43,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) - v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * + v1 = A2 * sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t) v2 = v1 v3 = v1 @@ -74,12 +74,12 @@ end # Define auxiliary functions for the strange function of the y variable # to make expressions easier to read - g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) - g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + + g = log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) + g_y = (A3 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0)) g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) - - A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) + A3^2 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) # Density and its derivatives rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) diff --git a/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl b/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl index 8f8e867dca8..c03bb0c196e 100644 --- a/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl +++ b/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl @@ -31,7 +31,7 @@ A Gaussian pulse, used in the `gauss_wall` example elixir in combination with function initial_condition_gauss_wall(x, t, equations::AcousticPerturbationEquations2D) v1_prime = 0.0 v2_prime = 0.0 - p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25) + p_prime = exp(-log_(2) * (x[1]^2 + (x[2] - 25)^2) / 25) prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...) diff --git a/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl b/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl index e1cc0932969..801d10b34d3 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl b/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl index a40f92cac02..2c5db9e078c 100644 --- a/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl +++ b/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl @@ -11,10 +11,10 @@ equations = IdealGlmMhdEquations2D(5 / 3) function initial_condition_shifted_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D) # Adapted MHD version of the weak blast wave from Hennemann & Gassner JCP paper 2020 (Sec. 6.3) # Shift blastwave to center of domain - inicenter = (sqrt(2) / 2, sqrt(2) / 2) + inicenter = (sqrt_(2) / 2, sqrt_(2) / 2) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) # Calculate primitive variables diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl index 8e9d396d826..ae496148705 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl @@ -57,7 +57,7 @@ function initial_condition_ec_discontinuous_bottom(x, t, element_id, inicenter = SVector(0.7, 0.7) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl index 94202b81df0..02d3e287222 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl @@ -66,7 +66,7 @@ function initial_condition_ec_discontinuous_bottom(x, t, element_id, inicenter = SVector(0.7, 0.7) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl index 6164f9d4a55..2e5b83e4130 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl @@ -31,9 +31,9 @@ function initial_condition_three_mounds(x, t, equations::ShallowWaterEquations2D v2 = 0.0 x1, x2 = x - M_1 = 1 - 0.1 * sqrt((x1 - 30.0)^2 + (x2 - 22.5)^2) - M_2 = 1 - 0.1 * sqrt((x1 - 30.0)^2 + (x2 - 7.5)^2) - M_3 = 2.8 - 0.28 * sqrt((x1 - 47.5)^2 + (x2 - 15.0)^2) + M_1 = 1 - 0.1 * sqrt_((x1 - 30.0)^2 + (x2 - 22.5)^2) + M_2 = 1 - 0.1 * sqrt_((x1 - 30.0)^2 + (x2 - 7.5)^2) + M_3 = 2.8 - 0.28 * sqrt_((x1 - 47.5)^2 + (x2 - 15.0)^2) b = max(0.0, M_1, M_2, M_3) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl index 4ad5f7e3201..d2d1dd25e7f 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl @@ -16,7 +16,7 @@ equations = ShallowWaterTwoLayerEquations2D(gravity_constant = 1.0, rho_upper = # condition is reset with the true discontinuous values from initial_condition_discontinuous_dam_break. function initial_condition_dam_break(x, t, equations::ShallowWaterTwoLayerEquations2D) - if x[1] < sqrt(2) / 2 + if x[1] < sqrt_(2) / 2 H_upper = 1.0 H_lower = 0.6 b = 0.1 diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl index 6a727df2502..6ddb7921489 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl @@ -22,7 +22,7 @@ function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEq # Bottom Topography b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? - 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] + + 0.2 * (cos(4 * pi * sqrt_((x[1] - 0.5)^2 + (x[2] + -0.5)^2)) + 1) : 0.0) return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl index 76b9642d595..389ae5fd660 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl @@ -14,7 +14,7 @@ function initial_condition_stone_throw(x, t, equations::ShallowWaterEquations2D) inicenter = SVector(0.15, 0.15) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) # Calculate primitive variables H = equations.H0 diff --git a/ext/TrixiMakieExt.jl b/ext/TrixiMakieExt.jl index 301a7656da9..bba1d7fea3f 100644 --- a/ext/TrixiMakieExt.jl +++ b/ext/TrixiMakieExt.jl @@ -392,7 +392,7 @@ function Makie.plot!(fig, pd::PlotData2DTriangulated; cols = length(pd) rows = 1 else - cols = ceil(Int, sqrt(length(pd))) + cols = ceil(Int, sqrt_(length(pd))) rows = cld(length(pd), cols) end diff --git a/src/auxiliary/mpi.jl b/src/auxiliary/mpi.jl index c85c23670b0..f0c9e19fc83 100644 --- a/src/auxiliary/mpi.jl +++ b/src/auxiliary/mpi.jl @@ -81,9 +81,9 @@ function ode_norm(u::AbstractArray, t) if mpi_isparallel() global_sumabs2, global_length = MPI.Allreduce([local_sumabs2, local_length], +, mpi_comm()) - return sqrt(global_sumabs2 / global_length) + return sqrt_(global_sumabs2 / global_length) else - return sqrt(local_sumabs2 / local_length) + return sqrt_(local_sumabs2 / local_length) end end diff --git a/src/auxiliary/special_elixirs.jl b/src/auxiliary/special_elixirs.jl index 5fdd9aea0c5..2cd95242e9b 100644 --- a/src/auxiliary/special_elixirs.jl +++ b/src/auxiliary/special_elixirs.jl @@ -119,7 +119,7 @@ function analyze_convergence(errors, iterations, # Calculate EOCs where the columns represent the variables # As dx halves in every iteration the denominator needs to be log(1/2) - eocs = Dict(kind => log.(error[2:end, :] ./ error[1:(end - 1), :]) ./ log(1 / 2) + eocs = Dict(kind => log_.(error[2:end, :] ./ error[1:(end - 1), :]) ./ log_(1 / 2) for (kind, error) in errorsmatrix) eoc_mean_values = Dict{Symbol, Any}() diff --git a/src/callbacks_step/analysis_dg1d.jl b/src/callbacks_step/analysis_dg1d.jl index d2613c325be..7d95dd9ae9c 100644 --- a/src/callbacks_step/analysis_dg1d.jl +++ b/src/callbacks_step/analysis_dg1d.jl @@ -75,7 +75,7 @@ function calc_error_norms(func, u, t, analyzer, end # For L2 error, divide by total volume - l2_error = @. sqrt(l2_error / total_volume) + l2_error = @. sqrt_(l2_error / total_volume) return l2_error, linf_error end @@ -113,7 +113,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt(l2_error / total_volume_) + l2_error = @. sqrt_(l2_error / total_volume_) return l2_error, linf_error end diff --git a/src/callbacks_step/analysis_dg2d.jl b/src/callbacks_step/analysis_dg2d.jl index a9e0cf87b0a..aa46d963e6a 100644 --- a/src/callbacks_step/analysis_dg2d.jl +++ b/src/callbacks_step/analysis_dg2d.jl @@ -101,7 +101,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt(l2_error / total_volume_) + l2_error = @. sqrt_(l2_error / total_volume_) return l2_error, linf_error end @@ -144,7 +144,7 @@ function calc_error_norms(func, u, t, analyzer, end # For L2 error, divide by total volume - l2_error = @. sqrt(l2_error / total_volume) + l2_error = @. sqrt_(l2_error / total_volume) return l2_error, linf_error end diff --git a/src/callbacks_step/analysis_dg2d_parallel.jl b/src/callbacks_step/analysis_dg2d_parallel.jl index a04bf732604..870e0deab27 100644 --- a/src/callbacks_step/analysis_dg2d_parallel.jl +++ b/src/callbacks_step/analysis_dg2d_parallel.jl @@ -44,7 +44,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt(l2_error / total_volume_) + l2_error = @. sqrt_(l2_error / total_volume_) else l2_error = convert(eltype(l2_errors), NaN * zero(eltype(l2_errors))) linf_error = convert(eltype(linf_errors), NaN * zero(eltype(linf_errors))) @@ -136,7 +136,7 @@ function calc_error_norms(func, u, t, analyzer, l2_error = convert(typeof(l2_error), global_l2_error) linf_error = convert(typeof(linf_error), global_linf_error) # For L2 error, divide by total volume - l2_error = @. sqrt(l2_error / total_volume) + l2_error = @. sqrt_(l2_error / total_volume) else l2_error = convert(typeof(l2_error), NaN * global_l2_error) linf_error = convert(typeof(linf_error), NaN * global_linf_error) diff --git a/src/callbacks_step/analysis_dg3d.jl b/src/callbacks_step/analysis_dg3d.jl index 81d0795a159..010731d4742 100644 --- a/src/callbacks_step/analysis_dg3d.jl +++ b/src/callbacks_step/analysis_dg3d.jl @@ -112,7 +112,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt(l2_error / total_volume_) + l2_error = @. sqrt_(l2_error / total_volume_) return l2_error, linf_error end @@ -159,7 +159,7 @@ function calc_error_norms(func, u, t, analyzer, end # For L2 error, divide by total volume - l2_error = @. sqrt(l2_error / total_volume) + l2_error = @. sqrt_(l2_error / total_volume) return l2_error, linf_error end diff --git a/src/callbacks_step/analysis_dg3d_parallel.jl b/src/callbacks_step/analysis_dg3d_parallel.jl index d8756d91c9d..3f0d12d0b9c 100644 --- a/src/callbacks_step/analysis_dg3d_parallel.jl +++ b/src/callbacks_step/analysis_dg3d_parallel.jl @@ -54,7 +54,7 @@ function calc_error_norms(func, u, t, analyzer, l2_error = convert(typeof(l2_error), global_l2_error) linf_error = convert(typeof(linf_error), global_linf_error) # For L2 error, divide by total volume - l2_error = @. sqrt(l2_error / total_volume) + l2_error = @. sqrt_(l2_error / total_volume) else l2_error = convert(typeof(l2_error), NaN * global_l2_error) linf_error = convert(typeof(linf_error), NaN * global_linf_error) diff --git a/src/callbacks_step/analysis_dgmulti.jl b/src/callbacks_step/analysis_dgmulti.jl index dc294de9e7b..aff43002785 100644 --- a/src/callbacks_step/analysis_dgmulti.jl +++ b/src/callbacks_step/analysis_dgmulti.jl @@ -24,7 +24,7 @@ function calc_error_norms(func, u, t, analyzer, component_linf_errors = max.(component_linf_errors, abs.(error_at_node)) end total_volume = sum(md.wJq) - return sqrt.(component_l2_errors ./ total_volume), component_linf_errors + return sqrt_.(component_l2_errors ./ total_volume), component_linf_errors end function integrate(func::Func, u, @@ -112,7 +112,7 @@ function analyze(::Val{:l2_divb}, du, u, t, l2norm_divB += local_l2norm_divB end - return sqrt(l2norm_divB) + return sqrt_(l2norm_divB) end function analyze(::Val{:linf_divb}, du, u, t, diff --git a/src/callbacks_step/visualization.jl b/src/callbacks_step/visualization.jl index 98c0126a302..c5048354c0c 100644 --- a/src/callbacks_step/visualization.jl +++ b/src/callbacks_step/visualization.jl @@ -204,13 +204,13 @@ function show_plot(plot_data, variable_names; # cols = length(plots) # rows = 1 # else - # cols = ceil(Int, sqrt(length(plots))) + # cols = ceil(Int, sqrt_(length(plots))) # rows = div(length(plots), cols, RoundUp) # end # layout = (rows, cols) # Determine layout - cols = ceil(Int, sqrt(length(plots))) + cols = ceil(Int, sqrt_(length(plots))) rows = div(length(plots), cols, RoundUp) layout = (rows, cols) @@ -248,7 +248,7 @@ function save_plot(plot_data, variable_names; end # Determine layout - cols = ceil(Int, sqrt(length(plots))) + cols = ceil(Int, sqrt_(length(plots))) rows = div(length(plots), cols, RoundUp) layout = (rows, cols) diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index 6dd685e9608..aa62185051e 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -857,7 +857,7 @@ Compactly summarized: # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) SsL = min(v_roe - c_roe, v_ll - beta * c_ll, zero(v_roe)) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index a02fd0f4a64..0b8fab1d760 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -164,7 +164,7 @@ function initial_condition_weak_blast_wave(x, t, inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) @@ -308,7 +308,7 @@ Should be used together with [`UnstructuredMesh2D`](@ref). # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = sqrt(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = sqrt_(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -318,7 +318,7 @@ Should be used together with [`UnstructuredMesh2D`](@ref). B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + sqrt(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + sqrt_(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -719,7 +719,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -767,7 +767,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -857,7 +857,7 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho if orientation == 1 @@ -887,7 +887,7 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho if orientation == 1 @@ -943,9 +943,9 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho - lambda = 0.5 * (sqrt(v1^2 + v2^2) + a) + lambda = 0.5 * (sqrt_(v1^2 + v2^2) + a) if orientation == 1 #lambda = 0.5 * (abs(v1) + a) @@ -970,9 +970,9 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) H = (rho_e + p) / rho - lambda = 0.5 * (sqrt(v1^2 + v2^2) + a) + lambda = 0.5 * (sqrt_(v1^2 + v2^2) + a) if orientation == 1 #lambda = 0.5 * (abs(v1) + a) @@ -1006,8 +1006,8 @@ end v_rr = v2_rr end # Calculate sound speeds - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -1022,12 +1022,12 @@ end v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2]) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # right v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2]) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end @@ -1039,11 +1039,11 @@ end rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + sqrt_(equations.gamma * p_rr / rho_rr) else # y-direction - λ_min = v2_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v2_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v2_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v2_rr + sqrt_(equations.gamma * p_rr / rho_rr) end return λ_min, λ_max @@ -1059,8 +1059,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - sqrt(equations.gamma * p_ll / rho_ll) * norm_ - λ_max = v_normal_rr + sqrt(equations.gamma * p_rr / rho_rr) * norm_ + λ_min = v_normal_ll - sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + λ_max = v_normal_rr + sqrt_(equations.gamma * p_rr / rho_rr) * norm_ return λ_min, λ_max end @@ -1071,8 +1071,8 @@ end rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1093,8 +1093,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -1166,21 +1166,21 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, v2_ll = rho_v2_ll / rho_ll e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * (v1_ll^2 + v2_ll^2)) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v2_rr = rho_v2_rr / rho_rr e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * (v1_rr^2 + v2_rr^2)) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr if orientation == 1 # x-direction vel_L = v1_ll @@ -1196,7 +1196,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) sMu_L = Ssl - vel_L @@ -1265,16 +1265,16 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, norm_sq = norm_ * norm_ inv_norm_sq = inv(norm_sq) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ # Obtain left and right fluxes f_ll = flux(u_ll, normal_direction, equations) f_rr = flux(u_rr, normal_direction, equations) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) / sum_sqrt_rho @@ -1289,7 +1289,7 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, H_rr = (u_rr[4] + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ Ssl = min(v_dot_n_ll - c_ll, vel_roe - c_roe) Ssr = max(v_dot_n_rr + c_rr, vel_roe + c_roe) @@ -1367,15 +1367,15 @@ of the numerical flux. # `u_ll[4]` is total energy `rho_e_ll` on the left H_ll = (u_ll[4] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # `u_rr[4]` is total energy `rho_e_rr` on the right H_rr = (u_rr[4] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1383,11 +1383,11 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) if orientation == 1 # x-direction @@ -1429,15 +1429,15 @@ of the numerical flux. # `u_ll[4]` is total energy `rho_e_ll` on the left H_ll = (u_ll[4] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ # `u_rr[4]` is total energy `rho_e_rr` on the right H_rr = (u_rr[4] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1446,11 +1446,11 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) SsL = min(v_roe - c_roe, v_dot_n_ll - beta * c_ll, zero(v_roe)) @@ -1461,7 +1461,7 @@ end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations2D) rho, v1, v2, p = cons2prim(u, equations) - c = sqrt(equations.gamma * p / rho) + c = sqrt_(equations.gamma * p / rho) return abs(v1) + c, abs(v2) + c end @@ -1485,7 +1485,7 @@ end v2 = rho_v2 / rho v_square = v1^2 + v2^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - equations.gamma * log(rho) + s = log_(p) - equations.gamma * log_(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1575,7 +1575,7 @@ end p = (equations.gamma - 1) * (cons[4] - 1 / 2 * (cons[2]^2 + cons[3]^2) / cons[1]) # Thermodynamic entropy - s = log(p) - equations.gamma * log(cons[1]) + s = log_(p) - equations.gamma * log_(cons[1]) return s end diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 65fbd5a62ce..86afef34a33 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -148,7 +148,7 @@ function initial_condition_weak_blast_wave(x, t, x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) phi = atan(y_norm, x_norm) theta = iszero(r) ? 0.0 : acos(z_norm / r) @@ -310,7 +310,7 @@ Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = sqrt(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = sqrt_(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -320,7 +320,7 @@ Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + sqrt(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + sqrt_(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -797,7 +797,7 @@ end v3 = rho_v3 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2 + rho_v3 * v3)) - a = sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -868,7 +868,7 @@ end v3 = rho_v3 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2 + rho_v3 * v3)) - a = sqrt(equations.gamma * p / rho) + a = sqrt_(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -1044,8 +1044,8 @@ end v_rr = v3_rr end # Calculate sound speeds - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -1060,12 +1060,12 @@ end v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + v3_ll * normal_direction[3]) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # right v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + v3_rr * normal_direction[3]) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end @@ -1077,14 +1077,14 @@ end rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + sqrt_(equations.gamma * p_rr / rho_rr) elseif orientation == 2 # y-direction - λ_min = v2_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v2_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v2_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v2_rr + sqrt_(equations.gamma * p_rr / rho_rr) else # z-direction - λ_min = v3_ll - sqrt(equations.gamma * p_ll / rho_ll) - λ_max = v3_rr + sqrt(equations.gamma * p_rr / rho_rr) + λ_min = v3_ll - sqrt_(equations.gamma * p_ll / rho_ll) + λ_max = v3_rr + sqrt_(equations.gamma * p_rr / rho_rr) end return λ_min, λ_max @@ -1102,8 +1102,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - sqrt(equations.gamma * p_ll / rho_ll) * norm_ - λ_max = v_normal_rr + sqrt(equations.gamma * p_rr / rho_rr) * norm_ + λ_min = v_normal_ll - sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + λ_max = v_normal_rr + sqrt_(equations.gamma * p_rr / rho_rr) * norm_ return λ_min, λ_max end @@ -1114,8 +1114,8 @@ end rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1139,8 +1139,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + @@ -1210,7 +1210,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * (v1_ll^2 + v2_ll^2 + v3_ll^2)) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v2_rr = rho_v2_rr / rho_rr @@ -1218,15 +1218,15 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * (v1_rr^2 + v2_rr^2 + v3_rr^2)) - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr if orientation == 1 # x-direction vel_L = v1_ll @@ -1246,7 +1246,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) sMu_L = Ssl - vel_L @@ -1333,16 +1333,16 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, norm_sq = norm_ * norm_ inv_norm_sq = inv(norm_sq) - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ # Obtain left and right fluxes f_ll = flux(u_ll, normal_direction, equations) f_rr = flux(u_rr, normal_direction, equations) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) / sum_sqrt_rho @@ -1359,7 +1359,7 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, H_rr = (u_rr[5] + p_rr) / rho_rr H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ Ssl = min(v_dot_n_ll - c_ll, vel_roe - c_roe) Ssr = max(v_dot_n_rr + c_rr, vel_roe + c_roe) @@ -1445,15 +1445,15 @@ of the numerical flux. # `u_ll[5]` is total energy `rho_e_ll` on the left H_ll = (u_ll[5] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) # `u_rr[5]` is total energy `rho_e_rr` on the right H_rr = (u_rr[5] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1462,11 +1462,11 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) if orientation == 1 # x-direction @@ -1513,15 +1513,15 @@ of the numerical flux. # `u_ll[5]` is total energy `rho_e_ll` on the left H_ll = (u_ll[5] + p_ll) / rho_ll - c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ # `u_rr[5]` is total energy `rho_e_rr` on the right H_rr = (u_rr[5] + p_rr) / rho_rr - c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrt_rho_ll = sqrt(rho_ll) - sqrt_rho_rr = sqrt(rho_rr) + sqrt_rho_ll = sqrt_(rho_ll) + sqrt_rho_rr = sqrt_(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho @@ -1532,11 +1532,11 @@ of the numerical flux. v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) SsL = min(v_roe - c_roe, v_dot_n_ll - beta * c_ll, zero(v_roe)) @@ -1547,7 +1547,7 @@ end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations3D) rho, v1, v2, v3, p = cons2prim(u, equations) - c = sqrt(equations.gamma * p / rho) + c = sqrt_(equations.gamma * p / rho) return abs(v1) + c, abs(v2) + c, abs(v3) + c end @@ -1574,7 +1574,7 @@ end v3 = rho_v3 / rho v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log(p) - equations.gamma * log(rho) + s = log_(p) - equations.gamma * log_(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1647,7 +1647,7 @@ end p = pressure(u, equations) # Thermodynamic entropy - s = log(p) - equations.gamma * log(rho) + s = log_(p) - equations.gamma * log_(rho) return s end diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index 7c12510b58e..5bc8662a5ab 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -478,14 +478,14 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - gamma * log_(rho) - log(gas_constant) + s = log_(p) - gamma * log_(rho) - log_(gas_constant) rho_p = rho / p T = (rho_e - 0.5 * rho * v_square) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}((cv[i] * - (1 - log(T)) + + (1 - log_(T)) + gas_constants[i] * - (1 + log(u[i + 2])) - + (1 + log_(u[i + 2])) - v1^2 / (2 * T)) for i in eachcomponent(equations)) @@ -505,7 +505,7 @@ end cons_rho = SVector{ncomponents(equations), real(equations)}(exp(1 / gas_constants[i] * (-cv[i] * - log(-w[2]) - + log_(-w[2]) - cp[i] + w[i + 2] - 0.5 * w[1]^2 / w[2])) @@ -536,7 +536,7 @@ end total_entropy = zero(u[1]) for i in eachcomponent(equations) - total_entropy -= u[i + 2] * (cv[i] * log(T) - gas_constants[i] * log(u[i + 2])) + total_entropy -= u[i + 2] * (cv[i] * log_(T) - gas_constants[i] * log_(u[i + 2])) end return total_entropy diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index 66a872bfb0a..4872053cc67 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -213,7 +213,7 @@ function initial_condition_weak_blast_wave(x, t, inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) @@ -662,14 +662,14 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - gamma * log_(rho) - log(gas_constant) + s = log_(p) - gamma * log_(rho) - log_(gas_constant) rho_p = rho / p T = (rho_e - 0.5 * rho * v_square) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}((cv[i] * - (1 - log(T)) + + (1 - log_(T)) + gas_constants[i] * - (1 + log(u[i + 3])) - + (1 + log_(u[i + 3])) - v_square / (2 * T)) for i in eachcomponent(equations)) @@ -691,7 +691,7 @@ end v_squared = v1^2 + v2^2 cons_rho = SVector{ncomponents(equations), real(equations)}(exp((w[i + 3] - cv[i] * - (1 - log(T)) + + (1 - log_(T)) + v_squared / (2 * T)) / gas_constants[i] - @@ -742,7 +742,7 @@ end total_entropy = zero(u[1]) for i in eachcomponent(equations) - total_entropy -= u[i + 3] * (cv[i] * log(T) - gas_constants[i] * log(u[i + 3])) + total_entropy -= u[i + 3] * (cv[i] * log_(T) - gas_constants[i] * log_(u[i + 3])) end return total_entropy diff --git a/src/equations/ideal_glm_mhd_1d.jl b/src/equations/ideal_glm_mhd_1d.jl index 98d780aed46..c4622306f76 100644 --- a/src/equations/ideal_glm_mhd_1d.jl +++ b/src/equations/ideal_glm_mhd_1d.jl @@ -88,7 +88,7 @@ function initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations # Set up polar coordinates inicenter = (0,) x_norm = x[1] - inicenter[1] - r = sqrt(x_norm^2) + r = sqrt_(x_norm^2) phi = atan(x_norm) # Calculate primitive variables @@ -574,7 +574,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho v3 = rho_v3 / rho - v_mag = sqrt(v1^2 + v2^2 + v3^2) + v_mag = sqrt_(v1^2 + v2^2 + v3^2) p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = equations.gamma * p / rho @@ -584,7 +584,7 @@ end b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end @@ -657,7 +657,7 @@ as given by # Ignore orientation since it is always "1" in 1D c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) return v1_roe, c_f_roe end diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index 6ddf7419316..ed6f8ea3353 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -98,7 +98,7 @@ function initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations inicenter = (0, 0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) # Calculate primitive variables @@ -676,8 +676,8 @@ end rho_mean = ln_mean(rho_ll, rho_rr) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` # in exact arithmetic since - # log((ϱₗ/pₗ) / (ϱᵣ/pᵣ)) / (ϱₗ/pₗ - ϱᵣ/pᵣ) - # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) + # log_((ϱₗ/pₗ) / (ϱᵣ/pᵣ)) / (ϱₗ/pₗ - ϱᵣ/pᵣ) + # = pₗ pᵣ log_((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) v1_avg = 0.5 * (v1_ll + v1_rr) v2_avg = 0.5 * (v2_ll + v2_rr) @@ -1145,10 +1145,10 @@ end b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f @@ -1174,7 +1174,7 @@ end b_dot_n_squared = (b1 * normal_direction[1] + b2 * normal_direction[2])^2 / norm_squared - c_f = sqrt((0.5 * (a_square + b_square) + + c_f = sqrt_((0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * norm_squared) return c_f @@ -1255,7 +1255,7 @@ as given by c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe end @@ -1325,7 +1325,7 @@ end c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) - c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) + c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + v2_roe * normal_direction[2]) diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 8a939f83318..47c3f2c6448 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -73,8 +73,8 @@ function initial_condition_convergence_test(x, t, equations::IdealGlmMhdEquation r = 2 # e: epsilon = 0.2 e = 0.2 - nx = 1 / sqrt(r^2 + 1) - ny = r / sqrt(r^2 + 1) + nx = 1 / sqrt_(r^2 + 1) + ny = r / sqrt_(r^2 + 1) sqr = 1 Va = omega / (ny * sqr) phi_alv = omega / ny * (nx * (x[1] - 0.5 * r) + ny * (x[2] - 0.5 * r)) - Va * t @@ -107,7 +107,7 @@ function initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) phi = atan(y_norm, x_norm) theta = iszero(r) ? 0.0 : acos(z_norm / r) @@ -1038,13 +1038,13 @@ end b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) elseif orientation == 2 # y-direction - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) else # z-direction - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b3^2)) end return c_f @@ -1072,7 +1072,7 @@ end b2 * normal_direction[2] + b3 * normal_direction[3])^2 / norm_squared - c_f = sqrt((0.5 * (a_square + b_square) + + c_f = sqrt_((0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * norm_squared) return c_f @@ -1146,19 +1146,19 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe elseif orientation == 2 # y-direction c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe else # z-direction c_a_roe = B3_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v3_roe end @@ -1230,7 +1230,7 @@ end c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) - c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) + c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + v3_roe * normal_direction[3]) diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index ffca32d80ba..1404ea0b087 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -116,7 +116,7 @@ function initial_condition_weak_blast_wave(x, t, # Set up polar coordinates inicenter = (0) x_norm = x[1] - inicenter[1] - r = sqrt(x_norm^2) + r = sqrt_(x_norm^2) phi = atan(x_norm) # Calculate primitive variables @@ -306,8 +306,8 @@ Hindenlang (2019), extending [`flux_ranocha`](@ref) to the MHD equations. # Compute the necessary mean values needed for either direction # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` # in exact arithmetic since - # log((ϱₗ/pₗ) / (ϱᵣ/pᵣ)) / (ϱₗ/pₗ - ϱᵣ/pᵣ) - # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) + # log_((ϱₗ/pₗ) / (ϱᵣ/pᵣ)) / (ϱₗ/pₗ - ϱᵣ/pᵣ) + # = pₗ pᵣ log_((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) v1_avg = 0.5 * (v1_ll + v1_rr) v2_avg = 0.5 * (v2_ll + v2_rr) @@ -496,7 +496,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho v3 = rho_v3 / rho - v_mag = sqrt(v1^2 + v2^2 + v3^2) + v_mag = sqrt_(v1^2 + v2^2 + v3^2) gamma = totalgamma(cons, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = gamma * p / rho @@ -506,7 +506,7 @@ end b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index 5ef9c0aa56b..fd923ef7066 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -125,7 +125,7 @@ function initial_condition_weak_blast_wave(x, t, inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) @@ -659,7 +659,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho v3 = rho_v3 / rho - v_mag = sqrt(v1^2 + v2^2 + v3^2) + v_mag = sqrt_(v1^2 + v2^2 + v3^2) gamma = totalgamma(cons, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) @@ -670,10 +670,10 @@ end b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 if direction == 1 # x-direction - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else - c_f = sqrt(0.5 * (a_square + b_square) + + c_f = sqrt_(0.5 * (a_square + b_square) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f diff --git a/src/equations/lattice_boltzmann_2d.jl b/src/equations/lattice_boltzmann_2d.jl index 272dd897ce3..f2220c0c8e3 100644 --- a/src/equations/lattice_boltzmann_2d.jl +++ b/src/equations/lattice_boltzmann_2d.jl @@ -101,7 +101,7 @@ function LatticeBoltzmannEquations2D(; Ma, Re, collision_op = collision_bgk, # The relation between the isothermal speed of sound `c_s` and the mean thermal molecular velocity # `c` depends on the used phase space discretization, and is valid for D2Q9 (and others). For # details, see, e.g., [3] in the docstring above. - c_s = c / sqrt(3) + c_s = c / sqrt_(3) # Calculate missing quantities if isnothing(Ma) diff --git a/src/equations/lattice_boltzmann_3d.jl b/src/equations/lattice_boltzmann_3d.jl index d3eada15f56..6a0b0726b36 100644 --- a/src/equations/lattice_boltzmann_3d.jl +++ b/src/equations/lattice_boltzmann_3d.jl @@ -141,7 +141,7 @@ function LatticeBoltzmannEquations3D(; Ma, Re, collision_op = collision_bgk, # The relation between the isothermal speed of sound `c_s` and the mean thermal molecular velocity # `c` depends on the used phase space discretization, and is valid for D3Q27 (and others). For # details, see, e.g., [3] in the docstring above. - c_s = c / sqrt(3) + c_s = c / sqrt_(3) # Calculate missing quantities if isnothing(Ma) diff --git a/src/equations/polytropic_euler_2d.jl b/src/equations/polytropic_euler_2d.jl index f0473d53a6d..4cbe939e946 100644 --- a/src/equations/polytropic_euler_2d.jl +++ b/src/equations/polytropic_euler_2d.jl @@ -109,7 +109,7 @@ function initial_condition_weak_blast_wave(x, t, equations::PolytropicEulerEquat inicenter = (0, 0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) # Calculate primitive variables diff --git a/src/equations/shallow_water_1d.jl b/src/equations/shallow_water_1d.jl index d79c8fb0b65..3798427c6d2 100644 --- a/src/equations/shallow_water_1d.jl +++ b/src/equations/shallow_water_1d.jl @@ -100,12 +100,12 @@ A smooth initial condition used for convergence tests in combination with function initial_condition_convergence_test(x, t, equations::ShallowWaterEquations1D) # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)] c = 7.0 - omega_x = 2.0 * pi * sqrt(2.0) + omega_x = 2.0 * pi * sqrt_(2.0) omega_t = 2.0 * pi H = c + cos(omega_x * x[1]) * cos(omega_t * t) v = 0.5 - b = 2.0 + 0.5 * sin(sqrt(2.0) * pi * x[1]) + b = 2.0 + 0.5 * sin(sqrt_(2.0) * pi * x[1]) return prim2cons(SVector(H, v, b), equations) end @@ -117,7 +117,7 @@ Source terms used for convergence tests in combination with (and [`BoundaryConditionDirichlet(initial_condition_convergence_test)`](@ref) in non-periodic domains). This manufactured solution source term is specifically designed for the bottom topography function -`b(x) = 2.0 + 0.5 * sin(sqrt(2.0)*pi*x[1])` +`b(x) = 2.0 + 0.5 * sin(sqrt_(2.0)*pi*x[1])` as defined in [`initial_condition_convergence_test`](@ref). """ @@ -126,9 +126,9 @@ as defined in [`initial_condition_convergence_test`](@ref). # Same settings as in `initial_condition_convergence_test`. Some derivative simplify because # this manufactured solution velocity is taken to be constant c = 7.0 - omega_x = 2.0 * pi * sqrt(2.0) + omega_x = 2.0 * pi * sqrt_(2.0) omega_t = 2.0 * pi - omega_b = sqrt(2.0) * pi + omega_b = sqrt_(2.0) * pi v = 0.5 sinX, cosX = sincos(omega_x * x[1]) @@ -141,7 +141,7 @@ as defined in [`initial_condition_convergence_test`](@ref). H_t = -omega_t * cosX * sinT # bottom topography and its spatial derivative - b = 2.0 + 0.5 * sin(sqrt(2.0) * pi * x[1]) + b = 2.0 + 0.5 * sin(sqrt_(2.0) * pi * x[1]) b_x = 0.5 * omega_b * cos(omega_b * x[1]) du1 = H_t + v * (H_x - b_x) diff --git a/src/equations/shallow_water_2d.jl b/src/equations/shallow_water_2d.jl index fdcb4c00328..6fad3d142d1 100644 --- a/src/equations/shallow_water_2d.jl +++ b/src/equations/shallow_water_2d.jl @@ -102,7 +102,7 @@ A smooth initial condition used for convergence tests in combination with function initial_condition_convergence_test(x, t, equations::ShallowWaterEquations2D) # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)]^2 c = 7.0 - omega_x = 2.0 * pi * sqrt(2.0) + omega_x = 2.0 * pi * sqrt_(2.0) omega_t = 2.0 * pi x1, x2 = x @@ -110,7 +110,7 @@ function initial_condition_convergence_test(x, t, equations::ShallowWaterEquatio H = c + cos(omega_x * x1) * sin(omega_x * x2) * cos(omega_t * t) v1 = 0.5 v2 = 1.5 - b = 2.0 + 0.5 * sin(sqrt(2.0) * pi * x1) + 0.5 * sin(sqrt(2.0) * pi * x2) + b = 2.0 + 0.5 * sin(sqrt_(2.0) * pi * x1) + 0.5 * sin(sqrt_(2.0) * pi * x2) return prim2cons(SVector(H, v1, v2, b), equations) end @@ -122,7 +122,7 @@ Source terms used for convergence tests in combination with (and [`BoundaryConditionDirichlet(initial_condition_convergence_test)`](@ref) in non-periodic domains). This manufactured solution source term is specifically designed for the bottom topography function -`b(x,y) = 2 + 0.5 * sin(sqrt(2)*pi*x) + 0.5 * sin(sqrt(2)*pi*y)` +`b(x,y) = 2 + 0.5 * sin(sqrt_(2)*pi*x) + 0.5 * sin(sqrt_(2)*pi*y)` as defined in [`initial_condition_convergence_test`](@ref). """ @inline function source_terms_convergence_test(u, x, t, @@ -130,9 +130,9 @@ as defined in [`initial_condition_convergence_test`](@ref). # Same settings as in `initial_condition_convergence_test`. Some derivative simplify because # this manufactured solution velocities are taken to be constants c = 7.0 - omega_x = 2.0 * pi * sqrt(2.0) + omega_x = 2.0 * pi * sqrt_(2.0) omega_t = 2.0 * pi - omega_b = sqrt(2.0) * pi + omega_b = sqrt_(2.0) * pi v1 = 0.5 v2 = 1.5 @@ -150,7 +150,7 @@ as defined in [`initial_condition_convergence_test`](@ref). H_t = -omega_t * cosX * sinY * sinT # bottom topography and its gradient - b = 2.0 + 0.5 * sin(sqrt(2.0) * pi * x1) + 0.5 * sin(sqrt(2.0) * pi * x2) + b = 2.0 + 0.5 * sin(sqrt_(2.0) * pi * x1) + 0.5 * sin(sqrt_(2.0) * pi * x2) tmp1 = 0.5 * omega_b b_x = tmp1 * cos(omega_b * x1) b_y = tmp1 * cos(omega_b * x2) @@ -172,7 +172,7 @@ function initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquation inicenter = SVector(0.7, 0.7) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt(x_norm^2 + y_norm^2) + r = sqrt_(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/src/equations/shallow_water_quasi_1d.jl b/src/equations/shallow_water_quasi_1d.jl index 67a75d0096b..9d37c52522b 100644 --- a/src/equations/shallow_water_quasi_1d.jl +++ b/src/equations/shallow_water_quasi_1d.jl @@ -95,7 +95,7 @@ function initial_condition_convergence_test(x, t, equations::ShallowWaterEquationsQuasi1D) # generates a manufactured solution. # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)] - Omega = sqrt(2) * pi + Omega = sqrt_(2) * pi H = 2.0 + 0.5 * sin(Omega * x[1] - t) v = 0.25 b = 0.2 - 0.05 * sin(Omega * x[1]) @@ -118,7 +118,7 @@ as defined in [`initial_condition_convergence_test`](@ref). equations::ShallowWaterEquationsQuasi1D) # Same settings as in `initial_condition_convergence_test`. Some derivative simplify because # this manufactured solution velocity is taken to be constant - Omega = sqrt(2) * pi + Omega = sqrt_(2) * pi H = 2.0 + 0.5 * sin(Omega * x[1] - t) H_x = 0.5 * cos(Omega * x[1] - t) * Omega H_t = -0.5 * cos(Omega * x[1] - t) diff --git a/src/equations/shallow_water_two_layer_1d.jl b/src/equations/shallow_water_two_layer_1d.jl index 38e1240c2ac..e030128bce1 100644 --- a/src/equations/shallow_water_two_layer_1d.jl +++ b/src/equations/shallow_water_two_layer_1d.jl @@ -109,7 +109,7 @@ A smooth initial condition used for convergence tests in combination with function initial_condition_convergence_test(x, t, equations::ShallowWaterTwoLayerEquations1D) # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)] - ω = 2.0 * pi * sqrt(2.0) + ω = 2.0 * pi * sqrt_(2.0) H_lower = 2.0 + 0.1 * sin(ω * x[1] + t) H_upper = 4.0 + 0.1 * cos(ω * x[1] + t) @@ -132,7 +132,7 @@ in non-periodic domains). equations::ShallowWaterTwoLayerEquations1D) # Same settings as in `initial_condition_convergence_test`. Some derivative simplify because # this manufactured solution velocity is taken to be constant - ω = 2 * pi * sqrt(2.0) + ω = 2 * pi * sqrt_(2.0) du1 = (-0.1 * cos(t + ω * x[1]) - 0.1 * sin(t + ω * x[1]) - 0.09 * ω * cos(t + ω * x[1]) + diff --git a/src/equations/shallow_water_two_layer_2d.jl b/src/equations/shallow_water_two_layer_2d.jl index c8c9a510620..f339cfd2a43 100644 --- a/src/equations/shallow_water_two_layer_2d.jl +++ b/src/equations/shallow_water_two_layer_2d.jl @@ -121,7 +121,7 @@ A smooth initial condition used for convergence tests in combination with function initial_condition_convergence_test(x, t, equations::ShallowWaterTwoLayerEquations2D) # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)]^2] - ω = 2.0 * pi * sqrt(2.0) + ω = 2.0 * pi * sqrt_(2.0) H_lower = 2.0 + 0.1 * sin(ω * x[1] + t) * cos(ω * x[2] + t) H_upper = 4.0 + 0.1 * cos(ω * x[1] + t) * sin(ω * x[2] + t) @@ -144,8 +144,8 @@ Source terms used for convergence tests in combination with @inline function source_terms_convergence_test(u, x, t, equations::ShallowWaterTwoLayerEquations2D) # Same settings as in `initial_condition_convergence_test`. - # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)]^2] - ω = 2.0 * pi * sqrt(2.0) + # some constants are chosen such that the function is periodic on the domain [0,sqrt_(2)]^2] + ω = 2.0 * pi * sqrt_(2.0) # Source terms obtained with SymPy du1 = 0.01 * ω * cos(t + ω * x[1]) * cos(t + ω * x[2]) + diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index 60db285e04f..772633c2243 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -1217,7 +1217,7 @@ function cubed_sphere_mapping(xi, eta, zeta, inner_radius, thickness, direction) SVector(x, y, 1)) # Radius on cube surface - r = sqrt(1 + x^2 + y^2) + r = sqrt_(1 + x^2 + y^2) # Radius of the sphere R = inner_radius + thickness * (0.5 * (zeta + 1)) diff --git a/src/semidiscretization/semidiscretization.jl b/src/semidiscretization/semidiscretization.jl index 8518cf27fd3..cf7f5a7d873 100644 --- a/src/semidiscretization/semidiscretization.jl +++ b/src/semidiscretization/semidiscretization.jl @@ -206,7 +206,7 @@ function jacobian_fd(semi::AbstractSemidiscretization; # use second order finite difference to estimate Jacobian matrix for idx in eachindex(u0_ode) # determine size of fluctuation - epsilon = sqrt(eps(u0_ode[idx])) + epsilon = sqrt_(eps(u0_ode[idx])) # plus fluctuation u_ode[idx] = u0_ode[idx] + epsilon diff --git a/src/solvers/dgmulti/shock_capturing.jl b/src/solvers/dgmulti/shock_capturing.jl index d224e5ed03d..63589d0a5a9 100644 --- a/src/solvers/dgmulti/shock_capturing.jl +++ b/src/solvers/dgmulti/shock_capturing.jl @@ -68,7 +68,7 @@ function (indicator_hg::IndicatorHennemannGassner)(u, mesh::DGMultiMesh, # magic parameters threshold = 0.5 * 10^(-1.8 * (dg.basis.N + 1)^0.25) - parameter_s = log((1 - 0.0001) / 0.0001) + parameter_s = log_((1 - 0.0001) / 0.0001) @threaded for element in eachelement(mesh, dg) indicator = indicator_threaded[Threads.threadid()] diff --git a/src/solvers/dgsem/basis_lobatto_legendre.jl b/src/solvers/dgsem/basis_lobatto_legendre.jl index 6a92fd1c066..e350190bce6 100644 --- a/src/solvers/dgsem/basis_lobatto_legendre.jl +++ b/src/solvers/dgsem/basis_lobatto_legendre.jl @@ -625,7 +625,7 @@ function gauss_nodes_weights(n_nodes::Integer) weights .= 2.0 return nodes, weights elseif N == 1 - nodes[1] = -sqrt(1 / 3) + nodes[1] = -sqrt_(1 / 3) nodes[end] = -nodes[1] weights .= 1.0 return nodes, weights @@ -692,8 +692,8 @@ function legendre_polynomial_and_derivative(N::Int, x::Real) end # Normalize - poly = poly * sqrt(N + 0.5) - deriv = deriv * sqrt(N + 0.5) + poly = poly * sqrt_(N + 0.5) + deriv = deriv * sqrt_(N + 0.5) return poly, deriv end diff --git a/src/solvers/dgsem_tree/indicators.jl b/src/solvers/dgsem_tree/indicators.jl index bb9109f2762..7644e87cfc1 100644 --- a/src/solvers/dgsem_tree/indicators.jl +++ b/src/solvers/dgsem_tree/indicators.jl @@ -191,7 +191,7 @@ function (indicator_hg::IndicatorHennemannGassner)(u, mesh, equations, dg::DGSEM # magic parameters threshold = 0.5 * 10^(-1.8 * (nnodes(dg))^0.25) - parameter_s = log((1 - 0.0001) / 0.0001) + parameter_s = log_((1 - 0.0001) / 0.0001) @threaded for element in eachelement(dg, cache) # This is dispatched by mesh dimension. diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index dff87bfe06c..66d38ee33ce 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -47,7 +47,7 @@ function (indicator_hg::IndicatorHennemannGassnerShallowWater)(u::AbstractArray{ # magic parameters threshold = 0.5 * 10^(-1.8 * (nnodes(dg))^0.25) - parameter_s = log((1 - 0.0001) / 0.0001) + parameter_s = log_((1 - 0.0001) / 0.0001) # If the water height `h` at one LGL node is lower than `threshold_partially_wet` # the indicator sets the element-wise blending factor alpha[element] = 1 diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index fa8ed481eb9..b7a712153cd 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -51,7 +51,7 @@ function (indicator_hg::IndicatorHennemannGassnerShallowWater)(u::AbstractArray{ # magic parameters threshold = 0.5 * 10^(-1.8 * (nnodes(dg))^0.25) - parameter_s = log((1 - 0.0001) / 0.0001) + parameter_s = log_((1 - 0.0001) / 0.0001) # If the water height `h` at one LGL node is lower than `threshold_partially_wet` # the indicator sets the element-wise blending factor alpha[element] = 1 diff --git a/src/solvers/dgsem_unstructured/containers_2d.jl b/src/solvers/dgsem_unstructured/containers_2d.jl index f51dd09801b..8b1cebfcc0d 100644 --- a/src/solvers/dgsem_unstructured/containers_2d.jl +++ b/src/solvers/dgsem_unstructured/containers_2d.jl @@ -224,19 +224,19 @@ function init_interfaces!(interfaces, edge_information, boundary_names, n_elemen # structured mesh where the element local surface numbering is right-handed if boundary_names[primary_side, primary_element] === :Bottom secondary_element = primary_element + - (n_elements - convert(Int, sqrt(n_elements))) + (n_elements - convert(Int, sqrt_(n_elements))) secondary_side = 3 elseif boundary_names[primary_side, primary_element] === :Top secondary_element = primary_element - - (n_elements - convert(Int, sqrt(n_elements))) + (n_elements - convert(Int, sqrt_(n_elements))) secondary_side = 1 elseif boundary_names[primary_side, primary_element] === :Left secondary_element = primary_element + - (convert(Int, sqrt(n_elements)) - 1) + (convert(Int, sqrt_(n_elements)) - 1) secondary_side = 2 elseif boundary_names[primary_side, primary_element] === :Right secondary_element = primary_element - - (convert(Int, sqrt(n_elements)) - 1) + (convert(Int, sqrt_(n_elements)) - 1) secondary_side = 4 end interfaces.element_ids[1, j] = primary_element diff --git a/src/solvers/fdsbp_tree/fdsbp_1d.jl b/src/solvers/fdsbp_tree/fdsbp_1d.jl index 0de0cff4851..f334e8af6d3 100644 --- a/src/solvers/fdsbp_tree/fdsbp_1d.jl +++ b/src/solvers/fdsbp_tree/fdsbp_1d.jl @@ -319,7 +319,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt(l2_error / total_volume_) + l2_error = @. sqrt_(l2_error / total_volume_) return l2_error, linf_error end diff --git a/src/solvers/fdsbp_tree/fdsbp_2d.jl b/src/solvers/fdsbp_tree/fdsbp_2d.jl index 09d18cecd75..6a92458fd9b 100644 --- a/src/solvers/fdsbp_tree/fdsbp_2d.jl +++ b/src/solvers/fdsbp_tree/fdsbp_2d.jl @@ -374,7 +374,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt(l2_error / total_volume_) + l2_error = @. sqrt_(l2_error / total_volume_) return l2_error, linf_error end diff --git a/src/solvers/fdsbp_tree/fdsbp_3d.jl b/src/solvers/fdsbp_tree/fdsbp_3d.jl index 0c3f18b6d6e..d7f39ffa7c0 100644 --- a/src/solvers/fdsbp_tree/fdsbp_3d.jl +++ b/src/solvers/fdsbp_tree/fdsbp_3d.jl @@ -427,7 +427,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt(l2_error / total_volume_) + l2_error = @. sqrt_(l2_error / total_volume_) return l2_error, linf_error end diff --git a/src/solvers/fdsbp_unstructured/fdsbp_2d.jl b/src/solvers/fdsbp_unstructured/fdsbp_2d.jl index b459f4c42cc..3df95e706e2 100644 --- a/src/solvers/fdsbp_unstructured/fdsbp_2d.jl +++ b/src/solvers/fdsbp_unstructured/fdsbp_2d.jl @@ -212,7 +212,7 @@ function calc_error_norms(func, u, t, analyzer, end # For L2 error, divide by total volume - l2_error = @. sqrt(l2_error / total_volume) + l2_error = @. sqrt_(l2_error / total_volume) return l2_error, linf_error end diff --git a/src/visualization/recipes_plots.jl b/src/visualization/recipes_plots.jl index 0e9b5a66a8d..61167154bc0 100644 --- a/src/visualization/recipes_plots.jl +++ b/src/visualization/recipes_plots.jl @@ -89,7 +89,7 @@ RecipesBase.@recipe function f(pd::AbstractPlotData) cols = length(pd) rows = 1 else - cols = ceil(Int, sqrt(length(pd))) + cols = ceil(Int, sqrt_(length(pd))) rows = ceil(Int, length(pd) / cols) end diff --git a/src/visualization/utilities.jl b/src/visualization/utilities.jl index 05457395ac0..35c4454ba0e 100644 --- a/src/visualization/utilities.jl +++ b/src/visualization/utilities.jl @@ -742,7 +742,7 @@ function calc_arc_length(coordinates) arc_length = zeros(n_points) for i in 1:(n_points - 1) arc_length[i + 1] = arc_length[i] + - sqrt(sum((coordinates[:, i] - coordinates[:, i + 1]) .^ 2)) + sqrt_(sum((coordinates[:, i] - coordinates[:, i + 1]) .^ 2)) end return arc_length end diff --git a/test/test_dgmulti_1d.jl b/test/test_dgmulti_1d.jl index 0363086341f..bd934c24785 100644 --- a/test/test_dgmulti_1d.jl +++ b/test/test_dgmulti_1d.jl @@ -37,7 +37,7 @@ end 7.853842541289665e-7, 9.609905503440606e-7, 2.832322219966481e-6, - ] ./ sqrt(2.0), + ] ./ sqrt_(2.0), linf=[ 1.5003758788711963e-6, 1.802998748523521e-6, diff --git a/test/test_dgmulti_2d.jl b/test/test_dgmulti_2d.jl index 892c8ed37f0..d85178702e1 100644 --- a/test/test_dgmulti_2d.jl +++ b/test/test_dgmulti_2d.jl @@ -244,7 +244,7 @@ end 1.1343911906935844e-5, 3.679582619220412e-5, ], - rtol=2 * sqrt(eps())) + rtol=2 * sqrt_(eps())) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_dgmulti_3d.jl b/test/test_dgmulti_3d.jl index 3a1db255484..69a98e238fa 100644 --- a/test/test_dgmulti_3d.jl +++ b/test/test_dgmulti_3d.jl @@ -24,7 +24,7 @@ isdir(outdir) && rm(outdir, recursive = true) 0.001072975385793516, 0.000997247778892257, 0.0039364354651358294, - ] ./ sqrt(8), + ] ./ sqrt_(8), linf=[ 0.003660737033303718, 0.005625620600749226, @@ -53,7 +53,7 @@ end 0.016589517840793006, 0.015905000907070196, 0.03903416208587798, - ] ./ sqrt(8), + ] ./ sqrt_(8), linf=[ 0.06856547797256729, 0.08225664880340489, @@ -81,7 +81,7 @@ end 0.00040146357607564597, 0.000401463576075708, 0.0015749412434154315, - ] ./ sqrt(8), + ] ./ sqrt_(8), linf=[ 0.00036910287847780054, 0.00042659774184228283, @@ -161,7 +161,7 @@ end 0.0011273991123913515, 0.0010418496196130177, 0.004058878478404962, - ] ./ sqrt(8), + ] ./ sqrt_(8), linf=[ 0.003227752881827861, 0.005620317864620361, @@ -189,7 +189,7 @@ end 0.0004439720471461567, 0.0004439720471464591, 0.0016639410646990126, - ] ./ sqrt(8), + ] ./ sqrt_(8), linf=[ 0.0003674374460325147, 0.0004253921341716982, @@ -220,7 +220,7 @@ end 0.0024913155507195303, 0.002491315550720031, 0.008585818982343299, - ] ./ sqrt(8), + ] ./ sqrt_(8), linf=[ 0.003810078279323559, 0.004998778644230928, diff --git a/test/test_mpi_tree.jl b/test/test_mpi_tree.jl index 0831f6a1313..36e012d2732 100644 --- a/test/test_mpi_tree.jl +++ b/test/test_mpi_tree.jl @@ -177,7 +177,7 @@ CI_ON_WINDOWS = (get(ENV, "GITHUB_ACTIONS", false) == "true") && Sys.iswindows() 1.1707525976456523e-5, 4.8869615580926506e-5, ], - rtol=2000 * sqrt(eps())) + rtol=2000 * sqrt_(eps())) end end diff --git a/test/test_special_elixirs.jl b/test/test_special_elixirs.jl index ba670a6025e..d768ff9bc2e 100644 --- a/test/test_special_elixirs.jl +++ b/test/test_special_elixirs.jl @@ -119,7 +119,7 @@ end tspan = (0.0, 0.0), initial_refinement_level = 2) A, b = linear_structure(semi) λ = eigvals(Matrix(A)) - @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) trixi_include(@__MODULE__, joinpath(EXAMPLES_DIR, "tree_2d_dgsem", @@ -127,7 +127,7 @@ end tspan = (0.0, 0.0), initial_refinement_level = 2) A, b = linear_structure(semi) λ = eigvals(Matrix(A)) - @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) # check whether the user can modify `b` without changing `A` x = vec(ode.u0) @@ -147,12 +147,12 @@ end J = jacobian_ad_forward(semi) @test Matrix(A) ≈ J λ = eigvals(J) - @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) J = jacobian_fd(semi) @test Matrix(A) ≈ J λ = eigvals(J) - @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) end @timed_testset "Linear advection-diffusion" begin @@ -163,7 +163,7 @@ end J = jacobian_ad_forward(semi) λ = eigvals(J) - @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) end @timed_testset "Compressible Euler equations" begin @@ -263,7 +263,7 @@ end tspan = (0.0, 0.0), initial_refinement_level = 1) A, b = linear_structure(semi) λ = eigvals(Matrix(A)) - @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) end @timed_testset "Test Jacobian of DG (3D)" begin diff --git a/test/test_tree_1d.jl b/test/test_tree_1d.jl index 4654f6313f7..8ec1e182708 100644 --- a/test/test_tree_1d.jl +++ b/test/test_tree_1d.jl @@ -255,7 +255,7 @@ end # characteristics function initial_condition_sine(x, t, equation::NonconservativeLinearAdvectionEquation) - x0 = -2 * atan(sqrt(3) * tan(sqrt(3) / 2 * t - atan(tan(x[1] / 2) / sqrt(3)))) + x0 = -2 * atan(sqrt_(3) * tan(sqrt_(3) / 2 * t - atan(tan(x[1] / 2) / sqrt_(3)))) scalar = sin(x0) advection_velocity = 2 + cos(x[1]) SVector(scalar, advection_velocity) diff --git a/test/test_trixi.jl b/test/test_trixi.jl index cebe2164ae6..6f94998099d 100644 --- a/test/test_trixi.jl +++ b/test/test_trixi.jl @@ -18,7 +18,7 @@ macro test_trixi_include(elixir, args...) local l2 = get_kwarg(args, :l2, nothing) local linf = get_kwarg(args, :linf, nothing) local atol = get_kwarg(args, :atol, 500 * eps()) - local rtol = get_kwarg(args, :rtol, sqrt(eps())) + local rtol = get_kwarg(args, :rtol, sqrt_(eps())) local skip_coverage = get_kwarg(args, :skip_coverage, false) local coverage_override = expr_to_named_tuple(get_kwarg(args, :coverage_override, :())) if !(:maxiters in keys(coverage_override)) From af22566aae49ac0e3dc7369b6e47f9683343792b Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 10 Jan 2024 23:20:39 +0100 Subject: [PATCH 19/55] docu --- src/auxiliary/math.jl | 89 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 8 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 7a5d4982cb4..eacd90f830f 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,19 +5,92 @@ @muladd begin #! format: noindent -# `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` +""" + sqrt_(x::Real) + +Custom square root function which returns `NaN` for negative arguments instead of throwing an error. +This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) +when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), +i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`threaded`](@ref). + +We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsic `sqrt_llvm` as for this the +`sqrt_llvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. +For other types, such as integers or dual numbers required for algorithmic differentiation, we +fall back to the Julia built-in `sqrt` function after a check for negative arguments. +Since these cases are not performance critical, the check for negativity does not hurt here +and can (as of now) optimized away by the compiler. + +When debugging code, it might be useful to change the implementation of this function to redirect to +the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated +in the stacktrace. +""" @inline sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) -# sqrt_llvm returns garbage for ints, prevent that from happening -@inline sqrt_(x::Union{Float64, Float32}) = Base.sqrt_llvm(x) -#@inline sqrt_(x) = Base.sqrt(x) # For benchmarking -# < 0 suffices since log(0) = -Inf -# `AbstractFloat` clashes with `ForwardDiff.Dual` => use `Real` +""" + sqrt_(x::Union{Float64, Float32, Float16}) + +Custom square root function which returns `NaN` for negative arguments instead of throwing an error. +This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) +when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), +i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`threaded`](@ref). + +For `Float64, Float32, Float16` the LLVM intrinsic `sqrt_llvm` function can be used out-of the box, +i.e., it returns `NaN` for negative arguments. +For other types, such as integers or dual numbers required for algorithmic differentiation, we +fall back to the Julia built-in `sqrt` function after a check for negative arguments, +see [`sqrt_(x::Real)`](@ref). + +When debugging code, it might be useful to change the implementation of this function to redirect to +the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated +in the stacktrace. +""" +@inline sqrt_(x::Union{Float64, Float32, Float16}) = Base.sqrt_llvm(x) +#@inline sqrt_(x) = Base.sqrt(x) # For benchmarking and debugging + +""" + log_(x::Real) + +Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. +This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) +when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), +i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`threaded`](@ref). + +We dispatch this function for `Float64, Float32, Float16` to the respective LLVM intrinsics +`llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16"` as for this the LLVM functions can be used out-of the box, i.e., +they return `NaN` for negative arguments. +For other types, such as integers or dual numbers required for algorithmic differentiation, we +fall back to the Julia built-in `log` function after a check for negative arguments. +Since these cases are not performance critical, the check for negativity does not hurt here +and can (as of now) optimized away by the compiler. + +When debugging code, it might be useful to change the implementation of this function to redirect to +the Julia built-in `log` function, as this reports the exact place in code where the domain is violated +in the stacktrace. +""" @inline log_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) -# See https://github.com/JuliaLang/julia/issues/8869#issuecomment-596165947 + +""" + log_(x::Float64_or_Float32_or_Float16) + +Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. +This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) +when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), +i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`threaded`](@ref). + +For `Float64, Float32, Float16` the respective LLVM intrinsic `llvm.log.f64/f32/f16` function can be used out-of the box, +i.e., it returns `NaN` for negative arguments. +For other types, such as integers or dual numbers required for algorithmic differentiation, we +fall back to the Julia built-in `log` function after a check for negative arguments, +see [`log_(x::Real)`](@ref). + +When debugging code, it might be useful to change the implementation of this function to redirect to +the Julia built-in `log` function, as this reports the exact place in code where the domain is violated +in the stacktrace. +""" @inline log_(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64, ), x) @inline log_(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32, ), x) -#@inline log_(x) = Base.log(x) # For benchmarking +@inline log_(x::Float16) = ccall("llvm.log.f32", llvmcall, Float32, (Float32, ), x) +#@inline log_(x) = Base.log(x) # For benchmarking and debugging """ ln_mean(x, y) From 7bbec8b652316f802bb9a2eff35e6a9dff64e617 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 10 Jan 2024 23:23:34 +0100 Subject: [PATCH 20/55] fmt --- .../elixir_shallowwater_twolayer_well_balanced.jl | 2 +- .../elixir_shallowwater_twolayer_well_balanced.jl | 2 +- src/auxiliary/math.jl | 6 +++--- src/equations/compressible_euler_2d.jl | 2 +- src/equations/compressible_euler_3d.jl | 2 +- src/equations/compressible_euler_multicomponent_1d.jl | 3 ++- src/equations/compressible_euler_multicomponent_2d.jl | 3 ++- src/equations/ideal_glm_mhd_1d.jl | 2 +- src/equations/ideal_glm_mhd_2d.jl | 8 ++++---- src/equations/ideal_glm_mhd_3d.jl | 10 +++++----- src/equations/ideal_glm_mhd_multicomponent_1d.jl | 2 +- src/equations/ideal_glm_mhd_multicomponent_2d.jl | 4 ++-- test/test_tree_1d.jl | 3 ++- 13 files changed, 26 insertions(+), 23 deletions(-) diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl index 09596ecd795..5c7aa232613 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl @@ -20,7 +20,7 @@ function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEq v2_lower = 0.0 b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? 0.2 * (cos(4 * pi * sqrt_((x[1] - 0.5)^2 + (x[2] + - -0.5)^2)) + 1) : 0.0) + -0.5)^2)) + 1) : 0.0) return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl index 6ddb7921489..4e7828f044b 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl @@ -23,7 +23,7 @@ function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEq # Bottom Topography b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? 0.2 * (cos(4 * pi * sqrt_((x[1] - 0.5)^2 + (x[2] + - -0.5)^2)) + 1) : 0.0) + -0.5)^2)) + 1) : 0.0) return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations) end diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index eacd90f830f..f596de1e79f 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -87,9 +87,9 @@ When debugging code, it might be useful to change the implementation of this fun the Julia built-in `log` function, as this reports the exact place in code where the domain is violated in the stacktrace. """ -@inline log_(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64, ), x) -@inline log_(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32, ), x) -@inline log_(x::Float16) = ccall("llvm.log.f32", llvmcall, Float32, (Float32, ), x) +@inline log_(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64,), x) +@inline log_(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) +@inline log_(x::Float16) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) #@inline log_(x) = Base.log(x) # For benchmarking and debugging """ diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 0b8fab1d760..65b8d661204 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1607,4 +1607,4 @@ end @inline function energy_internal(cons, equations::CompressibleEulerEquations2D) return energy_total(cons, equations) - energy_kinetic(cons, equations) end -end # @muladd \ No newline at end of file +end # @muladd diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 86afef34a33..46ce8e63514 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1679,4 +1679,4 @@ end @inline function energy_internal(cons, equations::CompressibleEulerEquations3D) return energy_total(cons, equations) - energy_kinetic(cons, equations) end -end # @muladd \ No newline at end of file +end # @muladd diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index 5bc8662a5ab..d1129e89a3a 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -536,7 +536,8 @@ end total_entropy = zero(u[1]) for i in eachcomponent(equations) - total_entropy -= u[i + 2] * (cv[i] * log_(T) - gas_constants[i] * log_(u[i + 2])) + total_entropy -= u[i + 2] * + (cv[i] * log_(T) - gas_constants[i] * log_(u[i + 2])) end return total_entropy diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index 4872053cc67..1f26dc192f2 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -742,7 +742,8 @@ end total_entropy = zero(u[1]) for i in eachcomponent(equations) - total_entropy -= u[i + 3] * (cv[i] * log_(T) - gas_constants[i] * log_(u[i + 3])) + total_entropy -= u[i + 3] * + (cv[i] * log_(T) - gas_constants[i] * log_(u[i + 3])) end return total_entropy diff --git a/src/equations/ideal_glm_mhd_1d.jl b/src/equations/ideal_glm_mhd_1d.jl index c4622306f76..cef2f5f8c49 100644 --- a/src/equations/ideal_glm_mhd_1d.jl +++ b/src/equations/ideal_glm_mhd_1d.jl @@ -585,7 +585,7 @@ end b_square = b1^2 + b2^2 + b3^2 c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index ed6f8ea3353..563d1346031 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -1146,10 +1146,10 @@ end b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end @@ -1175,8 +1175,8 @@ end b2 * normal_direction[2])^2 / norm_squared c_f = sqrt_((0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * - norm_squared) + 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + norm_squared) return c_f end diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 47c3f2c6448..b914e6cec4b 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -1039,13 +1039,13 @@ end b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) elseif orientation == 2 # y-direction c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) else # z-direction c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b3^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b3^2)) end return c_f end @@ -1073,8 +1073,8 @@ end b3 * normal_direction[3])^2 / norm_squared c_f = sqrt_((0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * - norm_squared) + 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + norm_squared) return c_f end diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index 1404ea0b087..ffd2ca34a6c 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -507,7 +507,7 @@ end b_square = b1^2 + b2^2 + b3^2 c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index fd923ef7066..e9f82d5d6a4 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -671,10 +671,10 @@ end b_square = b1^2 + b2^2 + b3^2 if direction == 1 # x-direction c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end diff --git a/test/test_tree_1d.jl b/test/test_tree_1d.jl index 8ec1e182708..563dff200a6 100644 --- a/test/test_tree_1d.jl +++ b/test/test_tree_1d.jl @@ -255,7 +255,8 @@ end # characteristics function initial_condition_sine(x, t, equation::NonconservativeLinearAdvectionEquation) - x0 = -2 * atan(sqrt_(3) * tan(sqrt_(3) / 2 * t - atan(tan(x[1] / 2) / sqrt_(3)))) + x0 = -2 * + atan(sqrt_(3) * tan(sqrt_(3) / 2 * t - atan(tan(x[1] / 2) / sqrt_(3)))) scalar = sin(x0) advection_velocity = 2 + cos(x[1]) SVector(scalar, advection_velocity) From 35a32bb5c5554c125be2bb353a5d9f93af7ba95e Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 10 Jan 2024 23:29:02 +0100 Subject: [PATCH 21/55] replace in comment --- examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl index 0ec9fc222f2..f9cc5580df6 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl @@ -59,7 +59,7 @@ boundary_condition_inflow = BoundaryConditionDirichlet(initial_condition_mach3_f # rho_local, v_normal, v_tangent, p_local = cons2prim(u_local, equations) # # Compute local Mach number - # a_local = sqrt( equations.gamma * p_local / rho_local ) + # a_local = sqrt_( equations.gamma * p_local / rho_local ) # Mach_local = abs( v_normal / a_local ) # if Mach_local <= 1.0 # p_local = # Set to the external reference pressure value (somehow? maybe stored in `equations`) From f308b77bc9bb5eec10842d359a0b2a7d9f1c879b Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 10 Jan 2024 23:40:38 +0100 Subject: [PATCH 22/55] try exporting nan funcs --- src/Trixi.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Trixi.jl b/src/Trixi.jl index e18b2f6415c..f8d973516cb 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -219,6 +219,7 @@ export entropy, energy_total, energy_kinetic, energy_internal, energy_magnetic, enstrophy export lake_at_rest_error export ncomponents, eachcomponent +export sqrt_, log_ export TreeMesh, StructuredMesh, UnstructuredMesh2D, P4estMesh, T8codeMesh From 4f7fa49971e4afb0cd36945a29bad109eae688aa Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 11 Jan 2024 00:39:42 +0100 Subject: [PATCH 23/55] enable SIMD again --- src/solvers/dgsem_structured/dg_2d_compressible_euler.jl | 4 ++-- src/solvers/dgsem_structured/dg_3d_compressible_euler.jl | 4 ++-- src/solvers/dgsem_tree/dg_2d_compressible_euler.jl | 4 ++-- src/solvers/dgsem_tree/dg_3d_compressible_euler.jl | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl index 2b2b9bef436..43f70da4750 100644 --- a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl @@ -265,8 +265,8 @@ end u_prim[i, j, 2] = v1 u_prim[i, j, 3] = v2 u_prim[i, j, 4] = p - u_prim[i, j, 5] = log_(rho) - u_prim[i, j, 6] = log_(p) + u_prim[i, j, 5] = log(rho) + u_prim[i, j, 6] = log(p) end # x direction diff --git a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl index ef3c70e11cb..64a3456b940 100644 --- a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl @@ -393,8 +393,8 @@ end u_prim[i, j, k, 3] = v2 u_prim[i, j, k, 4] = v3 u_prim[i, j, k, 5] = p - u_prim[i, j, k, 6] = log_(rho) - u_prim[i, j, k, 7] = log_(p) + u_prim[i, j, k, 6] = log(rho) + u_prim[i, j, k, 7] = log(p) end # x direction diff --git a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl index 123fdef9c74..50b1e8cb5b4 100644 --- a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl @@ -264,8 +264,8 @@ end u_prim[i, j, 2] = v1 u_prim[i, j, 3] = v2 u_prim[i, j, 4] = p - u_prim[i, j, 5] = log_(rho) - u_prim[i, j, 6] = log_(p) + u_prim[i, j, 5] = log(rho) + u_prim[i, j, 6] = log(p) end # x direction diff --git a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl index 2dd23f47439..ec3647ed649 100644 --- a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl @@ -304,8 +304,8 @@ end u_prim[i, j, k, 3] = v2 u_prim[i, j, k, 4] = v3 u_prim[i, j, k, 5] = p - u_prim[i, j, k, 6] = log_(rho) - u_prim[i, j, k, 7] = log_(p) + u_prim[i, j, k, 6] = log(rho) + u_prim[i, j, k, 7] = log(p) end # x direction From 6547640548aa23f9a4594af2ed62b0db54e83aa7 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 11 Jan 2024 08:13:37 +0100 Subject: [PATCH 24/55] Bring back SIMD --- src/solvers/dgmulti/flux_differencing_compressible_euler.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solvers/dgmulti/flux_differencing_compressible_euler.jl b/src/solvers/dgmulti/flux_differencing_compressible_euler.jl index 8432c518cd5..70a29bc73f2 100644 --- a/src/solvers/dgmulti/flux_differencing_compressible_euler.jl +++ b/src/solvers/dgmulti/flux_differencing_compressible_euler.jl @@ -37,7 +37,7 @@ function cons2entropy!(entropy_var_values::StructArray, v2 = rho_v2 / rho v_square = v1^2 + v2^2 p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - gamma * log_(rho) + s = log(p) - gamma * log(rho) rho_p = rho / p w1_values[i] = (gamma - s) * inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -121,7 +121,7 @@ function cons2entropy!(entropy_var_values::StructArray, v3 = rho_v3 / rho v_square = v1^2 + v2^2 + v3^2 p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - gamma * log_(rho) + s = log(p) - gamma * log(rho) rho_p = rho / p w1_values[i] = (gamma - s) * inv_gamma_minus_one - 0.5 * rho_p * v_square From 50fa9f15ae50102985e5b4b15bf43eca1a9a8915 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 11 Jan 2024 09:03:15 +0100 Subject: [PATCH 25/55] doc --- src/auxiliary/math.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index f596de1e79f..1da86cb1bfe 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -11,7 +11,7 @@ Custom square root function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`threaded`](@ref). +i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`@threaded`](@ref). We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsic `sqrt_llvm` as for this the `sqrt_llvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. @@ -32,7 +32,7 @@ in the stacktrace. Custom square root function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`threaded`](@ref). +i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`@threaded`](@ref). For `Float64, Float32, Float16` the LLVM intrinsic `sqrt_llvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. @@ -53,7 +53,7 @@ in the stacktrace. Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`threaded`](@ref). +i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`@threaded`](@ref). We dispatch this function for `Float64, Float32, Float16` to the respective LLVM intrinsics `llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16"` as for this the LLVM functions can be used out-of the box, i.e., @@ -75,7 +75,7 @@ in the stacktrace. Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`threaded`](@ref). +i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`@threaded`](@ref). For `Float64, Float32, Float16` the respective LLVM intrinsic `llvm.log.f64/f32/f16` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. From 2ce3fdd777b27b9918e6e1a22af33349218f09af Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Thu, 11 Jan 2024 14:03:20 +0100 Subject: [PATCH 26/55] Update src/auxiliary/math.jl Co-authored-by: Hendrik Ranocha --- src/auxiliary/math.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 1da86cb1bfe..a7335debfdc 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -11,7 +11,7 @@ Custom square root function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`@threaded`](@ref). +i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsic `sqrt_llvm` as for this the `sqrt_llvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. From 8062e9550465c1347513615e9fe850b1eb52c02c Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Thu, 11 Jan 2024 14:03:31 +0100 Subject: [PATCH 27/55] Update src/auxiliary/math.jl Co-authored-by: Hendrik Ranocha --- src/auxiliary/math.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index a7335debfdc..4405e779fd9 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -53,7 +53,7 @@ in the stacktrace. Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`@threaded`](@ref). +i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). We dispatch this function for `Float64, Float32, Float16` to the respective LLVM intrinsics `llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16"` as for this the LLVM functions can be used out-of the box, i.e., From 303c33292d72556c92b60c6dccb5cfa97ffcf217 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 11 Jan 2024 14:23:54 +0100 Subject: [PATCH 28/55] docstring fmt --- src/auxiliary/math.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 4405e779fd9..bef5af75689 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -32,7 +32,7 @@ in the stacktrace. Custom square root function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`@threaded`](@ref). +i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). For `Float64, Float32, Float16` the LLVM intrinsic `sqrt_llvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. @@ -75,7 +75,7 @@ in the stacktrace. Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the @batch macro instead of the Julia built-in @threads macro, see [`@threaded`](@ref). +i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). For `Float64, Float32, Float16` the respective LLVM intrinsic `llvm.log.f64/f32/f16` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. From a77cfaf27c2591d58d67399dadb393970899b159 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 11 Jan 2024 18:55:42 +0100 Subject: [PATCH 29/55] remove redundant docstrings --- src/auxiliary/math.jl | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index bef5af75689..f58612717c4 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -26,24 +26,6 @@ in the stacktrace. """ @inline sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) -""" - sqrt_(x::Union{Float64, Float32, Float16}) - -Custom square root function which returns `NaN` for negative arguments instead of throwing an error. -This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) -when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). - -For `Float64, Float32, Float16` the LLVM intrinsic `sqrt_llvm` function can be used out-of the box, -i.e., it returns `NaN` for negative arguments. -For other types, such as integers or dual numbers required for algorithmic differentiation, we -fall back to the Julia built-in `sqrt` function after a check for negative arguments, -see [`sqrt_(x::Real)`](@ref). - -When debugging code, it might be useful to change the implementation of this function to redirect to -the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated -in the stacktrace. -""" @inline sqrt_(x::Union{Float64, Float32, Float16}) = Base.sqrt_llvm(x) #@inline sqrt_(x) = Base.sqrt(x) # For benchmarking and debugging @@ -69,24 +51,6 @@ in the stacktrace. """ @inline log_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) -""" - log_(x::Float64_or_Float32_or_Float16) - -Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. -This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) -when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). - -For `Float64, Float32, Float16` the respective LLVM intrinsic `llvm.log.f64/f32/f16` function can be used out-of the box, -i.e., it returns `NaN` for negative arguments. -For other types, such as integers or dual numbers required for algorithmic differentiation, we -fall back to the Julia built-in `log` function after a check for negative arguments, -see [`log_(x::Real)`](@ref). - -When debugging code, it might be useful to change the implementation of this function to redirect to -the Julia built-in `log` function, as this reports the exact place in code where the domain is violated -in the stacktrace. -""" @inline log_(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64,), x) @inline log_(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) @inline log_(x::Float16) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) From c2fb55c16533258c28bc0ca6ed13203e44b3d29b Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 12 Jan 2024 08:54:31 +0100 Subject: [PATCH 30/55] no own names --- .../elixir_shallow_water_quasi_1d.jl | 2 +- .../elixir_advection_diffusion_nonperiodic.jl | 8 +- ...lixir_euler_rayleigh_taylor_instability.jl | 2 +- .../dgmulti_2d/elixir_mhd_reflective_wall.jl | 2 +- .../elixir_navierstokes_convergence.jl | 16 +-- .../elixir_navierstokes_convergence_curved.jl | 16 +-- .../elixir_shallowwater_source_terms.jl | 2 +- .../elixir_navierstokes_convergence.jl | 8 +- .../elixir_navierstokes_convergence_curved.jl | 8 +- ...ixir_advection_amr_solution_independent.jl | 2 +- ...xir_advection_diffusion_nonperiodic_amr.jl | 8 +- ..._advection_diffusion_nonperiodic_curved.jl | 8 +- .../elixir_euler_blast_wave_amr.jl | 2 +- .../elixir_euler_double_mach_amr.jl | 2 +- .../elixir_euler_forward_step_amr.jl | 2 +- examples/p4est_2d_dgsem/elixir_euler_sedov.jl | 2 +- .../p4est_2d_dgsem/elixir_mhd_alfven_wave.jl | 2 +- examples/p4est_2d_dgsem/elixir_mhd_rotor.jl | 4 +- .../elixir_navierstokes_convergence.jl | 16 +-- ...ir_navierstokes_convergence_nonperiodic.jl | 16 +-- .../elixir_shallowwater_source_terms.jl | 2 +- .../elixir_euler_baroclinic_instability.jl | 4 +- examples/p4est_3d_dgsem/elixir_euler_sedov.jl | 2 +- .../elixir_mhd_shockcapturing_amr.jl | 2 +- .../elixir_navierstokes_blast_wave_amr.jl | 2 +- .../elixir_navierstokes_convergence.jl | 8 +- ...ir_navierstokes_taylor_green_vortex_amr.jl | 2 +- .../elixir_eulergravity_sedov_blast_wave.jl | 2 +- .../elixir_advection_shockcapturing.jl | 4 +- ...lixir_euler_rayleigh_taylor_instability.jl | 2 +- .../structured_2d_dgsem/elixir_euler_sedov.jl | 2 +- .../elixir_mhd_alfven_wave.jl | 12 +- examples/structured_2d_dgsem/elixir_mhd_ec.jl | 2 +- .../elixir_shallowwater_conical_island.jl | 4 +- .../elixir_shallowwater_parabolic_bowl.jl | 2 +- .../elixir_shallowwater_source_terms.jl | 2 +- .../structured_3d_dgsem/elixir_euler_sedov.jl | 2 +- ...ixir_advection_amr_solution_independent.jl | 2 +- .../t8code_2d_dgsem/elixir_euler_sedov.jl | 2 +- .../t8code_2d_dgsem/elixir_mhd_alfven_wave.jl | 2 +- examples/t8code_2d_dgsem/elixir_mhd_rotor.jl | 4 +- .../elixir_shallowwater_source_terms.jl | 2 +- .../elixir_mhd_ryujones_shock_tube.jl | 2 +- .../elixir_navierstokes_convergence_walls.jl | 10 +- ...ixir_navierstokes_convergence_walls_amr.jl | 10 +- ...xir_shallow_water_quasi_1d_source_terms.jl | 2 +- .../elixir_shallowwater_beach.jl | 6 +- .../elixir_shallowwater_parabolic_bowl.jl | 2 +- .../elixir_shallowwater_source_terms.jl | 2 +- ...xir_shallowwater_source_terms_dirichlet.jl | 2 +- ...lixir_shallowwater_twolayer_convergence.jl | 2 +- ..._shallowwater_well_balanced_nonperiodic.jl | 2 +- .../elixir_acoustics_gauss_wall.jl | 2 +- ...ixir_advection_amr_solution_independent.jl | 2 +- .../elixir_advection_diffusion_nonperiodic.jl | 8 +- .../tree_2d_dgsem/elixir_euler_blast_wave.jl | 2 +- .../elixir_euler_blast_wave_amr.jl | 2 +- .../elixir_euler_blast_wave_pure_fv.jl | 2 +- ...euler_blast_wave_sc_subcell_nonperiodic.jl | 2 +- .../tree_2d_dgsem/elixir_euler_blob_amr.jl | 4 +- .../tree_2d_dgsem/elixir_euler_blob_mortar.jl | 4 +- .../tree_2d_dgsem/elixir_euler_positivity.jl | 2 +- .../elixir_euler_sedov_blast_wave.jl | 2 +- ...lixir_euler_sedov_blast_wave_sc_subcell.jl | 2 +- .../elixir_euler_shockcapturing_subcell.jl | 2 +- .../tree_2d_dgsem/elixir_euler_vortex_amr.jl | 2 +- .../elixir_eulermulti_shock_bubble.jl | 2 +- ...ck_bubble_shockcapturing_subcell_minmax.jl | 2 +- ...ubble_shockcapturing_subcell_positivity.jl | 2 +- .../elixir_linearizedeuler_gauss_wall.jl | 2 +- .../tree_2d_dgsem/elixir_mhd_alfven_wave.jl | 2 +- .../elixir_mhd_alfven_wave_mortar.jl | 2 +- .../tree_2d_dgsem/elixir_mhd_blast_wave.jl | 4 +- examples/tree_2d_dgsem/elixir_mhd_rotor.jl | 4 +- .../elixir_mhd_shockcapturing_subcell.jl | 4 +- .../elixir_mhdmulti_convergence.jl | 2 +- .../tree_2d_dgsem/elixir_mhdmulti_rotor.jl | 4 +- .../elixir_navierstokes_convergence.jl | 16 +-- .../elixir_shallowwater_conical_island.jl | 4 +- .../tree_2d_dgsem/elixir_shallowwater_ec.jl | 2 +- .../elixir_shallowwater_parabolic_bowl.jl | 2 +- .../elixir_shallowwater_source_terms.jl | 2 +- ...xir_shallowwater_source_terms_dirichlet.jl | 2 +- ...lixir_shallowwater_twolayer_convergence.jl | 2 +- ...xir_shallowwater_twolayer_well_balanced.jl | 2 +- .../elixir_advection_diffusion_nonperiodic.jl | 8 +- .../tree_3d_dgsem/elixir_euler_blob_amr.jl | 4 +- .../elixir_euler_sedov_blast_wave.jl | 2 +- .../elixir_navierstokes_convergence.jl | 8 +- .../elixir_acoustics_gauss_wall.jl | 2 +- .../elixir_euler_sedov.jl | 2 +- .../unstructured_2d_dgsem/elixir_mhd_ec.jl | 4 +- .../elixir_shallowwater_ec.jl | 2 +- .../elixir_shallowwater_ec_shockcapturing.jl | 2 +- ...ixir_shallowwater_three_mound_dam_break.jl | 6 +- .../elixir_shallowwater_twolayer_dam_break.jl | 2 +- ...xir_shallowwater_twolayer_well_balanced.jl | 2 +- ...xir_shallowwater_wall_bc_shockcapturing.jl | 2 +- ext/TrixiMakieExt.jl | 2 +- src/Trixi.jl | 1 - src/auxiliary/math.jl | 31 ++-- src/auxiliary/mpi.jl | 4 +- src/auxiliary/special_elixirs.jl | 2 +- src/auxiliary/t8code.jl | 4 +- src/callbacks_step/analysis_dg1d.jl | 4 +- src/callbacks_step/analysis_dg2d.jl | 4 +- src/callbacks_step/analysis_dg2d_parallel.jl | 4 +- src/callbacks_step/analysis_dg3d.jl | 4 +- src/callbacks_step/analysis_dg3d_parallel.jl | 2 +- src/callbacks_step/analysis_dgmulti.jl | 4 +- src/callbacks_step/averaging_dg2d.jl | 4 +- src/callbacks_step/visualization.jl | 6 +- src/equations/compressible_euler_1d.jl | 68 ++++----- src/equations/compressible_euler_2d.jl | 136 +++++++++--------- src/equations/compressible_euler_3d.jl | 136 +++++++++--------- .../compressible_euler_multicomponent_1d.jl | 16 +-- .../compressible_euler_multicomponent_2d.jl | 18 +-- src/equations/compressible_euler_quasi_1d.jl | 6 +- src/equations/hyperbolic_diffusion_1d.jl | 4 +- src/equations/hyperbolic_diffusion_2d.jl | 12 +- src/equations/hyperbolic_diffusion_3d.jl | 6 +- src/equations/ideal_glm_mhd_1d.jl | 42 +++--- src/equations/ideal_glm_mhd_2d.jl | 88 ++++++------ src/equations/ideal_glm_mhd_3d.jl | 98 ++++++------- .../ideal_glm_mhd_multicomponent_1d.jl | 26 ++-- .../ideal_glm_mhd_multicomponent_2d.jl | 26 ++-- src/equations/lattice_boltzmann_2d.jl | 2 +- src/equations/lattice_boltzmann_3d.jl | 2 +- src/equations/polytropic_euler_2d.jl | 18 +-- src/equations/shallow_water_1d.jl | 40 +++--- src/equations/shallow_water_2d.jl | 72 +++++----- src/equations/shallow_water_quasi_1d.jl | 10 +- src/equations/shallow_water_two_layer_1d.jl | 10 +- src/equations/shallow_water_two_layer_2d.jl | 16 +-- src/meshes/p4est_mesh.jl | 2 +- src/semidiscretization/semidiscretization.jl | 2 +- src/solvers/dgmulti/shock_capturing.jl | 2 +- src/solvers/dgsem/basis_lobatto_legendre.jl | 6 +- .../dg_2d_compressible_euler.jl | 40 +++--- .../dg_3d_compressible_euler.jl | 60 ++++---- .../dgsem_tree/dg_2d_compressible_euler.jl | 40 +++--- .../dgsem_tree/dg_3d_compressible_euler.jl | 60 ++++---- src/solvers/dgsem_tree/indicators.jl | 2 +- src/solvers/dgsem_tree/indicators_1d.jl | 2 +- src/solvers/dgsem_tree/indicators_2d.jl | 2 +- .../dgsem_unstructured/containers_2d.jl | 8 +- src/solvers/fdsbp_tree/fdsbp_1d.jl | 2 +- src/solvers/fdsbp_tree/fdsbp_2d.jl | 2 +- src/solvers/fdsbp_tree/fdsbp_3d.jl | 2 +- src/solvers/fdsbp_unstructured/fdsbp_2d.jl | 2 +- src/visualization/recipes_plots.jl | 2 +- src/visualization/utilities.jl | 2 +- test/test_dgmulti_1d.jl | 2 +- test/test_dgmulti_2d.jl | 2 +- test/test_dgmulti_3d.jl | 12 +- test/test_mpi_tree.jl | 2 +- test/test_special_elixirs.jl | 12 +- test/test_tree_1d.jl | 2 +- test/test_trixi.jl | 2 +- 159 files changed, 792 insertions(+), 790 deletions(-) diff --git a/examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl b/examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl index 524275a1a62..85741f9dbd3 100644 --- a/examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl +++ b/examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl @@ -19,7 +19,7 @@ dg = DGMulti(polydeg = 4, element_type = Line(), approximation_type = SBP(), cells_per_dimension = (8,) mesh = DGMultiMesh(dg, cells_per_dimension, - coordinates_min = (0.0,), coordinates_max = (sqrt_(2),), + coordinates_min = (0.0,), coordinates_max = (sqrt(2),), periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; source_terms = source_terms_convergence_test) diff --git a/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl b/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl index 82bd46dabcf..d2f11f18507 100644 --- a/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl +++ b/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl @@ -18,10 +18,10 @@ equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations) function initial_condition_erikkson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # Note: this requires epsilon < 0.6 due to the sqrt - lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl b/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl index 2bacf9f0125..49c8b28eaf8 100644 --- a/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl +++ b/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl @@ -42,7 +42,7 @@ defined below. smoothed_heaviside(x, left, right) = left + 0.5 * (1 + tanh(slope * x)) * (right - left) rho = smoothed_heaviside(x[2] - 0.5, 2.0, 1.0) - c = sqrt_(equations.gamma * p / rho) + c = sqrt(equations.gamma * p / rho) # the velocity is multiplied by sin(pi*y)^6 as in Remacle et al. 2003 to ensure that the # initial condition satisfies reflective boundary conditions at the top/bottom boundaries. v = -0.025 * c * cos(8 * pi * x[1]) * sin(pi * x[2])^6 diff --git a/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl b/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl index 050497764f5..11670288526 100644 --- a/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl +++ b/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl @@ -21,7 +21,7 @@ function initial_condition_perturbation(x, t, equations::IdealGlmMhdEquations2D) # the pressure and magnetic field are chosen to be strongly # magnetized, such that p / ||B||^2 ≈ 0.01. B1 = 0.0 - B2 = 40.0 / sqrt_(4.0 * pi) + B2 = 40.0 / sqrt(4.0 * pi) B3 = 0.0 psi = 0.0 diff --git a/examples/dgmulti_2d/elixir_navierstokes_convergence.jl b/examples/dgmulti_2d/elixir_navierstokes_convergence.jl index 75398d66684..38cf3d7984b 100644 --- a/examples/dgmulti_2d/elixir_navierstokes_convergence.jl +++ b/examples/dgmulti_2d/elixir_navierstokes_convergence.jl @@ -40,7 +40,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -75,19 +75,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl b/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl index f7331a1ff3e..87ffd0e0995 100644 --- a/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl +++ b/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl @@ -48,7 +48,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -83,19 +83,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl b/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl index f29bb257f4a..f7120d8091b 100644 --- a/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl +++ b/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl @@ -16,7 +16,7 @@ dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = SBP(), cells_per_dimension = (8, 8) mesh = DGMultiMesh(dg, cells_per_dimension, - coordinates_min = (0.0, 0.0), coordinates_max = (sqrt_(2), sqrt_(2)), + coordinates_min = (0.0, 0.0), coordinates_max = (sqrt(2), sqrt(2)), periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; diff --git a/examples/dgmulti_3d/elixir_navierstokes_convergence.jl b/examples/dgmulti_3d/elixir_navierstokes_convergence.jl index 1707dcc10db..5fa0ad7ce60 100644 --- a/examples/dgmulti_3d/elixir_navierstokes_convergence.jl +++ b/examples/dgmulti_3d/elixir_navierstokes_convergence.jl @@ -42,7 +42,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) - v1 = A2 * sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * + v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t) v2 = v1 v3 = v1 @@ -73,12 +73,12 @@ end # Define auxiliary functions for the strange function of the y variable # to make expressions easier to read - g = log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) - g_y = (A3 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + + g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) + g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0)) g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) - - A3^2 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) + A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) # Density and its derivatives rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) diff --git a/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl b/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl index 6038dcf0c13..c58d78d2581 100644 --- a/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl +++ b/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl @@ -50,7 +50,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) - v1 = A2 * sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * + v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t) v2 = v1 v3 = v1 @@ -81,12 +81,12 @@ end # Define auxiliary functions for the strange function of the y variable # to make expressions easier to read - g = log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) - g_y = (A3 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + + g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) + g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0)) g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) - - A3^2 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) + A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) # Density and its derivatives rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) diff --git a/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl index 502a9f70911..5a2537be4e6 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -63,7 +63,7 @@ function periodic_distance_2d(coordinates, center, domain_length) dx = coordinates .- center dx_shifted = abs.(dx .% domain_length) dx_periodic = min.(dx_shifted, domain_length .- dx_shifted) - return sqrt_(sum(dx_periodic .^ 2)) + return sqrt(sum(dx_periodic .^ 2)) end #This takes a cells coordinates and transforms them into the coordinates of a parent-cell it originally refined from. diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl index 64ef05da574..f87c0e056ca 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl @@ -30,10 +30,10 @@ mesh = P4estMesh(trees_per_dimension, function initial_condition_eriksson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt - lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl index 0f3005ee3f3..5497f13aa65 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl @@ -18,10 +18,10 @@ equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations) function initial_condition_eriksson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt - lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl index 98dbc7d4bf3..0ca4fdc2eb7 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl @@ -22,7 +22,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl index 90c2c49d5fe..92928146d7b 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl @@ -23,7 +23,7 @@ See Section IV c on the paper below for details. """ @inline function initial_condition_double_mach_reflection(x, t, equations::CompressibleEulerEquations2D) - if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt_(3) + if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt(3) phi = pi / 6 sin_phi, cos_phi = sincos(phi) diff --git a/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl index f9cc5580df6..0ec9fc222f2 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl @@ -59,7 +59,7 @@ boundary_condition_inflow = BoundaryConditionDirichlet(initial_condition_mach3_f # rho_local, v_normal, v_tangent, p_local = cons2prim(u_local, equations) # # Compute local Mach number - # a_local = sqrt_( equations.gamma * p_local / rho_local ) + # a_local = sqrt( equations.gamma * p_local / rho_local ) # Mach_local = abs( v_normal / a_local ) # if Mach_local <= 1.0 # p_local = # Set to the external reference pressure value (somehow? maybe stored in `equations`) diff --git a/examples/p4est_2d_dgsem/elixir_euler_sedov.jl b/examples/p4est_2d_dgsem/elixir_euler_sedov.jl index 0b3453e3705..539ddb45395 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_sedov.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl index 62fa80df816..b2b402a25f6 100644 --- a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -18,7 +18,7 @@ solver = DGSEM(polydeg = 4, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) trees_per_dimension = (8, 8) mesh = P4estMesh(trees_per_dimension, diff --git a/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl b/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl index 1aff490f450..380db487356 100644 --- a/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl @@ -20,7 +20,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) # domain must be [0, 1] x [0, 1], γ = 1.4 dx = x[1] - 0.5 dy = x[2] - 0.5 - r = sqrt_(dx^2 + dy^2) + r = sqrt(dx^2 + dy^2) f = (0.115 - r) / 0.015 if r <= 0.1 rho = 10.0 @@ -37,7 +37,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) end v3 = 0.0 p = 1.0 - B1 = 5.0 / sqrt_(4.0 * pi) + B1 = 5.0 / sqrt(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl index bee43f282e8..54ec09d2be8 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl @@ -40,7 +40,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -75,19 +75,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl index c3c32ced373..b4177fe8538 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl @@ -40,7 +40,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -75,19 +75,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl index 8e9e1c81cd9..c7922fd3b75 100644 --- a/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl @@ -21,7 +21,7 @@ solver = DGSEM(polydeg = 3, # Get the P4estMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) # minimum coordinates (min(x), min(y)) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) # maximum coordinates (max(x), max(y)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) # maximum coordinates (max(x), max(y)) # Create P4estMesh with 8 x 8 trees and 16 x 16 elements trees_per_dimension = (8, 8) diff --git a/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl b/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl index 6186f02629a..0274a89aec7 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl @@ -132,7 +132,7 @@ function basic_state_baroclinic_instability_longitudinal_velocity(lon, lat, z) big_u = gravitational_acceleration / radius_earth * k * temperature * inttau2 * (temp3^(k - 1) - temp3^(k + 1)) temp5 = radius_earth * cos(lat) - u = -angular_velocity * temp5 + sqrt_(angular_velocity^2 * temp5^2 + temp5 * big_u) + u = -angular_velocity * temp5 + sqrt(angular_velocity^2 * temp5^2 + temp5 * big_u) # Hydrostatic pressure p = surface_pressure * @@ -173,7 +173,7 @@ function perturbation_stream_function(lon, lat, z) sin_, cos_ = sincos(0.5 * pi * great_circle_distance_by_a / perturbation_radius) # Common factor for both u and v - factor = 16 / (3 * sqrt_(3)) * perturbed_wind_amplitude * perttaper * cos_^3 * sin_ + factor = 16 / (3 * sqrt(3)) * perturbed_wind_amplitude * perttaper * cos_^3 * sin_ u_perturbation = -factor * (-sin(perturbation_lat) * cos(lat) + cos(perturbation_lat) * sin(lat) * cos(lon - perturbation_lon)) / diff --git a/examples/p4est_3d_dgsem/elixir_euler_sedov.jl b/examples/p4est_3d_dgsem/elixir_euler_sedov.jl index a2a13d65b9c..8df95a3cc21 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_sedov.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_sedov.jl @@ -21,7 +21,7 @@ function initial_condition_medium_sedov_blast_wave(x, t, x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl index 14489a0d7b9..3941a40b2e4 100644 --- a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl @@ -22,7 +22,7 @@ function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations3D) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) delta_0 = 0.1 r_0 = 0.3 diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl index f4c6b9f564f..5df89fbcdf2 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl @@ -23,7 +23,7 @@ function initial_condition_3d_blast_wave(x, t, equations::CompressibleEulerEquat u_o = 0.0 rc = 0.5 - r = sqrt_(x[1]^2 + x[2]^2 + x[3]^2) + r = sqrt(x[1]^2 + x[2]^2 + x[3]^2) if r < rc rho = rho_c v1 = u_c diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl index 6c0c1d4010b..c640b255b05 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl @@ -43,7 +43,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) - v1 = A2 * sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * + v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t) v2 = v1 v3 = v1 @@ -74,12 +74,12 @@ end # Define auxiliary functions for the strange function of the y variable # to make expressions easier to read - g = log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) - g_y = (A3 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + + g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) + g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0)) g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) - - A3^2 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) + A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) # Density and its derivatives rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl index cebc3e70260..c15227a1c29 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl @@ -39,7 +39,7 @@ initial_condition = initial_condition_taylor_green_vortex @inline function vel_mag(u, equations::CompressibleEulerEquations3D) rho, rho_v1, rho_v2, rho_v3, _ = u - return sqrt_(rho_v1^2 + rho_v2^2 + rho_v3^2) / rho + return sqrt(rho_v1^2 + rho_v2^2 + rho_v3^2) / rho end volume_flux = flux_ranocha diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl index a789e093eda..b7be2320228 100644 --- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl +++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl @@ -20,7 +20,7 @@ Should be used together with [`boundary_condition_sedov_self_gravity`](@ref). """ function initial_condition_sedov_self_gravity(x, t, equations::CompressibleEulerEquations2D) # Set up polar coordinates - r = sqrt_(x[1]^2 + x[2]^2) + r = sqrt(x[1]^2 + x[2]^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000 r0 = 0.125 # = 4.0 * smallest dx (for domain length=8 and max-ref=8) diff --git a/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl b/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl index 451475e9674..96566bc2373 100644 --- a/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl +++ b/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl @@ -29,13 +29,13 @@ function initial_condition_composite(x, t, equations::LinearScalarAdvectionEquat end if x_ > -0.8 && x_ < -0.6 - value = exp(-log_(2.0) * (x_ + 0.7)^2 / 0.0009) + value = exp(-log(2.0) * (x_ + 0.7)^2 / 0.0009) elseif x_ > -0.4 && x_ < -0.2 value = 1.0 elseif x_ > 0.0 && x_ < 0.2 value = 1.0 - abs(10.0 * (x_ - 0.1)) elseif x_ > 0.4 && x_ < 0.6 - value = sqrt_(1.0 - 100.0 * (x_ - 0.5)^2) + value = sqrt(1.0 - 100.0 * (x_ - 0.5)^2) else value = 0.0 end diff --git a/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl b/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl index 277af463396..6c254e8bd8b 100644 --- a/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl +++ b/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl @@ -42,7 +42,7 @@ defined below. smoothed_heaviside(x, left, right) = left + 0.5 * (1 + tanh(slope * x)) * (right - left) rho = smoothed_heaviside(x[2] - 0.5, 2.0, 1.0) - c = sqrt_(equations.gamma * p / rho) + c = sqrt(equations.gamma * p / rho) # the velocity is multiplied by sin(pi*y)^6 as in Remacle et al. 2003 to ensure that the # initial condition satisfies reflective boundary conditions at the top/bottom boundaries. v = -0.025 * c * cos(8 * pi * x[1]) * sin(pi * x[2])^6 diff --git a/examples/structured_2d_dgsem/elixir_euler_sedov.jl b/examples/structured_2d_dgsem/elixir_euler_sedov.jl index c9e103ec003..42094d7191c 100644 --- a/examples/structured_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/structured_2d_dgsem/elixir_euler_sedov.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl index 04a8252a192..e8f2b2ecc3a 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -21,16 +21,16 @@ solver = DGSEM(polydeg = 3, function mapping(xi_, eta_) # Transform input variables between -1 and 1 onto [0, sqrt(2)] # Note, we use the domain [0, sqrt(2)]^2 for the Alfvén wave convergence test case - xi = 0.5 * sqrt_(2) * xi_ + 0.5 * sqrt_(2) - eta = 0.5 * sqrt_(2) * eta_ + 0.5 * sqrt_(2) + xi = 0.5 * sqrt(2) * xi_ + 0.5 * sqrt(2) + eta = 0.5 * sqrt(2) * eta_ + 0.5 * sqrt(2) y = eta + - sqrt_(2) / 12 * (cos(1.5 * pi * (2 * xi - sqrt_(2)) / sqrt_(2)) * - cos(0.5 * pi * (2 * eta - sqrt_(2)) / sqrt_(2))) + sqrt(2) / 12 * (cos(1.5 * pi * (2 * xi - sqrt(2)) / sqrt(2)) * + cos(0.5 * pi * (2 * eta - sqrt(2)) / sqrt(2))) x = xi + - sqrt_(2) / 12 * (cos(0.5 * pi * (2 * xi - sqrt_(2)) / sqrt_(2)) * - cos(2 * pi * (2 * y - sqrt_(2)) / sqrt_(2))) + sqrt(2) / 12 * (cos(0.5 * pi * (2 * xi - sqrt(2)) / sqrt(2)) * + cos(2 * pi * (2 * y - sqrt(2)) / sqrt(2))) return SVector(x, y) end diff --git a/examples/structured_2d_dgsem/elixir_mhd_ec.jl b/examples/structured_2d_dgsem/elixir_mhd_ec.jl index ecc1b1a3c18..a6c31744ca5 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_ec.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_ec.jl @@ -14,7 +14,7 @@ function initial_condition_shifted_weak_blast_wave(x, t, equations::IdealGlmMhdE inicenter = (1.5, 1.5) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) # Calculate primitive variables diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl b/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl index d27a638b048..e65ed19221e 100644 --- a/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl +++ b/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl @@ -26,14 +26,14 @@ function initial_condition_conical_island(x, t, equations::ShallowWaterEquations v2 = 0.0 x1, x2 = x - b = max(0.1, 1.0 - 4.0 * sqrt_(x1^2 + x2^2)) + b = max(0.1, 1.0 - 4.0 * sqrt(x1^2 + x2^2)) # use a logistic function to transfer water height value smoothly L = equations.H0 # maximum of function x0 = 0.3 # center point of function k = -25.0 # sharpness of transfer - H = max(b, L / (1.0 + exp(-k * (sqrt_(x1^2 + x2^2) - x0)))) + H = max(b, L / (1.0 + exp(-k * (sqrt(x1^2 + x2^2) - x0)))) # It is mandatory to shift the water level at dry areas to make sure the water height h # stays positive. The system would not be stable for h set to a hard 0 due to division by h in diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl index 69aaa5f3c7b..bc198f18835 100644 --- a/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl +++ b/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl @@ -32,7 +32,7 @@ function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations a = 1.0 h_0 = 0.1 sigma = 0.5 - ω = sqrt_(2 * equations.gravity * h_0) / a + ω = sqrt(2 * equations.gravity * h_0) / a v1 = -sigma * ω * sin(ω * t) v2 = sigma * ω * cos(ω * t) diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl index f14851b5f0a..48fe37b9996 100644 --- a/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl @@ -15,7 +15,7 @@ solver = DGSEM(polydeg = 3, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) cells_per_dimension = (8, 8) diff --git a/examples/structured_3d_dgsem/elixir_euler_sedov.jl b/examples/structured_3d_dgsem/elixir_euler_sedov.jl index 64286044684..1f2d9d2eeb6 100644 --- a/examples/structured_3d_dgsem/elixir_euler_sedov.jl +++ b/examples/structured_3d_dgsem/elixir_euler_sedov.jl @@ -21,7 +21,7 @@ function initial_condition_medium_sedov_blast_wave(x, t, x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl index c193c16f268..653bab41e2d 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -62,7 +62,7 @@ function periodic_distance_2d(coordinates, center, domain_length) dx = coordinates .- center dx_shifted = abs.(dx .% domain_length) dx_periodic = min.(dx_shifted, domain_length .- dx_shifted) - return sqrt_(sum(dx_periodic .^ 2)) + return sqrt(sum(dx_periodic .^ 2)) end # This takes a cells coordinates and transforms them into the coordinates of a diff --git a/examples/t8code_2d_dgsem/elixir_euler_sedov.jl b/examples/t8code_2d_dgsem/elixir_euler_sedov.jl index 3b153ce3dd0..965d794f8dc 100644 --- a/examples/t8code_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/t8code_2d_dgsem/elixir_euler_sedov.jl @@ -17,7 +17,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) # Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl index 05c7e8ebd95..1e2362a123c 100644 --- a/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -15,7 +15,7 @@ solver = DGSEM(polydeg = 4, surface_flux = (flux_hlle, flux_nonconservative_powe volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) mapping = Trixi.coordinates2mapping(coordinates_min, coordinates_max) diff --git a/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl b/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl index fae61bd5991..9a4bd99e444 100644 --- a/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl @@ -19,7 +19,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) # domain must be [0, 1] x [0, 1], γ = 1.4 dx = x[1] - 0.5 dy = x[2] - 0.5 - r = sqrt_(dx^2 + dy^2) + r = sqrt(dx^2 + dy^2) f = (0.115 - r) / 0.015 if r <= 0.1 rho = 10.0 @@ -36,7 +36,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) end v3 = 0.0 p = 1.0 - B1 = 5.0 / sqrt_(4.0 * pi) + B1 = 5.0 / sqrt(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl index 63c606862b6..b2d5097036f 100644 --- a/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl @@ -20,7 +20,7 @@ solver = DGSEM(polydeg = 3, # Get the P4estMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) # minimum coordinates (min(x), min(y)) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) # maximum coordinates (max(x), max(y)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) # maximum coordinates (max(x), max(y)) mapping = Trixi.coordinates2mapping(coordinates_min, coordinates_max) diff --git a/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl index 940eafc8fae..a7d7689a806 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl @@ -28,7 +28,7 @@ function initial_condition_ryujones_shock_tube(x, t, equations::IdealGlmMhdEquat v2 = x[1] <= 0.5 ? 0.01 : 0.0 v3 = x[1] <= 0.5 ? 0.5 : 0.0 p = x[1] <= 0.5 ? 0.95 : 1.0 - inv_sqrt4pi = 1.0 / sqrt_(4 * pi) + inv_sqrt4pi = 1.0 / sqrt(4 * pi) B1 = 2 * inv_sqrt4pi B2 = x[1] <= 0.5 ? 3.6 * inv_sqrt4pi : 4.0 * inv_sqrt4pi B3 = B1 diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl index 8574dd86590..40030d53345 100644 --- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl +++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl @@ -39,7 +39,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * cos(pi_x) * cos(pi_t) - v1 = log_(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t) + v1 = log(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t) p = rho^2 return prim2cons(SVector(rho, v1, p), equations) @@ -70,12 +70,12 @@ end rho_x = -pi * A * sin(pi_x) * cos(pi_t) rho_xx = -pi * pi * A * cos(pi_x) * cos(pi_t) - v1 = log_(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t) - v1_t = -pi * log_(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t) - v1_x = (A * log_(x + 2.0) * exp(-A * (x - 1.0)) + + v1 = log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t) + v1_t = -pi * log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t) + v1_x = (A * log(x + 2.0) * exp(-A * (x - 1.0)) + (1.0 - exp(-A * (x - 1.0))) / (x + 2.0)) * cos(pi_t) v1_xx = ((2.0 * A * exp(-A * (x - 1.0)) / (x + 2.0) - - A * A * log_(x + 2.0) * exp(-A * (x - 1.0)) - + A * A * log(x + 2.0) * exp(-A * (x - 1.0)) - (1.0 - exp(-A * (x - 1.0))) / ((x + 2.0) * (x + 2.0))) * cos(pi_t)) p = rho * rho diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl index 0a35b77cb14..e833155a68e 100644 --- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl +++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl @@ -39,7 +39,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * cos(pi_x) * cos(pi_t) - v1 = log_(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t) + v1 = log(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t) p = rho^2 return prim2cons(SVector(rho, v1, p), equations) @@ -70,12 +70,12 @@ end rho_x = -pi * A * sin(pi_x) * cos(pi_t) rho_xx = -pi * pi * A * cos(pi_x) * cos(pi_t) - v1 = log_(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t) - v1_t = -pi * log_(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t) - v1_x = (A * log_(x + 2.0) * exp(-A * (x - 1.0)) + + v1 = log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t) + v1_t = -pi * log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t) + v1_x = (A * log(x + 2.0) * exp(-A * (x - 1.0)) + (1.0 - exp(-A * (x - 1.0))) / (x + 2.0)) * cos(pi_t) v1_xx = ((2.0 * A * exp(-A * (x - 1.0)) / (x + 2.0) - - A * A * log_(x + 2.0) * exp(-A * (x - 1.0)) - + A * A * log(x + 2.0) * exp(-A * (x - 1.0)) - (1.0 - exp(-A * (x - 1.0))) / ((x + 2.0) * (x + 2.0))) * cos(pi_t)) p = rho * rho diff --git a/examples/tree_1d_dgsem/elixir_shallow_water_quasi_1d_source_terms.jl b/examples/tree_1d_dgsem/elixir_shallow_water_quasi_1d_source_terms.jl index ce763f8d6e8..72747c669e2 100644 --- a/examples/tree_1d_dgsem/elixir_shallow_water_quasi_1d_source_terms.jl +++ b/examples/tree_1d_dgsem/elixir_shallow_water_quasi_1d_source_terms.jl @@ -22,7 +22,7 @@ solver = DGSEM(polydeg = 3, surface_flux = surface_flux, # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt_(2.0) +coordinates_max = sqrt(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl b/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl index db2354a153c..378079ca334 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl @@ -25,8 +25,8 @@ found in section 5.2 of the paper: function initial_condition_beach(x, t, equations::ShallowWaterEquations1D) D = 1 delta = 0.02 - gamma = sqrt_((3 * delta) / (4 * D)) - x_a = sqrt_((4 * D) / (3 * delta)) * acosh(sqrt_(20)) + gamma = sqrt((3 * delta) / (4 * D)) + x_a = sqrt((4 * D) / (3 * delta)) * acosh(sqrt(20)) f = D + 40 * delta * sech(gamma * (8 * x[1] - x_a))^2 @@ -38,7 +38,7 @@ function initial_condition_beach(x, t, equations::ShallowWaterEquations1D) v = 0.0 else H = f - v = sqrt_(equations.gravity / D) * H + v = sqrt(equations.gravity / D) * H end # It is mandatory to shift the water level at dry areas to make sure the water height h diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl index f0843934209..a586562af7e 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl @@ -32,7 +32,7 @@ function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations a = 1 h_0 = 0.1 sigma = 0.5 - ω = sqrt_(2 * equations.gravity * h_0) / a + ω = sqrt(2 * equations.gravity * h_0) / a v = -sigma * ω * sin(ω * t) diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl index 3ef354cd03e..af596a377f8 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl @@ -21,7 +21,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt_(2.0) +coordinates_max = sqrt(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl index bdbcc9ea402..cbc98a30f9f 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl @@ -23,7 +23,7 @@ solver = DGSEM(polydeg = 3, surface_flux = surface_flux, # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt_(2.0) +coordinates_max = sqrt(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl index 3f111241e4d..e6a01849852 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl @@ -22,7 +22,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt_(2.0) +coordinates_max = sqrt(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl index 0ded3ff3dbe..e55fffc101e 100644 --- a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl +++ b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl @@ -33,7 +33,7 @@ solver = DGSEM(polydeg = 4, surface_flux = (flux_hll, flux_nonconservative_fjord # Get the TreeMesh and setup a periodic mesh coordinates_min = 0.0 -coordinates_max = sqrt_(2.0) +coordinates_max = sqrt(2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl b/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl index 190e4aba0ac..918c0831fcd 100644 --- a/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl +++ b/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl @@ -28,7 +28,7 @@ A Gaussian pulse, used in the `gauss_wall` example elixir in combination with function initial_condition_gauss_wall(x, t, equations::AcousticPerturbationEquations2D) v1_prime = 0.0 v2_prime = 0.0 - p_prime = exp(-log_(2) * (x[1]^2 + (x[2] - 25)^2) / 25) + p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25) prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...) diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl index 00e5a3463a4..03a213689ec 100644 --- a/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -58,7 +58,7 @@ function periodic_distance_2d(coordinates, center, domain_length) dx = coordinates .- center dx_shifted = abs.(dx .% domain_length) dx_periodic = min.(dx_shifted, domain_length .- dx_shifted) - return sqrt_(sum(dx_periodic .^ 2)) + return sqrt(sum(dx_periodic .^ 2)) end #This takes a cells coordinates and transforms them into the coordinates of a parent-cell it originally refined from. diff --git a/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl index c949e3bede9..8da542b0b5d 100644 --- a/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl @@ -30,10 +30,10 @@ mesh = TreeMesh(coordinates_min, coordinates_max, function initial_condition_eriksson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt - lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl index 25d77105717..ccd7b54086b 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl index aeea654c6c7..d32c2e51b06 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl index bc802c0c33a..a2392d05e5a 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl index 8d20ebaf833..209aa2ae352 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl index b8569e2af2d..2b3659017a3 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl @@ -31,7 +31,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D) tau_kh = 1.0 tau_cr = tau_kh / 1.6 # crushing time # determine background velocity - velx0 = 2 * R * sqrt_(Chi) / tau_cr + velx0 = 2 * R * sqrt(Chi) / tau_cr vely0 = 0.0 Ma0 = 2.7 # background flow Mach number Ma=v/c c = velx0 / Ma0 # sound speed @@ -40,7 +40,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D) # initial center of the blob inicenter = [-15, 0] x_rel = x - inicenter - r = sqrt_(x_rel[1]^2 + x_rel[2]^2) + r = sqrt(x_rel[1]^2 + x_rel[2]^2) # steepness of the tanh transition zone slope = 2 # density blob diff --git a/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl b/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl index 787fb699780..8bd5db00c9a 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl @@ -31,7 +31,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D) tau_kh = 1.0 tau_cr = tau_kh / 1.6 # crushing time # determine background velocity - velx0 = 2 * R * sqrt_(Chi) / tau_cr + velx0 = 2 * R * sqrt(Chi) / tau_cr vely0 = 0.0 Ma0 = 2.7 # background flow Mach number Ma=v/c c = velx0 / Ma0 # sound speed @@ -40,7 +40,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D) # initial center of the blob inicenter = [-15, 0] x_rel = x - inicenter - r = sqrt_(x_rel[1]^2 + x_rel[2]^2) + r = sqrt(x_rel[1]^2 + x_rel[2]^2) # steepness of the tanh transition zone slope = 2 # density blob diff --git a/examples/tree_2d_dgsem/elixir_euler_positivity.jl b/examples/tree_2d_dgsem/elixir_euler_positivity.jl index 78c625bc142..6fec4c1bf9b 100644 --- a/examples/tree_2d_dgsem/elixir_euler_positivity.jl +++ b/examples/tree_2d_dgsem/elixir_euler_positivity.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl index 1cbaa9736f0..5b8959b97d1 100644 --- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl index 227ae0507df..c1ba3d96962 100644 --- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl index c5a0d4e74aa..44e63a0872e 100644 --- a/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl @@ -21,7 +21,7 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl index 8677721536b..e9831c95526 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl @@ -54,7 +54,7 @@ end function periodic_distance_2d(coordinates, center, domain_length) dx = @. abs(coordinates - center) dx_periodic = @. min(dx, domain_length - dx) - return sqrt_(sum(abs2, dx_periodic)) + return sqrt(sum(abs2, dx_periodic)) end end # module TrixiExtension diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl index 4dc07dffd88..c6ed07dcda1 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl @@ -52,7 +52,7 @@ function initial_condition_shock_bubble(x, t, inicenter = SVector(zero(delta), zero(delta)) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) if (x[1] > 0.50) # Set up Region III diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl index fd06631b52a..4b606502ebe 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl @@ -52,7 +52,7 @@ function initial_condition_shock_bubble(x, t, inicenter = SVector(zero(delta), zero(delta)) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) if (x[1] > 0.50) # Set up Region III diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl index df6cf0a8559..78ff47e255f 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl @@ -52,7 +52,7 @@ function initial_condition_shock_bubble(x, t, inicenter = SVector(zero(delta), zero(delta)) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) if (x[1] > 0.50) # Set up Region III diff --git a/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl b/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl index 9e418f3dccc..fad03fab6ef 100644 --- a/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl +++ b/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl @@ -23,7 +23,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, function initial_condition_gauss_wall(x, t, equations::LinearizedEulerEquations2D) v1_prime = 0.0 v2_prime = 0.0 - rho_prime = p_prime = exp(-log_(2) * (x[1]^2 + (x[2] - 25)^2) / 25) + rho_prime = p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25) return SVector(rho_prime, v1_prime, v2_prime, p_prime) end initial_condition = initial_condition_gauss_wall diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl index 84adfc8ddd6..377a07e947e 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -15,7 +15,7 @@ solver = DGSEM(polydeg = 3, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, n_cells_max = 10_000) diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl index 0f1311c4315..0200b591844 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl @@ -16,7 +16,7 @@ solver = DGSEM(polydeg = 3, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) refinement_patches = ((type = "box", coordinates_min = 0.25 .* coordinates_max, coordinates_max = 0.75 .* coordinates_max),) mesh = TreeMesh(coordinates_min, coordinates_max, diff --git a/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl b/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl index 61efa73edda..a0909ca7580 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl @@ -18,7 +18,7 @@ An MHD blast wave taken from function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D) # setup taken from Derigs et al. DMV article (2018) # domain must be [-0.5, 0.5] x [-0.5, 0.5], γ = 1.4 - r = sqrt_(x[1]^2 + x[2]^2) + r = sqrt(x[1]^2 + x[2]^2) f = (0.1 - r) / 0.01 if r <= 0.09 p = 1000.0 @@ -31,7 +31,7 @@ function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D) v1 = 0.0 v2 = 0.0 v3 = 0.0 - B1 = 100.0 / sqrt_(4.0 * pi) + B1 = 100.0 / sqrt(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/tree_2d_dgsem/elixir_mhd_rotor.jl b/examples/tree_2d_dgsem/elixir_mhd_rotor.jl index d9b90dc1f02..3109b1ce303 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_rotor.jl @@ -19,7 +19,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) # domain must be [0, 1] x [0, 1], γ = 1.4 dx = x[1] - 0.5 dy = x[2] - 0.5 - r = sqrt_(dx^2 + dy^2) + r = sqrt(dx^2 + dy^2) f = (0.115 - r) / 0.015 if r <= 0.1 rho = 10.0 @@ -36,7 +36,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D) end v3 = 0.0 p = 1.0 - B1 = 5.0 / sqrt_(4.0 * pi) + B1 = 5.0 / sqrt(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl b/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl index 42b09fa3613..fe9ad92467f 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl @@ -19,7 +19,7 @@ This setup needs a positivity limiter for the density. function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D) # setup taken from Derigs et al. DMV article (2018) # domain must be [-0.5, 0.5] x [-0.5, 0.5], γ = 1.4 - r = sqrt_(x[1]^2 + x[2]^2) + r = sqrt(x[1]^2 + x[2]^2) pmax = 10.0 pmin = 1.0 @@ -38,7 +38,7 @@ function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D) v1 = 0.0 v2 = 0.0 v3 = 0.0 - B1 = 1.0 / sqrt_(4.0 * pi) + B1 = 1.0 / sqrt(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl index 326d7755b7b..4f1f8c5f2b7 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl @@ -16,7 +16,7 @@ solver = DGSEM(polydeg = 3, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2), sqrt_(2)) +coordinates_max = (sqrt(2), sqrt(2)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, n_cells_max = 10_000) diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl index 3d28531760c..5ca21cc5e9c 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl @@ -17,7 +17,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdMulticomponentEquat # domain must be [0, 1] x [0, 1], γ = 1.4 dx = x[1] - 0.5 dy = x[2] - 0.5 - r = sqrt_(dx^2 + dy^2) + r = sqrt(dx^2 + dy^2) f = (0.115 - r) / 0.015 if r <= 0.1 rho1 = 10.0 @@ -37,7 +37,7 @@ function initial_condition_rotor(x, t, equations::IdealGlmMhdMulticomponentEquat end v3 = 0.0 p = 1.0 - B1 = 5.0 / sqrt_(4.0 * pi) + B1 = 5.0 / sqrt(4.0 * pi) B2 = 0.0 B3 = 0.0 psi = 0.0 diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl b/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl index a8b12883598..b0c8678baad 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl @@ -40,7 +40,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t) v2 = v1 p = rho^2 @@ -75,19 +75,19 @@ end rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t) - v1 = sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) - v1_t = -pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) - v1_x = pi * cos(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t) + v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_y = sin(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) - v1_xx = -pi * pi * sin(pi_x) * log_(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) + v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t) v1_xy = pi * cos(pi_x) * - (A * log_(y + 2.0) * exp(-A * (y - 1.0)) + + (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t) v1_yy = (sin(pi_x) * (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) - - A * A * log_(y + 2.0) * exp(-A * (y - 1.0)) - + A * A * log(y + 2.0) * exp(-A * (y - 1.0)) - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t)) v2 = v1 v2_t = v1_t diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl b/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl index 7604be705f5..349b3741869 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl @@ -27,14 +27,14 @@ function initial_condition_conical_island(x, t, equations::ShallowWaterEquations v2 = 0.0 x1, x2 = x - b = max(0.1, 1.0 - 4.0 * sqrt_(x1^2 + x2^2)) + b = max(0.1, 1.0 - 4.0 * sqrt(x1^2 + x2^2)) # use a logistic function to transfer water height value smoothly L = equations.H0 # maximum of function x0 = 0.3 # center point of function k = -25.0 # sharpness of transfer - H = max(b, L / (1.0 + exp(-k * (sqrt_(x1^2 + x2^2) - x0)))) + H = max(b, L / (1.0 + exp(-k * (sqrt(x1^2 + x2^2) - x0)))) # It is mandatory to shift the water level at dry areas to make sure the water height h # stays positive. The system would not be stable for h set to a hard 0 due to division by h in diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl b/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl index a3fb76cefc9..bc528ae7756 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl @@ -53,7 +53,7 @@ function initial_condition_ec_discontinuous_bottom(x, t, element_id, inicenter = SVector(0.7, 0.7) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl index 848ad7080b5..2008019cc31 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl @@ -32,7 +32,7 @@ function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations a = 1.0 h_0 = 0.1 sigma = 0.5 - ω = sqrt_(2 * equations.gravity * h_0) / a + ω = sqrt(2 * equations.gravity * h_0) / a v1 = -sigma * ω * sin(ω * t) v2 = sigma * ω * cos(ω * t) diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl index 5748767ba22..c92e885c161 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl @@ -21,7 +21,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl index 1c6ab7d6482..f7544b1e32e 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl @@ -23,7 +23,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 10_000, diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl index 59f1cb85716..790916e4467 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl @@ -22,7 +22,7 @@ solver = DGSEM(polydeg = 3, # Get the TreeMesh and setup a periodic mesh coordinates_min = (0.0, 0.0) -coordinates_max = (sqrt_(2.0), sqrt_(2.0)) +coordinates_max = (sqrt(2.0), sqrt(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 20_000, diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl index 5c7aa232613..54c1a333071 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl @@ -19,7 +19,7 @@ function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEq v1_lower = 0.0 v2_lower = 0.0 b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? - 0.2 * (cos(4 * pi * sqrt_((x[1] - 0.5)^2 + (x[2] + + 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] + -0.5)^2)) + 1) : 0.0) return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), diff --git a/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl b/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl index 26e531ad23a..4c30406680a 100644 --- a/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl +++ b/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl @@ -30,10 +30,10 @@ mesh = TreeMesh(coordinates_min, coordinates_max, function initial_condition_eriksson_johnson(x, t, equations) l = 4 epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt - lambda_1 = (-1 + sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - lambda_2 = (-1 - sqrt_(1 - 4 * epsilon * l)) / (-2 * epsilon) - r1 = (1 + sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) - s1 = (1 - sqrt_(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon) + r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) + s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon) u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) + cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1)) return SVector{1}(u) diff --git a/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl b/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl index 8da4325930b..0ce886620cc 100644 --- a/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl +++ b/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl @@ -31,7 +31,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations3D) tau_kh = 1.0 tau_cr = tau_kh / 1.6 # crushing time # determine background velocity - v1 = 2 * R * sqrt_(Chi) / tau_cr + v1 = 2 * R * sqrt(Chi) / tau_cr v2 = 0.0 v3 = 0.0 Ma0 = 2.7 # background flow Mach number Ma=v/c @@ -41,7 +41,7 @@ function initial_condition_blob(x, t, equations::CompressibleEulerEquations3D) # initial center of the blob inicenter = [-15, 0, 0] x_rel = x - inicenter - r = sqrt_(x_rel[1]^2 + x_rel[2]^2 + x_rel[3]^2) + r = sqrt(x_rel[1]^2 + x_rel[2]^2 + x_rel[3]^2) # steepness of the tanh transition zone slope = 2 # density blob diff --git a/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl index dfc9c0443b9..87774ada266 100644 --- a/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl +++ b/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl @@ -20,7 +20,7 @@ Should be used together with [`boundary_condition_sedov_self_gravity`](@ref). """ function initial_condition_sedov_self_gravity(x, t, equations::CompressibleEulerEquations3D) # Calculate radius as distance from origin - r = sqrt_(x[1]^2 + x[2]^2 + x[3]^2) + r = sqrt(x[1]^2 + x[2]^2 + x[3]^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.25 # = 4.0 * smallest dx (for domain length=8 and max-ref=7) diff --git a/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl b/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl index c70eb99efab..3ada9503c6a 100644 --- a/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl @@ -43,7 +43,7 @@ function initial_condition_navier_stokes_convergence_test(x, t, equations) pi_t = pi * t rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) - v1 = A2 * sin(pi_x) * log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * + v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t) v2 = v1 v3 = v1 @@ -74,12 +74,12 @@ end # Define auxiliary functions for the strange function of the y variable # to make expressions easier to read - g = log_(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) - g_y = (A3 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + + g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) + g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0)) g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) - - A3^2 * log_(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) + A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))) # Density and its derivatives rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t) diff --git a/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl b/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl index c03bb0c196e..8f8e867dca8 100644 --- a/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl +++ b/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl @@ -31,7 +31,7 @@ A Gaussian pulse, used in the `gauss_wall` example elixir in combination with function initial_condition_gauss_wall(x, t, equations::AcousticPerturbationEquations2D) v1_prime = 0.0 v2_prime = 0.0 - p_prime = exp(-log_(2) * (x[1]^2 + (x[2] - 25)^2) / 25) + p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25) prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...) diff --git a/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl b/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl index 801d10b34d3..e1cc0932969 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl @@ -18,7 +18,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000 r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6) diff --git a/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl b/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl index 2c5db9e078c..a40f92cac02 100644 --- a/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl +++ b/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl @@ -11,10 +11,10 @@ equations = IdealGlmMhdEquations2D(5 / 3) function initial_condition_shifted_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D) # Adapted MHD version of the weak blast wave from Hennemann & Gassner JCP paper 2020 (Sec. 6.3) # Shift blastwave to center of domain - inicenter = (sqrt_(2) / 2, sqrt_(2) / 2) + inicenter = (sqrt(2) / 2, sqrt(2) / 2) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) # Calculate primitive variables diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl index ae496148705..8e9d396d826 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl @@ -57,7 +57,7 @@ function initial_condition_ec_discontinuous_bottom(x, t, element_id, inicenter = SVector(0.7, 0.7) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl index 02d3e287222..94202b81df0 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl @@ -66,7 +66,7 @@ function initial_condition_ec_discontinuous_bottom(x, t, element_id, inicenter = SVector(0.7, 0.7) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl index 2e5b83e4130..6164f9d4a55 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl @@ -31,9 +31,9 @@ function initial_condition_three_mounds(x, t, equations::ShallowWaterEquations2D v2 = 0.0 x1, x2 = x - M_1 = 1 - 0.1 * sqrt_((x1 - 30.0)^2 + (x2 - 22.5)^2) - M_2 = 1 - 0.1 * sqrt_((x1 - 30.0)^2 + (x2 - 7.5)^2) - M_3 = 2.8 - 0.28 * sqrt_((x1 - 47.5)^2 + (x2 - 15.0)^2) + M_1 = 1 - 0.1 * sqrt((x1 - 30.0)^2 + (x2 - 22.5)^2) + M_2 = 1 - 0.1 * sqrt((x1 - 30.0)^2 + (x2 - 7.5)^2) + M_3 = 2.8 - 0.28 * sqrt((x1 - 47.5)^2 + (x2 - 15.0)^2) b = max(0.0, M_1, M_2, M_3) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl index d2d1dd25e7f..4ad5f7e3201 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl @@ -16,7 +16,7 @@ equations = ShallowWaterTwoLayerEquations2D(gravity_constant = 1.0, rho_upper = # condition is reset with the true discontinuous values from initial_condition_discontinuous_dam_break. function initial_condition_dam_break(x, t, equations::ShallowWaterTwoLayerEquations2D) - if x[1] < sqrt_(2) / 2 + if x[1] < sqrt(2) / 2 H_upper = 1.0 H_lower = 0.6 b = 0.1 diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl index 4e7828f044b..48e98e60019 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl @@ -22,7 +22,7 @@ function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEq # Bottom Topography b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? - 0.2 * (cos(4 * pi * sqrt_((x[1] - 0.5)^2 + (x[2] + + 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] + -0.5)^2)) + 1) : 0.0) return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl index 389ae5fd660..76b9642d595 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl @@ -14,7 +14,7 @@ function initial_condition_stone_throw(x, t, equations::ShallowWaterEquations2D) inicenter = SVector(0.15, 0.15) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) # Calculate primitive variables H = equations.H0 diff --git a/ext/TrixiMakieExt.jl b/ext/TrixiMakieExt.jl index bba1d7fea3f..301a7656da9 100644 --- a/ext/TrixiMakieExt.jl +++ b/ext/TrixiMakieExt.jl @@ -392,7 +392,7 @@ function Makie.plot!(fig, pd::PlotData2DTriangulated; cols = length(pd) rows = 1 else - cols = ceil(Int, sqrt_(length(pd))) + cols = ceil(Int, sqrt(length(pd))) rows = cld(length(pd), cols) end diff --git a/src/Trixi.jl b/src/Trixi.jl index f8d973516cb..e18b2f6415c 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -219,7 +219,6 @@ export entropy, energy_total, energy_kinetic, energy_internal, energy_magnetic, enstrophy export lake_at_rest_error export ncomponents, eachcomponent -export sqrt_, log_ export TreeMesh, StructuredMesh, UnstructuredMesh2D, P4estMesh, T8codeMesh diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index f58612717c4..c3f9ddcbd51 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -6,15 +6,15 @@ #! format: noindent """ - sqrt_(x::Real) + sqrt(x::Real) Custom square root function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). -We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsic `sqrt_llvm` as for this the -`sqrt_llvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. +We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsic `sqrtllvm` as for this the +`sqrtllvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. For other types, such as integers or dual numbers required for algorithmic differentiation, we fall back to the Julia built-in `sqrt` function after a check for negative arguments. Since these cases are not performance critical, the check for negativity does not hurt here @@ -24,13 +24,16 @@ When debugging code, it might be useful to change the implementation of this fun the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated in the stacktrace. """ -@inline sqrt_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +@inline sqrt(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) -@inline sqrt_(x::Union{Float64, Float32, Float16}) = Base.sqrt_llvm(x) -#@inline sqrt_(x) = Base.sqrt(x) # For benchmarking and debugging +#@inline sqrt(x::Union{Float64, Float32, Float16}) = Base.sqrt_llvm(x) +@inline sqrt(x::Float64) = ccall("llvm.sqrt.f64", llvmcall, Float64, (Float64,), x) +@inline sqrt(x::Float32) = ccall("llvm.sqrt.f32", llvmcall, Float32, (Float32,), x) +@inline sqrt(x::Float16) = ccall("llvm.sqrt.f16", llvmcall, Float16, (Float16,), x) +#@inline sqrt(x) = Base.sqrt(x) # For benchmarking and debugging (shows up in stacktrace) """ - log_(x::Real) + log(x::Real) Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) @@ -49,12 +52,12 @@ When debugging code, it might be useful to change the implementation of this fun the Julia built-in `log` function, as this reports the exact place in code where the domain is violated in the stacktrace. """ -@inline log_(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) +@inline log(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) -@inline log_(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64,), x) -@inline log_(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) -@inline log_(x::Float16) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) -#@inline log_(x) = Base.log(x) # For benchmarking and debugging +@inline log(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64,), x) +@inline log(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) +@inline log(x::Float16) = ccall("llvm.log.f16", llvmcall, Float16, (Float16,), x) +#@inline log(x) = Base.log(x) # For benchmarking and debugging (shows up in stacktrace) """ ln_mean(x, y) @@ -110,7 +113,7 @@ Given ε = 1.0e-4, we use the following algorithm. if f2 < epsilon_f2 return (x + y) / @evalpoly(f2, 2, 2/3, 2/5, 2/7) else - return (y - x) / log_(y / x) + return (y - x) / log(y / x) end end @@ -130,7 +133,7 @@ multiplication. if f2 < epsilon_f2 return @evalpoly(f2, 2, 2/3, 2/5, 2/7) / (x + y) else - return log_(y / x) / (y - x) + return log(y / x) / (y - x) end end diff --git a/src/auxiliary/mpi.jl b/src/auxiliary/mpi.jl index f0c9e19fc83..c85c23670b0 100644 --- a/src/auxiliary/mpi.jl +++ b/src/auxiliary/mpi.jl @@ -81,9 +81,9 @@ function ode_norm(u::AbstractArray, t) if mpi_isparallel() global_sumabs2, global_length = MPI.Allreduce([local_sumabs2, local_length], +, mpi_comm()) - return sqrt_(global_sumabs2 / global_length) + return sqrt(global_sumabs2 / global_length) else - return sqrt_(local_sumabs2 / local_length) + return sqrt(local_sumabs2 / local_length) end end diff --git a/src/auxiliary/special_elixirs.jl b/src/auxiliary/special_elixirs.jl index 2cd95242e9b..5fdd9aea0c5 100644 --- a/src/auxiliary/special_elixirs.jl +++ b/src/auxiliary/special_elixirs.jl @@ -119,7 +119,7 @@ function analyze_convergence(errors, iterations, # Calculate EOCs where the columns represent the variables # As dx halves in every iteration the denominator needs to be log(1/2) - eocs = Dict(kind => log_.(error[2:end, :] ./ error[1:(end - 1), :]) ./ log_(1 / 2) + eocs = Dict(kind => log.(error[2:end, :] ./ error[1:(end - 1), :]) ./ log(1 / 2) for (kind, error) in errorsmatrix) eoc_mean_values = Dict{Symbol, Any}() diff --git a/src/auxiliary/t8code.jl b/src/auxiliary/t8code.jl index bd781b21c1e..3428d5c428b 100644 --- a/src/auxiliary/t8code.jl +++ b/src/auxiliary/t8code.jl @@ -15,8 +15,8 @@ function init_t8code() end # Initialize the sc library, has to happen before we initialize t8code. - let catch_signals = 0, print_backtrace = 0, log_handler = C_NULL - T8code.Libt8.sc_init(mpi_comm(), catch_signals, print_backtrace, log_handler, + let catch_signals = 0, print_backtrace = 0, loghandler = C_NULL + T8code.Libt8.sc_init(mpi_comm(), catch_signals, print_backtrace, loghandler, T8code.Libt8.SC_LP_ERROR) end diff --git a/src/callbacks_step/analysis_dg1d.jl b/src/callbacks_step/analysis_dg1d.jl index 7d95dd9ae9c..d2613c325be 100644 --- a/src/callbacks_step/analysis_dg1d.jl +++ b/src/callbacks_step/analysis_dg1d.jl @@ -75,7 +75,7 @@ function calc_error_norms(func, u, t, analyzer, end # For L2 error, divide by total volume - l2_error = @. sqrt_(l2_error / total_volume) + l2_error = @. sqrt(l2_error / total_volume) return l2_error, linf_error end @@ -113,7 +113,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt_(l2_error / total_volume_) + l2_error = @. sqrt(l2_error / total_volume_) return l2_error, linf_error end diff --git a/src/callbacks_step/analysis_dg2d.jl b/src/callbacks_step/analysis_dg2d.jl index aa46d963e6a..a9e0cf87b0a 100644 --- a/src/callbacks_step/analysis_dg2d.jl +++ b/src/callbacks_step/analysis_dg2d.jl @@ -101,7 +101,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt_(l2_error / total_volume_) + l2_error = @. sqrt(l2_error / total_volume_) return l2_error, linf_error end @@ -144,7 +144,7 @@ function calc_error_norms(func, u, t, analyzer, end # For L2 error, divide by total volume - l2_error = @. sqrt_(l2_error / total_volume) + l2_error = @. sqrt(l2_error / total_volume) return l2_error, linf_error end diff --git a/src/callbacks_step/analysis_dg2d_parallel.jl b/src/callbacks_step/analysis_dg2d_parallel.jl index 870e0deab27..a04bf732604 100644 --- a/src/callbacks_step/analysis_dg2d_parallel.jl +++ b/src/callbacks_step/analysis_dg2d_parallel.jl @@ -44,7 +44,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt_(l2_error / total_volume_) + l2_error = @. sqrt(l2_error / total_volume_) else l2_error = convert(eltype(l2_errors), NaN * zero(eltype(l2_errors))) linf_error = convert(eltype(linf_errors), NaN * zero(eltype(linf_errors))) @@ -136,7 +136,7 @@ function calc_error_norms(func, u, t, analyzer, l2_error = convert(typeof(l2_error), global_l2_error) linf_error = convert(typeof(linf_error), global_linf_error) # For L2 error, divide by total volume - l2_error = @. sqrt_(l2_error / total_volume) + l2_error = @. sqrt(l2_error / total_volume) else l2_error = convert(typeof(l2_error), NaN * global_l2_error) linf_error = convert(typeof(linf_error), NaN * global_linf_error) diff --git a/src/callbacks_step/analysis_dg3d.jl b/src/callbacks_step/analysis_dg3d.jl index 010731d4742..81d0795a159 100644 --- a/src/callbacks_step/analysis_dg3d.jl +++ b/src/callbacks_step/analysis_dg3d.jl @@ -112,7 +112,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt_(l2_error / total_volume_) + l2_error = @. sqrt(l2_error / total_volume_) return l2_error, linf_error end @@ -159,7 +159,7 @@ function calc_error_norms(func, u, t, analyzer, end # For L2 error, divide by total volume - l2_error = @. sqrt_(l2_error / total_volume) + l2_error = @. sqrt(l2_error / total_volume) return l2_error, linf_error end diff --git a/src/callbacks_step/analysis_dg3d_parallel.jl b/src/callbacks_step/analysis_dg3d_parallel.jl index 3f0d12d0b9c..d8756d91c9d 100644 --- a/src/callbacks_step/analysis_dg3d_parallel.jl +++ b/src/callbacks_step/analysis_dg3d_parallel.jl @@ -54,7 +54,7 @@ function calc_error_norms(func, u, t, analyzer, l2_error = convert(typeof(l2_error), global_l2_error) linf_error = convert(typeof(linf_error), global_linf_error) # For L2 error, divide by total volume - l2_error = @. sqrt_(l2_error / total_volume) + l2_error = @. sqrt(l2_error / total_volume) else l2_error = convert(typeof(l2_error), NaN * global_l2_error) linf_error = convert(typeof(linf_error), NaN * global_linf_error) diff --git a/src/callbacks_step/analysis_dgmulti.jl b/src/callbacks_step/analysis_dgmulti.jl index aff43002785..dc294de9e7b 100644 --- a/src/callbacks_step/analysis_dgmulti.jl +++ b/src/callbacks_step/analysis_dgmulti.jl @@ -24,7 +24,7 @@ function calc_error_norms(func, u, t, analyzer, component_linf_errors = max.(component_linf_errors, abs.(error_at_node)) end total_volume = sum(md.wJq) - return sqrt_.(component_l2_errors ./ total_volume), component_linf_errors + return sqrt.(component_l2_errors ./ total_volume), component_linf_errors end function integrate(func::Func, u, @@ -112,7 +112,7 @@ function analyze(::Val{:l2_divb}, du, u, t, l2norm_divB += local_l2norm_divB end - return sqrt_(l2norm_divB) + return sqrt(l2norm_divB) end function analyze(::Val{:linf_divb}, du, u, t, diff --git a/src/callbacks_step/averaging_dg2d.jl b/src/callbacks_step/averaging_dg2d.jl index d6f4b300e6e..959a5655d96 100644 --- a/src/callbacks_step/averaging_dg2d.jl +++ b/src/callbacks_step/averaging_dg2d.jl @@ -68,8 +68,8 @@ function calc_mean_values!(mean_values, averaging_callback_cache, u, u_prev, rho, v1, v2, p = u_node_prim rho_prev, v1_prev, v2_prev, p_prev = u_prev_node_prim - c = sqrt_(equations.gamma * p / rho) - c_prev = sqrt_(equations.gamma * p_prev / rho_prev) + c = sqrt(equations.gamma * p / rho) + c_prev = sqrt(equations.gamma * p_prev / rho_prev) # Calculate the contribution to the mean values using the trapezoidal rule vorticity_mean[i, j, element] += integration_constant * diff --git a/src/callbacks_step/visualization.jl b/src/callbacks_step/visualization.jl index c5048354c0c..98c0126a302 100644 --- a/src/callbacks_step/visualization.jl +++ b/src/callbacks_step/visualization.jl @@ -204,13 +204,13 @@ function show_plot(plot_data, variable_names; # cols = length(plots) # rows = 1 # else - # cols = ceil(Int, sqrt_(length(plots))) + # cols = ceil(Int, sqrt(length(plots))) # rows = div(length(plots), cols, RoundUp) # end # layout = (rows, cols) # Determine layout - cols = ceil(Int, sqrt_(length(plots))) + cols = ceil(Int, sqrt(length(plots))) rows = div(length(plots), cols, RoundUp) layout = (rows, cols) @@ -248,7 +248,7 @@ function save_plot(plot_data, variable_names; end # Determine layout - cols = ceil(Int, sqrt_(length(plots))) + cols = ceil(Int, sqrt(length(plots))) rows = div(length(plots), cols, RoundUp) layout = (rows, cols) diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index aa62185051e..b87a177811e 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -230,7 +230,7 @@ are available in the paper: # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = sqrt_(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = sqrt(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -240,7 +240,7 @@ are available in the paper: B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + sqrt_(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + sqrt(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -454,7 +454,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) lambda1 = v1 lambda2 = v1 + a @@ -480,7 +480,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) lambda1 = v1 lambda2 = v1 + a @@ -549,7 +549,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -571,7 +571,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -637,7 +637,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -664,7 +664,7 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho_v1 * v1) # sound speed and enthalpy - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho # signed Mach number @@ -695,11 +695,11 @@ end v1_ll = rho_v1_ll / rho_ll v_mag_ll = abs(v1_ll) p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * v_mag_ll^2) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v_mag_rr = abs(v1_rr) p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * v_mag_rr^2) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) λ_max = max(v_mag_ll, v_mag_rr) + max(c_ll, c_rr) end @@ -710,8 +710,8 @@ end rho_ll, v1_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, p_rr = cons2prim(u_rr, equations) - λ_min = v1_ll - sqrt_(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + sqrt_(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + sqrt(equations.gamma * p_rr / rho_rr) return λ_min, λ_max end @@ -722,8 +722,8 @@ end rho_ll, v1_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, p_rr = cons2prim(u_rr, equations) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) λ_min = min(v1_ll - c_ll, v1_rr - c_rr) λ_max = max(v1_ll + c_ll, v1_rr + c_rr) @@ -747,29 +747,29 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, v1_ll = rho_v1_ll / rho_ll e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * v1_ll^2) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * v1_rr^2) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + sum_sqrtrho = sqrtrho_ll + sqrtrho_rr vel_L = v1_ll vel_R = v1_rr - vel_roe = (sqrt_rho_ll * vel_L + sqrt_rho_rr * vel_R) / sum_sqrt_rho + vel_roe = (sqrtrho_ll * vel_L + sqrtrho_rr * vel_R) / sum_sqrtrho ekin_roe = 0.5 * vel_roe^2 H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - ekin_roe)) + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) @@ -838,26 +838,26 @@ Compactly summarized: # `u_ll[3]` is total energy `rho_e_ll` on the left H_ll = (u_ll[3] + p_ll) / rho_ll - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) # `u_rr[3]` is total energy `rho_e_rr` on the right H_rr = (u_rr[3] + p_rr) / rho_rr - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) - v_roe = (sqrt_rho_ll * v_ll + sqrt_rho_rr * v_rr) * inv_sum_sqrt_rho + v_roe = (sqrtrho_ll * v_ll + sqrtrho_rr * v_rr) * inv_sum_sqrtrho v_roe_mag = v_roe^2 - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) SsL = min(v_roe - c_roe, v_ll - beta * c_ll, zero(v_roe)) @@ -870,7 +870,7 @@ end rho, rho_v1, rho_e = u v1 = rho_v1 / rho p = (equations.gamma - 1) * (rho_e - 1 / 2 * rho * v1^2) - c = sqrt_(equations.gamma * p / rho) + c = sqrt(equations.gamma * p / rho) return (abs(v1) + c,) end @@ -892,7 +892,7 @@ end v1 = rho_v1 / rho v_square = v1^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - equations.gamma * log_(rho) + s = log(p) - equations.gamma * log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -956,7 +956,7 @@ end p = (equations.gamma - 1) * (cons[3] - 1 / 2 * (cons[2]^2) / cons[1]) # Thermodynamic entropy - s = log_(p) - equations.gamma * log_(cons[1]) + s = log(p) - equations.gamma * log(cons[1]) return s end diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 65b8d661204..0dbe4b542ef 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -164,7 +164,7 @@ function initial_condition_weak_blast_wave(x, t, inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) @@ -308,7 +308,7 @@ Should be used together with [`UnstructuredMesh2D`](@ref). # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = sqrt_(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = sqrt(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -318,7 +318,7 @@ Should be used together with [`UnstructuredMesh2D`](@ref). B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + sqrt_(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + sqrt(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -719,7 +719,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -767,7 +767,7 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -857,7 +857,7 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho if orientation == 1 @@ -887,7 +887,7 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho if orientation == 1 @@ -943,9 +943,9 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho - lambda = 0.5 * (sqrt_(v1^2 + v2^2) + a) + lambda = 0.5 * (sqrt(v1^2 + v2^2) + a) if orientation == 1 #lambda = 0.5 * (abs(v1) + a) @@ -970,9 +970,9 @@ end v2 = rho_v2 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2)) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) H = (rho_e + p) / rho - lambda = 0.5 * (sqrt_(v1^2 + v2^2) + a) + lambda = 0.5 * (sqrt(v1^2 + v2^2) + a) if orientation == 1 #lambda = 0.5 * (abs(v1) + a) @@ -1006,8 +1006,8 @@ end v_rr = v2_rr end # Calculate sound speeds - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -1022,12 +1022,12 @@ end v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2]) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) # right v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2]) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end @@ -1039,11 +1039,11 @@ end rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - sqrt_(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + sqrt_(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + sqrt(equations.gamma * p_rr / rho_rr) else # y-direction - λ_min = v2_ll - sqrt_(equations.gamma * p_ll / rho_ll) - λ_max = v2_rr + sqrt_(equations.gamma * p_rr / rho_rr) + λ_min = v2_ll - sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v2_rr + sqrt(equations.gamma * p_rr / rho_rr) end return λ_min, λ_max @@ -1059,8 +1059,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - sqrt_(equations.gamma * p_ll / rho_ll) * norm_ - λ_max = v_normal_rr + sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + λ_min = v_normal_ll - sqrt(equations.gamma * p_ll / rho_ll) * norm_ + λ_max = v_normal_rr + sqrt(equations.gamma * p_rr / rho_rr) * norm_ return λ_min, λ_max end @@ -1071,8 +1071,8 @@ end rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1093,8 +1093,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -1166,22 +1166,22 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, v2_ll = rho_v2_ll / rho_ll e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * (v1_ll^2 + v2_ll^2)) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v2_rr = rho_v2_rr / rho_rr e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * (v1_rr^2 + v2_rr^2)) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + sum_sqrtrho = sqrtrho_ll + sqrtrho_rr if orientation == 1 # x-direction vel_L = v1_ll vel_R = v1_rr @@ -1189,14 +1189,14 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, vel_L = v2_ll vel_R = v2_rr end - vel_roe = (sqrt_rho_ll * vel_L + sqrt_rho_rr * vel_R) / sum_sqrt_rho - v1_roe = sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr - v2_roe = sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr - vel_roe_mag = (v1_roe^2 + v2_roe^2) / sum_sqrt_rho^2 + vel_roe = (sqrtrho_ll * vel_L + sqrtrho_rr * vel_R) / sum_sqrtrho + v1_roe = sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr + v2_roe = sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr + vel_roe_mag = (v1_roe^2 + v2_roe^2) / sum_sqrtrho^2 H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) sMu_L = Ssl - vel_L @@ -1265,20 +1265,20 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, norm_sq = norm_ * norm_ inv_norm_sq = inv(norm_sq) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ # Obtain left and right fluxes f_ll = flux(u_ll, normal_direction, equations) f_rr = flux(u_rr, normal_direction, equations) # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + sum_sqrtrho = sqrtrho_ll + sqrtrho_rr - v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) / sum_sqrt_rho - v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) / sum_sqrt_rho + v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) / sum_sqrtrho + v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) / sum_sqrtrho vel_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] vel_roe_mag = v1_roe^2 + v2_roe^2 @@ -1288,8 +1288,8 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, H_ll = (u_ll[4] + p_ll) / rho_ll H_rr = (u_rr[4] + p_rr) / rho_rr - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ Ssl = min(v_dot_n_ll - c_ll, vel_roe - c_roe) Ssr = max(v_dot_n_rr + c_rr, vel_roe + c_roe) @@ -1367,27 +1367,27 @@ of the numerical flux. # `u_ll[4]` is total energy `rho_e_ll` on the left H_ll = (u_ll[4] + p_ll) / rho_ll - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) # `u_rr[4]` is total energy `rho_e_rr` on the right H_rr = (u_rr[4] + p_rr) / rho_rr - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) - v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho - v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho + v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) * inv_sum_sqrtrho + v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) * inv_sum_sqrtrho v_roe_mag = v1_roe^2 + v2_roe^2 - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) if orientation == 1 # x-direction @@ -1429,28 +1429,28 @@ of the numerical flux. # `u_ll[4]` is total energy `rho_e_ll` on the left H_ll = (u_ll[4] + p_ll) / rho_ll - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ # `u_rr[4]` is total energy `rho_e_rr` on the right H_rr = (u_rr[4] + p_rr) / rho_rr - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) - v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho - v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho + v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) * inv_sum_sqrtrho + v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) * inv_sum_sqrtrho v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] v_roe_mag = v1_roe^2 + v2_roe^2 - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) SsL = min(v_roe - c_roe, v_dot_n_ll - beta * c_ll, zero(v_roe)) @@ -1461,7 +1461,7 @@ end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations2D) rho, v1, v2, p = cons2prim(u, equations) - c = sqrt_(equations.gamma * p / rho) + c = sqrt(equations.gamma * p / rho) return abs(v1) + c, abs(v2) + c end @@ -1485,7 +1485,7 @@ end v2 = rho_v2 / rho v_square = v1^2 + v2^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - equations.gamma * log_(rho) + s = log(p) - equations.gamma * log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1575,7 +1575,7 @@ end p = (equations.gamma - 1) * (cons[4] - 1 / 2 * (cons[2]^2 + cons[3]^2) / cons[1]) # Thermodynamic entropy - s = log_(p) - equations.gamma * log_(cons[1]) + s = log(p) - equations.gamma * log(cons[1]) return s end diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 46ce8e63514..aa8179e2d93 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -148,7 +148,7 @@ function initial_condition_weak_blast_wave(x, t, x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) phi = atan(y_norm, x_norm) theta = iszero(r) ? 0.0 : acos(z_norm / r) @@ -310,7 +310,7 @@ Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of # Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction # [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761) if v_normal <= 0.0 - sound_speed = sqrt_(equations.gamma * p_local / rho_local) # local sound speed + sound_speed = sqrt(equations.gamma * p_local / rho_local) # local sound speed p_star = p_local * (1 + 0.5 * (equations.gamma - 1) * v_normal / sound_speed)^(2 * equations.gamma * @@ -320,7 +320,7 @@ Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of B = p_local * (equations.gamma - 1) / (equations.gamma + 1) p_star = p_local + 0.5 * v_normal / A * - (v_normal + sqrt_(v_normal^2 + 4 * A * (p_local + B))) + (v_normal + sqrt(v_normal^2 + 4 * A * (p_local + B))) end # For the slip wall we directly set the flux as the normal velocity is zero @@ -797,7 +797,7 @@ end v3 = rho_v3 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2 + rho_v3 * v3)) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -868,7 +868,7 @@ end v3 = rho_v3 / rho p = (equations.gamma - 1) * (rho_e - 0.5 * (rho_v1 * v1 + rho_v2 * v2 + rho_v3 * v3)) - a = sqrt_(equations.gamma * p / rho) + a = sqrt(equations.gamma * p / rho) if orientation == 1 lambda1 = v1 @@ -1044,8 +1044,8 @@ end v_rr = v3_rr end # Calculate sound speeds - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -1060,12 +1060,12 @@ end v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + v3_ll * normal_direction[3]) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) # right v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + v3_rr * normal_direction[3]) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end @@ -1077,14 +1077,14 @@ end rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - sqrt_(equations.gamma * p_ll / rho_ll) - λ_max = v1_rr + sqrt_(equations.gamma * p_rr / rho_rr) + λ_min = v1_ll - sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v1_rr + sqrt(equations.gamma * p_rr / rho_rr) elseif orientation == 2 # y-direction - λ_min = v2_ll - sqrt_(equations.gamma * p_ll / rho_ll) - λ_max = v2_rr + sqrt_(equations.gamma * p_rr / rho_rr) + λ_min = v2_ll - sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v2_rr + sqrt(equations.gamma * p_rr / rho_rr) else # z-direction - λ_min = v3_ll - sqrt_(equations.gamma * p_ll / rho_ll) - λ_max = v3_rr + sqrt_(equations.gamma * p_rr / rho_rr) + λ_min = v3_ll - sqrt(equations.gamma * p_ll / rho_ll) + λ_max = v3_rr + sqrt(equations.gamma * p_rr / rho_rr) end return λ_min, λ_max @@ -1102,8 +1102,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - sqrt_(equations.gamma * p_ll / rho_ll) * norm_ - λ_max = v_normal_rr + sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + λ_min = v_normal_ll - sqrt(equations.gamma * p_ll / rho_ll) * norm_ + λ_max = v_normal_rr + sqrt(equations.gamma * p_rr / rho_rr) * norm_ return λ_min, λ_max end @@ -1114,8 +1114,8 @@ end rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1139,8 +1139,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + @@ -1210,7 +1210,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, e_ll = rho_e_ll / rho_ll p_ll = (equations.gamma - 1) * (rho_e_ll - 1 / 2 * rho_ll * (v1_ll^2 + v2_ll^2 + v3_ll^2)) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) v1_rr = rho_v1_rr / rho_rr v2_rr = rho_v2_rr / rho_rr @@ -1218,16 +1218,16 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, e_rr = rho_e_rr / rho_rr p_rr = (equations.gamma - 1) * (rho_e_rr - 1 / 2 * rho_rr * (v1_rr^2 + v2_rr^2 + v3_rr^2)) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Obtain left and right fluxes f_ll = flux(u_ll, orientation, equations) f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + sum_sqrtrho = sqrtrho_ll + sqrtrho_rr if orientation == 1 # x-direction vel_L = v1_ll vel_R = v1_rr @@ -1238,15 +1238,15 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, vel_L = v3_ll vel_R = v3_rr end - vel_roe = (sqrt_rho_ll * vel_L + sqrt_rho_rr * vel_R) / sum_sqrt_rho - v1_roe = sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr - v2_roe = sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr - v3_roe = sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr - vel_roe_mag = (v1_roe^2 + v2_roe^2 + v3_roe^2) / sum_sqrt_rho^2 + vel_roe = (sqrtrho_ll * vel_L + sqrtrho_rr * vel_R) / sum_sqrtrho + v1_roe = sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr + v2_roe = sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr + v3_roe = sqrtrho_ll * v3_ll + sqrtrho_rr * v3_rr + vel_roe_mag = (v1_roe^2 + v2_roe^2 + v3_roe^2) / sum_sqrtrho^2 H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) sMu_L = Ssl - vel_L @@ -1333,21 +1333,21 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, norm_sq = norm_ * norm_ inv_norm_sq = inv(norm_sq) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ # Obtain left and right fluxes f_ll = flux(u_ll, normal_direction, equations) f_rr = flux(u_rr, normal_direction, equations) # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + sum_sqrtrho = sqrtrho_ll + sqrtrho_rr - v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) / sum_sqrt_rho - v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) / sum_sqrt_rho - v3_roe = (sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr) / sum_sqrt_rho + v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) / sum_sqrtrho + v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) / sum_sqrtrho + v3_roe = (sqrtrho_ll * v3_ll + sqrtrho_rr * v3_rr) / sum_sqrtrho vel_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + v3_roe * normal_direction[3] vel_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 @@ -1358,8 +1358,8 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, H_ll = (u_ll[5] + p_ll) / rho_ll H_rr = (u_rr[5] + p_rr) / rho_rr - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ Ssl = min(v_dot_n_ll - c_ll, vel_roe - c_roe) Ssr = max(v_dot_n_rr + c_rr, vel_roe + c_roe) @@ -1445,28 +1445,28 @@ of the numerical flux. # `u_ll[5]` is total energy `rho_e_ll` on the left H_ll = (u_ll[5] + p_ll) / rho_ll - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) # `u_rr[5]` is total energy `rho_e_rr` on the right H_rr = (u_rr[5] + p_rr) / rho_rr - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) - v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho - v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho - v3_roe = (sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr) * inv_sum_sqrt_rho + v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) * inv_sum_sqrtrho + v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) * inv_sum_sqrtrho + v3_roe = (sqrtrho_ll * v3_ll + sqrtrho_rr * v3_rr) * inv_sum_sqrtrho v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) if orientation == 1 # x-direction @@ -1513,30 +1513,30 @@ of the numerical flux. # `u_ll[5]` is total energy `rho_e_ll` on the left H_ll = (u_ll[5] + p_ll) / rho_ll - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ # `u_rr[5]` is total energy `rho_e_rr` on the right H_rr = (u_rr[5] + p_rr) / rho_rr - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) - v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho - v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho - v3_roe = (sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr) * inv_sum_sqrt_rho + v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) * inv_sum_sqrtrho + v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) * inv_sum_sqrtrho + v3_roe = (sqrtrho_ll * v3_ll + sqrtrho_rr * v3_rr) * inv_sum_sqrtrho v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + v3_roe * normal_direction[3] v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 - H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho - c_roe = sqrt_((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see # https://doi.org/10.1016/0021-9991(91)90211-3 - beta = sqrt_(0.5 * (equations.gamma - 1) / equations.gamma) + beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) # Estimate the edges of the Riemann fan (with positivity conservation) SsL = min(v_roe - c_roe, v_dot_n_ll - beta * c_ll, zero(v_roe)) @@ -1547,7 +1547,7 @@ end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations3D) rho, v1, v2, v3, p = cons2prim(u, equations) - c = sqrt_(equations.gamma * p / rho) + c = sqrt(equations.gamma * p / rho) return abs(v1) + c, abs(v2) + c, abs(v3) + c end @@ -1574,7 +1574,7 @@ end v3 = rho_v3 / rho v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - equations.gamma * log_(rho) + s = log(p) - equations.gamma * log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1647,7 +1647,7 @@ end p = pressure(u, equations) # Thermodynamic entropy - s = log_(p) - equations.gamma * log_(rho) + s = log(p) - equations.gamma * log(rho) return s end diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index d1129e89a3a..acee52a0b86 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -400,8 +400,8 @@ end p_ll = (gamma_ll - 1) * (rho_e_ll - 1 / 2 * rho_ll * v_ll^2) p_rr = (gamma_rr - 1) * (rho_e_rr - 1 / 2 * rho_rr * v_rr^2) - c_ll = sqrt_(gamma_ll * p_ll / rho_ll) - c_rr = sqrt_(gamma_rr * p_rr / rho_rr) + c_ll = sqrt(gamma_ll * p_ll / rho_ll) + c_rr = sqrt(gamma_rr * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -415,7 +415,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 1 / 2 * rho * (v1^2)) - c = sqrt_(gamma * p / rho) + c = sqrt(gamma * p / rho) return (abs(v1) + c,) end @@ -478,14 +478,14 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - gamma * log_(rho) - log_(gas_constant) + s = log(p) - gamma * log(rho) - log(gas_constant) rho_p = rho / p T = (rho_e - 0.5 * rho * v_square) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}((cv[i] * - (1 - log_(T)) + + (1 - log(T)) + gas_constants[i] * - (1 + log_(u[i + 2])) - + (1 + log(u[i + 2])) - v1^2 / (2 * T)) for i in eachcomponent(equations)) @@ -505,7 +505,7 @@ end cons_rho = SVector{ncomponents(equations), real(equations)}(exp(1 / gas_constants[i] * (-cv[i] * - log_(-w[2]) - + log(-w[2]) - cp[i] + w[i + 2] - 0.5 * w[1]^2 / w[2])) @@ -537,7 +537,7 @@ end total_entropy = zero(u[1]) for i in eachcomponent(equations) total_entropy -= u[i + 2] * - (cv[i] * log_(T) - gas_constants[i] * log_(u[i + 2])) + (cv[i] * log(T) - gas_constants[i] * log(u[i + 2])) end return total_entropy diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index 1f26dc192f2..3fcc37f4dbe 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -213,7 +213,7 @@ function initial_condition_weak_blast_wave(x, t, inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) @@ -558,9 +558,9 @@ end # Compute the sound speeds on the left and right p_ll = (gamma_ll - 1) * (rho_e_ll - 1 / 2 * (rho_v1_ll^2 + rho_v2_ll^2) / rho_ll) - c_ll = sqrt_(gamma_ll * p_ll / rho_ll) + c_ll = sqrt(gamma_ll * p_ll / rho_ll) p_rr = (gamma_rr - 1) * (rho_e_rr - 1 / 2 * (rho_v1_rr^2 + rho_v2_rr^2) / rho_rr) - c_rr = sqrt_(gamma_rr * p_rr / rho_rr) + c_rr = sqrt(gamma_rr * p_rr / rho_rr) λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -575,7 +575,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 1 / 2 * rho * (v1^2 + v2^2)) - c = sqrt_(gamma * p / rho) + c = sqrt(gamma * p / rho) return (abs(v1) + c, abs(v2) + c) end @@ -662,14 +662,14 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square) - s = log_(p) - gamma * log_(rho) - log_(gas_constant) + s = log(p) - gamma * log(rho) - log(gas_constant) rho_p = rho / p T = (rho_e - 0.5 * rho * v_square) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}((cv[i] * - (1 - log_(T)) + + (1 - log(T)) + gas_constants[i] * - (1 + log_(u[i + 3])) - + (1 + log(u[i + 3])) - v_square / (2 * T)) for i in eachcomponent(equations)) @@ -691,7 +691,7 @@ end v_squared = v1^2 + v2^2 cons_rho = SVector{ncomponents(equations), real(equations)}(exp((w[i + 3] - cv[i] * - (1 - log_(T)) + + (1 - log(T)) + v_squared / (2 * T)) / gas_constants[i] - @@ -743,7 +743,7 @@ end total_entropy = zero(u[1]) for i in eachcomponent(equations) total_entropy -= u[i + 3] * - (cv[i] * log_(T) - gas_constants[i] * log_(u[i + 3])) + (cv[i] * log(T) - gas_constants[i] * log(u[i + 3])) end return total_entropy diff --git a/src/equations/compressible_euler_quasi_1d.jl b/src/equations/compressible_euler_quasi_1d.jl index 2d9e603f4b7..6844bf9bee5 100644 --- a/src/equations/compressible_euler_quasi_1d.jl +++ b/src/equations/compressible_euler_quasi_1d.jl @@ -277,13 +277,13 @@ end v1_ll = a_rho_v1_ll / a_rho_ll v_mag_ll = abs(v1_ll) p_ll = (equations.gamma - 1) * (e_ll - 0.5 * rho_ll * v_mag_ll^2) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) rho_rr = a_rho_rr / a_rr e_rr = a_e_rr / a_rr v1_rr = a_rho_v1_rr / a_rho_rr v_mag_rr = abs(v1_rr) p_rr = (equations.gamma - 1) * (e_rr - 0.5 * rho_rr * v_mag_rr^2) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) λ_max = max(v_mag_ll, v_mag_rr) + max(c_ll, c_rr) end @@ -294,7 +294,7 @@ end v1 = a_rho_v1 / a_rho e = a_e / a p = (equations.gamma - 1) * (e - 0.5 * rho * v1^2) - c = sqrt_(equations.gamma * p / rho) + c = sqrt(equations.gamma * p / rho) return (abs(v1) + c,) end diff --git a/src/equations/hyperbolic_diffusion_1d.jl b/src/equations/hyperbolic_diffusion_1d.jl index 869b49c7979..39a555e7c72 100644 --- a/src/equations/hyperbolic_diffusion_1d.jl +++ b/src/equations/hyperbolic_diffusion_1d.jl @@ -165,13 +165,13 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations1D) - λ_max = sqrt_(equations.nu * equations.inv_Tr) + λ_max = sqrt(equations.nu * equations.inv_Tr) end @inline have_constant_speed(::HyperbolicDiffusionEquations1D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations1D) - return sqrt_(eq.nu * eq.inv_Tr) + return sqrt(eq.nu * eq.inv_Tr) end # Convert conservative variables to primitive diff --git a/src/equations/hyperbolic_diffusion_2d.jl b/src/equations/hyperbolic_diffusion_2d.jl index 37fa89ce15d..511d1b8935d 100644 --- a/src/equations/hyperbolic_diffusion_2d.jl +++ b/src/equations/hyperbolic_diffusion_2d.jl @@ -162,12 +162,12 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations2D) - sqrt_(equations.nu * equations.inv_Tr) + sqrt(equations.nu * equations.inv_Tr) end @inline function max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations::HyperbolicDiffusionEquations2D) - sqrt_(equations.nu * equations.inv_Tr) * norm(normal_direction) + sqrt(equations.nu * equations.inv_Tr) * norm(normal_direction) end @inline function flux_godunov(u_ll, u_rr, orientation::Integer, @@ -180,7 +180,7 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = sqrt_(equations.nu * equations.inv_Tr) + λ_max = sqrt(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) if orientation == 1 # x-direction f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) @@ -203,10 +203,10 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = sqrt_(equations.nu * equations.inv_Tr) + λ_max = sqrt(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) * - sqrt_(normal_direction[1]^2 + normal_direction[2]^2) + sqrt(normal_direction[1]^2 + normal_direction[2]^2) f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) * normal_direction[1] f3 = 1 / 2 * (f_ll[3] + f_rr[3]) - @@ -218,7 +218,7 @@ end @inline have_constant_speed(::HyperbolicDiffusionEquations2D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations2D) - λ = sqrt_(eq.nu * eq.inv_Tr) + λ = sqrt(eq.nu * eq.inv_Tr) return λ, λ end diff --git a/src/equations/hyperbolic_diffusion_3d.jl b/src/equations/hyperbolic_diffusion_3d.jl index 1f8d2940e1d..ed807511b67 100644 --- a/src/equations/hyperbolic_diffusion_3d.jl +++ b/src/equations/hyperbolic_diffusion_3d.jl @@ -170,7 +170,7 @@ end # Calculate maximum wave speed for local Lax-Friedrichs-type dissipation @inline function max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations::HyperbolicDiffusionEquations3D) - λ_max = sqrt_(equations.nu * equations.inv_Tr) + λ_max = sqrt(equations.nu * equations.inv_Tr) end @inline function flux_godunov(u_ll, u_rr, orientation::Integer, @@ -183,7 +183,7 @@ end # this is an optimized version of the application of the upwind dissipation matrix: # dissipation = 0.5*R_n*|Λ|*inv(R_n)[[u]] - λ_max = sqrt_(equations.nu * equations.inv_Tr) + λ_max = sqrt(equations.nu * equations.inv_Tr) f1 = 1 / 2 * (f_ll[1] + f_rr[1]) - 1 / 2 * λ_max * (phi_rr - phi_ll) if orientation == 1 # x-direction f2 = 1 / 2 * (f_ll[2] + f_rr[2]) - 1 / 2 * λ_max * (q1_rr - q1_ll) @@ -205,7 +205,7 @@ end @inline have_constant_speed(::HyperbolicDiffusionEquations3D) = True() @inline function max_abs_speeds(eq::HyperbolicDiffusionEquations3D) - λ = sqrt_(eq.nu * eq.inv_Tr) + λ = sqrt(eq.nu * eq.inv_Tr) return λ, λ, λ end diff --git a/src/equations/ideal_glm_mhd_1d.jl b/src/equations/ideal_glm_mhd_1d.jl index cef2f5f8c49..053f3be3c51 100644 --- a/src/equations/ideal_glm_mhd_1d.jl +++ b/src/equations/ideal_glm_mhd_1d.jl @@ -88,7 +88,7 @@ function initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations # Set up polar coordinates inicenter = (0,) x_norm = x[1] - inicenter[1] - r = sqrt_(x_norm^2) + r = sqrt(x_norm^2) phi = atan(x_norm) # Calculate primitive variables @@ -518,7 +518,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) - s = log_(p) - equations.gamma * log_(rho) + s = log(p) - equations.gamma * log(rho) rho_p = rho / p w1 = (equations.gamma - s) / (equations.gamma - 1) - 0.5 * rho_p * v_square @@ -574,18 +574,18 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho v3 = rho_v3 / rho - v_mag = sqrt_(v1^2 + v2^2 + v3^2) + v_mag = sqrt(v1^2 + v2^2 + v3^2) p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = equations.gamma * p / rho - sqrt_rho = sqrt_(rho) - b1 = B1 / sqrt_rho - b2 = B2 / sqrt_rho - b3 = B3 / sqrt_rho + sqrtrho = sqrt(rho) + b1 = B1 / sqrtrho + b2 = B2 / sqrtrho + b3 = B3 / sqrtrho b_square = b1^2 + b2^2 + b3^2 - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end @@ -626,12 +626,12 @@ as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) - inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) - rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add - rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) + inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) + rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add + rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -646,18 +646,18 @@ as given by H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equations (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrt_rho_add^2 + inv_sqrtrho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - b_square_roe)) # acoustic speed # finally compute the average wave speed and set the output velocity # Ignore orientation since it is always "1" in 1D - c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_a_roe = B1_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) + c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) return v1_roe, c_f_roe end @@ -671,7 +671,7 @@ end 1 / 2 * (cons[6]^2 + cons[7]^2 + cons[8]^2)) # Thermodynamic entropy - s = log_(p) - equations.gamma * log_(cons[1]) + s = log(p) - equations.gamma * log(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index 563d1346031..90857a56429 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -98,7 +98,7 @@ function initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations inicenter = (0, 0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) # Calculate primitive variables @@ -676,8 +676,8 @@ end rho_mean = ln_mean(rho_ll, rho_rr) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` # in exact arithmetic since - # log_((ϱₗ/pₗ) / (ϱᵣ/pᵣ)) / (ϱₗ/pₗ - ϱᵣ/pᵣ) - # = pₗ pᵣ log_((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) + # log((ϱₗ/pₗ) / (ϱᵣ/pᵣ)) / (ϱₗ/pₗ - ϱᵣ/pᵣ) + # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) v1_avg = 0.5 * (v1_ll + v1_rr) v2_avg = 0.5 * (v2_ll + v2_rr) @@ -1046,7 +1046,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = log_(p) - equations.gamma * log_(rho) + s = log(p) - equations.gamma * log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1139,17 +1139,17 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = sqrt_(rho) - b1 = B1 / sqrt_rho - b2 = B2 / sqrt_rho - b3 = B3 / sqrt_rho + sqrtrho = sqrt(rho) + b1 = B1 / sqrtrho + b2 = B2 / sqrtrho + b3 = B3 / sqrtrho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end @@ -1164,18 +1164,18 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = sqrt_(rho) - b1 = B1 / sqrt_rho - b2 = B2 / sqrt_rho - b3 = B3 / sqrt_rho + sqrtrho = sqrt(rho) + b1 = B1 / sqrtrho + b2 = B2 / sqrtrho + b3 = B3 / sqrtrho b_square = b1 * b1 + b2 * b2 + b3 * b3 norm_squared = (normal_direction[1] * normal_direction[1] + normal_direction[2] * normal_direction[2]) b_dot_n_squared = (b1 * normal_direction[1] + b2 * normal_direction[2])^2 / norm_squared - c_f = sqrt_((0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + c_f = sqrt((0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * norm_squared) return c_f end @@ -1217,12 +1217,12 @@ as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) - inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) - rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add - rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) + inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) + rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add + rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -1237,25 +1237,25 @@ as given by H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equation (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrt_rho_add^2 + inv_sqrtrho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - b_square_roe)) # acoustic speed # finally compute the average wave speed and set the output velocity (depends on orientation) if orientation == 1 # x-direction - c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - + c_a_roe = B1_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe else # y-direction - c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - + c_a_roe = B2_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe end @@ -1289,12 +1289,12 @@ end p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) - inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) - rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add - rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) + inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) + rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add + rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -1309,9 +1309,9 @@ end H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equation (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrt_rho_add^2 + inv_sqrtrho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - @@ -1323,9 +1323,9 @@ end B_roe_dot_n_squared = (B1_roe * normal_direction[1] + B2_roe * normal_direction[2])^2 / norm_squared - c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) - c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) + c_a_roe = B_roe_dot_n_squared * inv_sqrtrho_prod # (squared) Alfvén wave speed + a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) + c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + v2_roe * normal_direction[2]) @@ -1343,7 +1343,7 @@ end 1 / 2 * cons[9]^2) # Thermodynamic entropy - s = log_(p) - equations.gamma * log_(cons[1]) + s = log(p) - equations.gamma * log(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index b914e6cec4b..00259743858 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -73,8 +73,8 @@ function initial_condition_convergence_test(x, t, equations::IdealGlmMhdEquation r = 2 # e: epsilon = 0.2 e = 0.2 - nx = 1 / sqrt_(r^2 + 1) - ny = r / sqrt_(r^2 + 1) + nx = 1 / sqrt(r^2 + 1) + ny = r / sqrt(r^2 + 1) sqr = 1 Va = omega / (ny * sqr) phi_alv = omega / ny * (nx * (x[1] - 0.5 * r) + ny * (x[2] - 0.5 * r)) - Va * t @@ -107,7 +107,7 @@ function initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] z_norm = x[3] - inicenter[3] - r = sqrt_(x_norm^2 + y_norm^2 + z_norm^2) + r = sqrt(x_norm^2 + y_norm^2 + z_norm^2) phi = atan(y_norm, x_norm) theta = iszero(r) ? 0.0 : acos(z_norm / r) @@ -967,7 +967,7 @@ end v_square = v1^2 + v2^2 + v3^2 p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = log_(p) - equations.gamma * log_(rho) + s = log(p) - equations.gamma * log(rho) rho_p = rho / p w1 = (equations.gamma - s) * equations.inv_gamma_minus_one - 0.5 * rho_p * v_square @@ -1032,20 +1032,20 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = sqrt_(rho) - b1 = B1 / sqrt_rho - b2 = B2 / sqrt_rho - b3 = B3 / sqrt_rho + sqrtrho = sqrt(rho) + b1 = B1 / sqrtrho + b2 = B2 / sqrtrho + b3 = B3 / sqrtrho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) elseif orientation == 2 # y-direction - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) else # z-direction - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b3^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b3^2)) end return c_f end @@ -1060,10 +1060,10 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrt_rho = sqrt_(rho) - b1 = B1 / sqrt_rho - b2 = B2 / sqrt_rho - b3 = B3 / sqrt_rho + sqrtrho = sqrt(rho) + b1 = B1 / sqrtrho + b2 = B2 / sqrtrho + b3 = B3 / sqrtrho b_square = b1 * b1 + b2 * b2 + b3 * b3 norm_squared = (normal_direction[1] * normal_direction[1] + normal_direction[2] * normal_direction[2] + @@ -1072,8 +1072,8 @@ end b2 * normal_direction[2] + b3 * normal_direction[3])^2 / norm_squared - c_f = sqrt_((0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + c_f = sqrt((0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * norm_squared) return c_f end @@ -1114,12 +1114,12 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) - inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) - rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add - rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) + inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) + rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add + rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -1134,31 +1134,31 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equation (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrt_rho_add^2 + inv_sqrtrho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - b_square_roe)) # acoustic speed # finally compute the average wave speed and set the output velocity (depends on orientation) if orientation == 1 # x-direction - c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - + c_a_roe = B1_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe elseif orientation == 2 # y-direction - c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - + c_a_roe = B2_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe else # z-direction - c_a_roe = B3_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - + c_a_roe = B3_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) - c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe)) + c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v3_roe end @@ -1192,12 +1192,12 @@ end p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrt_rho_ll = sqrt_(rho_ll) - sqrt_rho_rr = sqrt_(rho_rr) - inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) - inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) - rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add - rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add + sqrtrho_ll = sqrt(rho_ll) + sqrtrho_rr = sqrt(rho_rr) + inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) + inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) + rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add + rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -1212,9 +1212,9 @@ end H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equation (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrt_rho_add^2 + inv_sqrtrho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - @@ -1228,9 +1228,9 @@ end B2_roe * normal_direction[2] + B3_roe * normal_direction[3])^2 / norm_squared - c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed - a_star_roe = sqrt_((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) - c_f_roe = sqrt_(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) + c_a_roe = B_roe_dot_n_squared * inv_sqrtrho_prod # (squared) Alfvén wave speed + a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) + c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + v3_roe * normal_direction[3]) @@ -1249,7 +1249,7 @@ end 1 / 2 * cons[9]^2) # Thermodynamic entropy - s = log_(p) - equations.gamma * log_(cons[1]) + s = log(p) - equations.gamma * log(cons[1]) return s end diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index ffd2ca34a6c..38f681a1459 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -116,7 +116,7 @@ function initial_condition_weak_blast_wave(x, t, # Set up polar coordinates inicenter = (0) x_norm = x[1] - inicenter[1] - r = sqrt_(x_norm^2) + r = sqrt(x_norm^2) phi = atan(x_norm) # Calculate primitive variables @@ -306,8 +306,8 @@ Hindenlang (2019), extending [`flux_ranocha`](@ref) to the MHD equations. # Compute the necessary mean values needed for either direction # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` # in exact arithmetic since - # log_((ϱₗ/pₗ) / (ϱᵣ/pᵣ)) / (ϱₗ/pₗ - ϱᵣ/pᵣ) - # = pₗ pᵣ log_((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) + # log((ϱₗ/pₗ) / (ϱᵣ/pᵣ)) / (ϱₗ/pₗ - ϱᵣ/pᵣ) + # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) v1_avg = 0.5 * (v1_ll + v1_rr) v2_avg = 0.5 * (v2_ll + v2_rr) @@ -423,7 +423,7 @@ end v_square = v1^2 + v2^2 + v3^2 gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) - s = log_(p) - gamma * log_(rho) + s = log(p) - gamma * log(rho) rho_p = rho / p # Multicomponent stuff @@ -436,9 +436,9 @@ end T = (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2)) / (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(-1.0 * - (cv[i] * log_(T) - + (cv[i] * log(T) - gas_constants[i] * - log_(u[i + 7])) + + log(u[i + 7])) + gas_constants[i] + cv[i] - (v_square / (2 * T)) @@ -496,18 +496,18 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho v3 = rho_v3 / rho - v_mag = sqrt_(v1^2 + v2^2 + v3^2) + v_mag = sqrt(v1^2 + v2^2 + v3^2) gamma = totalgamma(cons, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = gamma * p / rho - sqrt_rho = sqrt_(rho) - b1 = B1 / sqrt_rho - b2 = B2 / sqrt_rho - b3 = B3 / sqrt_rho + sqrtrho = sqrt(rho) + b1 = B1 / sqrtrho + b2 = B2 / sqrtrho + b3 = B3 / sqrtrho b_square = b1^2 + b2^2 + b3^2 - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index e9f82d5d6a4..6acbb6760fd 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -125,7 +125,7 @@ function initial_condition_weak_blast_wave(x, t, inicenter = SVector(0.0, 0.0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) @@ -593,7 +593,7 @@ end gamma = totalgamma(u, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_square - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) - s = log_(p) - gamma * log_(rho) + s = log(p) - gamma * log(rho) rho_p = rho / p # Multicomponent stuff @@ -607,9 +607,9 @@ end (help1) entrop_rho = SVector{ncomponents(equations), real(equations)}(-1.0 * - (cv[i] * log_(T) - + (cv[i] * log(T) - gas_constants[i] * - log_(u[i + 8])) + + log(u[i + 8])) + gas_constants[i] + cv[i] - (v_square / (2 * T)) @@ -659,22 +659,22 @@ end v1 = rho_v1 / rho v2 = rho_v2 / rho v3 = rho_v3 / rho - v_mag = sqrt_(v1^2 + v2^2 + v3^2) + v_mag = sqrt(v1^2 + v2^2 + v3^2) gamma = totalgamma(cons, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) a_square = gamma * p / rho - sqrt_rho = sqrt_(rho) - b1 = B1 / sqrt_rho - b2 = B2 / sqrt_rho - b3 = B3 / sqrt_rho + sqrtrho = sqrt(rho) + b1 = B1 / sqrtrho + b2 = B2 / sqrtrho + b3 = B3 / sqrtrho b_square = b1^2 + b2^2 + b3^2 if direction == 1 # x-direction - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else - c_f = sqrt_(0.5 * (a_square + b_square) + - 0.5 * sqrt_((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + c_f = sqrt(0.5 * (a_square + b_square) + + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end diff --git a/src/equations/lattice_boltzmann_2d.jl b/src/equations/lattice_boltzmann_2d.jl index f2220c0c8e3..272dd897ce3 100644 --- a/src/equations/lattice_boltzmann_2d.jl +++ b/src/equations/lattice_boltzmann_2d.jl @@ -101,7 +101,7 @@ function LatticeBoltzmannEquations2D(; Ma, Re, collision_op = collision_bgk, # The relation between the isothermal speed of sound `c_s` and the mean thermal molecular velocity # `c` depends on the used phase space discretization, and is valid for D2Q9 (and others). For # details, see, e.g., [3] in the docstring above. - c_s = c / sqrt_(3) + c_s = c / sqrt(3) # Calculate missing quantities if isnothing(Ma) diff --git a/src/equations/lattice_boltzmann_3d.jl b/src/equations/lattice_boltzmann_3d.jl index 6a0b0726b36..d3eada15f56 100644 --- a/src/equations/lattice_boltzmann_3d.jl +++ b/src/equations/lattice_boltzmann_3d.jl @@ -141,7 +141,7 @@ function LatticeBoltzmannEquations3D(; Ma, Re, collision_op = collision_bgk, # The relation between the isothermal speed of sound `c_s` and the mean thermal molecular velocity # `c` depends on the used phase space discretization, and is valid for D3Q27 (and others). For # details, see, e.g., [3] in the docstring above. - c_s = c / sqrt_(3) + c_s = c / sqrt(3) # Calculate missing quantities if isnothing(Ma) diff --git a/src/equations/polytropic_euler_2d.jl b/src/equations/polytropic_euler_2d.jl index 4cbe939e946..f5d2f7b0bad 100644 --- a/src/equations/polytropic_euler_2d.jl +++ b/src/equations/polytropic_euler_2d.jl @@ -109,7 +109,7 @@ function initial_condition_weak_blast_wave(x, t, equations::PolytropicEulerEquat inicenter = (0, 0) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) # Calculate primitive variables @@ -241,8 +241,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - lambda_min = v_normal_ll - sqrt_(equations.gamma * p_ll / rho_ll) * norm_ - lambda_max = v_normal_rr + sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + lambda_min = v_normal_ll - sqrt(equations.gamma * p_ll / rho_ll) * norm_ + lambda_max = v_normal_rr + sqrt(equations.gamma * p_rr / rho_rr) * norm_ return lambda_min, lambda_max end @@ -256,8 +256,8 @@ end p_ll = equations.kappa * rho_ll^equations.gamma p_rr = equations.kappa * rho_rr^equations.gamma - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) + c_ll = sqrt(equations.gamma * p_ll / rho_ll) + c_rr = sqrt(equations.gamma * p_rr / rho_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -281,8 +281,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt_(equations.gamma * p_ll / rho_ll) * norm_ - c_rr = sqrt_(equations.gamma * p_rr / rho_rr) * norm_ + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -296,7 +296,7 @@ end @inline function max_abs_speeds(u, equations::PolytropicEulerEquations2D) rho, v1, v2 = cons2prim(u, equations) - c = sqrt_(equations.gamma * equations.kappa * rho^(equations.gamma - 1)) + c = sqrt(equations.gamma * equations.kappa * rho^(equations.gamma - 1)) return abs(v1) + c, abs(v2) + c end @@ -321,7 +321,7 @@ end p = pressure(u, equations) # Form of the internal energy depends on gas type if equations.gamma == 1.0 # isothermal gas - internal_energy = equations.kappa * log_(rho) + internal_energy = equations.kappa * log(rho) else # equations.gamma > 1 # polytropic gas internal_energy = equations.kappa * rho^(equations.gamma - 1) / (equations.gamma - 1.0) diff --git a/src/equations/shallow_water_1d.jl b/src/equations/shallow_water_1d.jl index 3798427c6d2..25ce0fa79fe 100644 --- a/src/equations/shallow_water_1d.jl +++ b/src/equations/shallow_water_1d.jl @@ -100,12 +100,12 @@ A smooth initial condition used for convergence tests in combination with function initial_condition_convergence_test(x, t, equations::ShallowWaterEquations1D) # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)] c = 7.0 - omega_x = 2.0 * pi * sqrt_(2.0) + omega_x = 2.0 * pi * sqrt(2.0) omega_t = 2.0 * pi H = c + cos(omega_x * x[1]) * cos(omega_t * t) v = 0.5 - b = 2.0 + 0.5 * sin(sqrt_(2.0) * pi * x[1]) + b = 2.0 + 0.5 * sin(sqrt(2.0) * pi * x[1]) return prim2cons(SVector(H, v, b), equations) end @@ -117,7 +117,7 @@ Source terms used for convergence tests in combination with (and [`BoundaryConditionDirichlet(initial_condition_convergence_test)`](@ref) in non-periodic domains). This manufactured solution source term is specifically designed for the bottom topography function -`b(x) = 2.0 + 0.5 * sin(sqrt_(2.0)*pi*x[1])` +`b(x) = 2.0 + 0.5 * sin(sqrt(2.0)*pi*x[1])` as defined in [`initial_condition_convergence_test`](@ref). """ @@ -126,9 +126,9 @@ as defined in [`initial_condition_convergence_test`](@ref). # Same settings as in `initial_condition_convergence_test`. Some derivative simplify because # this manufactured solution velocity is taken to be constant c = 7.0 - omega_x = 2.0 * pi * sqrt_(2.0) + omega_x = 2.0 * pi * sqrt(2.0) omega_t = 2.0 * pi - omega_b = sqrt_(2.0) * pi + omega_b = sqrt(2.0) * pi v = 0.5 sinX, cosX = sincos(omega_x * x[1]) @@ -141,7 +141,7 @@ as defined in [`initial_condition_convergence_test`](@ref). H_t = -omega_t * cosX * sinT # bottom topography and its spatial derivative - b = 2.0 + 0.5 * sin(sqrt_(2.0) * pi * x[1]) + b = 2.0 + 0.5 * sin(sqrt(2.0) * pi * x[1]) b_x = 0.5 * omega_b * cos(omega_b * x[1]) du1 = H_t + v * (H_x - b_x) @@ -593,8 +593,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = sqrt_(equations.gravity * h_ll) - c_rr = sqrt_(equations.gravity * h_rr) + c_ll = sqrt(equations.gravity * h_ll) + c_rr = sqrt(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -640,8 +640,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - λ_min = v_ll - sqrt_(equations.gravity * h_ll) - λ_max = v_rr + sqrt_(equations.gravity * h_rr) + λ_min = v_ll - sqrt(equations.gravity * h_ll) + λ_max = v_rr + sqrt(equations.gravity * h_rr) return λ_min, λ_max end @@ -670,8 +670,8 @@ Further details on this hydrostatic reconstruction and its motivation can be fou h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - a_ll = sqrt_(equations.gravity * h_ll) - a_rr = sqrt_(equations.gravity * h_rr) + a_ll = sqrt(equations.gravity * h_ll) + a_rr = sqrt(equations.gravity * h_rr) λ_min = min(v_ll - a_ll, v_rr - a_rr, zero(eltype(u_ll))) λ_max = max(v_ll + a_ll, v_rr + a_rr, zero(eltype(u_ll))) @@ -687,8 +687,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - c_ll = sqrt_(equations.gravity * h_ll) - c_rr = sqrt_(equations.gravity * h_rr) + c_ll = sqrt(equations.gravity * h_ll) + c_rr = sqrt(equations.gravity * h_rr) λ_min = min(v_ll - c_ll, v_rr - c_rr) λ_max = max(v_ll + c_ll, v_rr + c_rr) @@ -703,8 +703,8 @@ end h_rr = waterheight(u_rr, equations) v_rr = velocity(u_rr, equations) - c_ll = sqrt_(equations.gravity * h_ll) - c_rr = sqrt_(equations.gravity * h_rr) + c_ll = sqrt(equations.gravity * h_ll) + c_rr = sqrt(equations.gravity * h_rr) v_roe, c_roe = calc_wavespeed_roe(u_ll, u_rr, orientation, equations) @@ -718,7 +718,7 @@ end h = waterheight(u, equations) v = velocity(u, equations) - c = equations.gravity * sqrt_(h) + c = equations.gravity * sqrt(h) return (abs(v) + c,) end @@ -806,10 +806,10 @@ Or equation (9.17) in [this lecture notes](https://metaphor.ethz.ch/x/2019/hs/40 v_rr = velocity(u_rr, equations) h_roe = 0.5 * (h_ll + h_rr) - c_roe = sqrt_(equations.gravity * h_roe) + c_roe = sqrt(equations.gravity * h_roe) - h_ll_sqrt = sqrt_(h_ll) - h_rr_sqrt = sqrt_(h_rr) + h_ll_sqrt = sqrt(h_ll) + h_rr_sqrt = sqrt(h_rr) v_roe = (h_ll_sqrt * v_ll + h_rr_sqrt * v_rr) / (h_ll_sqrt + h_rr_sqrt) diff --git a/src/equations/shallow_water_2d.jl b/src/equations/shallow_water_2d.jl index 6fad3d142d1..6728d7d5553 100644 --- a/src/equations/shallow_water_2d.jl +++ b/src/equations/shallow_water_2d.jl @@ -102,7 +102,7 @@ A smooth initial condition used for convergence tests in combination with function initial_condition_convergence_test(x, t, equations::ShallowWaterEquations2D) # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)]^2 c = 7.0 - omega_x = 2.0 * pi * sqrt_(2.0) + omega_x = 2.0 * pi * sqrt(2.0) omega_t = 2.0 * pi x1, x2 = x @@ -110,7 +110,7 @@ function initial_condition_convergence_test(x, t, equations::ShallowWaterEquatio H = c + cos(omega_x * x1) * sin(omega_x * x2) * cos(omega_t * t) v1 = 0.5 v2 = 1.5 - b = 2.0 + 0.5 * sin(sqrt_(2.0) * pi * x1) + 0.5 * sin(sqrt_(2.0) * pi * x2) + b = 2.0 + 0.5 * sin(sqrt(2.0) * pi * x1) + 0.5 * sin(sqrt(2.0) * pi * x2) return prim2cons(SVector(H, v1, v2, b), equations) end @@ -122,7 +122,7 @@ Source terms used for convergence tests in combination with (and [`BoundaryConditionDirichlet(initial_condition_convergence_test)`](@ref) in non-periodic domains). This manufactured solution source term is specifically designed for the bottom topography function -`b(x,y) = 2 + 0.5 * sin(sqrt_(2)*pi*x) + 0.5 * sin(sqrt_(2)*pi*y)` +`b(x,y) = 2 + 0.5 * sin(sqrt(2)*pi*x) + 0.5 * sin(sqrt(2)*pi*y)` as defined in [`initial_condition_convergence_test`](@ref). """ @inline function source_terms_convergence_test(u, x, t, @@ -130,9 +130,9 @@ as defined in [`initial_condition_convergence_test`](@ref). # Same settings as in `initial_condition_convergence_test`. Some derivative simplify because # this manufactured solution velocities are taken to be constants c = 7.0 - omega_x = 2.0 * pi * sqrt_(2.0) + omega_x = 2.0 * pi * sqrt(2.0) omega_t = 2.0 * pi - omega_b = sqrt_(2.0) * pi + omega_b = sqrt(2.0) * pi v1 = 0.5 v2 = 1.5 @@ -150,7 +150,7 @@ as defined in [`initial_condition_convergence_test`](@ref). H_t = -omega_t * cosX * sinY * sinT # bottom topography and its gradient - b = 2.0 + 0.5 * sin(sqrt_(2.0) * pi * x1) + 0.5 * sin(sqrt_(2.0) * pi * x2) + b = 2.0 + 0.5 * sin(sqrt(2.0) * pi * x1) + 0.5 * sin(sqrt(2.0) * pi * x2) tmp1 = 0.5 * omega_b b_x = tmp1 * cos(omega_b * x1) b_y = tmp1 * cos(omega_b * x2) @@ -172,7 +172,7 @@ function initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquation inicenter = SVector(0.7, 0.7) x_norm = x[1] - inicenter[1] y_norm = x[2] - inicenter[2] - r = sqrt_(x_norm^2 + y_norm^2) + r = sqrt(x_norm^2 + y_norm^2) phi = atan(y_norm, x_norm) sin_phi, cos_phi = sincos(phi) @@ -926,8 +926,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = sqrt_(equations.gravity * h_ll) - c_rr = sqrt_(equations.gravity * h_rr) + c_ll = sqrt(equations.gravity * h_ll) + c_rr = sqrt(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -943,8 +943,8 @@ end # Compute the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = sqrt_(equations.gravity * h_ll) - c_rr = sqrt_(equations.gravity * h_rr) + c_ll = sqrt(equations.gravity * h_ll) + c_rr = sqrt(equations.gravity * h_rr) # The normal velocities are already scaled by the norm return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) @@ -992,11 +992,11 @@ end v1_rr, v2_rr = velocity(u_rr, equations) if orientation == 1 # x-direction - λ_min = v1_ll - sqrt_(equations.gravity * h_ll) - λ_max = v1_rr + sqrt_(equations.gravity * h_rr) + λ_min = v1_ll - sqrt(equations.gravity * h_ll) + λ_max = v1_rr + sqrt(equations.gravity * h_rr) else # y-direction - λ_min = v2_ll - sqrt_(equations.gravity * h_ll) - λ_max = v2_rr + sqrt_(equations.gravity * h_rr) + λ_min = v2_ll - sqrt(equations.gravity * h_ll) + λ_max = v2_rr + sqrt(equations.gravity * h_rr) end return λ_min, λ_max @@ -1014,8 +1014,8 @@ end norm_ = norm(normal_direction) # The v_normals are already scaled by the norm - λ_min = v_normal_ll - sqrt_(equations.gravity * h_ll) * norm_ - λ_max = v_normal_rr + sqrt_(equations.gravity * h_rr) * norm_ + λ_min = v_normal_ll - sqrt(equations.gravity * h_ll) * norm_ + λ_max = v_normal_rr + sqrt(equations.gravity * h_rr) * norm_ return λ_min, λ_max end @@ -1046,8 +1046,8 @@ the reference below. The definition of the wave speeds are given in Equation (2. h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - a_ll = sqrt_(equations.gravity * h_ll) - a_rr = sqrt_(equations.gravity * h_rr) + a_ll = sqrt(equations.gravity * h_ll) + a_rr = sqrt(equations.gravity * h_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - a_ll, v1_rr - a_rr, zero(eltype(u_ll))) @@ -1072,8 +1072,8 @@ end norm_ = norm(normal_direction) - a_ll = sqrt_(equations.gravity * h_ll) * norm_ - a_rr = sqrt_(equations.gravity * h_rr) * norm_ + a_ll = sqrt(equations.gravity * h_ll) * norm_ + a_rr = sqrt(equations.gravity * h_rr) * norm_ λ_min = min(v_normal_ll - a_ll, v_normal_rr - a_rr, zero(eltype(u_ll))) λ_max = max(v_normal_ll + a_ll, v_normal_rr + a_rr, zero(eltype(u_ll))) @@ -1089,8 +1089,8 @@ end h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - c_ll = sqrt_(equations.gravity * h_ll) - c_rr = sqrt_(equations.gravity * h_rr) + c_ll = sqrt(equations.gravity * h_ll) + c_rr = sqrt(equations.gravity * h_rr) if orientation == 1 # x-direction λ_min = min(v1_ll - c_ll, v1_rr - c_rr) @@ -1111,8 +1111,8 @@ end v1_rr, v2_rr = velocity(u_rr, equations) norm_ = norm(normal_direction) - c_ll = sqrt_(equations.gravity * h_ll) * norm_ - c_rr = sqrt_(equations.gravity * h_rr) * norm_ + c_ll = sqrt(equations.gravity * h_ll) * norm_ + c_rr = sqrt(equations.gravity * h_rr) * norm_ v_normal_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] v_normal_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] @@ -1131,8 +1131,8 @@ end h_rr = waterheight(u_rr, equations) v1_rr, v2_rr = velocity(u_rr, equations) - c_ll = sqrt_(equations.gravity * h_ll) - c_rr = sqrt_(equations.gravity * h_rr) + c_ll = sqrt(equations.gravity * h_ll) + c_rr = sqrt(equations.gravity * h_rr) if orientation == 1 # x-direction v_roe, c_roe = calc_wavespeed_roe(u_ll, u_rr, orientation, equations) @@ -1156,8 +1156,8 @@ end norm_ = norm(normal_direction) - c_ll = sqrt_(equations.gravity * h_ll) * norm_ - c_rr = sqrt_(equations.gravity * h_rr) * norm_ + c_ll = sqrt(equations.gravity * h_ll) * norm_ + c_rr = sqrt(equations.gravity * h_rr) * norm_ v_normal_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2]) v_normal_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2]) @@ -1173,7 +1173,7 @@ end h = waterheight(u, equations) v1, v2 = velocity(u, equations) - c = equations.gravity * sqrt_(h) + c = equations.gravity * sqrt(h) return abs(v1) + c, abs(v2) + c end @@ -1264,10 +1264,10 @@ slides 8 and 9. v1_rr, v2_rr = velocity(u_rr, equations) h_roe = 0.5 * (h_ll + h_rr) - c_roe = sqrt_(equations.gravity * h_roe) + c_roe = sqrt(equations.gravity * h_roe) - h_ll_sqrt = sqrt_(h_ll) - h_rr_sqrt = sqrt_(h_rr) + h_ll_sqrt = sqrt(h_ll) + h_rr_sqrt = sqrt(h_rr) if orientation == 1 # x-direction v_roe = (h_ll_sqrt * v1_ll + h_rr_sqrt * v1_rr) / (h_ll_sqrt + h_rr_sqrt) @@ -1288,10 +1288,10 @@ end norm_ = norm(normal_direction) h_roe = 0.5 * (h_ll + h_rr) - c_roe = sqrt_(equations.gravity * h_roe) * norm_ + c_roe = sqrt(equations.gravity * h_roe) * norm_ - h_ll_sqrt = sqrt_(h_ll) - h_rr_sqrt = sqrt_(h_rr) + h_ll_sqrt = sqrt(h_ll) + h_rr_sqrt = sqrt(h_rr) v1_roe = (h_ll_sqrt * v1_ll + h_rr_sqrt * v1_rr) / (h_ll_sqrt + h_rr_sqrt) v2_roe = (h_ll_sqrt * v2_ll + h_rr_sqrt * v2_rr) / (h_ll_sqrt + h_rr_sqrt) diff --git a/src/equations/shallow_water_quasi_1d.jl b/src/equations/shallow_water_quasi_1d.jl index 9d37c52522b..d52fbab841d 100644 --- a/src/equations/shallow_water_quasi_1d.jl +++ b/src/equations/shallow_water_quasi_1d.jl @@ -95,7 +95,7 @@ function initial_condition_convergence_test(x, t, equations::ShallowWaterEquationsQuasi1D) # generates a manufactured solution. # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)] - Omega = sqrt_(2) * pi + Omega = sqrt(2) * pi H = 2.0 + 0.5 * sin(Omega * x[1] - t) v = 0.25 b = 0.2 - 0.05 * sin(Omega * x[1]) @@ -118,7 +118,7 @@ as defined in [`initial_condition_convergence_test`](@ref). equations::ShallowWaterEquationsQuasi1D) # Same settings as in `initial_condition_convergence_test`. Some derivative simplify because # this manufactured solution velocity is taken to be constant - Omega = sqrt_(2) * pi + Omega = sqrt(2) * pi H = 2.0 + 0.5 * sin(Omega * x[1] - t) H_x = 0.5 * cos(Omega * x[1] - t) * Omega H_t = -0.5 * cos(Omega * x[1] - t) @@ -250,8 +250,8 @@ end # Calculate the wave celerity on the left and right h_ll = waterheight(u_ll, equations) h_rr = waterheight(u_rr, equations) - c_ll = sqrt_(equations.gravity * h_ll) - c_rr = sqrt_(equations.gravity * h_rr) + c_ll = sqrt(equations.gravity * h_ll) + c_rr = sqrt(equations.gravity * h_rr) return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) end @@ -271,7 +271,7 @@ end h = waterheight(u, equations) v = velocity(u, equations) - c = equations.gravity * sqrt_(h) + c = equations.gravity * sqrt(h) return (abs(v) + c,) end diff --git a/src/equations/shallow_water_two_layer_1d.jl b/src/equations/shallow_water_two_layer_1d.jl index e030128bce1..42ff393593e 100644 --- a/src/equations/shallow_water_two_layer_1d.jl +++ b/src/equations/shallow_water_two_layer_1d.jl @@ -109,7 +109,7 @@ A smooth initial condition used for convergence tests in combination with function initial_condition_convergence_test(x, t, equations::ShallowWaterTwoLayerEquations1D) # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)] - ω = 2.0 * pi * sqrt_(2.0) + ω = 2.0 * pi * sqrt(2.0) H_lower = 2.0 + 0.1 * sin(ω * x[1] + t) H_upper = 4.0 + 0.1 * cos(ω * x[1] + t) @@ -132,7 +132,7 @@ in non-periodic domains). equations::ShallowWaterTwoLayerEquations1D) # Same settings as in `initial_condition_convergence_test`. Some derivative simplify because # this manufactured solution velocity is taken to be constant - ω = 2 * pi * sqrt_(2.0) + ω = 2 * pi * sqrt(2.0) du1 = (-0.1 * cos(t + ω * x[1]) - 0.1 * sin(t + ω * x[1]) - 0.09 * ω * cos(t + ω * x[1]) + @@ -393,8 +393,8 @@ end # Calculate the wave celerity on the left and right h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = sqrt_(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = sqrt_(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) return (max(abs(v_m_ll) + c_ll, abs(v_m_rr) + c_rr)) end @@ -416,7 +416,7 @@ end # Calculate averaged velocity of both layers v_m = (h_v_upper + h_v_lower) / (h_upper + h_lower) - c = sqrt_(equations.gravity * (h_upper + h_lower)) + c = sqrt(equations.gravity * (h_upper + h_lower)) return (abs(v_m) + c) end diff --git a/src/equations/shallow_water_two_layer_2d.jl b/src/equations/shallow_water_two_layer_2d.jl index f339cfd2a43..a31d881f2ef 100644 --- a/src/equations/shallow_water_two_layer_2d.jl +++ b/src/equations/shallow_water_two_layer_2d.jl @@ -121,7 +121,7 @@ A smooth initial condition used for convergence tests in combination with function initial_condition_convergence_test(x, t, equations::ShallowWaterTwoLayerEquations2D) # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)]^2] - ω = 2.0 * pi * sqrt_(2.0) + ω = 2.0 * pi * sqrt(2.0) H_lower = 2.0 + 0.1 * sin(ω * x[1] + t) * cos(ω * x[2] + t) H_upper = 4.0 + 0.1 * cos(ω * x[1] + t) * sin(ω * x[2] + t) @@ -144,8 +144,8 @@ Source terms used for convergence tests in combination with @inline function source_terms_convergence_test(u, x, t, equations::ShallowWaterTwoLayerEquations2D) # Same settings as in `initial_condition_convergence_test`. - # some constants are chosen such that the function is periodic on the domain [0,sqrt_(2)]^2] - ω = 2.0 * pi * sqrt_(2.0) + # some constants are chosen such that the function is periodic on the domain [0,sqrt(2)]^2] + ω = 2.0 * pi * sqrt(2.0) # Source terms obtained with SymPy du1 = 0.01 * ω * cos(t + ω * x[1]) * cos(t + ω * x[2]) + @@ -628,8 +628,8 @@ end h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = sqrt_(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = sqrt_(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) return (max(abs(v_m_ll), abs(v_m_rr)) + max(c_ll, c_rr)) end @@ -664,8 +664,8 @@ end h_upper_ll, h_lower_ll = waterheight(u_ll, equations) h_upper_rr, h_lower_rr = waterheight(u_rr, equations) - c_ll = sqrt_(equations.gravity * (h_upper_ll + h_lower_ll)) - c_rr = sqrt_(equations.gravity * (h_upper_rr + h_lower_rr)) + c_ll = sqrt(equations.gravity * (h_upper_ll + h_lower_ll)) + c_rr = sqrt(equations.gravity * (h_upper_rr + h_lower_rr)) # The normal velocities are already scaled by the norm return max(abs(v_m_ll), abs(v_m_rr)) + max(c_ll, c_rr) * norm(normal_direction) @@ -693,7 +693,7 @@ end h_upper, h_lower = waterheight(u, equations) v1_upper, v2_upper, v1_lower, v2_lower = velocity(u, equations) - c = sqrt_(equations.gravity * (h_upper + h_lower)) + c = sqrt(equations.gravity * (h_upper + h_lower)) return (max(abs(v1_m) + c, abs(v1_upper), abs(v1_lower)), max(abs(v2_m) + c, abs(v2_upper), abs(v2_lower))) end diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index 772633c2243..60db285e04f 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -1217,7 +1217,7 @@ function cubed_sphere_mapping(xi, eta, zeta, inner_radius, thickness, direction) SVector(x, y, 1)) # Radius on cube surface - r = sqrt_(1 + x^2 + y^2) + r = sqrt(1 + x^2 + y^2) # Radius of the sphere R = inner_radius + thickness * (0.5 * (zeta + 1)) diff --git a/src/semidiscretization/semidiscretization.jl b/src/semidiscretization/semidiscretization.jl index cf7f5a7d873..8518cf27fd3 100644 --- a/src/semidiscretization/semidiscretization.jl +++ b/src/semidiscretization/semidiscretization.jl @@ -206,7 +206,7 @@ function jacobian_fd(semi::AbstractSemidiscretization; # use second order finite difference to estimate Jacobian matrix for idx in eachindex(u0_ode) # determine size of fluctuation - epsilon = sqrt_(eps(u0_ode[idx])) + epsilon = sqrt(eps(u0_ode[idx])) # plus fluctuation u_ode[idx] = u0_ode[idx] + epsilon diff --git a/src/solvers/dgmulti/shock_capturing.jl b/src/solvers/dgmulti/shock_capturing.jl index 63589d0a5a9..d224e5ed03d 100644 --- a/src/solvers/dgmulti/shock_capturing.jl +++ b/src/solvers/dgmulti/shock_capturing.jl @@ -68,7 +68,7 @@ function (indicator_hg::IndicatorHennemannGassner)(u, mesh::DGMultiMesh, # magic parameters threshold = 0.5 * 10^(-1.8 * (dg.basis.N + 1)^0.25) - parameter_s = log_((1 - 0.0001) / 0.0001) + parameter_s = log((1 - 0.0001) / 0.0001) @threaded for element in eachelement(mesh, dg) indicator = indicator_threaded[Threads.threadid()] diff --git a/src/solvers/dgsem/basis_lobatto_legendre.jl b/src/solvers/dgsem/basis_lobatto_legendre.jl index e350190bce6..6a92fd1c066 100644 --- a/src/solvers/dgsem/basis_lobatto_legendre.jl +++ b/src/solvers/dgsem/basis_lobatto_legendre.jl @@ -625,7 +625,7 @@ function gauss_nodes_weights(n_nodes::Integer) weights .= 2.0 return nodes, weights elseif N == 1 - nodes[1] = -sqrt_(1 / 3) + nodes[1] = -sqrt(1 / 3) nodes[end] = -nodes[1] weights .= 1.0 return nodes, weights @@ -692,8 +692,8 @@ function legendre_polynomial_and_derivative(N::Int, x::Real) end # Normalize - poly = poly * sqrt_(N + 0.5) - deriv = deriv * sqrt_(N + 0.5) + poly = poly * sqrt(N + 0.5) + deriv = deriv * sqrt(N + 0.5) return poly, deriv end diff --git a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl index 43f70da4750..b0804b6499c 100644 --- a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl @@ -310,15 +310,15 @@ end v1_ll = u_prim_permuted[j, i, 2] v2_ll = u_prim_permuted[j, i, 3] p_ll = u_prim_permuted[j, i, 4] - log_rho_ll = u_prim_permuted[j, i, 5] - log_p_ll = u_prim_permuted[j, i, 6] + logrho_ll = u_prim_permuted[j, i, 5] + logp_ll = u_prim_permuted[j, i, 6] rho_rr = u_prim_permuted[j, ii, 1] v1_rr = u_prim_permuted[j, ii, 2] v2_rr = u_prim_permuted[j, ii, 3] p_rr = u_prim_permuted[j, ii, 4] - log_rho_rr = u_prim_permuted[j, ii, 5] - log_p_rr = u_prim_permuted[j, ii, 6] + logrho_rr = u_prim_permuted[j, ii, 5] + logp_rr = u_prim_permuted[j, ii, 6] normal_direction_1 = 0.5 * (contravariant_vectors_x[j, i, 1] + contravariant_vectors_x[j, ii, 1]) @@ -333,14 +333,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -349,14 +349,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -414,15 +414,15 @@ end v1_ll = u_prim[i, j, 2] v2_ll = u_prim[i, j, 3] p_ll = u_prim[i, j, 4] - log_rho_ll = u_prim[i, j, 5] - log_p_ll = u_prim[i, j, 6] + logrho_ll = u_prim[i, j, 5] + logp_ll = u_prim[i, j, 6] rho_rr = u_prim[i, jj, 1] v1_rr = u_prim[i, jj, 2] v2_rr = u_prim[i, jj, 3] p_rr = u_prim[i, jj, 4] - log_rho_rr = u_prim[i, jj, 5] - log_p_rr = u_prim[i, jj, 6] + logrho_rr = u_prim[i, jj, 5] + logp_rr = u_prim[i, jj, 6] normal_direction_1 = 0.5 * (contravariant_vectors_y[i, j, 1] + contravariant_vectors_y[i, jj, 1]) @@ -437,14 +437,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -453,14 +453,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) diff --git a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl index 64a3456b940..3812442f945 100644 --- a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl @@ -444,16 +444,16 @@ end v2_ll = u_prim_permuted[jk, i, 3] v3_ll = u_prim_permuted[jk, i, 4] p_ll = u_prim_permuted[jk, i, 5] - log_rho_ll = u_prim_permuted[jk, i, 6] - log_p_ll = u_prim_permuted[jk, i, 7] + logrho_ll = u_prim_permuted[jk, i, 6] + logp_ll = u_prim_permuted[jk, i, 7] rho_rr = u_prim_permuted[jk, ii, 1] v1_rr = u_prim_permuted[jk, ii, 2] v2_rr = u_prim_permuted[jk, ii, 3] v3_rr = u_prim_permuted[jk, ii, 4] p_rr = u_prim_permuted[jk, ii, 5] - log_rho_rr = u_prim_permuted[jk, ii, 6] - log_p_rr = u_prim_permuted[jk, ii, 7] + logrho_rr = u_prim_permuted[jk, ii, 6] + logp_rr = u_prim_permuted[jk, ii, 7] normal_direction_1 = 0.5 * (contravariant_vectors_x[jk, i, 1] + contravariant_vectors_x[jk, ii, 1]) @@ -472,14 +472,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -488,14 +488,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -564,16 +564,16 @@ end v2_ll = u_prim[i, j, k, 3] v3_ll = u_prim[i, j, k, 4] p_ll = u_prim[i, j, k, 5] - log_rho_ll = u_prim[i, j, k, 6] - log_p_ll = u_prim[i, j, k, 7] + logrho_ll = u_prim[i, j, k, 6] + logp_ll = u_prim[i, j, k, 7] rho_rr = u_prim[i, jj, k, 1] v1_rr = u_prim[i, jj, k, 2] v2_rr = u_prim[i, jj, k, 3] v3_rr = u_prim[i, jj, k, 4] p_rr = u_prim[i, jj, k, 5] - log_rho_rr = u_prim[i, jj, k, 6] - log_p_rr = u_prim[i, jj, k, 7] + logrho_rr = u_prim[i, jj, k, 6] + logp_rr = u_prim[i, jj, k, 7] normal_direction_1 = 0.5 * (contravariant_vectors_y[i, j, k, 1] + contravariant_vectors_y[i, jj, k, 1]) @@ -592,14 +592,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -608,14 +608,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -686,16 +686,16 @@ end v2_ll = u_prim_reshaped[ij, k, 3] v3_ll = u_prim_reshaped[ij, k, 4] p_ll = u_prim_reshaped[ij, k, 5] - log_rho_ll = u_prim_reshaped[ij, k, 6] - log_p_ll = u_prim_reshaped[ij, k, 7] + logrho_ll = u_prim_reshaped[ij, k, 6] + logp_ll = u_prim_reshaped[ij, k, 7] rho_rr = u_prim_reshaped[ij, kk, 1] v1_rr = u_prim_reshaped[ij, kk, 2] v2_rr = u_prim_reshaped[ij, kk, 3] v3_rr = u_prim_reshaped[ij, kk, 4] p_rr = u_prim_reshaped[ij, kk, 5] - log_rho_rr = u_prim_reshaped[ij, kk, 6] - log_p_rr = u_prim_reshaped[ij, kk, 7] + logrho_rr = u_prim_reshaped[ij, kk, 6] + logp_rr = u_prim_reshaped[ij, kk, 7] normal_direction_1 = 0.5 * (contravariant_vectors_z[ij, k, 1] + contravariant_vectors_z[ij, kk, 1]) @@ -714,14 +714,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -730,14 +730,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) diff --git a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl index 50b1e8cb5b4..f0261975fb5 100644 --- a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl @@ -298,29 +298,29 @@ end v1_ll = u_prim_permuted[j, i, 2] v2_ll = u_prim_permuted[j, i, 3] p_ll = u_prim_permuted[j, i, 4] - log_rho_ll = u_prim_permuted[j, i, 5] - log_p_ll = u_prim_permuted[j, i, 6] + logrho_ll = u_prim_permuted[j, i, 5] + logp_ll = u_prim_permuted[j, i, 6] rho_rr = u_prim_permuted[j, ii, 1] v1_rr = u_prim_permuted[j, ii, 2] v2_rr = u_prim_permuted[j, ii, 3] p_rr = u_prim_permuted[j, ii, 4] - log_rho_rr = u_prim_permuted[j, ii, 5] - log_p_rr = u_prim_permuted[j, ii, 6] + logrho_rr = u_prim_permuted[j, ii, 5] + logp_rr = u_prim_permuted[j, ii, 6] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -329,14 +329,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -382,29 +382,29 @@ end v1_ll = u_prim[i, j, 2] v2_ll = u_prim[i, j, 3] p_ll = u_prim[i, j, 4] - log_rho_ll = u_prim[i, j, 5] - log_p_ll = u_prim[i, j, 6] + logrho_ll = u_prim[i, j, 5] + logp_ll = u_prim[i, j, 6] rho_rr = u_prim[i, jj, 1] v1_rr = u_prim[i, jj, 2] v2_rr = u_prim[i, jj, 3] p_rr = u_prim[i, jj, 4] - log_rho_rr = u_prim[i, jj, 5] - log_p_rr = u_prim[i, jj, 6] + logrho_rr = u_prim[i, jj, 5] + logp_rr = u_prim[i, jj, 6] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -413,14 +413,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) diff --git a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl index ec3647ed649..0c5c20b2faf 100644 --- a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl @@ -342,30 +342,30 @@ end v2_ll = u_prim_permuted[jk, i, 3] v3_ll = u_prim_permuted[jk, i, 4] p_ll = u_prim_permuted[jk, i, 5] - log_rho_ll = u_prim_permuted[jk, i, 6] - log_p_ll = u_prim_permuted[jk, i, 7] + logrho_ll = u_prim_permuted[jk, i, 6] + logp_ll = u_prim_permuted[jk, i, 7] rho_rr = u_prim_permuted[jk, ii, 1] v1_rr = u_prim_permuted[jk, ii, 2] v2_rr = u_prim_permuted[jk, ii, 3] v3_rr = u_prim_permuted[jk, ii, 4] p_rr = u_prim_permuted[jk, ii, 5] - log_rho_rr = u_prim_permuted[jk, ii, 6] - log_p_rr = u_prim_permuted[jk, ii, 7] + logrho_rr = u_prim_permuted[jk, ii, 6] + logp_rr = u_prim_permuted[jk, ii, 7] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -374,14 +374,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -436,30 +436,30 @@ end v2_ll = u_prim[i, j, k, 3] v3_ll = u_prim[i, j, k, 4] p_ll = u_prim[i, j, k, 5] - log_rho_ll = u_prim[i, j, k, 6] - log_p_ll = u_prim[i, j, k, 7] + logrho_ll = u_prim[i, j, k, 6] + logp_ll = u_prim[i, j, k, 7] rho_rr = u_prim[i, jj, k, 1] v1_rr = u_prim[i, jj, k, 2] v2_rr = u_prim[i, jj, k, 3] v3_rr = u_prim[i, jj, k, 4] p_rr = u_prim[i, jj, k, 5] - log_rho_rr = u_prim[i, jj, k, 6] - log_p_rr = u_prim[i, jj, k, 7] + logrho_rr = u_prim[i, jj, k, 6] + logp_rr = u_prim[i, jj, k, 7] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -468,14 +468,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -529,30 +529,30 @@ end v2_ll = u_prim_reshaped[ij, k, 3] v3_ll = u_prim_reshaped[ij, k, 4] p_ll = u_prim_reshaped[ij, k, 5] - log_rho_ll = u_prim_reshaped[ij, k, 6] - log_p_ll = u_prim_reshaped[ij, k, 7] + logrho_ll = u_prim_reshaped[ij, k, 6] + logp_ll = u_prim_reshaped[ij, k, 7] rho_rr = u_prim_reshaped[ij, kk, 1] v1_rr = u_prim_reshaped[ij, kk, 2] v2_rr = u_prim_reshaped[ij, kk, 3] v3_rr = u_prim_reshaped[ij, kk, 4] p_rr = u_prim_reshaped[ij, kk, 5] - log_rho_rr = u_prim_reshaped[ij, kk, 6] - log_p_rr = u_prim_reshaped[ij, kk, 7] + logrho_rr = u_prim_reshaped[ij, kk, 6] + logp_rr = u_prim_reshaped[ij, kk, 7] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - log_x1 = log_rho_ll + logx1 = logrho_ll y1 = rho_rr - log_y1 = log_rho_rr + logy1 = logrho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (log_y1 - log_x1) + regular_path1 = y1_minus_x1 / (logy1 - logx1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -561,14 +561,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - log_x2 = log_rho_ll + log_p_rr + logx2 = logrho_ll + logp_rr y2 = rho_rr * p_ll - log_y2 = log_rho_rr + log_p_ll + logy2 = logrho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (log_y2 - log_x2) / y2_minus_x2 + regular_path2 = (logy2 - logx2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) diff --git a/src/solvers/dgsem_tree/indicators.jl b/src/solvers/dgsem_tree/indicators.jl index 7644e87cfc1..bb9109f2762 100644 --- a/src/solvers/dgsem_tree/indicators.jl +++ b/src/solvers/dgsem_tree/indicators.jl @@ -191,7 +191,7 @@ function (indicator_hg::IndicatorHennemannGassner)(u, mesh, equations, dg::DGSEM # magic parameters threshold = 0.5 * 10^(-1.8 * (nnodes(dg))^0.25) - parameter_s = log_((1 - 0.0001) / 0.0001) + parameter_s = log((1 - 0.0001) / 0.0001) @threaded for element in eachelement(dg, cache) # This is dispatched by mesh dimension. diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index 66d38ee33ce..dff87bfe06c 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -47,7 +47,7 @@ function (indicator_hg::IndicatorHennemannGassnerShallowWater)(u::AbstractArray{ # magic parameters threshold = 0.5 * 10^(-1.8 * (nnodes(dg))^0.25) - parameter_s = log_((1 - 0.0001) / 0.0001) + parameter_s = log((1 - 0.0001) / 0.0001) # If the water height `h` at one LGL node is lower than `threshold_partially_wet` # the indicator sets the element-wise blending factor alpha[element] = 1 diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index b7a712153cd..fa8ed481eb9 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -51,7 +51,7 @@ function (indicator_hg::IndicatorHennemannGassnerShallowWater)(u::AbstractArray{ # magic parameters threshold = 0.5 * 10^(-1.8 * (nnodes(dg))^0.25) - parameter_s = log_((1 - 0.0001) / 0.0001) + parameter_s = log((1 - 0.0001) / 0.0001) # If the water height `h` at one LGL node is lower than `threshold_partially_wet` # the indicator sets the element-wise blending factor alpha[element] = 1 diff --git a/src/solvers/dgsem_unstructured/containers_2d.jl b/src/solvers/dgsem_unstructured/containers_2d.jl index 8b1cebfcc0d..f51dd09801b 100644 --- a/src/solvers/dgsem_unstructured/containers_2d.jl +++ b/src/solvers/dgsem_unstructured/containers_2d.jl @@ -224,19 +224,19 @@ function init_interfaces!(interfaces, edge_information, boundary_names, n_elemen # structured mesh where the element local surface numbering is right-handed if boundary_names[primary_side, primary_element] === :Bottom secondary_element = primary_element + - (n_elements - convert(Int, sqrt_(n_elements))) + (n_elements - convert(Int, sqrt(n_elements))) secondary_side = 3 elseif boundary_names[primary_side, primary_element] === :Top secondary_element = primary_element - - (n_elements - convert(Int, sqrt_(n_elements))) + (n_elements - convert(Int, sqrt(n_elements))) secondary_side = 1 elseif boundary_names[primary_side, primary_element] === :Left secondary_element = primary_element + - (convert(Int, sqrt_(n_elements)) - 1) + (convert(Int, sqrt(n_elements)) - 1) secondary_side = 2 elseif boundary_names[primary_side, primary_element] === :Right secondary_element = primary_element - - (convert(Int, sqrt_(n_elements)) - 1) + (convert(Int, sqrt(n_elements)) - 1) secondary_side = 4 end interfaces.element_ids[1, j] = primary_element diff --git a/src/solvers/fdsbp_tree/fdsbp_1d.jl b/src/solvers/fdsbp_tree/fdsbp_1d.jl index f334e8af6d3..0de0cff4851 100644 --- a/src/solvers/fdsbp_tree/fdsbp_1d.jl +++ b/src/solvers/fdsbp_tree/fdsbp_1d.jl @@ -319,7 +319,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt_(l2_error / total_volume_) + l2_error = @. sqrt(l2_error / total_volume_) return l2_error, linf_error end diff --git a/src/solvers/fdsbp_tree/fdsbp_2d.jl b/src/solvers/fdsbp_tree/fdsbp_2d.jl index 6a92458fd9b..09d18cecd75 100644 --- a/src/solvers/fdsbp_tree/fdsbp_2d.jl +++ b/src/solvers/fdsbp_tree/fdsbp_2d.jl @@ -374,7 +374,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt_(l2_error / total_volume_) + l2_error = @. sqrt(l2_error / total_volume_) return l2_error, linf_error end diff --git a/src/solvers/fdsbp_tree/fdsbp_3d.jl b/src/solvers/fdsbp_tree/fdsbp_3d.jl index d7f39ffa7c0..0c3f18b6d6e 100644 --- a/src/solvers/fdsbp_tree/fdsbp_3d.jl +++ b/src/solvers/fdsbp_tree/fdsbp_3d.jl @@ -427,7 +427,7 @@ function calc_error_norms(func, u, t, analyzer, # For L2 error, divide by total volume total_volume_ = total_volume(mesh) - l2_error = @. sqrt_(l2_error / total_volume_) + l2_error = @. sqrt(l2_error / total_volume_) return l2_error, linf_error end diff --git a/src/solvers/fdsbp_unstructured/fdsbp_2d.jl b/src/solvers/fdsbp_unstructured/fdsbp_2d.jl index 3df95e706e2..b459f4c42cc 100644 --- a/src/solvers/fdsbp_unstructured/fdsbp_2d.jl +++ b/src/solvers/fdsbp_unstructured/fdsbp_2d.jl @@ -212,7 +212,7 @@ function calc_error_norms(func, u, t, analyzer, end # For L2 error, divide by total volume - l2_error = @. sqrt_(l2_error / total_volume) + l2_error = @. sqrt(l2_error / total_volume) return l2_error, linf_error end diff --git a/src/visualization/recipes_plots.jl b/src/visualization/recipes_plots.jl index 61167154bc0..0e9b5a66a8d 100644 --- a/src/visualization/recipes_plots.jl +++ b/src/visualization/recipes_plots.jl @@ -89,7 +89,7 @@ RecipesBase.@recipe function f(pd::AbstractPlotData) cols = length(pd) rows = 1 else - cols = ceil(Int, sqrt_(length(pd))) + cols = ceil(Int, sqrt(length(pd))) rows = ceil(Int, length(pd) / cols) end diff --git a/src/visualization/utilities.jl b/src/visualization/utilities.jl index 35c4454ba0e..05457395ac0 100644 --- a/src/visualization/utilities.jl +++ b/src/visualization/utilities.jl @@ -742,7 +742,7 @@ function calc_arc_length(coordinates) arc_length = zeros(n_points) for i in 1:(n_points - 1) arc_length[i + 1] = arc_length[i] + - sqrt_(sum((coordinates[:, i] - coordinates[:, i + 1]) .^ 2)) + sqrt(sum((coordinates[:, i] - coordinates[:, i + 1]) .^ 2)) end return arc_length end diff --git a/test/test_dgmulti_1d.jl b/test/test_dgmulti_1d.jl index bd934c24785..0363086341f 100644 --- a/test/test_dgmulti_1d.jl +++ b/test/test_dgmulti_1d.jl @@ -37,7 +37,7 @@ end 7.853842541289665e-7, 9.609905503440606e-7, 2.832322219966481e-6, - ] ./ sqrt_(2.0), + ] ./ sqrt(2.0), linf=[ 1.5003758788711963e-6, 1.802998748523521e-6, diff --git a/test/test_dgmulti_2d.jl b/test/test_dgmulti_2d.jl index d85178702e1..892c8ed37f0 100644 --- a/test/test_dgmulti_2d.jl +++ b/test/test_dgmulti_2d.jl @@ -244,7 +244,7 @@ end 1.1343911906935844e-5, 3.679582619220412e-5, ], - rtol=2 * sqrt_(eps())) + rtol=2 * sqrt(eps())) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_dgmulti_3d.jl b/test/test_dgmulti_3d.jl index 69a98e238fa..3a1db255484 100644 --- a/test/test_dgmulti_3d.jl +++ b/test/test_dgmulti_3d.jl @@ -24,7 +24,7 @@ isdir(outdir) && rm(outdir, recursive = true) 0.001072975385793516, 0.000997247778892257, 0.0039364354651358294, - ] ./ sqrt_(8), + ] ./ sqrt(8), linf=[ 0.003660737033303718, 0.005625620600749226, @@ -53,7 +53,7 @@ end 0.016589517840793006, 0.015905000907070196, 0.03903416208587798, - ] ./ sqrt_(8), + ] ./ sqrt(8), linf=[ 0.06856547797256729, 0.08225664880340489, @@ -81,7 +81,7 @@ end 0.00040146357607564597, 0.000401463576075708, 0.0015749412434154315, - ] ./ sqrt_(8), + ] ./ sqrt(8), linf=[ 0.00036910287847780054, 0.00042659774184228283, @@ -161,7 +161,7 @@ end 0.0011273991123913515, 0.0010418496196130177, 0.004058878478404962, - ] ./ sqrt_(8), + ] ./ sqrt(8), linf=[ 0.003227752881827861, 0.005620317864620361, @@ -189,7 +189,7 @@ end 0.0004439720471461567, 0.0004439720471464591, 0.0016639410646990126, - ] ./ sqrt_(8), + ] ./ sqrt(8), linf=[ 0.0003674374460325147, 0.0004253921341716982, @@ -220,7 +220,7 @@ end 0.0024913155507195303, 0.002491315550720031, 0.008585818982343299, - ] ./ sqrt_(8), + ] ./ sqrt(8), linf=[ 0.003810078279323559, 0.004998778644230928, diff --git a/test/test_mpi_tree.jl b/test/test_mpi_tree.jl index 36e012d2732..0831f6a1313 100644 --- a/test/test_mpi_tree.jl +++ b/test/test_mpi_tree.jl @@ -177,7 +177,7 @@ CI_ON_WINDOWS = (get(ENV, "GITHUB_ACTIONS", false) == "true") && Sys.iswindows() 1.1707525976456523e-5, 4.8869615580926506e-5, ], - rtol=2000 * sqrt_(eps())) + rtol=2000 * sqrt(eps())) end end diff --git a/test/test_special_elixirs.jl b/test/test_special_elixirs.jl index d768ff9bc2e..ba670a6025e 100644 --- a/test/test_special_elixirs.jl +++ b/test/test_special_elixirs.jl @@ -119,7 +119,7 @@ end tspan = (0.0, 0.0), initial_refinement_level = 2) A, b = linear_structure(semi) λ = eigvals(Matrix(A)) - @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) trixi_include(@__MODULE__, joinpath(EXAMPLES_DIR, "tree_2d_dgsem", @@ -127,7 +127,7 @@ end tspan = (0.0, 0.0), initial_refinement_level = 2) A, b = linear_structure(semi) λ = eigvals(Matrix(A)) - @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) # check whether the user can modify `b` without changing `A` x = vec(ode.u0) @@ -147,12 +147,12 @@ end J = jacobian_ad_forward(semi) @test Matrix(A) ≈ J λ = eigvals(J) - @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) J = jacobian_fd(semi) @test Matrix(A) ≈ J λ = eigvals(J) - @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) end @timed_testset "Linear advection-diffusion" begin @@ -163,7 +163,7 @@ end J = jacobian_ad_forward(semi) λ = eigvals(J) - @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) end @timed_testset "Compressible Euler equations" begin @@ -263,7 +263,7 @@ end tspan = (0.0, 0.0), initial_refinement_level = 1) A, b = linear_structure(semi) λ = eigvals(Matrix(A)) - @test maximum(real, λ) < 10 * sqrt_(eps(real(semi))) + @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) end @timed_testset "Test Jacobian of DG (3D)" begin diff --git a/test/test_tree_1d.jl b/test/test_tree_1d.jl index 563dff200a6..097a62823c3 100644 --- a/test/test_tree_1d.jl +++ b/test/test_tree_1d.jl @@ -256,7 +256,7 @@ end function initial_condition_sine(x, t, equation::NonconservativeLinearAdvectionEquation) x0 = -2 * - atan(sqrt_(3) * tan(sqrt_(3) / 2 * t - atan(tan(x[1] / 2) / sqrt_(3)))) + atan(sqrt(3) * tan(sqrt(3) / 2 * t - atan(tan(x[1] / 2) / sqrt(3)))) scalar = sin(x0) advection_velocity = 2 + cos(x[1]) SVector(scalar, advection_velocity) diff --git a/test/test_trixi.jl b/test/test_trixi.jl index 6f94998099d..cebe2164ae6 100644 --- a/test/test_trixi.jl +++ b/test/test_trixi.jl @@ -18,7 +18,7 @@ macro test_trixi_include(elixir, args...) local l2 = get_kwarg(args, :l2, nothing) local linf = get_kwarg(args, :linf, nothing) local atol = get_kwarg(args, :atol, 500 * eps()) - local rtol = get_kwarg(args, :rtol, sqrt_(eps())) + local rtol = get_kwarg(args, :rtol, sqrt(eps())) local skip_coverage = get_kwarg(args, :skip_coverage, false) local coverage_override = expr_to_named_tuple(get_kwarg(args, :coverage_override, :())) if !(:maxiters in keys(coverage_override)) From f9f46d332c15d0cbcfcb28a4bcb78cf30f196438 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 12 Jan 2024 08:55:40 +0100 Subject: [PATCH 31/55] fmt --- ...elixir_shallowwater_twolayer_well_balanced.jl | 2 +- ...elixir_shallowwater_twolayer_well_balanced.jl | 2 +- src/equations/ideal_glm_mhd_1d.jl | 2 +- src/equations/ideal_glm_mhd_2d.jl | 12 ++++++------ src/equations/ideal_glm_mhd_3d.jl | 16 ++++++++-------- src/equations/ideal_glm_mhd_multicomponent_1d.jl | 2 +- src/equations/ideal_glm_mhd_multicomponent_2d.jl | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl index 54c1a333071..264c26390fe 100644 --- a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl +++ b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl @@ -20,7 +20,7 @@ function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEq v2_lower = 0.0 b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] + - -0.5)^2)) + 1) : 0.0) + -0.5)^2)) + 1) : 0.0) return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations) diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl index 48e98e60019..6a727df2502 100644 --- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl +++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl @@ -23,7 +23,7 @@ function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEq # Bottom Topography b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] + - -0.5)^2)) + 1) : 0.0) + -0.5)^2)) + 1) : 0.0) return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations) end diff --git a/src/equations/ideal_glm_mhd_1d.jl b/src/equations/ideal_glm_mhd_1d.jl index 053f3be3c51..db365cdc3e5 100644 --- a/src/equations/ideal_glm_mhd_1d.jl +++ b/src/equations/ideal_glm_mhd_1d.jl @@ -585,7 +585,7 @@ end b_square = b1^2 + b2^2 + b3^2 c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index 90857a56429..a8ec6024d58 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -1146,10 +1146,10 @@ end b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end @@ -1175,8 +1175,8 @@ end b2 * normal_direction[2])^2 / norm_squared c_f = sqrt((0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * - norm_squared) + 0.5 * sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + norm_squared) return c_f end @@ -1248,13 +1248,13 @@ as given by if orientation == 1 # x-direction c_a_roe = B1_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe else # y-direction c_a_roe = B2_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe end diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 00259743858..09a72cc810e 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -1039,13 +1039,13 @@ end b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) elseif orientation == 2 # y-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) else # z-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b3^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b3^2)) end return c_f end @@ -1073,8 +1073,8 @@ end b3 * normal_direction[3])^2 / norm_squared c_f = sqrt((0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * - norm_squared) + 0.5 * sqrt((a_square + b_square)^2 - 4 * a_square * b_dot_n_squared)) * + norm_squared) return c_f end @@ -1145,19 +1145,19 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by if orientation == 1 # x-direction c_a_roe = B1_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe elseif orientation == 2 # y-direction c_a_roe = B2_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe else # z-direction c_a_roe = B3_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - - 4.0 * a_square_roe * c_a_roe) + 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v3_roe end diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index 38f681a1459..5d2995ad601 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -507,7 +507,7 @@ end b_square = b1^2 + b2^2 + b3^2 c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) return c_f end diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index 6acbb6760fd..fdec2d8ec50 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -671,10 +671,10 @@ end b_square = b1^2 + b2^2 + b3^2 if direction == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b1^2)) else c_f = sqrt(0.5 * (a_square + b_square) + - 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) + 0.5 * sqrt((a_square + b_square)^2 - 4.0 * a_square * b2^2)) end return c_f end From 3a93ea31b30eed3dc7594733df3bbc324f1a787c Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 12 Jan 2024 08:58:18 +0100 Subject: [PATCH 32/55] revert unintended --- src/auxiliary/t8code.jl | 4 +- src/equations/compressible_euler_1d.jl | 20 +++---- src/equations/compressible_euler_2d.jl | 52 ++++++++-------- src/equations/compressible_euler_3d.jl | 60 +++++++++---------- src/equations/ideal_glm_mhd_1d.jl | 26 ++++---- src/equations/ideal_glm_mhd_2d.jl | 54 ++++++++--------- src/equations/ideal_glm_mhd_3d.jl | 56 ++++++++--------- .../ideal_glm_mhd_multicomponent_1d.jl | 8 +-- .../ideal_glm_mhd_multicomponent_2d.jl | 8 +-- 9 files changed, 144 insertions(+), 144 deletions(-) diff --git a/src/auxiliary/t8code.jl b/src/auxiliary/t8code.jl index 3428d5c428b..bd781b21c1e 100644 --- a/src/auxiliary/t8code.jl +++ b/src/auxiliary/t8code.jl @@ -15,8 +15,8 @@ function init_t8code() end # Initialize the sc library, has to happen before we initialize t8code. - let catch_signals = 0, print_backtrace = 0, loghandler = C_NULL - T8code.Libt8.sc_init(mpi_comm(), catch_signals, print_backtrace, loghandler, + let catch_signals = 0, print_backtrace = 0, log_handler = C_NULL + T8code.Libt8.sc_init(mpi_comm(), catch_signals, print_backtrace, log_handler, T8code.Libt8.SC_LP_ERROR) end diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index b87a177811e..a50c896cd1c 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -759,16 +759,16 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - sum_sqrtrho = sqrtrho_ll + sqrtrho_rr + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr vel_L = v1_ll vel_R = v1_rr - vel_roe = (sqrtrho_ll * vel_L + sqrtrho_rr * vel_R) / sum_sqrtrho + vel_roe = (sqrt_rho_ll * vel_L + sqrt_rho_rr * vel_R) / sum_sqrt_rho ekin_roe = 0.5 * vel_roe^2 H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - ekin_roe)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) @@ -845,14 +845,14 @@ Compactly summarized: c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) - v_roe = (sqrtrho_ll * v_ll + sqrtrho_rr * v_rr) * inv_sum_sqrtrho + v_roe = (sqrt_rho_ll * v_ll + sqrt_rho_rr * v_rr) * inv_sum_sqrt_rho v_roe_mag = v_roe^2 - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 0dbe4b542ef..b0fd5c53f45 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1179,9 +1179,9 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - sum_sqrtrho = sqrtrho_ll + sqrtrho_rr + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr if orientation == 1 # x-direction vel_L = v1_ll vel_R = v1_rr @@ -1189,13 +1189,13 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, vel_L = v2_ll vel_R = v2_rr end - vel_roe = (sqrtrho_ll * vel_L + sqrtrho_rr * vel_R) / sum_sqrtrho - v1_roe = sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr - v2_roe = sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr - vel_roe_mag = (v1_roe^2 + v2_roe^2) / sum_sqrtrho^2 + vel_roe = (sqrt_rho_ll * vel_L + sqrt_rho_rr * vel_R) / sum_sqrt_rho + v1_roe = sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr + v2_roe = sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr + vel_roe_mag = (v1_roe^2 + v2_roe^2) / sum_sqrt_rho^2 H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) @@ -1273,12 +1273,12 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, f_rr = flux(u_rr, normal_direction, equations) # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - sum_sqrtrho = sqrtrho_ll + sqrtrho_rr + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr - v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) / sum_sqrtrho - v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) / sum_sqrtrho + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) / sum_sqrt_rho + v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) / sum_sqrt_rho vel_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] vel_roe_mag = v1_roe^2 + v2_roe^2 @@ -1288,7 +1288,7 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, H_ll = (u_ll[4] + p_ll) / rho_ll H_rr = (u_rr[4] + p_rr) / rho_rr - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ Ssl = min(v_dot_n_ll - c_ll, vel_roe - c_roe) @@ -1374,15 +1374,15 @@ of the numerical flux. c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) - v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) * inv_sum_sqrtrho - v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) * inv_sum_sqrtrho + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho + v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho v_roe_mag = v1_roe^2 + v2_roe^2 - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see @@ -1436,16 +1436,16 @@ of the numerical flux. c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) - v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) * inv_sum_sqrtrho - v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) * inv_sum_sqrtrho + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho + v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] v_roe_mag = v1_roe^2 + v2_roe^2 - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index aa8179e2d93..82c4a7efa32 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1225,9 +1225,9 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, f_rr = flux(u_rr, orientation, equations) # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - sum_sqrtrho = sqrtrho_ll + sqrtrho_rr + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr if orientation == 1 # x-direction vel_L = v1_ll vel_R = v1_rr @@ -1238,14 +1238,14 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, vel_L = v3_ll vel_R = v3_rr end - vel_roe = (sqrtrho_ll * vel_L + sqrtrho_rr * vel_R) / sum_sqrtrho - v1_roe = sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr - v2_roe = sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr - v3_roe = sqrtrho_ll * v3_ll + sqrtrho_rr * v3_rr - vel_roe_mag = (v1_roe^2 + v2_roe^2 + v3_roe^2) / sum_sqrtrho^2 + vel_roe = (sqrt_rho_ll * vel_L + sqrt_rho_rr * vel_R) / sum_sqrt_rho + v1_roe = sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr + v2_roe = sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr + v3_roe = sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr + vel_roe_mag = (v1_roe^2 + v2_roe^2 + v3_roe^2) / sum_sqrt_rho^2 H_ll = (rho_e_ll + p_ll) / rho_ll H_rr = (rho_e_rr + p_rr) / rho_rr - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) Ssl = min(vel_L - c_ll, vel_roe - c_roe) Ssr = max(vel_R + c_rr, vel_roe + c_roe) @@ -1341,13 +1341,13 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, f_rr = flux(u_rr, normal_direction, equations) # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - sum_sqrtrho = sqrtrho_ll + sqrtrho_rr + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + sum_sqrt_rho = sqrt_rho_ll + sqrt_rho_rr - v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) / sum_sqrtrho - v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) / sum_sqrtrho - v3_roe = (sqrtrho_ll * v3_ll + sqrtrho_rr * v3_rr) / sum_sqrtrho + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) / sum_sqrt_rho + v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) / sum_sqrt_rho + v3_roe = (sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr) / sum_sqrt_rho vel_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + v3_roe * normal_direction[3] vel_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 @@ -1358,7 +1358,7 @@ function flux_hllc(u_ll, u_rr, normal_direction::AbstractVector, H_ll = (u_ll[5] + p_ll) / rho_ll H_rr = (u_rr[5] + p_rr) / rho_rr - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) / sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) / sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * vel_roe_mag)) * norm_ Ssl = min(v_dot_n_ll - c_ll, vel_roe - c_roe) @@ -1452,16 +1452,16 @@ of the numerical flux. c_rr = sqrt(equations.gamma * p_rr / rho_rr) # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) - v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) * inv_sum_sqrtrho - v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) * inv_sum_sqrtrho - v3_roe = (sqrtrho_ll * v3_ll + sqrtrho_rr * v3_rr) * inv_sum_sqrtrho + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho + v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho + v3_roe = (sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr) * inv_sum_sqrt_rho v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) # Compute convenience constant for positivity preservation, see @@ -1520,18 +1520,18 @@ of the numerical flux. c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ # Compute Roe averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sum_sqrtrho = inv(sqrtrho_ll + sqrtrho_rr) + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) - v1_roe = (sqrtrho_ll * v1_ll + sqrtrho_rr * v1_rr) * inv_sum_sqrtrho - v2_roe = (sqrtrho_ll * v2_ll + sqrtrho_rr * v2_rr) * inv_sum_sqrtrho - v3_roe = (sqrtrho_ll * v3_ll + sqrtrho_rr * v3_rr) * inv_sum_sqrtrho + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho + v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho + v3_roe = (sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr) * inv_sum_sqrt_rho v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + v3_roe * normal_direction[3] v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 - H_roe = (sqrtrho_ll * H_ll + sqrtrho_rr * H_rr) * inv_sum_sqrtrho + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ # Compute convenience constant for positivity preservation, see diff --git a/src/equations/ideal_glm_mhd_1d.jl b/src/equations/ideal_glm_mhd_1d.jl index db365cdc3e5..5a523daf3f6 100644 --- a/src/equations/ideal_glm_mhd_1d.jl +++ b/src/equations/ideal_glm_mhd_1d.jl @@ -578,10 +578,10 @@ end p = (equations.gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = equations.gamma * p / rho - sqrtrho = sqrt(rho) - b1 = B1 / sqrtrho - b2 = B2 / sqrtrho - b3 = B3 / sqrtrho + sqrt_rho = sqrt(rho) + b1 = B1 / sqrt_rho + b2 = B2 / sqrt_rho + b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 c_f = sqrt(0.5 * (a_square + b_square) + @@ -626,12 +626,12 @@ as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) - inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) - rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add - rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) + inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) + rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add + rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -646,16 +646,16 @@ as given by H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equations (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrtrho_add^2 + inv_sqrt_rho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - b_square_roe)) # acoustic speed # finally compute the average wave speed and set the output velocity # Ignore orientation since it is always "1" in 1D - c_a_roe = B1_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) diff --git a/src/equations/ideal_glm_mhd_2d.jl b/src/equations/ideal_glm_mhd_2d.jl index a8ec6024d58..43d1991e34b 100644 --- a/src/equations/ideal_glm_mhd_2d.jl +++ b/src/equations/ideal_glm_mhd_2d.jl @@ -1139,10 +1139,10 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrtrho = sqrt(rho) - b1 = B1 / sqrtrho - b2 = B2 / sqrtrho - b3 = B3 / sqrtrho + sqrt_rho = sqrt(rho) + b1 = B1 / sqrt_rho + b2 = B2 / sqrt_rho + b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + @@ -1164,10 +1164,10 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrtrho = sqrt(rho) - b1 = B1 / sqrtrho - b2 = B2 / sqrtrho - b3 = B3 / sqrtrho + sqrt_rho = sqrt(rho) + b1 = B1 / sqrt_rho + b2 = B2 / sqrt_rho + b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 norm_squared = (normal_direction[1] * normal_direction[1] + normal_direction[2] * normal_direction[2]) @@ -1217,12 +1217,12 @@ as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) - inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) - rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add - rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) + inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) + rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add + rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -1237,22 +1237,22 @@ as given by H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equation (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrtrho_add^2 + inv_sqrt_rho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - b_square_roe)) # acoustic speed # finally compute the average wave speed and set the output velocity (depends on orientation) if orientation == 1 # x-direction - c_a_roe = B1_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe else # y-direction - c_a_roe = B2_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) @@ -1289,12 +1289,12 @@ end p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) - inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) - rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add - rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) + inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) + rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add + rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -1309,9 +1309,9 @@ end H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equation (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrtrho_add^2 + inv_sqrt_rho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - @@ -1323,7 +1323,7 @@ end B_roe_dot_n_squared = (B1_roe * normal_direction[1] + B2_roe * normal_direction[2])^2 / norm_squared - c_a_roe = B_roe_dot_n_squared * inv_sqrtrho_prod # (squared) Alfvén wave speed + c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + diff --git a/src/equations/ideal_glm_mhd_3d.jl b/src/equations/ideal_glm_mhd_3d.jl index 09a72cc810e..321e501b051 100644 --- a/src/equations/ideal_glm_mhd_3d.jl +++ b/src/equations/ideal_glm_mhd_3d.jl @@ -1032,10 +1032,10 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrtrho = sqrt(rho) - b1 = B1 / sqrtrho - b2 = B2 / sqrtrho - b3 = B3 / sqrtrho + sqrt_rho = sqrt(rho) + b1 = B1 / sqrt_rho + b2 = B2 / sqrt_rho + b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 if orientation == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + @@ -1060,10 +1060,10 @@ end mag_en = 0.5 * (B1 * B1 + B2 * B2 + B3 * B3) p = (equations.gamma - 1) * (rho_e - kin_en - mag_en - 0.5 * psi^2) a_square = equations.gamma * p / rho - sqrtrho = sqrt(rho) - b1 = B1 / sqrtrho - b2 = B2 / sqrtrho - b3 = B3 / sqrtrho + sqrt_rho = sqrt(rho) + b1 = B1 / sqrt_rho + b2 = B2 / sqrt_rho + b3 = B3 / sqrt_rho b_square = b1 * b1 + b2 * b2 + b3 * b3 norm_squared = (normal_direction[1] * normal_direction[1] + normal_direction[2] * normal_direction[2] + @@ -1114,12 +1114,12 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) - inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) - rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add - rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) + inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) + rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add + rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -1134,28 +1134,28 @@ Compute the fast magnetoacoustic wave speed using Roe averages as given by H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equation (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrtrho_add^2 + inv_sqrt_rho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - b_square_roe)) # acoustic speed # finally compute the average wave speed and set the output velocity (depends on orientation) if orientation == 1 # x-direction - c_a_roe = B1_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + c_a_roe = B1_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v1_roe elseif orientation == 2 # y-direction - c_a_roe = B2_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + c_a_roe = B2_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) vel_out_roe = v2_roe else # z-direction - c_a_roe = B3_roe^2 * inv_sqrtrho_prod # (squared) Alfvén wave speed + c_a_roe = B3_roe^2 * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4.0 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe)) @@ -1192,12 +1192,12 @@ end p_total_rr = p_rr + 0.5 * mag_norm_rr # compute the Roe density averages - sqrtrho_ll = sqrt(rho_ll) - sqrtrho_rr = sqrt(rho_rr) - inv_sqrtrho_add = 1.0 / (sqrtrho_ll + sqrtrho_rr) - inv_sqrtrho_prod = 1.0 / (sqrtrho_ll * sqrtrho_rr) - rho_ll_roe = sqrtrho_ll * inv_sqrtrho_add - rho_rr_roe = sqrtrho_rr * inv_sqrtrho_add + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sqrt_rho_add = 1.0 / (sqrt_rho_ll + sqrt_rho_rr) + inv_sqrt_rho_prod = 1.0 / (sqrt_rho_ll * sqrt_rho_rr) + rho_ll_roe = sqrt_rho_ll * inv_sqrt_rho_add + rho_rr_roe = sqrt_rho_rr * inv_sqrt_rho_add # Roe averages # velocities and magnetic fields v1_roe = v1_ll * rho_ll_roe + v1_rr * rho_rr_roe @@ -1212,9 +1212,9 @@ end H_roe = H_ll * rho_ll_roe + H_rr * rho_rr_roe # temporary variable see equation (4.12) in Cargo and Gallice X = 0.5 * ((B1_ll - B1_rr)^2 + (B2_ll - B2_rr)^2 + (B3_ll - B3_rr)^2) * - inv_sqrtrho_add^2 + inv_sqrt_rho_add^2 # averaged components needed to compute c_f, the fast magnetoacoustic wave speed - b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrtrho_prod # scaled magnectic sum + b_square_roe = (B1_roe^2 + B2_roe^2 + B3_roe^2) * inv_sqrt_rho_prod # scaled magnectic sum a_square_roe = ((2.0 - equations.gamma) * X + (equations.gamma - 1.0) * (H_roe - 0.5 * (v1_roe^2 + v2_roe^2 + v3_roe^2) - @@ -1228,7 +1228,7 @@ end B2_roe * normal_direction[2] + B3_roe * normal_direction[3])^2 / norm_squared - c_a_roe = B_roe_dot_n_squared * inv_sqrtrho_prod # (squared) Alfvén wave speed + c_a_roe = B_roe_dot_n_squared * inv_sqrt_rho_prod # (squared) Alfvén wave speed a_star_roe = sqrt((a_square_roe + b_square_roe)^2 - 4 * a_square_roe * c_a_roe) c_f_roe = sqrt(0.5 * (a_square_roe + b_square_roe + a_star_roe) * norm_squared) vel_out_roe = (v1_roe * normal_direction[1] + diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index 5d2995ad601..dad7c27e86c 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -500,10 +500,10 @@ end gamma = totalgamma(cons, equations) p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2)) a_square = gamma * p / rho - sqrtrho = sqrt(rho) - b1 = B1 / sqrtrho - b2 = B2 / sqrtrho - b3 = B3 / sqrtrho + sqrt_rho = sqrt(rho) + b1 = B1 / sqrt_rho + b2 = B2 / sqrt_rho + b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 c_f = sqrt(0.5 * (a_square + b_square) + diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index fdec2d8ec50..a3a50c0485f 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -664,10 +664,10 @@ end p = (gamma - 1) * (rho_e - 0.5 * rho * v_mag^2 - 0.5 * (B1^2 + B2^2 + B3^2) - 0.5 * psi^2) a_square = gamma * p / rho - sqrtrho = sqrt(rho) - b1 = B1 / sqrtrho - b2 = B2 / sqrtrho - b3 = B3 / sqrtrho + sqrt_rho = sqrt(rho) + b1 = B1 / sqrt_rho + b2 = B2 / sqrt_rho + b3 = B3 / sqrt_rho b_square = b1^2 + b2^2 + b3^2 if direction == 1 # x-direction c_f = sqrt(0.5 * (a_square + b_square) + From 0e9ff777503a7332c222a580f0411da5f48b63f4 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 12 Jan 2024 08:59:03 +0100 Subject: [PATCH 33/55] revert --- .../dg_2d_compressible_euler.jl | 24 ++++++------- .../dg_3d_compressible_euler.jl | 36 +++++++++---------- .../dgsem_tree/dg_2d_compressible_euler.jl | 24 ++++++------- .../dgsem_tree/dg_3d_compressible_euler.jl | 36 +++++++++---------- 4 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl index b0804b6499c..6d4a86b01c6 100644 --- a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl @@ -310,14 +310,14 @@ end v1_ll = u_prim_permuted[j, i, 2] v2_ll = u_prim_permuted[j, i, 3] p_ll = u_prim_permuted[j, i, 4] - logrho_ll = u_prim_permuted[j, i, 5] + log_rho_ll = u_prim_permuted[j, i, 5] logp_ll = u_prim_permuted[j, i, 6] rho_rr = u_prim_permuted[j, ii, 1] v1_rr = u_prim_permuted[j, ii, 2] v2_rr = u_prim_permuted[j, ii, 3] p_rr = u_prim_permuted[j, ii, 4] - logrho_rr = u_prim_permuted[j, ii, 5] + log_rho_rr = u_prim_permuted[j, ii, 5] logp_rr = u_prim_permuted[j, ii, 6] normal_direction_1 = 0.5 * (contravariant_vectors_x[j, i, 1] + @@ -333,9 +333,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -349,9 +349,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 @@ -414,14 +414,14 @@ end v1_ll = u_prim[i, j, 2] v2_ll = u_prim[i, j, 3] p_ll = u_prim[i, j, 4] - logrho_ll = u_prim[i, j, 5] + log_rho_ll = u_prim[i, j, 5] logp_ll = u_prim[i, j, 6] rho_rr = u_prim[i, jj, 1] v1_rr = u_prim[i, jj, 2] v2_rr = u_prim[i, jj, 3] p_rr = u_prim[i, jj, 4] - logrho_rr = u_prim[i, jj, 5] + log_rho_rr = u_prim[i, jj, 5] logp_rr = u_prim[i, jj, 6] normal_direction_1 = 0.5 * (contravariant_vectors_y[i, j, 1] + @@ -437,9 +437,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -453,9 +453,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 diff --git a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl index 3812442f945..0c9af40029d 100644 --- a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl @@ -444,7 +444,7 @@ end v2_ll = u_prim_permuted[jk, i, 3] v3_ll = u_prim_permuted[jk, i, 4] p_ll = u_prim_permuted[jk, i, 5] - logrho_ll = u_prim_permuted[jk, i, 6] + log_rho_ll = u_prim_permuted[jk, i, 6] logp_ll = u_prim_permuted[jk, i, 7] rho_rr = u_prim_permuted[jk, ii, 1] @@ -452,7 +452,7 @@ end v2_rr = u_prim_permuted[jk, ii, 3] v3_rr = u_prim_permuted[jk, ii, 4] p_rr = u_prim_permuted[jk, ii, 5] - logrho_rr = u_prim_permuted[jk, ii, 6] + log_rho_rr = u_prim_permuted[jk, ii, 6] logp_rr = u_prim_permuted[jk, ii, 7] normal_direction_1 = 0.5 * (contravariant_vectors_x[jk, i, 1] + @@ -472,9 +472,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -488,9 +488,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 @@ -564,7 +564,7 @@ end v2_ll = u_prim[i, j, k, 3] v3_ll = u_prim[i, j, k, 4] p_ll = u_prim[i, j, k, 5] - logrho_ll = u_prim[i, j, k, 6] + log_rho_ll = u_prim[i, j, k, 6] logp_ll = u_prim[i, j, k, 7] rho_rr = u_prim[i, jj, k, 1] @@ -572,7 +572,7 @@ end v2_rr = u_prim[i, jj, k, 3] v3_rr = u_prim[i, jj, k, 4] p_rr = u_prim[i, jj, k, 5] - logrho_rr = u_prim[i, jj, k, 6] + log_rho_rr = u_prim[i, jj, k, 6] logp_rr = u_prim[i, jj, k, 7] normal_direction_1 = 0.5 * (contravariant_vectors_y[i, j, k, 1] + @@ -592,9 +592,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -608,9 +608,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 @@ -686,7 +686,7 @@ end v2_ll = u_prim_reshaped[ij, k, 3] v3_ll = u_prim_reshaped[ij, k, 4] p_ll = u_prim_reshaped[ij, k, 5] - logrho_ll = u_prim_reshaped[ij, k, 6] + log_rho_ll = u_prim_reshaped[ij, k, 6] logp_ll = u_prim_reshaped[ij, k, 7] rho_rr = u_prim_reshaped[ij, kk, 1] @@ -694,7 +694,7 @@ end v2_rr = u_prim_reshaped[ij, kk, 3] v3_rr = u_prim_reshaped[ij, kk, 4] p_rr = u_prim_reshaped[ij, kk, 5] - logrho_rr = u_prim_reshaped[ij, kk, 6] + log_rho_rr = u_prim_reshaped[ij, kk, 6] logp_rr = u_prim_reshaped[ij, kk, 7] normal_direction_1 = 0.5 * (contravariant_vectors_z[ij, k, 1] + @@ -714,9 +714,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -730,9 +730,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 diff --git a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl index f0261975fb5..bfc4a77ff9a 100644 --- a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl @@ -298,14 +298,14 @@ end v1_ll = u_prim_permuted[j, i, 2] v2_ll = u_prim_permuted[j, i, 3] p_ll = u_prim_permuted[j, i, 4] - logrho_ll = u_prim_permuted[j, i, 5] + log_rho_ll = u_prim_permuted[j, i, 5] logp_ll = u_prim_permuted[j, i, 6] rho_rr = u_prim_permuted[j, ii, 1] v1_rr = u_prim_permuted[j, ii, 2] v2_rr = u_prim_permuted[j, ii, 3] p_rr = u_prim_permuted[j, ii, 4] - logrho_rr = u_prim_permuted[j, ii, 5] + log_rho_rr = u_prim_permuted[j, ii, 5] logp_rr = u_prim_permuted[j, ii, 6] # Compute required mean values @@ -313,9 +313,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -329,9 +329,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 @@ -382,14 +382,14 @@ end v1_ll = u_prim[i, j, 2] v2_ll = u_prim[i, j, 3] p_ll = u_prim[i, j, 4] - logrho_ll = u_prim[i, j, 5] + log_rho_ll = u_prim[i, j, 5] logp_ll = u_prim[i, j, 6] rho_rr = u_prim[i, jj, 1] v1_rr = u_prim[i, jj, 2] v2_rr = u_prim[i, jj, 3] p_rr = u_prim[i, jj, 4] - logrho_rr = u_prim[i, jj, 5] + log_rho_rr = u_prim[i, jj, 5] logp_rr = u_prim[i, jj, 6] # Compute required mean values @@ -397,9 +397,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -413,9 +413,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 diff --git a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl index 0c5c20b2faf..47d01411a4a 100644 --- a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl @@ -342,7 +342,7 @@ end v2_ll = u_prim_permuted[jk, i, 3] v3_ll = u_prim_permuted[jk, i, 4] p_ll = u_prim_permuted[jk, i, 5] - logrho_ll = u_prim_permuted[jk, i, 6] + log_rho_ll = u_prim_permuted[jk, i, 6] logp_ll = u_prim_permuted[jk, i, 7] rho_rr = u_prim_permuted[jk, ii, 1] @@ -350,7 +350,7 @@ end v2_rr = u_prim_permuted[jk, ii, 3] v3_rr = u_prim_permuted[jk, ii, 4] p_rr = u_prim_permuted[jk, ii, 5] - logrho_rr = u_prim_permuted[jk, ii, 6] + log_rho_rr = u_prim_permuted[jk, ii, 6] logp_rr = u_prim_permuted[jk, ii, 7] # Compute required mean values @@ -358,9 +358,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -374,9 +374,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 @@ -436,7 +436,7 @@ end v2_ll = u_prim[i, j, k, 3] v3_ll = u_prim[i, j, k, 4] p_ll = u_prim[i, j, k, 5] - logrho_ll = u_prim[i, j, k, 6] + log_rho_ll = u_prim[i, j, k, 6] logp_ll = u_prim[i, j, k, 7] rho_rr = u_prim[i, jj, k, 1] @@ -444,7 +444,7 @@ end v2_rr = u_prim[i, jj, k, 3] v3_rr = u_prim[i, jj, k, 4] p_rr = u_prim[i, jj, k, 5] - logrho_rr = u_prim[i, jj, k, 6] + log_rho_rr = u_prim[i, jj, k, 6] logp_rr = u_prim[i, jj, k, 7] # Compute required mean values @@ -452,9 +452,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -468,9 +468,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 @@ -529,7 +529,7 @@ end v2_ll = u_prim_reshaped[ij, k, 3] v3_ll = u_prim_reshaped[ij, k, 4] p_ll = u_prim_reshaped[ij, k, 5] - logrho_ll = u_prim_reshaped[ij, k, 6] + log_rho_ll = u_prim_reshaped[ij, k, 6] logp_ll = u_prim_reshaped[ij, k, 7] rho_rr = u_prim_reshaped[ij, kk, 1] @@ -537,7 +537,7 @@ end v2_rr = u_prim_reshaped[ij, kk, 3] v3_rr = u_prim_reshaped[ij, kk, 4] p_rr = u_prim_reshaped[ij, kk, 5] - logrho_rr = u_prim_reshaped[ij, kk, 6] + log_rho_rr = u_prim_reshaped[ij, kk, 6] logp_rr = u_prim_reshaped[ij, kk, 7] # Compute required mean values @@ -545,9 +545,9 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = logrho_ll + logx1 = log_rho_ll y1 = rho_rr - logy1 = logrho_rr + logy1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 @@ -561,9 +561,9 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = logrho_ll + logp_rr + logx2 = log_rho_ll + logp_rr y2 = rho_rr * p_ll - logy2 = logrho_rr + logp_ll + logy2 = log_rho_rr + logp_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 From a952ac495cc19c9e316624e5bbbaa48416aceb56 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 12 Jan 2024 09:00:22 +0100 Subject: [PATCH 34/55] remove unintended --- .../dg_2d_compressible_euler.jl | 32 ++++++------- .../dg_3d_compressible_euler.jl | 48 +++++++++---------- .../dgsem_tree/dg_2d_compressible_euler.jl | 32 ++++++------- src/solvers/dgsem_tree/dg_2d_parabolic.jl | 2 +- .../dgsem_tree/dg_3d_compressible_euler.jl | 48 +++++++++---------- src/solvers/dgsem_tree/dg_3d_parabolic.jl | 2 +- 6 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl index 6d4a86b01c6..43f70da4750 100644 --- a/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_2d_compressible_euler.jl @@ -311,14 +311,14 @@ end v2_ll = u_prim_permuted[j, i, 3] p_ll = u_prim_permuted[j, i, 4] log_rho_ll = u_prim_permuted[j, i, 5] - logp_ll = u_prim_permuted[j, i, 6] + log_p_ll = u_prim_permuted[j, i, 6] rho_rr = u_prim_permuted[j, ii, 1] v1_rr = u_prim_permuted[j, ii, 2] v2_rr = u_prim_permuted[j, ii, 3] p_rr = u_prim_permuted[j, ii, 4] log_rho_rr = u_prim_permuted[j, ii, 5] - logp_rr = u_prim_permuted[j, ii, 6] + log_p_rr = u_prim_permuted[j, ii, 6] normal_direction_1 = 0.5 * (contravariant_vectors_x[j, i, 1] + contravariant_vectors_x[j, ii, 1]) @@ -333,14 +333,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -349,14 +349,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -415,14 +415,14 @@ end v2_ll = u_prim[i, j, 3] p_ll = u_prim[i, j, 4] log_rho_ll = u_prim[i, j, 5] - logp_ll = u_prim[i, j, 6] + log_p_ll = u_prim[i, j, 6] rho_rr = u_prim[i, jj, 1] v1_rr = u_prim[i, jj, 2] v2_rr = u_prim[i, jj, 3] p_rr = u_prim[i, jj, 4] log_rho_rr = u_prim[i, jj, 5] - logp_rr = u_prim[i, jj, 6] + log_p_rr = u_prim[i, jj, 6] normal_direction_1 = 0.5 * (contravariant_vectors_y[i, j, 1] + contravariant_vectors_y[i, jj, 1]) @@ -437,14 +437,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -453,14 +453,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) diff --git a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl index 0c9af40029d..64a3456b940 100644 --- a/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_structured/dg_3d_compressible_euler.jl @@ -445,7 +445,7 @@ end v3_ll = u_prim_permuted[jk, i, 4] p_ll = u_prim_permuted[jk, i, 5] log_rho_ll = u_prim_permuted[jk, i, 6] - logp_ll = u_prim_permuted[jk, i, 7] + log_p_ll = u_prim_permuted[jk, i, 7] rho_rr = u_prim_permuted[jk, ii, 1] v1_rr = u_prim_permuted[jk, ii, 2] @@ -453,7 +453,7 @@ end v3_rr = u_prim_permuted[jk, ii, 4] p_rr = u_prim_permuted[jk, ii, 5] log_rho_rr = u_prim_permuted[jk, ii, 6] - logp_rr = u_prim_permuted[jk, ii, 7] + log_p_rr = u_prim_permuted[jk, ii, 7] normal_direction_1 = 0.5 * (contravariant_vectors_x[jk, i, 1] + contravariant_vectors_x[jk, ii, 1]) @@ -472,14 +472,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -488,14 +488,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -565,7 +565,7 @@ end v3_ll = u_prim[i, j, k, 4] p_ll = u_prim[i, j, k, 5] log_rho_ll = u_prim[i, j, k, 6] - logp_ll = u_prim[i, j, k, 7] + log_p_ll = u_prim[i, j, k, 7] rho_rr = u_prim[i, jj, k, 1] v1_rr = u_prim[i, jj, k, 2] @@ -573,7 +573,7 @@ end v3_rr = u_prim[i, jj, k, 4] p_rr = u_prim[i, jj, k, 5] log_rho_rr = u_prim[i, jj, k, 6] - logp_rr = u_prim[i, jj, k, 7] + log_p_rr = u_prim[i, jj, k, 7] normal_direction_1 = 0.5 * (contravariant_vectors_y[i, j, k, 1] + contravariant_vectors_y[i, jj, k, 1]) @@ -592,14 +592,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -608,14 +608,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -687,7 +687,7 @@ end v3_ll = u_prim_reshaped[ij, k, 4] p_ll = u_prim_reshaped[ij, k, 5] log_rho_ll = u_prim_reshaped[ij, k, 6] - logp_ll = u_prim_reshaped[ij, k, 7] + log_p_ll = u_prim_reshaped[ij, k, 7] rho_rr = u_prim_reshaped[ij, kk, 1] v1_rr = u_prim_reshaped[ij, kk, 2] @@ -695,7 +695,7 @@ end v3_rr = u_prim_reshaped[ij, kk, 4] p_rr = u_prim_reshaped[ij, kk, 5] log_rho_rr = u_prim_reshaped[ij, kk, 6] - logp_rr = u_prim_reshaped[ij, kk, 7] + log_p_rr = u_prim_reshaped[ij, kk, 7] normal_direction_1 = 0.5 * (contravariant_vectors_z[ij, k, 1] + contravariant_vectors_z[ij, kk, 1]) @@ -714,14 +714,14 @@ end # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -730,14 +730,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) diff --git a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl index bfc4a77ff9a..50b1e8cb5b4 100644 --- a/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_2d_compressible_euler.jl @@ -299,28 +299,28 @@ end v2_ll = u_prim_permuted[j, i, 3] p_ll = u_prim_permuted[j, i, 4] log_rho_ll = u_prim_permuted[j, i, 5] - logp_ll = u_prim_permuted[j, i, 6] + log_p_ll = u_prim_permuted[j, i, 6] rho_rr = u_prim_permuted[j, ii, 1] v1_rr = u_prim_permuted[j, ii, 2] v2_rr = u_prim_permuted[j, ii, 3] p_rr = u_prim_permuted[j, ii, 4] log_rho_rr = u_prim_permuted[j, ii, 5] - logp_rr = u_prim_permuted[j, ii, 6] + log_p_rr = u_prim_permuted[j, ii, 6] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -329,14 +329,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -383,28 +383,28 @@ end v2_ll = u_prim[i, j, 3] p_ll = u_prim[i, j, 4] log_rho_ll = u_prim[i, j, 5] - logp_ll = u_prim[i, j, 6] + log_p_ll = u_prim[i, j, 6] rho_rr = u_prim[i, jj, 1] v1_rr = u_prim[i, jj, 2] v2_rr = u_prim[i, jj, 3] p_rr = u_prim[i, jj, 4] log_rho_rr = u_prim[i, jj, 5] - logp_rr = u_prim[i, jj, 6] + log_p_rr = u_prim[i, jj, 6] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -413,14 +413,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) diff --git a/src/solvers/dgsem_tree/dg_2d_parabolic.jl b/src/solvers/dgsem_tree/dg_2d_parabolic.jl index 3083ae30680..5f2ac7f6ba9 100644 --- a/src/solvers/dgsem_tree/dg_2d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_2d_parabolic.jl @@ -613,7 +613,7 @@ function prolong2mortars!(cache, flux_viscous::Vector{Array{uEltype, 4}}, return nothing end -# NOTE: Use analogy to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms. +# NOTE: Use analog_y to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms. # Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for # hyperbolic terms with conserved terms only, i.e., no nonconservative terms. function calc_mortar_flux!(surface_flux_values, diff --git a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl index 47d01411a4a..ec3647ed649 100644 --- a/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl +++ b/src/solvers/dgsem_tree/dg_3d_compressible_euler.jl @@ -343,7 +343,7 @@ end v3_ll = u_prim_permuted[jk, i, 4] p_ll = u_prim_permuted[jk, i, 5] log_rho_ll = u_prim_permuted[jk, i, 6] - logp_ll = u_prim_permuted[jk, i, 7] + log_p_ll = u_prim_permuted[jk, i, 7] rho_rr = u_prim_permuted[jk, ii, 1] v1_rr = u_prim_permuted[jk, ii, 2] @@ -351,21 +351,21 @@ end v3_rr = u_prim_permuted[jk, ii, 4] p_rr = u_prim_permuted[jk, ii, 5] log_rho_rr = u_prim_permuted[jk, ii, 6] - logp_rr = u_prim_permuted[jk, ii, 7] + log_p_rr = u_prim_permuted[jk, ii, 7] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -374,14 +374,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -437,7 +437,7 @@ end v3_ll = u_prim[i, j, k, 4] p_ll = u_prim[i, j, k, 5] log_rho_ll = u_prim[i, j, k, 6] - logp_ll = u_prim[i, j, k, 7] + log_p_ll = u_prim[i, j, k, 7] rho_rr = u_prim[i, jj, k, 1] v1_rr = u_prim[i, jj, k, 2] @@ -445,21 +445,21 @@ end v3_rr = u_prim[i, jj, k, 4] p_rr = u_prim[i, jj, k, 5] log_rho_rr = u_prim[i, jj, k, 6] - logp_rr = u_prim[i, jj, k, 7] + log_p_rr = u_prim[i, jj, k, 7] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -468,14 +468,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) v1_avg = 0.5 * (v1_ll + v1_rr) @@ -530,7 +530,7 @@ end v3_ll = u_prim_reshaped[ij, k, 4] p_ll = u_prim_reshaped[ij, k, 5] log_rho_ll = u_prim_reshaped[ij, k, 6] - logp_ll = u_prim_reshaped[ij, k, 7] + log_p_ll = u_prim_reshaped[ij, k, 7] rho_rr = u_prim_reshaped[ij, kk, 1] v1_rr = u_prim_reshaped[ij, kk, 2] @@ -538,21 +538,21 @@ end v3_rr = u_prim_reshaped[ij, kk, 4] p_rr = u_prim_reshaped[ij, kk, 5] log_rho_rr = u_prim_reshaped[ij, kk, 6] - logp_rr = u_prim_reshaped[ij, kk, 7] + log_p_rr = u_prim_reshaped[ij, kk, 7] # Compute required mean values # We inline the logarithmic mean to allow LoopVectorization.jl to optimize # it efficiently. This is equivalent to # rho_mean = ln_mean(rho_ll, rho_rr) x1 = rho_ll - logx1 = log_rho_ll + log_x1 = log_rho_ll y1 = rho_rr - logy1 = log_rho_rr + log_y1 = log_rho_rr x1_plus_y1 = x1 + y1 y1_minus_x1 = y1 - x1 z1 = y1_minus_x1^2 / x1_plus_y1^2 special_path1 = x1_plus_y1 / (2 + z1 * (2 / 3 + z1 * (2 / 5 + 2 / 7 * z1))) - regular_path1 = y1_minus_x1 / (logy1 - logx1) + regular_path1 = y1_minus_x1 / (log_y1 - log_x1) rho_mean = ifelse(z1 < 1.0e-4, special_path1, regular_path1) # Algebraically equivalent to `inv_ln_mean(rho_ll / p_ll, rho_rr / p_rr)` @@ -561,14 +561,14 @@ end # = pₗ pᵣ log((ϱₗ pᵣ) / (ϱᵣ pₗ)) / (ϱₗ pᵣ - ϱᵣ pₗ) # inv_rho_p_mean = p_ll * p_rr * inv_ln_mean(rho_ll * p_rr, rho_rr * p_ll) x2 = rho_ll * p_rr - logx2 = log_rho_ll + logp_rr + log_x2 = log_rho_ll + log_p_rr y2 = rho_rr * p_ll - logy2 = log_rho_rr + logp_ll + log_y2 = log_rho_rr + log_p_ll x2_plus_y2 = x2 + y2 y2_minus_x2 = y2 - x2 z2 = y2_minus_x2^2 / x2_plus_y2^2 special_path2 = (2 + z2 * (2 / 3 + z2 * (2 / 5 + 2 / 7 * z2))) / x2_plus_y2 - regular_path2 = (logy2 - logx2) / y2_minus_x2 + regular_path2 = (log_y2 - log_x2) / y2_minus_x2 inv_rho_p_mean = p_ll * p_rr * ifelse(z2 < 1.0e-4, special_path2, regular_path2) diff --git a/src/solvers/dgsem_tree/dg_3d_parabolic.jl b/src/solvers/dgsem_tree/dg_3d_parabolic.jl index 9ad28c6aa8e..3af88b1e1fb 100644 --- a/src/solvers/dgsem_tree/dg_3d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_3d_parabolic.jl @@ -824,7 +824,7 @@ function prolong2mortars!(cache, return nothing end -# NOTE: Use analogy to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms. +# NOTE: Use analog_y to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms. # Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for # hyperbolic terms with conserved terms only, i.e., no nonconservative terms. function calc_mortar_flux!(surface_flux_values, From 7d85892996ba0c2d90af83ac542506eaa7e45734 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 12 Jan 2024 09:01:30 +0100 Subject: [PATCH 35/55] revert --- src/solvers/dgsem_tree/dg_2d_parabolic.jl | 2 +- src/solvers/dgsem_tree/dg_3d_parabolic.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solvers/dgsem_tree/dg_2d_parabolic.jl b/src/solvers/dgsem_tree/dg_2d_parabolic.jl index 5f2ac7f6ba9..3083ae30680 100644 --- a/src/solvers/dgsem_tree/dg_2d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_2d_parabolic.jl @@ -613,7 +613,7 @@ function prolong2mortars!(cache, flux_viscous::Vector{Array{uEltype, 4}}, return nothing end -# NOTE: Use analog_y to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms. +# NOTE: Use analogy to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms. # Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for # hyperbolic terms with conserved terms only, i.e., no nonconservative terms. function calc_mortar_flux!(surface_flux_values, diff --git a/src/solvers/dgsem_tree/dg_3d_parabolic.jl b/src/solvers/dgsem_tree/dg_3d_parabolic.jl index 3af88b1e1fb..9ad28c6aa8e 100644 --- a/src/solvers/dgsem_tree/dg_3d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_3d_parabolic.jl @@ -824,7 +824,7 @@ function prolong2mortars!(cache, return nothing end -# NOTE: Use analog_y to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms. +# NOTE: Use analogy to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms. # Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for # hyperbolic terms with conserved terms only, i.e., no nonconservative terms. function calc_mortar_flux!(surface_flux_values, From c79ba8cebff9a0e208097ed566c59b5b86b1c012 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 12 Jan 2024 09:04:37 +0100 Subject: [PATCH 36/55] fmt --- src/auxiliary/math.jl | 1 + src/equations/compressible_euler_multicomponent_1d.jl | 3 +-- src/equations/compressible_euler_multicomponent_2d.jl | 3 +-- test/test_tree_1d.jl | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index c3f9ddcbd51..3dae3d8e3f6 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -26,6 +26,7 @@ in the stacktrace. """ @inline sqrt(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +# For the `sqrt` we could use the `sqrt_llvm` call, but for transparency we use the direct LLVM calls here. #@inline sqrt(x::Union{Float64, Float32, Float16}) = Base.sqrt_llvm(x) @inline sqrt(x::Float64) = ccall("llvm.sqrt.f64", llvmcall, Float64, (Float64,), x) @inline sqrt(x::Float32) = ccall("llvm.sqrt.f32", llvmcall, Float32, (Float32,), x) diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index acee52a0b86..6338e04c3ed 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -536,8 +536,7 @@ end total_entropy = zero(u[1]) for i in eachcomponent(equations) - total_entropy -= u[i + 2] * - (cv[i] * log(T) - gas_constants[i] * log(u[i + 2])) + total_entropy -= u[i + 2] * (cv[i] * log(T) - gas_constants[i] * log(u[i + 2])) end return total_entropy diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index 3fcc37f4dbe..60fce222f21 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -742,8 +742,7 @@ end total_entropy = zero(u[1]) for i in eachcomponent(equations) - total_entropy -= u[i + 3] * - (cv[i] * log(T) - gas_constants[i] * log(u[i + 3])) + total_entropy -= u[i + 3] * (cv[i] * log(T) - gas_constants[i] * log(u[i + 3])) end return total_entropy diff --git a/test/test_tree_1d.jl b/test/test_tree_1d.jl index 097a62823c3..4654f6313f7 100644 --- a/test/test_tree_1d.jl +++ b/test/test_tree_1d.jl @@ -255,8 +255,7 @@ end # characteristics function initial_condition_sine(x, t, equation::NonconservativeLinearAdvectionEquation) - x0 = -2 * - atan(sqrt(3) * tan(sqrt(3) / 2 * t - atan(tan(x[1] / 2) / sqrt(3)))) + x0 = -2 * atan(sqrt(3) * tan(sqrt(3) / 2 * t - atan(tan(x[1] / 2) / sqrt(3)))) scalar = sin(x0) advection_velocity = 2 + cos(x[1]) SVector(scalar, advection_velocity) From 5fd0563f00847da20576773509ce8be7e1044507 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 12 Jan 2024 09:05:52 +0100 Subject: [PATCH 37/55] comments --- src/auxiliary/math.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 3dae3d8e3f6..7bdb8ecc59f 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -26,11 +26,14 @@ in the stacktrace. """ @inline sqrt(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) -# For the `sqrt` we could use the `sqrt_llvm` call, but for transparency we use the direct LLVM calls here. +# For `sqrt` we could use the `sqrt_llvm` call, ... #@inline sqrt(x::Union{Float64, Float32, Float16}) = Base.sqrt_llvm(x) + +# ... but for transparency and consistency we use the direct LLVM calls here. @inline sqrt(x::Float64) = ccall("llvm.sqrt.f64", llvmcall, Float64, (Float64,), x) @inline sqrt(x::Float32) = ccall("llvm.sqrt.f32", llvmcall, Float32, (Float32,), x) @inline sqrt(x::Float16) = ccall("llvm.sqrt.f16", llvmcall, Float16, (Float16,), x) + #@inline sqrt(x) = Base.sqrt(x) # For benchmarking and debugging (shows up in stacktrace) """ @@ -58,6 +61,7 @@ in the stacktrace. @inline log(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64,), x) @inline log(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) @inline log(x::Float16) = ccall("llvm.log.f16", llvmcall, Float16, (Float16,), x) + #@inline log(x) = Base.log(x) # For benchmarking and debugging (shows up in stacktrace) """ From edc3e2d7ef341db84714b2c5abbcee2aa781a919 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Sun, 14 Jan 2024 14:32:55 +0100 Subject: [PATCH 38/55] update test vals --- test/test_unstructured_2d.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_unstructured_2d.jl b/test/test_unstructured_2d.jl index 139b423ead1..82a7ab1305c 100644 --- a/test/test_unstructured_2d.jl +++ b/test/test_unstructured_2d.jl @@ -710,9 +710,9 @@ end 1.0066867437607972e-13, 6.889210012578449e-14, 1.568290814572709e-13], - linf=[5.963762816918461e-10, - 5.08869890669672e-11, - 1.1581377523661729e-10, + linf=[8.71898109267022e-11, + 2.801543719233024e-11, + 2.344902050310793e-11, 4.61017890529547e-11], tspan=(0.0, 0.1), atol=1.0e-11) From 4372108783bed43bd6fcb4cf01fb5ee13b33ac47 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Sun, 14 Jan 2024 22:57:49 +0100 Subject: [PATCH 39/55] test vals --- test/test_unstructured_2d.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_unstructured_2d.jl b/test/test_unstructured_2d.jl index 82a7ab1305c..83b8318c926 100644 --- a/test/test_unstructured_2d.jl +++ b/test/test_unstructured_2d.jl @@ -710,9 +710,9 @@ end 1.0066867437607972e-13, 6.889210012578449e-14, 1.568290814572709e-13], - linf=[8.71898109267022e-11, + linf=[2.353373051988683e-10, 2.801543719233024e-11, - 2.344902050310793e-11, + 3.930469838486772e-11, 4.61017890529547e-11], tspan=(0.0, 0.1), atol=1.0e-11) From aec0375f371df326f52a693490c7468cca6a2ab4 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 15 Jan 2024 09:01:46 +0100 Subject: [PATCH 40/55] test vals --- test/test_parabolic_1d.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_parabolic_1d.jl b/test/test_parabolic_1d.jl index c1cfec052fe..41d375e2e31 100644 --- a/test/test_parabolic_1d.jl +++ b/test/test_parabolic_1d.jl @@ -195,14 +195,14 @@ end Prandtl = prandtl_number(), gradient_variables = GradientVariablesEntropy()), l2=[ - 2.459359632523962e-5, - 2.3928390718460263e-5, - 0.00011252414117082376, + 2.4593501090944024e-5, + 2.3928163240907908e-5, + 0.00011252309905552921, ], linf=[ - 0.0001185052018830568, - 0.00018987717854305393, - 0.0009597503607920999, + 0.0001185048754512863, + 0.0001898766501935486, + 0.0009597450028770993, ]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) From d74ffacca5c4f6fe1c692353ed945d743742d205 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 18 Jan 2024 11:55:58 +0100 Subject: [PATCH 41/55] Preferences --- Project.toml | 3 + src/Trixi.jl | 6 ++ src/auxiliary/math.jl | 136 ++++++++++++++++++++++++++---------------- 3 files changed, 94 insertions(+), 51 deletions(-) diff --git a/Project.toml b/Project.toml index f246bdfdab4..c1c21f38aa4 100644 --- a/Project.toml +++ b/Project.toml @@ -21,9 +21,11 @@ MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" Octavian = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" +OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" P4est = "7d669430-f675-4ae7-b43e-fab78ec5a902" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +Preferences = "21216c6a-2e73-6563-6e65-726566657250" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" @@ -44,6 +46,7 @@ TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" Triangulate = "f7e6ffb2-c36d-4f8f-a77e-16e897189344" TriplotBase = "981d1d27-644d-49a2-9326-4793e63143c3" TriplotRecipes = "808ab39a-a642-4abf-81ff-4cb34ebbffa3" +UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [weakdeps] Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" diff --git a/src/Trixi.jl b/src/Trixi.jl index e18b2f6415c..99e7d93cedc 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -73,6 +73,12 @@ using TriplotRecipes: DGTriPseudocolor using SimpleUnPack: @pack! using DataStructures: BinaryHeap, FasterForward, extract_all! +using UUIDs: UUID +using Preferences: @load_preference, set_preferences!, delete_preferences! + +const _PREFERENCE_SQRT = @load_preference("sqrt", "sqrt_Trixi_NaN") +const _PREFERENCE_LOG = @load_preference("log", "log_Trixi_NaN") + # finite difference SBP operators using SummationByPartsOperators: AbstractDerivativeOperator, AbstractNonperiodicDerivativeOperator, DerivativeOperator, diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 7bdb8ecc59f..ce16dd6fb26 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -5,64 +5,98 @@ @muladd begin #! format: noindent -""" - sqrt(x::Real) - -Custom square root function which returns `NaN` for negative arguments instead of throwing an error. -This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) -when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). - -We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsic `sqrtllvm` as for this the -`sqrtllvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. -For other types, such as integers or dual numbers required for algorithmic differentiation, we -fall back to the Julia built-in `sqrt` function after a check for negative arguments. -Since these cases are not performance critical, the check for negativity does not hurt here -and can (as of now) optimized away by the compiler. - -When debugging code, it might be useful to change the implementation of this function to redirect to -the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated -in the stacktrace. -""" -@inline sqrt(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) +const TRIXI_UUID = UUID("a7f1ee26-1774-49b1-8366-f1abc58fbfcb") -# For `sqrt` we could use the `sqrt_llvm` call, ... -#@inline sqrt(x::Union{Float64, Float32, Float16}) = Base.sqrt_llvm(x) +""" + set_sqrt_type(type; force = true) -# ... but for transparency and consistency we use the direct LLVM calls here. -@inline sqrt(x::Float64) = ccall("llvm.sqrt.f64", llvmcall, Float64, (Float64,), x) -@inline sqrt(x::Float32) = ccall("llvm.sqrt.f32", llvmcall, Float32, (Float32,), x) -@inline sqrt(x::Float16) = ccall("llvm.sqrt.f16", llvmcall, Float16, (Float16,), x) +Set the `type` of the square root function to be used in `Trixi.jl`. +The default is `sqrt_Trixi_NaN` which returns `NaN` for negative arguments instead of throwing an error. +Alternatively, you can set `type` to `sqrt_Base` to use the Julia built-in `sqrt` function +which provides a stack-trace of the error which might come in handy when debugging code. +""" +function set_sqrt_type(type; force = true) + @assert type == "sqrt_Trixi_NaN" || type == "sqrt_Base" "Only allowed `sqrt` function types are `sqrt_Trixi_NaN` and `sqrt_Base`." + set_preferences!(TRIXI_UUID, "sqrt" => type, force = force) + @info "Please restart Julia and reload Trixi.jl for the sqrt computation change to take effect" +end -#@inline sqrt(x) = Base.sqrt(x) # For benchmarking and debugging (shows up in stacktrace) +@static if _PREFERENCE_SQRT == "sqrt_Trixi_NaN" + """ + sqrt(x::Real) + + Custom square root function which returns `NaN` for negative arguments instead of throwing an error. + This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) + when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), + i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). + + We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsic `sqrtllvm` as for this the + `sqrtllvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. + For other types, such as integers or dual numbers required for algorithmic differentiation, we + fall back to the Julia built-in `sqrt` function after a check for negative arguments. + Since these cases are not performance critical, the check for negativity does not hurt here + and can (as of now) optimized away by the compiler. + + When debugging code, it might be useful to change the implementation of this function to redirect to + the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated + in the stacktrace. + """ + @inline sqrt(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) + + # For `sqrt` we could use the `sqrt_llvm` call, ... + #@inline sqrt(x::Union{Float64, Float32, Float16}) = Base.sqrt_llvm(x) + + # ... but for transparency and consistency we use the direct LLVM calls here. + @inline sqrt(x::Float64) = ccall("llvm.sqrt.f64", llvmcall, Float64, (Float64,), x) + @inline sqrt(x::Float32) = ccall("llvm.sqrt.f32", llvmcall, Float32, (Float32,), x) + @inline sqrt(x::Float16) = ccall("llvm.sqrt.f16", llvmcall, Float16, (Float16,), x) +elseif _PREFERENCE_SQRT == "sqrt_Base" + @inline sqrt(x) = Base.sqrt(x) # For benchmarking and debugging (shows up in stacktrace) +end """ - log(x::Real) - -Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. -This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) -when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), -i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). - -We dispatch this function for `Float64, Float32, Float16` to the respective LLVM intrinsics -`llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16"` as for this the LLVM functions can be used out-of the box, i.e., -they return `NaN` for negative arguments. -For other types, such as integers or dual numbers required for algorithmic differentiation, we -fall back to the Julia built-in `log` function after a check for negative arguments. -Since these cases are not performance critical, the check for negativity does not hurt here -and can (as of now) optimized away by the compiler. - -When debugging code, it might be useful to change the implementation of this function to redirect to -the Julia built-in `log` function, as this reports the exact place in code where the domain is violated -in the stacktrace. -""" -@inline log(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) + set_log_type(type; force = true) -@inline log(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64,), x) -@inline log(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) -@inline log(x::Float16) = ccall("llvm.log.f16", llvmcall, Float16, (Float16,), x) +Set the `type` of the (natural) `log` function to be used in `Trixi.jl`. +The default is `sqrt_Trixi_NaN` which returns `NaN` for negative arguments instead of throwing an error. +Alternatively, you can set `type` to `sqrt_Base` to use the Julia built-in `sqrt` function +which provides a stack-trace of the error which might come in handy when debugging code. +""" +function set_log_type(type; force = true) + @assert type == "log_Trixi_NaN" || type == "log_Base" "Only allowed log function types are `log_Trixi_NaN` and `log_Bases`." + set_preferences!(TRIXI_UUID, "log" => type, force = force) + @info "Please restart Julia and reload Trixi.jl for the log computation change to take effect" +end -#@inline log(x) = Base.log(x) # For benchmarking and debugging (shows up in stacktrace) +@static if _PREFERENCE_LOG == "log_Trixi_NaN" + """ + log(x::Real) + + Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. + This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) + when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), + i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). + + We dispatch this function for `Float64, Float32, Float16` to the respective LLVM intrinsics + `llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16"` as for this the LLVM functions can be used out-of the box, i.e., + they return `NaN` for negative arguments. + For other types, such as integers or dual numbers required for algorithmic differentiation, we + fall back to the Julia built-in `log` function after a check for negative arguments. + Since these cases are not performance critical, the check for negativity does not hurt here + and can (as of now) optimized away by the compiler. + + When debugging code, it might be useful to change the implementation of this function to redirect to + the Julia built-in `log` function, as this reports the exact place in code where the domain is violated + in the stacktrace. + """ + @inline log(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) + + @inline log(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64,), x) + @inline log(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) + @inline log(x::Float16) = ccall("llvm.log.f16", llvmcall, Float16, (Float16,), x) +elseif _PREFERENCE_LOG == "log_Base" + @inline log(x) = Base.log(x) # For benchmarking and debugging (shows up in stacktrace) +end """ ln_mean(x, y) From 64751ed184d8c5dded0f6bf10c11fd81efb379d1 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Thu, 18 Jan 2024 11:57:38 +0100 Subject: [PATCH 42/55] Update Project.toml --- Project.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Project.toml b/Project.toml index c1c21f38aa4..75d139157c6 100644 --- a/Project.toml +++ b/Project.toml @@ -21,7 +21,6 @@ MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" Octavian = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" P4est = "7d669430-f675-4ae7-b43e-fab78ec5a902" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" From a415bc52471c41d00b683c8728df5572c85faec8 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Thu, 18 Jan 2024 11:58:06 +0100 Subject: [PATCH 43/55] Update src/Trixi.jl --- src/Trixi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Trixi.jl b/src/Trixi.jl index 99e7d93cedc..9c27aa53637 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -74,7 +74,7 @@ using SimpleUnPack: @pack! using DataStructures: BinaryHeap, FasterForward, extract_all! using UUIDs: UUID -using Preferences: @load_preference, set_preferences!, delete_preferences! +using Preferences: @load_preference, set_preferences! const _PREFERENCE_SQRT = @load_preference("sqrt", "sqrt_Trixi_NaN") const _PREFERENCE_LOG = @load_preference("log", "log_Trixi_NaN") From f58b31693de312b89e9bd661e67be774b3f0d1ea Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 18 Jan 2024 11:59:11 +0100 Subject: [PATCH 44/55] fmt --- src/auxiliary/math.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index ce16dd6fb26..a6505ec85f5 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -16,7 +16,7 @@ Alternatively, you can set `type` to `sqrt_Base` to use the Julia built-in `sqrt which provides a stack-trace of the error which might come in handy when debugging code. """ function set_sqrt_type(type; force = true) - @assert type == "sqrt_Trixi_NaN" || type == "sqrt_Base" "Only allowed `sqrt` function types are `sqrt_Trixi_NaN` and `sqrt_Base`." + @assert type == "sqrt_Trixi_NaN"||type == "sqrt_Base" "Only allowed `sqrt` function types are `sqrt_Trixi_NaN` and `sqrt_Base`." set_preferences!(TRIXI_UUID, "sqrt" => type, force = force) @info "Please restart Julia and reload Trixi.jl for the sqrt computation change to take effect" end @@ -63,7 +63,7 @@ Alternatively, you can set `type` to `sqrt_Base` to use the Julia built-in `sqrt which provides a stack-trace of the error which might come in handy when debugging code. """ function set_log_type(type; force = true) - @assert type == "log_Trixi_NaN" || type == "log_Base" "Only allowed log function types are `log_Trixi_NaN` and `log_Bases`." + @assert type == "log_Trixi_NaN"||type == "log_Base" "Only allowed log function types are `log_Trixi_NaN` and `log_Bases`." set_preferences!(TRIXI_UUID, "log" => type, force = force) @info "Please restart Julia and reload Trixi.jl for the log computation change to take effect" end From 5db9c6cd8c54e59eeef67d2643abfbc41d76dd3a Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 18 Jan 2024 12:02:45 +0100 Subject: [PATCH 45/55] docstrings --- src/auxiliary/math.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index a6505ec85f5..c94866e2d1f 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -30,8 +30,9 @@ end when using the [`Polyester` package](https://github.com/JuliaSIMD/Polyester.jl), i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). - We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsic `sqrtllvm` as for this the - `sqrtllvm` function can be used out-of the box, i.e., it returns `NaN` for negative arguments. + We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsics + `llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16` as for these the LLVM functions can be used out-of the box, + i.e., they return `NaN` for negative arguments. For other types, such as integers or dual numbers required for algorithmic differentiation, we fall back to the Julia built-in `sqrt` function after a check for negative arguments. Since these cases are not performance critical, the check for negativity does not hurt here @@ -78,7 +79,7 @@ end i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). We dispatch this function for `Float64, Float32, Float16` to the respective LLVM intrinsics - `llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16"` as for this the LLVM functions can be used out-of the box, i.e., + `llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16` as for this the LLVM functions can be used out-of the box, i.e., they return `NaN` for negative arguments. For other types, such as integers or dual numbers required for algorithmic differentiation, we fall back to the Julia built-in `log` function after a check for negative arguments. From 7a440c853f99d42d02a09d294b0c34cd5ffaeb7c Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 18 Jan 2024 12:05:17 +0100 Subject: [PATCH 46/55] docstrings --- src/auxiliary/math.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index c94866e2d1f..f5ec6407be3 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -31,8 +31,10 @@ end i.e., using the `@batch` macro instead of the Julia built-in `@threads` macro, see [`@threaded`](@ref). We dispatch this function for `Float64, Float32, Float16` to the LLVM intrinsics - `llvm.log.f64`, `llvm.log.f32`, `llvm.log.f16` as for these the LLVM functions can be used out-of the box, + `llvm.sqrt.f64`, `llvm.sqrt.f32`, `llvm.sqrt.f16` as for these the LLVM functions can be used out-of the box, i.e., they return `NaN` for negative arguments. + In principle, one could also use the `sqrt_llvm` call, but for transparency and consistency with [`log`](@ref) we + spell out the datatype-dependent functions here. For other types, such as integers or dual numbers required for algorithmic differentiation, we fall back to the Julia built-in `sqrt` function after a check for negative arguments. Since these cases are not performance critical, the check for negativity does not hurt here From b8578dbe3a124d1b4521b5a7cf71184209de1144 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 18 Jan 2024 12:06:30 +0100 Subject: [PATCH 47/55] docstrings --- src/auxiliary/math.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index f5ec6407be3..1e7e30def33 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -38,7 +38,7 @@ end For other types, such as integers or dual numbers required for algorithmic differentiation, we fall back to the Julia built-in `sqrt` function after a check for negative arguments. Since these cases are not performance critical, the check for negativity does not hurt here - and can (as of now) optimized away by the compiler. + and can (as of now) even be optimized away by the compiler due to the implementation of `sqrt` in Julia. When debugging code, it might be useful to change the implementation of this function to redirect to the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated @@ -85,8 +85,7 @@ end they return `NaN` for negative arguments. For other types, such as integers or dual numbers required for algorithmic differentiation, we fall back to the Julia built-in `log` function after a check for negative arguments. - Since these cases are not performance critical, the check for negativity does not hurt here - and can (as of now) optimized away by the compiler. + Since these cases are not performance critical, the check for negativity does not hurt here. When debugging code, it might be useful to change the implementation of this function to redirect to the Julia built-in `log` function, as this reports the exact place in code where the domain is violated From ac94829465a4f3df57513a8226c9a9704b8a925a Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 18 Jan 2024 13:21:04 +0100 Subject: [PATCH 48/55] compat info --- Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Project.toml b/Project.toml index 75d139157c6..c384a0d6b7b 100644 --- a/Project.toml +++ b/Project.toml @@ -75,6 +75,7 @@ OffsetArrays = "1.3" P4est = "0.4.9" Polyester = "0.7.5" PrecompileTools = "1.1" +Preferences = "1" Printf = "1" RecipesBase = "1.1" Reexport = "1.0" @@ -95,6 +96,7 @@ TimerOutputs = "0.5.7" Triangulate = "2.0" TriplotBase = "0.1" TriplotRecipes = "0.1" +UUIDs = "1.6" julia = "1.8" [extras] From 0c7795c4fc7a95323eb5f545c02e9e30ddb154f9 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Fri, 19 Jan 2024 08:56:03 +0100 Subject: [PATCH 49/55] Apply suggestions from code review Co-authored-by: Hendrik Ranocha --- src/auxiliary/math.jl | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 1e7e30def33..67f71839c0d 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -8,22 +8,23 @@ const TRIXI_UUID = UUID("a7f1ee26-1774-49b1-8366-f1abc58fbfcb") """ - set_sqrt_type(type; force = true) + Trixi.set_sqrt_type(type; force = true) -Set the `type` of the square root function to be used in `Trixi.jl`. -The default is `sqrt_Trixi_NaN` which returns `NaN` for negative arguments instead of throwing an error. -Alternatively, you can set `type` to `sqrt_Base` to use the Julia built-in `sqrt` function +Set the `type` of the square root function to be used in Trixi.jl. +The default is `"sqrt_Trixi_NaN"` which returns `NaN` for negative arguments +instead of throwing an error. +Alternatively, you can set `type` to `"sqrt_Base"` to use the Julia built-in `sqrt` function which provides a stack-trace of the error which might come in handy when debugging code. """ function set_sqrt_type(type; force = true) - @assert type == "sqrt_Trixi_NaN"||type == "sqrt_Base" "Only allowed `sqrt` function types are `sqrt_Trixi_NaN` and `sqrt_Base`." + @assert type == "sqrt_Trixi_NaN"||type == "sqrt_Base" "Only allowed `sqrt` function types are `"sqrt_Trixi_NaN"` and `"sqrt_Base"`." set_preferences!(TRIXI_UUID, "sqrt" => type, force = force) - @info "Please restart Julia and reload Trixi.jl for the sqrt computation change to take effect" + @info "Please restart Julia and reload Trixi.jl for the `sqrt` computation change to take effect" end @static if _PREFERENCE_SQRT == "sqrt_Trixi_NaN" """ - sqrt(x::Real) + Trixi.sqrt(x::Real) Custom square root function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) @@ -43,6 +44,8 @@ end When debugging code, it might be useful to change the implementation of this function to redirect to the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated in the stacktrace. + + See also [`Trixi.set_sqrt_type`](@ref). """ @inline sqrt(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) @@ -53,27 +56,26 @@ end @inline sqrt(x::Float64) = ccall("llvm.sqrt.f64", llvmcall, Float64, (Float64,), x) @inline sqrt(x::Float32) = ccall("llvm.sqrt.f32", llvmcall, Float32, (Float32,), x) @inline sqrt(x::Float16) = ccall("llvm.sqrt.f16", llvmcall, Float16, (Float16,), x) -elseif _PREFERENCE_SQRT == "sqrt_Base" - @inline sqrt(x) = Base.sqrt(x) # For benchmarking and debugging (shows up in stacktrace) end """ - set_log_type(type; force = true) + Trixi.set_log_type(type; force = true) -Set the `type` of the (natural) `log` function to be used in `Trixi.jl`. -The default is `sqrt_Trixi_NaN` which returns `NaN` for negative arguments instead of throwing an error. -Alternatively, you can set `type` to `sqrt_Base` to use the Julia built-in `sqrt` function +Set the `type` of the (natural) `log` function to be used in Trixi.jl. +The default is `"sqrt_Trixi_NaN"` which returns `NaN` for negative arguments +instead of throwing an error. +Alternatively, you can set `type` to `"sqrt_Base"` to use the Julia built-in `sqrt` function which provides a stack-trace of the error which might come in handy when debugging code. """ function set_log_type(type; force = true) - @assert type == "log_Trixi_NaN"||type == "log_Base" "Only allowed log function types are `log_Trixi_NaN` and `log_Bases`." + @assert type == "log_Trixi_NaN"||type == "log_Base" "Only allowed log function types are `"log_Trixi_NaN"` and `"log_Base"`." set_preferences!(TRIXI_UUID, "log" => type, force = force) - @info "Please restart Julia and reload Trixi.jl for the log computation change to take effect" + @info "Please restart Julia and reload Trixi.jl for the `log` computation change to take effect" end @static if _PREFERENCE_LOG == "log_Trixi_NaN" """ - log(x::Real) + Trixi.log(x::Real) Custom natural logarithm function which returns `NaN` for negative arguments instead of throwing an error. This is required to ensure [correct results for multithreaded computations](https://github.com/trixi-framework/Trixi.jl/issues/1766) @@ -90,14 +92,14 @@ end When debugging code, it might be useful to change the implementation of this function to redirect to the Julia built-in `log` function, as this reports the exact place in code where the domain is violated in the stacktrace. + + See also [`Trixi.set_log_type`](@ref). """ @inline log(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) @inline log(x::Float64) = ccall("llvm.log.f64", llvmcall, Float64, (Float64,), x) @inline log(x::Float32) = ccall("llvm.log.f32", llvmcall, Float32, (Float32,), x) @inline log(x::Float16) = ccall("llvm.log.f16", llvmcall, Float16, (Float16,), x) -elseif _PREFERENCE_LOG == "log_Base" - @inline log(x) = Base.log(x) # For benchmarking and debugging (shows up in stacktrace) end """ From 35e0cf6ba5632eab604504b48d5055b1bb77acda Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 19 Jan 2024 09:07:52 +0100 Subject: [PATCH 50/55] escape " --- src/auxiliary/math.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 67f71839c0d..dfa917c6a92 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -17,7 +17,7 @@ Alternatively, you can set `type` to `"sqrt_Base"` to use the Julia built-in `sq which provides a stack-trace of the error which might come in handy when debugging code. """ function set_sqrt_type(type; force = true) - @assert type == "sqrt_Trixi_NaN"||type == "sqrt_Base" "Only allowed `sqrt` function types are `"sqrt_Trixi_NaN"` and `"sqrt_Base"`." + @assert type == "sqrt_Trixi_NaN"||type == "sqrt_Base" "Only allowed `sqrt` function types are `\"sqrt_Trixi_NaN\"` and `\"sqrt_Base`\"" set_preferences!(TRIXI_UUID, "sqrt" => type, force = force) @info "Please restart Julia and reload Trixi.jl for the `sqrt` computation change to take effect" end @@ -68,7 +68,7 @@ Alternatively, you can set `type` to `"sqrt_Base"` to use the Julia built-in `sq which provides a stack-trace of the error which might come in handy when debugging code. """ function set_log_type(type; force = true) - @assert type == "log_Trixi_NaN"||type == "log_Base" "Only allowed log function types are `"log_Trixi_NaN"` and `"log_Base"`." + @assert type == "log_Trixi_NaN"||type == "log_Base" "Only allowed log function types are `\"log_Trixi_NaN\"` and `\"log_Base\"`." set_preferences!(TRIXI_UUID, "log" => type, force = force) @info "Please restart Julia and reload Trixi.jl for the `log` computation change to take effect" end From 847c014d6b3fb379fae81c3b5019cff9d9b753a4 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 19 Jan 2024 09:23:44 +0100 Subject: [PATCH 51/55] fmt --- src/auxiliary/math.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index dfa917c6a92..49a2f68ef46 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -44,7 +44,7 @@ end When debugging code, it might be useful to change the implementation of this function to redirect to the Julia built-in `sqrt` function, as this reports the exact place in code where the domain is violated in the stacktrace. - + See also [`Trixi.set_sqrt_type`](@ref). """ @inline sqrt(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.sqrt(x) @@ -92,7 +92,7 @@ end When debugging code, it might be useful to change the implementation of this function to redirect to the Julia built-in `log` function, as this reports the exact place in code where the domain is violated in the stacktrace. - + See also [`Trixi.set_log_type`](@ref). """ @inline log(x::Real) = x < zero(x) ? oftype(x, NaN) : Base.log(x) From a920e51efb444cbd749dc108610aca5d2116997f Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Wed, 7 Feb 2024 07:16:24 +0100 Subject: [PATCH 52/55] fix benchmarks configuration --- benchmark/benchmarks.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index a3f7d1d2569..15d1d96c05f 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -55,5 +55,5 @@ let SUITE["latency"]["euler_2d"] = @benchmarkable run( `$(Base.julia_cmd()) -e 'using Trixi; trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_kelvin_helmholtz_instability.jl"), tspan=(0.0, 1.0e-10), save_restart=TrivialCallback(), save_solution=TrivialCallback())'`) seconds=60 SUITE["latency"]["mhd_2d"] = @benchmarkable run( - `$(Base.julia_cmd()) -e 'using Trixi; trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_mhd_blast_wave.jl"), tspan=(0.0, 1.0e-10), save_restart=TrivialCallback(), save_solution=TrivialCallback())'`) seconds=60 + `$(Base.julia_cmd()) -e 'using Trixi; trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_mhd_blast_wave.jl"), tspan=(0.0, 1.0e-10), save_solution=TrivialCallback())'`) seconds=60 end From c5eee3567ff1b458f0dba83840b81aece21121b3 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Thu, 22 Feb 2024 13:53:41 +0100 Subject: [PATCH 53/55] skip UUIDs in downgrade CI job --- .github/workflows/Downgrade.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Downgrade.yml b/.github/workflows/Downgrade.yml index c84b1026d1b..dd5d8ee7e32 100644 --- a/.github/workflows/Downgrade.yml +++ b/.github/workflows/Downgrade.yml @@ -72,7 +72,7 @@ jobs: - uses: julia-actions/cache@v1 - uses: julia-actions/julia-downgrade-compat@v1 with: - skip: LinearAlgebra,Printf,SparseArrays,DiffEqBase + skip: LinearAlgebra,Printf,SparseArrays,UUIDs,DiffEqBase projects: ., test - uses: julia-actions/julia-buildpkg@v1 env: From 3d0e108295dbd7836360170ff1d8eba7cee561fe Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Thu, 22 Feb 2024 14:36:16 +0100 Subject: [PATCH 54/55] Update src/auxiliary/math.jl Co-authored-by: Hendrik Ranocha --- src/auxiliary/math.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auxiliary/math.jl b/src/auxiliary/math.jl index 49a2f68ef46..9e3aaa181bf 100644 --- a/src/auxiliary/math.jl +++ b/src/auxiliary/math.jl @@ -17,7 +17,7 @@ Alternatively, you can set `type` to `"sqrt_Base"` to use the Julia built-in `sq which provides a stack-trace of the error which might come in handy when debugging code. """ function set_sqrt_type(type; force = true) - @assert type == "sqrt_Trixi_NaN"||type == "sqrt_Base" "Only allowed `sqrt` function types are `\"sqrt_Trixi_NaN\"` and `\"sqrt_Base`\"" + @assert type == "sqrt_Trixi_NaN"||type == "sqrt_Base" "Only allowed `sqrt` function types are `\"sqrt_Trixi_NaN\"` and `\"sqrt_Base\"`" set_preferences!(TRIXI_UUID, "sqrt" => type, force = force) @info "Please restart Julia and reload Trixi.jl for the `sqrt` computation change to take effect" end From fc22360d013c23533180e067a6d3f4a5246b37cc Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Thu, 22 Feb 2024 14:43:02 +0100 Subject: [PATCH 55/55] Update Project.toml Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 10c3d27a083..35ef93caa3a 100644 --- a/Project.toml +++ b/Project.toml @@ -78,7 +78,7 @@ OffsetArrays = "1.12" P4est = "0.4.9" Polyester = "0.7.5" PrecompileTools = "1.1" -Preferences = "1" +Preferences = "1.3" Printf = "1" RecipesBase = "1.1" Reexport = "1.0"