diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl index f5ef51c108a..c6ed07dcda1 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl @@ -17,10 +17,8 @@ A shock-bubble testcase for multicomponent Euler equations [arXiv: 1904.00972](https://arxiv.org/abs/1904.00972) """ function initial_condition_shock_bubble(x, t, - equations::CompressibleEulerMulticomponentEquations2D{ - 5, - 2 - }) + equations::CompressibleEulerMulticomponentEquations2D{5, + 2}) # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972 # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf # typical domain is rectangular, we change it to a square, as Trixi can only do squares 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 3159a2066ad..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 @@ -17,10 +17,8 @@ A shock-bubble testcase for multicomponent Euler equations [arXiv: 1904.00972](https://arxiv.org/abs/1904.00972) """ function initial_condition_shock_bubble(x, t, - equations::CompressibleEulerMulticomponentEquations2D{ - 5, - 2 - }) + equations::CompressibleEulerMulticomponentEquations2D{5, + 2}) # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972 # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf # typical domain is rectangular, we change it to a square, as Trixi can only do squares 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 7856c9bafbd..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 @@ -17,10 +17,8 @@ A shock-bubble testcase for multicomponent Euler equations [arXiv: 1904.00972](https://arxiv.org/abs/1904.00972) """ function initial_condition_shock_bubble(x, t, - equations::CompressibleEulerMulticomponentEquations2D{ - 5, - 2 - }) + equations::CompressibleEulerMulticomponentEquations2D{5, + 2}) # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972 # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf # typical domain is rectangular, we change it to a square, as Trixi can only do squares diff --git a/ext/TrixiMakieExt.jl b/ext/TrixiMakieExt.jl index 8cd7576a6e5..301a7656da9 100644 --- a/ext/TrixiMakieExt.jl +++ b/ext/TrixiMakieExt.jl @@ -29,9 +29,7 @@ import Trixi: iplot, iplot! # First some utilities # Given a reference plotting triangulation, this function generates a plotting triangulation for # the entire global mesh. The output can be plotted using `Makie.mesh`. -function global_plotting_triangulation_makie(pds::PlotDataSeries{ - <:PlotData2DTriangulated - }; +function global_plotting_triangulation_makie(pds::PlotDataSeries{<:PlotData2DTriangulated}; set_z_coordinate_zero = false) @unpack variable_id = pds pd = pds.plot_data @@ -61,8 +59,7 @@ end # Returns a list of `Makie.Point`s which can be used to plot the mesh, or a solution "wireframe" # (e.g., a plot of the mesh lines but with the z-coordinate equal to the value of the solution). -function convert_PlotData2D_to_mesh_Points(pds::PlotDataSeries{<:PlotData2DTriangulated - }; +function convert_PlotData2D_to_mesh_Points(pds::PlotDataSeries{<:PlotData2DTriangulated}; set_z_coordinate_zero = false) @unpack variable_id = pds pd = pds.plot_data diff --git a/src/auxiliary/precompile.jl b/src/auxiliary/precompile.jl index 7ed0e26b5ef..9cec502f6cb 100644 --- a/src/auxiliary/precompile.jl +++ b/src/auxiliary/precompile.jl @@ -186,8 +186,7 @@ function _precompile_manual_() Matrix{RealT}, # DerivativeMatrix #StaticArrays.SArray{Tuple{nnodes_,nnodes_},RealT,2,nnodes_^2}, - Matrix{RealT} - } + Matrix{RealT}} end function mortar_type_dgsem(RealT, nnodes_) @@ -197,8 +196,7 @@ function _precompile_manual_() Matrix{RealT}, # ReverseMatrix # StaticArrays.SArray{Tuple{nnodes_,nnodes_},RealT,2,nnodes_^2}, - Matrix{RealT} - } + Matrix{RealT}} end function analyzer_type_dgsem(RealT, nnodes_) @@ -208,8 +206,7 @@ function _precompile_manual_() # VectorT StaticArrays.SVector{nnodes_analysis, RealT}, # Vandermonde - Array{RealT, 2} - } + Array{RealT, 2}} end function adaptor_type_dgsem(RealT, nnodes_) @@ -242,8 +239,8 @@ function _precompile_manual_() @assert Base.precompile(Tuple{Core.kwftype(typeof(Trixi.Type)), NamedTuple{(:initial_refinement_level, :n_cells_max), Tuple{Int, Int}}, Type{TreeMesh}, - Tuple{RealT, RealT, RealT}, Tuple{RealT, RealT, RealT - }}) + Tuple{RealT, RealT, RealT}, + Tuple{RealT, RealT, RealT}}) end for TreeType in (SerialTree, ParallelTree), NDIMS in 1:3 @assert Base.precompile(Tuple{typeof(Trixi.initialize!), @@ -308,8 +305,8 @@ function _precompile_manual_() Base.precompile(Tuple{Type{LobattoLegendreBasis}, Int}) for RealT in (Float64,) Base.precompile(Tuple{Type{LobattoLegendreBasis}, RealT, Int}) - @assert Base.precompile(Tuple{typeof(Trixi.calc_dhat), Vector{RealT}, Vector{RealT} - }) + @assert Base.precompile(Tuple{typeof(Trixi.calc_dhat), Vector{RealT}, + Vector{RealT}}) @assert Base.precompile(Tuple{typeof(Trixi.calc_dsplit), Vector{RealT}, Vector{RealT}}) @assert Base.precompile(Tuple{typeof(Trixi.polynomial_derivative_matrix), @@ -332,10 +329,10 @@ function _precompile_manual_() @assert Base.precompile(Tuple{typeof(Trixi.calc_forward_lower), Int}) @assert Base.precompile(Tuple{typeof(Trixi.calc_reverse_upper), Int, Val{:gauss}}) @assert Base.precompile(Tuple{typeof(Trixi.calc_reverse_lower), Int, Val{:gauss}}) - @assert Base.precompile(Tuple{typeof(Trixi.calc_reverse_upper), Int, Val{:gauss_lobatto - }}) - @assert Base.precompile(Tuple{typeof(Trixi.calc_reverse_lower), Int, Val{:gauss_lobatto - }}) + @assert Base.precompile(Tuple{typeof(Trixi.calc_reverse_upper), Int, + Val{:gauss_lobatto}}) + @assert Base.precompile(Tuple{typeof(Trixi.calc_reverse_lower), Int, + Val{:gauss_lobatto}}) # Constructors: mortars, analyzers, adaptors for RealT in (Float64,), polydeg in 1:7 @@ -362,14 +359,12 @@ function _precompile_manual_() NamedTuple{(:interval, :save_final_restart), Tuple{Int, Bool}}, Type{SaveRestartCallback}}) @assert Base.precompile(Tuple{Core.kwftype(typeof(Trixi.Type)), - NamedTuple{ - (:interval, :save_initial_solution, + NamedTuple{(:interval, :save_initial_solution, :save_final_solution, :solution_variables), Tuple{Int, Bool, Bool, typeof(cons2cons)}}, Type{SaveSolutionCallback}}) @assert Base.precompile(Tuple{Core.kwftype(typeof(Trixi.Type)), - NamedTuple{ - (:interval, :save_initial_solution, + NamedTuple{(:interval, :save_initial_solution, :save_final_solution, :solution_variables), Tuple{Int, Bool, Bool, typeof(cons2prim)}}, Type{SaveSolutionCallback}}) @@ -385,8 +380,7 @@ function _precompile_manual_() # end # end @assert Base.precompile(Tuple{typeof(SummaryCallback)}) - @assert Base.precompile(Tuple{ - DiscreteCallback{typeof(Trixi.summary_callback), + @assert Base.precompile(Tuple{DiscreteCallback{typeof(Trixi.summary_callback), typeof(Trixi.summary_callback), typeof(Trixi.initialize_summary_callback), typeof(SciMLBase.FINALIZE_DEFAULT)}}) @@ -419,8 +413,8 @@ function _precompile_manual_() Trixi.ElementContainer2D{RealT, uEltype}}) @assert Base.precompile(Tuple{typeof(Trixi.init_mortars), Array{Int, 1}, TreeMesh{2, Trixi.SerialTree{2}}, - Trixi.ElementContainer2D{RealT, uEltype}, mortar_type - }) + Trixi.ElementContainer2D{RealT, uEltype}, + mortar_type}) @assert Base.precompile(Tuple{typeof(Trixi.save_mesh_file), TreeMesh{2, Trixi.SerialTree{2}}, String}) @@ -433,8 +427,8 @@ function _precompile_manual_() Trixi.ElementContainer2D{RealT, uEltype}}) @assert Base.precompile(Tuple{typeof(Trixi.init_mortars), Array{Int, 1}, TreeMesh{2, Trixi.ParallelTree{2}}, - Trixi.ElementContainer2D{RealT, uEltype}, mortar_type - }) + Trixi.ElementContainer2D{RealT, uEltype}, + mortar_type}) @assert Base.precompile(Tuple{typeof(Trixi.init_mpi_interfaces), Array{Int, 1}, TreeMesh{2, Trixi.ParallelTree{2}}, Trixi.ElementContainer2D{RealT, uEltype}}) @@ -450,8 +444,8 @@ function _precompile_manual_() Trixi.ElementContainer3D{RealT, uEltype}}) @assert Base.precompile(Tuple{typeof(Trixi.init_mortars), Array{Int, 1}, TreeMesh{3, Trixi.SerialTree{3}}, - Trixi.ElementContainer3D{RealT, uEltype}, mortar_type - }) + Trixi.ElementContainer3D{RealT, uEltype}, + mortar_type}) @assert Base.precompile(Tuple{typeof(Trixi.save_mesh_file), TreeMesh{3, Trixi.SerialTree{3}}, String}) end @@ -548,16 +542,10 @@ function _precompile_manual_() restart_callback_type}) for solution_variables in (cons2cons, cons2prim) - save_solution_callback_type = DiscreteCallback{ - SaveSolutionCallback{ - typeof(solution_variables) - }, - SaveSolutionCallback{ - typeof(solution_variables) - }, + save_solution_callback_type = DiscreteCallback{SaveSolutionCallback{typeof(solution_variables)}, + SaveSolutionCallback{typeof(solution_variables)}, typeof(Trixi.initialize!), - typeof(SciMLBase.FINALIZE_DEFAULT) - } + typeof(SciMLBase.FINALIZE_DEFAULT)} @assert Base.precompile(Tuple{typeof(show), Base.TTY, save_solution_callback_type}) @assert Base.precompile(Tuple{typeof(show), IOContext{Base.TTY}, diff --git a/src/callbacks_step/averaging.jl b/src/callbacks_step/averaging.jl index 8d2dcfeaefe..efa71af9b91 100644 --- a/src/callbacks_step/averaging.jl +++ b/src/callbacks_step/averaging.jl @@ -52,8 +52,7 @@ function Base.show(io::IO, ::MIME"text/plain", end function AveragingCallback(semi::SemidiscretizationHyperbolic{<:Any, - <:CompressibleEulerEquations2D - }, + <:CompressibleEulerEquations2D}, tspan; output_directory = "out", filename = "averaging.h5") mesh, equations, solver, cache = mesh_equations_solver_cache(semi) mean_values = initialize_mean_values(mesh, equations, solver, cache) diff --git a/src/callbacks_step/euler_acoustics_coupling.jl b/src/callbacks_step/euler_acoustics_coupling.jl index ea33175d0c5..52dc55befdc 100644 --- a/src/callbacks_step/euler_acoustics_coupling.jl +++ b/src/callbacks_step/euler_acoustics_coupling.jl @@ -34,8 +34,8 @@ the [`AveragingCallback`](@ref). A direct-hybrid method for aeroacoustic analysis [DOI: 10.18154/RWTH-2017-04082](https://doi.org/10.18154/RWTH-2017-04082) """ -mutable struct EulerAcousticsCouplingCallback{RealT <: Real, MeanValues, IntegratorEuler - } +mutable struct EulerAcousticsCouplingCallback{RealT <: Real, MeanValues, + IntegratorEuler} stepsize_callback_acoustics::StepsizeCallback{RealT} stepsize_callback_euler::StepsizeCallback{RealT} mean_values::MeanValues @@ -85,8 +85,7 @@ The mean values for the acoustic perturbation equations are read from `averaging """ function EulerAcousticsCouplingCallback(ode_euler, averaging_callback::DiscreteCallback{<:Any, - <:AveragingCallback - }, + <:AveragingCallback}, alg, cfl_acoustics::Real, cfl_euler::Real; kwargs...) @unpack mean_values = averaging_callback.affect! diff --git a/src/callbacks_step/glm_speed_dg.jl b/src/callbacks_step/glm_speed_dg.jl index 0686c547a34..302aae356ab 100644 --- a/src/callbacks_step/glm_speed_dg.jl +++ b/src/callbacks_step/glm_speed_dg.jl @@ -7,8 +7,8 @@ function calc_dt_for_cleaning_speed(cfl::Real, mesh, equations::Union{AbstractIdealGlmMhdEquations, - AbstractIdealGlmMhdMulticomponentEquations - }, dg::DG, cache) + AbstractIdealGlmMhdMulticomponentEquations}, + dg::DG, cache) # compute time step for GLM linear advection equation with c_h=1 for the DG discretization on # Cartesian meshes max_scaled_speed_for_c_h = maximum(cache.elements.inverse_jacobian) * @@ -20,8 +20,7 @@ end function calc_dt_for_cleaning_speed(cfl::Real, mesh, equations::Union{AbstractIdealGlmMhdEquations, - AbstractIdealGlmMhdMulticomponentEquations - }, + AbstractIdealGlmMhdMulticomponentEquations}, dg::DGMulti, cache) rd = dg.basis md = mesh.md diff --git a/src/callbacks_step/save_solution.jl b/src/callbacks_step/save_solution.jl index 0092360cb20..c106fe69bcd 100644 --- a/src/callbacks_step/save_solution.jl +++ b/src/callbacks_step/save_solution.jl @@ -39,8 +39,7 @@ end function Base.show(io::IO, cb::DiscreteCallback{<:Any, - <:PeriodicCallbackAffect{<:SaveSolutionCallback - }}) + <:PeriodicCallbackAffect{<:SaveSolutionCallback}}) @nospecialize cb # reduce precompilation time save_solution_callback = cb.affect!.affect! @@ -71,8 +70,7 @@ end function Base.show(io::IO, ::MIME"text/plain", cb::DiscreteCallback{<:Any, - <:PeriodicCallbackAffect{<:SaveSolutionCallback - }}) + <:PeriodicCallbackAffect{<:SaveSolutionCallback}}) @nospecialize cb # reduce precompilation time if get(io, :compact, false) diff --git a/src/callbacks_step/save_solution_dg.jl b/src/callbacks_step/save_solution_dg.jl index 7c015999035..350aee7336a 100644 --- a/src/callbacks_step/save_solution_dg.jl +++ b/src/callbacks_step/save_solution_dg.jl @@ -33,8 +33,7 @@ function save_solution_file(u, time, dt, timestep, # compute the solution variables via broadcasting, and reinterpret the # result as a plain array of floating point numbers data = Array(reinterpret(eltype(u), - solution_variables.(reinterpret(SVector{ - nvariables(equations), + solution_variables.(reinterpret(SVector{nvariables(equations), eltype(u)}, u), Ref(equations)))) @@ -116,8 +115,7 @@ function save_solution_file(u, time, dt, timestep, # compute the solution variables via broadcasting, and reinterpret the # result as a plain array of floating point numbers data = Array(reinterpret(eltype(u), - solution_variables.(reinterpret(SVector{ - nvariables(equations), + solution_variables.(reinterpret(SVector{nvariables(equations), eltype(u)}, u), Ref(equations)))) diff --git a/src/equations/compressible_euler_multicomponent_1d.jl b/src/equations/compressible_euler_multicomponent_1d.jl index 23ac222b976..8ddb0dcd08f 100644 --- a/src/equations/compressible_euler_multicomponent_1d.jl +++ b/src/equations/compressible_euler_multicomponent_1d.jl @@ -54,19 +54,15 @@ struct CompressibleEulerMulticomponentEquations1D{NVARS, NCOMP, RealT <: Real} < cv::SVector{NCOMP, RealT} cp::SVector{NCOMP, RealT} - function CompressibleEulerMulticomponentEquations1D{NVARS, NCOMP, RealT}(gammas::SVector{ - NCOMP, - RealT - }, - gas_constants::SVector{ - NCOMP, - RealT - }) where { - NVARS, - NCOMP, - RealT <: - Real - } + function CompressibleEulerMulticomponentEquations1D{NVARS, NCOMP, RealT}(gammas::SVector{NCOMP, + RealT}, + gas_constants::SVector{NCOMP, + RealT}) where { + NVARS, + NCOMP, + RealT <: + Real + } NCOMP >= 1 || throw(DimensionMismatch("`gammas` and `gas_constants` have to be filled with at least one value")) diff --git a/src/equations/compressible_euler_multicomponent_2d.jl b/src/equations/compressible_euler_multicomponent_2d.jl index ecd3bc80c0a..940d88b1aa5 100644 --- a/src/equations/compressible_euler_multicomponent_2d.jl +++ b/src/equations/compressible_euler_multicomponent_2d.jl @@ -58,19 +58,15 @@ struct CompressibleEulerMulticomponentEquations2D{NVARS, NCOMP, RealT <: Real} < cv::SVector{NCOMP, RealT} cp::SVector{NCOMP, RealT} - function CompressibleEulerMulticomponentEquations2D{NVARS, NCOMP, RealT}(gammas::SVector{ - NCOMP, - RealT - }, - gas_constants::SVector{ - NCOMP, - RealT - }) where { - NVARS, - NCOMP, - RealT <: - Real - } + function CompressibleEulerMulticomponentEquations2D{NVARS, NCOMP, RealT}(gammas::SVector{NCOMP, + RealT}, + gas_constants::SVector{NCOMP, + RealT}) where { + NVARS, + NCOMP, + RealT <: + Real + } NCOMP >= 1 || throw(DimensionMismatch("`gammas` and `gas_constants` have to be filled with at least one value")) diff --git a/src/equations/compressible_navier_stokes_1d.jl b/src/equations/compressible_navier_stokes_1d.jl index 73436c99b7c..d2c46ecc7d8 100644 --- a/src/equations/compressible_navier_stokes_1d.jl +++ b/src/equations/compressible_navier_stokes_1d.jl @@ -81,8 +81,7 @@ w_2 = \frac{\rho v1}{p},\, w_3 = -\frac{\rho}{p} ``` """ struct CompressibleNavierStokesDiffusion1D{GradientVariables, RealT <: Real, - E <: AbstractCompressibleEulerEquations{1} - } <: + E <: AbstractCompressibleEulerEquations{1}} <: AbstractCompressibleNavierStokesDiffusion{1, 3, GradientVariables} # TODO: parabolic # 1) For now save gamma and inv(gamma-1) again, but could potentially reuse them from the Euler equations @@ -130,14 +129,10 @@ end # we specialize this function to compute gradients of primitive variables instead of # conservative variables. -function gradient_variable_transformation(::CompressibleNavierStokesDiffusion1D{ - GradientVariablesPrimitive - }) +function gradient_variable_transformation(::CompressibleNavierStokesDiffusion1D{GradientVariablesPrimitive}) cons2prim end -function gradient_variable_transformation(::CompressibleNavierStokesDiffusion1D{ - GradientVariablesEntropy - }) +function gradient_variable_transformation(::CompressibleNavierStokesDiffusion1D{GradientVariablesEntropy}) cons2entropy end @@ -202,17 +197,13 @@ end # For CNS, it is simplest to formulate the viscous terms in primitive variables, so we transform the transformed # variables into primitive variables. @inline function convert_transformed_to_primitive(u_transformed, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesPrimitive}) return u_transformed end # TODO: parabolic. Make this more efficient! @inline function convert_transformed_to_primitive(u_transformed, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesEntropy}) # note: this uses CompressibleNavierStokesDiffusion1D versions of cons2prim and entropy2cons return cons2prim(entropy2cons(u_transformed, equations), equations) end @@ -223,17 +214,13 @@ end # Note, the first component of `gradient_entropy_vars` contains gradient(rho) which is unused. # TODO: parabolic; entropy stable viscous terms @inline function convert_derivative_to_primitive(u, gradient, - ::CompressibleNavierStokesDiffusion1D{ - GradientVariablesPrimitive - }) + ::CompressibleNavierStokesDiffusion1D{GradientVariablesPrimitive}) return gradient end # the first argument is always the "transformed" variables. @inline function convert_derivative_to_primitive(w, gradient_entropy_vars, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesEntropy}) # TODO: parabolic. This is inefficient to pass in transformed variables but then transform them back. # We can fix this if we directly compute v1, v2, T from the entropy variables @@ -272,9 +259,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesPrimitive}) v1 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) return SVector(u_inner[1], v1, u_inner[3]) @@ -288,9 +273,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesPrimitive}) # rho, v1, v2, _ = u_inner normal_heat_flux = boundary_condition.boundary_condition_heat_flux.boundary_value_normal_flux_function(x, t, @@ -310,9 +293,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesPrimitive}) v1 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) T = boundary_condition.boundary_condition_heat_flux.boundary_value_function(x, t, @@ -328,9 +309,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesPrimitive}) return flux_inner end @@ -350,9 +329,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesEntropy}) v1 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) negative_rho_inv_p = w_inner[3] # w_3 = -rho / p @@ -368,9 +345,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesEntropy}) normal_heat_flux = boundary_condition.boundary_condition_heat_flux.boundary_value_normal_flux_function(x, t, equations) @@ -389,9 +364,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesEntropy}) v1 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) T = boundary_condition.boundary_condition_heat_flux.boundary_value_function(x, t, @@ -410,9 +383,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion1D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion1D{GradientVariablesEntropy}) return SVector(flux_inner[1], flux_inner[2], flux_inner[3]) end end # @muladd diff --git a/src/equations/compressible_navier_stokes_2d.jl b/src/equations/compressible_navier_stokes_2d.jl index ad0db001872..5df7c01ca5c 100644 --- a/src/equations/compressible_navier_stokes_2d.jl +++ b/src/equations/compressible_navier_stokes_2d.jl @@ -81,8 +81,7 @@ w_2 = \frac{\rho v_1}{p},\, w_3 = \frac{\rho v_2}{p},\, w_4 = -\frac{\rho}{p} ``` """ struct CompressibleNavierStokesDiffusion2D{GradientVariables, RealT <: Real, - E <: AbstractCompressibleEulerEquations{2} - } <: + E <: AbstractCompressibleEulerEquations{2}} <: AbstractCompressibleNavierStokesDiffusion{2, 4, GradientVariables} # TODO: parabolic # 1) For now save gamma and inv(gamma-1) again, but could potentially reuse them from the Euler equations @@ -130,14 +129,10 @@ end # we specialize this function to compute gradients of primitive variables instead of # conservative variables. -function gradient_variable_transformation(::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) +function gradient_variable_transformation(::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) cons2prim end -function gradient_variable_transformation(::CompressibleNavierStokesDiffusion2D{ - GradientVariablesEntropy - }) +function gradient_variable_transformation(::CompressibleNavierStokesDiffusion2D{GradientVariablesEntropy}) cons2entropy end @@ -224,17 +219,13 @@ end # For CNS, it is simplest to formulate the viscous terms in primitive variables, so we transform the transformed # variables into primitive variables. @inline function convert_transformed_to_primitive(u_transformed, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) return u_transformed end # TODO: parabolic. Make this more efficient! @inline function convert_transformed_to_primitive(u_transformed, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesEntropy}) # note: this uses CompressibleNavierStokesDiffusion2D versions of cons2prim and entropy2cons return cons2prim(entropy2cons(u_transformed, equations), equations) end @@ -245,17 +236,13 @@ end # Note, the first component of `gradient_entropy_vars` contains gradient(rho) which is unused. # TODO: parabolic; entropy stable viscous terms @inline function convert_derivative_to_primitive(u, gradient, - ::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) + ::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) return gradient end # the first argument is always the "transformed" variables. @inline function convert_derivative_to_primitive(w, gradient_entropy_vars, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesEntropy}) # TODO: parabolic. This is inefficient to pass in transformed variables but then transform them back. # We can fix this if we directly compute v1, v2, T from the entropy variables @@ -310,9 +297,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) v1, v2 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) @@ -326,9 +311,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) # rho, v1, v2, _ = u_inner normal_heat_flux = boundary_condition.boundary_condition_heat_flux.boundary_value_normal_flux_function(x, t, @@ -348,9 +331,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) v1, v2 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) @@ -366,9 +347,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) return flux_inner end @@ -387,9 +366,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesEntropy}) v1, v2 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) @@ -406,9 +383,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesEntropy}) normal_heat_flux = boundary_condition.boundary_condition_heat_flux.boundary_value_normal_flux_function(x, t, equations) @@ -427,9 +402,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesEntropy}) v1, v2 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) @@ -448,9 +421,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesEntropy}) return SVector(flux_inner[1], flux_inner[2], flux_inner[3], flux_inner[4]) end @@ -461,9 +432,7 @@ end normal::AbstractVector, x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) # BCs are usually specified as conservative variables so we convert them to primitive variables # because the gradients are assumed to be with respect to the primitive variables u_boundary = boundary_condition.boundary_value_function(x, t, equations) @@ -476,9 +445,7 @@ end normal::AbstractVector, x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion2D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion2D{GradientVariablesPrimitive}) # for Dirichlet boundary conditions, we do not impose any conditions on the viscous fluxes return flux_inner end diff --git a/src/equations/compressible_navier_stokes_3d.jl b/src/equations/compressible_navier_stokes_3d.jl index c6a55983b53..e5567ae5789 100644 --- a/src/equations/compressible_navier_stokes_3d.jl +++ b/src/equations/compressible_navier_stokes_3d.jl @@ -81,8 +81,7 @@ w_2 = \frac{\rho v_1}{p},\, w_3 = \frac{\rho v_2}{p},\, w_4 = \frac{\rho v_3}{p} ``` """ struct CompressibleNavierStokesDiffusion3D{GradientVariables, RealT <: Real, - E <: AbstractCompressibleEulerEquations{3} - } <: + E <: AbstractCompressibleEulerEquations{3}} <: AbstractCompressibleNavierStokesDiffusion{3, 5, GradientVariables} # TODO: parabolic # 1) For now save gamma and inv(gamma-1) again, but could potentially reuse them from the Euler equations @@ -130,14 +129,10 @@ end # we specialize this function to compute gradients of primitive variables instead of # conservative variables. -function gradient_variable_transformation(::CompressibleNavierStokesDiffusion3D{ - GradientVariablesPrimitive - }) +function gradient_variable_transformation(::CompressibleNavierStokesDiffusion3D{GradientVariablesPrimitive}) cons2prim end -function gradient_variable_transformation(::CompressibleNavierStokesDiffusion3D{ - GradientVariablesEntropy - }) +function gradient_variable_transformation(::CompressibleNavierStokesDiffusion3D{GradientVariablesEntropy}) cons2entropy end @@ -250,17 +245,13 @@ end # For CNS, it is simplest to formulate the viscous terms in primitive variables, so we transform the transformed # variables into primitive variables. @inline function convert_transformed_to_primitive(u_transformed, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesPrimitive}) return u_transformed end # TODO: parabolic. Make this more efficient! @inline function convert_transformed_to_primitive(u_transformed, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesEntropy}) # note: this uses CompressibleNavierStokesDiffusion3D versions of cons2prim and entropy2cons return cons2prim(entropy2cons(u_transformed, equations), equations) end @@ -271,17 +262,13 @@ end # Note, the first component of `gradient_entropy_vars` contains gradient(rho) which is unused. # TODO: parabolic; entropy stable viscous terms @inline function convert_derivative_to_primitive(u, gradient, - ::CompressibleNavierStokesDiffusion3D{ - GradientVariablesPrimitive - }) + ::CompressibleNavierStokesDiffusion3D{GradientVariablesPrimitive}) return gradient end # the first argument is always the "transformed" variables. @inline function convert_derivative_to_primitive(w, gradient_entropy_vars, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesEntropy}) # TODO: parabolic. This is inefficient to pass in transformed variables but then transform them back. # We can fix this if we directly compute v1, v2, v3, T from the entropy variables @@ -342,9 +329,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesPrimitive}) v1, v2, v3 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) @@ -358,9 +343,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesPrimitive}) # rho, v1, v2, v3, _ = u_inner normal_heat_flux = boundary_condition.boundary_condition_heat_flux.boundary_value_normal_flux_function(x, t, @@ -381,9 +364,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesPrimitive}) v1, v2, v3 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) @@ -399,9 +380,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesPrimitive - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesPrimitive}) return flux_inner end @@ -420,9 +399,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesEntropy}) v1, v2, v3 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) @@ -439,9 +416,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesEntropy}) normal_heat_flux = boundary_condition.boundary_condition_heat_flux.boundary_value_normal_flux_function(x, t, equations) @@ -461,9 +436,7 @@ end x, t, operator_type::Gradient, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesEntropy}) v1, v2, v3 = boundary_condition.boundary_condition_velocity.boundary_value_function(x, t, equations) @@ -482,9 +455,7 @@ end x, t, operator_type::Divergence, - equations::CompressibleNavierStokesDiffusion3D{ - GradientVariablesEntropy - }) + equations::CompressibleNavierStokesDiffusion3D{GradientVariablesEntropy}) return SVector(flux_inner[1], flux_inner[2], flux_inner[3], flux_inner[4], flux_inner[5]) end diff --git a/src/equations/ideal_glm_mhd_multicomponent_1d.jl b/src/equations/ideal_glm_mhd_multicomponent_1d.jl index 0efa6426448..dad7c27e86c 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_1d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_1d.jl @@ -17,19 +17,15 @@ mutable struct IdealGlmMhdMulticomponentEquations1D{NVARS, NCOMP, RealT <: Real} cv::SVector{NCOMP, RealT} cp::SVector{NCOMP, RealT} - function IdealGlmMhdMulticomponentEquations1D{NVARS, NCOMP, RealT}(gammas::SVector{ - NCOMP, - RealT - }, - gas_constants::SVector{ - NCOMP, - RealT - }) where { - NVARS, - NCOMP, - RealT <: - Real - } + function IdealGlmMhdMulticomponentEquations1D{NVARS, NCOMP, RealT}(gammas::SVector{NCOMP, + RealT}, + gas_constants::SVector{NCOMP, + RealT}) where { + NVARS, + NCOMP, + RealT <: + Real + } NCOMP >= 1 || throw(DimensionMismatch("`gammas` and `gas_constants` have to be filled with at least one value")) diff --git a/src/equations/ideal_glm_mhd_multicomponent_2d.jl b/src/equations/ideal_glm_mhd_multicomponent_2d.jl index 9b0eeb411e8..a3a50c0485f 100644 --- a/src/equations/ideal_glm_mhd_multicomponent_2d.jl +++ b/src/equations/ideal_glm_mhd_multicomponent_2d.jl @@ -18,19 +18,15 @@ mutable struct IdealGlmMhdMulticomponentEquations2D{NVARS, NCOMP, RealT <: Real} cp::SVector{NCOMP, RealT} c_h::RealT # GLM cleaning speed - function IdealGlmMhdMulticomponentEquations2D{NVARS, NCOMP, RealT}(gammas::SVector{ - NCOMP, - RealT - }, - gas_constants::SVector{ - NCOMP, - RealT - }) where { - NVARS, - NCOMP, - RealT <: - Real - } + function IdealGlmMhdMulticomponentEquations2D{NVARS, NCOMP, RealT}(gammas::SVector{NCOMP, + RealT}, + gas_constants::SVector{NCOMP, + RealT}) where { + NVARS, + NCOMP, + RealT <: + Real + } NCOMP >= 1 || throw(DimensionMismatch("`gammas` and `gas_constants` have to be filled with at least one value")) diff --git a/src/equations/numerical_fluxes.jl b/src/equations/numerical_fluxes.jl index 43be04f745d..44d523b6e89 100644 --- a/src/equations/numerical_fluxes.jl +++ b/src/equations/numerical_fluxes.jl @@ -198,10 +198,7 @@ function max_abs_speed_naive end end const FluxLaxFriedrichs{MaxAbsSpeed} = FluxPlusDissipation{typeof(flux_central), - DissipationLocalLaxFriedrichs{ - MaxAbsSpeed - } - } + DissipationLocalLaxFriedrichs{MaxAbsSpeed}} """ FluxLaxFriedrichs(max_abs_speed=max_abs_speed_naive) diff --git a/src/meshes/unstructured_mesh.jl b/src/meshes/unstructured_mesh.jl index c370c0f25f8..fae52f834b3 100644 --- a/src/meshes/unstructured_mesh.jl +++ b/src/meshes/unstructured_mesh.jl @@ -15,8 +15,9 @@ An unstructured (possibly curved) quadrilateral mesh. All mesh information, neighbour coupling, and boundary curve information is read in from a mesh file `filename`. """ -mutable struct UnstructuredMesh2D{RealT <: Real, CurvedSurfaceT <: CurvedSurface{RealT} - } <: AbstractMesh{2} +mutable struct UnstructuredMesh2D{RealT <: Real, + CurvedSurfaceT <: CurvedSurface{RealT}} <: + AbstractMesh{2} filename :: String n_corners :: Int n_surfaces :: Int # total number of surfaces diff --git a/src/semidiscretization/semidiscretization_coupled.jl b/src/semidiscretization/semidiscretization_coupled.jl index 49763b12e5d..0941ae6a8ca 100644 --- a/src/semidiscretization/semidiscretization_coupled.jl +++ b/src/semidiscretization/semidiscretization_coupled.jl @@ -41,8 +41,9 @@ function SemidiscretizationCoupled(semis...) performance_counter = PerformanceCounter() - SemidiscretizationCoupled{typeof(semis), typeof(u_indices), typeof(performance_counter) - }(semis, u_indices, performance_counter) + SemidiscretizationCoupled{typeof(semis), typeof(u_indices), + typeof(performance_counter)}(semis, u_indices, + performance_counter) end function Base.show(io::IO, semi::SemidiscretizationCoupled) @@ -432,8 +433,7 @@ function allocate_coupled_boundary_condition(boundary_condition, direction, mesh end # In 2D -function allocate_coupled_boundary_condition(boundary_condition::BoundaryConditionCoupled{2 - }, +function allocate_coupled_boundary_condition(boundary_condition::BoundaryConditionCoupled{2}, direction, mesh, equations, dg::DGSEM) if direction in (1, 2) cell_size = size(mesh, 2) diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 9d465bfcc5f..7ebd758de37 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -29,17 +29,18 @@ struct SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, performance_counter::PerformanceCounter function SemidiscretizationHyperbolic{Mesh, Equations, InitialCondition, - BoundaryConditions, SourceTerms, Solver, Cache - }(mesh::Mesh, equations::Equations, - initial_condition::InitialCondition, - boundary_conditions::BoundaryConditions, - source_terms::SourceTerms, - solver::Solver, - cache::Cache) where {Mesh, Equations, - InitialCondition, - BoundaryConditions, - SourceTerms, Solver, - Cache} + BoundaryConditions, SourceTerms, Solver, + Cache}(mesh::Mesh, equations::Equations, + initial_condition::InitialCondition, + boundary_conditions::BoundaryConditions, + source_terms::SourceTerms, + solver::Solver, + cache::Cache) where {Mesh, Equations, + InitialCondition, + BoundaryConditions, + SourceTerms, + Solver, + Cache} @assert ndims(mesh) == ndims(equations) performance_counter = PerformanceCounter() @@ -268,8 +269,7 @@ end function print_boundary_conditions(io, semi::SemiHypMeshBCSolver{<:Any, - <:UnstructuredSortedBoundaryTypes - }) + <:UnstructuredSortedBoundaryTypes}) @unpack boundary_conditions = semi @unpack boundary_dictionary = boundary_conditions summary_line(io, "boundary conditions", length(boundary_dictionary)) @@ -289,8 +289,7 @@ function print_boundary_conditions(io, semi::SemiHypMeshBCSolver{<:Any, <:NamedT end function print_boundary_conditions(io, - semi::SemiHypMeshBCSolver{ - <:Union{TreeMesh, + semi::SemiHypMeshBCSolver{<:Union{TreeMesh, StructuredMesh}, <:Union{Tuple, NamedTuple, AbstractArray}}) diff --git a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl index 35340d65b1e..0f44941390a 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl @@ -45,30 +45,29 @@ struct SemidiscretizationHyperbolicParabolic{Mesh, Equations, EquationsParabolic BoundaryConditionsParabolic, SourceTerms, Solver, SolverParabolic, Cache, - CacheParabolic - }(mesh::Mesh, - equations::Equations, - equations_parabolic::EquationsParabolic, - initial_condition::InitialCondition, - boundary_conditions::BoundaryConditions, - boundary_conditions_parabolic::BoundaryConditionsParabolic, - source_terms::SourceTerms, - solver::Solver, - solver_parabolic::SolverParabolic, - cache::Cache, - cache_parabolic::CacheParabolic) where { - Mesh, - Equations, - EquationsParabolic, - InitialCondition, - BoundaryConditions, - BoundaryConditionsParabolic, - SourceTerms, - Solver, - SolverParabolic, - Cache, - CacheParabolic - } + CacheParabolic}(mesh::Mesh, + equations::Equations, + equations_parabolic::EquationsParabolic, + initial_condition::InitialCondition, + boundary_conditions::BoundaryConditions, + boundary_conditions_parabolic::BoundaryConditionsParabolic, + source_terms::SourceTerms, + solver::Solver, + solver_parabolic::SolverParabolic, + cache::Cache, + cache_parabolic::CacheParabolic) where { + Mesh, + Equations, + EquationsParabolic, + InitialCondition, + BoundaryConditions, + BoundaryConditionsParabolic, + SourceTerms, + Solver, + SolverParabolic, + Cache, + CacheParabolic + } @assert ndims(mesh) == ndims(equations) # Todo: assert nvariables(equations)==nvariables(equations_parabolic) diff --git a/src/solvers/dgmulti/flux_differencing.jl b/src/solvers/dgmulti/flux_differencing.jl index 884a8fac43b..36aa50dff4e 100644 --- a/src/solvers/dgmulti/flux_differencing.jl +++ b/src/solvers/dgmulti/flux_differencing.jl @@ -88,8 +88,8 @@ end # Version for sparse operators and symmetric fluxes @inline function hadamard_sum!(du, - A::LinearAlgebra.Adjoint{<:Any, <:AbstractSparseMatrixCSC - }, + A::LinearAlgebra.Adjoint{<:Any, + <:AbstractSparseMatrixCSC}, flux_is_symmetric::True, volume_flux, orientation_or_normal_direction, u, equations) A_base = parent(A) # the adjoint of a SparseMatrixCSC is basically a SparseMatrixCSR @@ -122,8 +122,8 @@ end # Version for sparse operators and symmetric fluxes with curved meshes @inline function hadamard_sum!(du, - A::LinearAlgebra.Adjoint{<:Any, <:AbstractSparseMatrixCSC - }, + A::LinearAlgebra.Adjoint{<:Any, + <:AbstractSparseMatrixCSC}, flux_is_symmetric::True, volume_flux, normal_directions::AbstractVector{<:AbstractVector}, u, equations) @@ -161,8 +161,8 @@ end # TODO: DGMulti. Fix for curved meshes. # Version for sparse operators and non-symmetric fluxes @inline function hadamard_sum!(du, - A::LinearAlgebra.Adjoint{<:Any, <:AbstractSparseMatrixCSC - }, + A::LinearAlgebra.Adjoint{<:Any, + <:AbstractSparseMatrixCSC}, flux_is_symmetric::False, volume_flux, normal_direction::AbstractVector, u, equations) A_base = parent(A) # the adjoint of a SparseMatrixCSC is basically a SparseMatrixCSR diff --git a/src/solvers/dgmulti/flux_differencing_gauss_sbp.jl b/src/solvers/dgmulti/flux_differencing_gauss_sbp.jl index 2c5505cc4e9..9059caf87f6 100644 --- a/src/solvers/dgmulti/flux_differencing_gauss_sbp.jl +++ b/src/solvers/dgmulti/flux_differencing_gauss_sbp.jl @@ -380,9 +380,8 @@ function create_cache(mesh::DGMultiMesh, equations, # specialized operators to perform tensor product interpolation to faces for Gauss nodes interp_matrix_gauss_to_face = TensorProductGaussFaceOperator(Interpolation(), dg) - projection_matrix_gauss_to_face = TensorProductGaussFaceOperator(Projection{ - Static.False() - }(), dg) + projection_matrix_gauss_to_face = TensorProductGaussFaceOperator(Projection{Static.False()}(), + dg) # `LIFT` matrix for Gauss nodes - this is equivalent to `projection_matrix_gauss_to_face` scaled by `diagm(rd.wf)`, # where `rd.wf` are Gauss node face quadrature weights. diff --git a/src/solvers/dgmulti/sbp.jl b/src/solvers/dgmulti/sbp.jl index d434d3146ce..232555e18b5 100644 --- a/src/solvers/dgmulti/sbp.jl +++ b/src/solvers/dgmulti/sbp.jl @@ -40,26 +40,28 @@ end const DGMultiPeriodicFDSBP{NDIMS, ApproxType, ElemType} = DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, - VolumeIntegral - } where {NDIMS, ElemType, - ApproxType <: - SummationByPartsOperators.AbstractPeriodicDerivativeOperator, - SurfaceIntegral, - VolumeIntegral} + VolumeIntegral} where { + NDIMS, + ElemType, + ApproxType <: + SummationByPartsOperators.AbstractPeriodicDerivativeOperator, + SurfaceIntegral, + VolumeIntegral + } const DGMultiFluxDiffPeriodicFDSBP{NDIMS, ApproxType, ElemType} = DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, - VolumeIntegral - } where {NDIMS, - ElemType, - ApproxType <: - SummationByPartsOperators.AbstractPeriodicDerivativeOperator, - SurfaceIntegral <: - SurfaceIntegralWeakForm, - VolumeIntegral <: - VolumeIntegralFluxDifferencing - } + VolumeIntegral} where { + NDIMS, + ElemType, + ApproxType <: + SummationByPartsOperators.AbstractPeriodicDerivativeOperator, + SurfaceIntegral <: + SurfaceIntegralWeakForm, + VolumeIntegral <: + VolumeIntegralFluxDifferencing + } """ DGMultiMesh(dg::DGMulti) diff --git a/src/solvers/dgmulti/types.jl b/src/solvers/dgmulti/types.jl index ae1eed7fd52..813bc67061e 100644 --- a/src/solvers/dgmulti/types.jl +++ b/src/solvers/dgmulti/types.jl @@ -4,49 +4,46 @@ # `DGMulti` refers to both multiple DG types (polynomial/SBP, simplices/quads/hexes) as well as # the use of multi-dimensional operators in the solver. -const DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral} = DG{ - <:RefElemData{ - NDIMS, +const DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral} = DG{<:RefElemData{NDIMS, ElemType, - ApproxType - }, + ApproxType}, Mortar, SurfaceIntegral, - VolumeIntegral - } where { - Mortar - } + VolumeIntegral} where { + Mortar + } # Type aliases. The first parameter is `ApproxType` since it is more commonly used for dispatch. const DGMultiWeakForm{ApproxType, ElemType} = DGMulti{NDIMS, ElemType, ApproxType, <:SurfaceIntegralWeakForm, - <:VolumeIntegralWeakForm - } where {NDIMS} + <:VolumeIntegralWeakForm} where {NDIMS + } const DGMultiFluxDiff{ApproxType, ElemType} = DGMulti{NDIMS, ElemType, ApproxType, <:SurfaceIntegralWeakForm, - <:Union{ - VolumeIntegralFluxDifferencing, - VolumeIntegralShockCapturingHG - }} where {NDIMS} + <:Union{VolumeIntegralFluxDifferencing, + VolumeIntegralShockCapturingHG}} where { + NDIMS + } const DGMultiFluxDiffSBP{ApproxType, ElemType} = DGMulti{NDIMS, ElemType, ApproxType, <:SurfaceIntegralWeakForm, - <:Union{ - VolumeIntegralFluxDifferencing, - VolumeIntegralShockCapturingHG - } - } where {NDIMS, - ApproxType <: Union{SBP, - AbstractDerivativeOperator - }} + <:Union{VolumeIntegralFluxDifferencing, + VolumeIntegralShockCapturingHG}} where { + NDIMS, + ApproxType <: + Union{SBP, + AbstractDerivativeOperator} + } const DGMultiSBP{ApproxType, ElemType} = DGMulti{NDIMS, ElemType, ApproxType, - SurfaceIntegral, VolumeIntegral - } where {NDIMS, ElemType, - ApproxType <: Union{SBP, - AbstractDerivativeOperator}, - SurfaceIntegral, VolumeIntegral} + SurfaceIntegral, + VolumeIntegral} where {NDIMS, ElemType, + ApproxType <: + Union{SBP, + AbstractDerivativeOperator}, + SurfaceIntegral, + VolumeIntegral} # By default, Julia/LLVM does not use fused multiply-add operations (FMAs). # Since these FMAs can increase the performance of many numerical algorithms, diff --git a/src/solvers/dgsem/basis_lobatto_legendre.jl b/src/solvers/dgsem/basis_lobatto_legendre.jl index 1b4e5446e44..6a92fd1c066 100644 --- a/src/solvers/dgsem/basis_lobatto_legendre.jl +++ b/src/solvers/dgsem/basis_lobatto_legendre.jl @@ -188,9 +188,9 @@ function MortarL2(basis::LobattoLegendreBasis) reverse_upper = Matrix{RealT}(reverse_upper_) reverse_lower = Matrix{RealT}(reverse_lower_) - LobattoLegendreMortarL2{RealT, nnodes_, typeof(forward_upper), typeof(reverse_upper) - }(forward_upper, forward_lower, - reverse_upper, reverse_lower) + LobattoLegendreMortarL2{RealT, nnodes_, typeof(forward_upper), + typeof(reverse_upper)}(forward_upper, forward_lower, + reverse_upper, reverse_lower) end function Base.show(io::IO, mortar::LobattoLegendreMortarL2) diff --git a/src/solvers/dgsem_p4est/containers.jl b/src/solvers/dgsem_p4est/containers.jl index 5fe68e06710..f9830d0011c 100644 --- a/src/solvers/dgsem_p4est/containers.jl +++ b/src/solvers/dgsem_p4est/containers.jl @@ -454,8 +454,7 @@ mutable struct InitSurfacesIterFaceUserData{Interfaces, Mortars, Boundaries, Mes end function InitSurfacesIterFaceUserData(interfaces, mortars, boundaries, mesh) - return InitSurfacesIterFaceUserData{ - typeof(interfaces), typeof(mortars), + return InitSurfacesIterFaceUserData{typeof(interfaces), typeof(mortars), typeof(boundaries), typeof(mesh)}(interfaces, 1, mortars, 1, boundaries, 1, diff --git a/src/solvers/dgsem_p4est/containers_parallel.jl b/src/solvers/dgsem_p4est/containers_parallel.jl index e7ee1f81478..7c7bd868457 100644 --- a/src/solvers/dgsem_p4est/containers_parallel.jl +++ b/src/solvers/dgsem_p4est/containers_parallel.jl @@ -266,8 +266,7 @@ end function ParallelInitSurfacesIterFaceUserData(interfaces, mortars, boundaries, mpi_interfaces, mpi_mortars, mesh) - return ParallelInitSurfacesIterFaceUserData{ - typeof(interfaces), typeof(mortars), + return ParallelInitSurfacesIterFaceUserData{typeof(interfaces), typeof(mortars), typeof(boundaries), typeof(mpi_interfaces), typeof(mpi_mortars), typeof(mesh)}(interfaces, diff --git a/src/solvers/dgsem_p4est/containers_parallel_2d.jl b/src/solvers/dgsem_p4est/containers_parallel_2d.jl index 8c39e4a69c8..d531d33821b 100644 --- a/src/solvers/dgsem_p4est/containers_parallel_2d.jl +++ b/src/solvers/dgsem_p4est/containers_parallel_2d.jl @@ -6,9 +6,7 @@ #! format: noindent # Initialize node_indices of MPI interface container -@inline function init_mpi_interface_node_indices!(mpi_interfaces::P4estMPIInterfaceContainer{ - 2 - }, +@inline function init_mpi_interface_node_indices!(mpi_interfaces::P4estMPIInterfaceContainer{2}, faces, local_side, orientation, mpi_interface_id) # Align interface in positive coordinate direction of primary element. diff --git a/src/solvers/dgsem_p4est/containers_parallel_3d.jl b/src/solvers/dgsem_p4est/containers_parallel_3d.jl index be4e2bfbfc9..56f0a543b97 100644 --- a/src/solvers/dgsem_p4est/containers_parallel_3d.jl +++ b/src/solvers/dgsem_p4est/containers_parallel_3d.jl @@ -6,9 +6,7 @@ #! format: noindent # Initialize node_indices of MPI interface container -@inline function init_mpi_interface_node_indices!(mpi_interfaces::P4estMPIInterfaceContainer{ - 3 - }, +@inline function init_mpi_interface_node_indices!(mpi_interfaces::P4estMPIInterfaceContainer{3}, faces, local_side, orientation, mpi_interface_id) # Align interface at the primary element (primary element has surface indices (:i_forward, :j_forward)). diff --git a/src/solvers/dgsem_p4est/dg_2d_parabolic.jl b/src/solvers/dgsem_p4est/dg_2d_parabolic.jl index 9dd10df16ae..a7f3345168f 100644 --- a/src/solvers/dgsem_p4est/dg_2d_parabolic.jl +++ b/src/solvers/dgsem_p4est/dg_2d_parabolic.jl @@ -803,8 +803,7 @@ end function calc_boundary_flux_gradients!(cache, t, boundary_condition::Union{BoundaryConditionPeriodic, - BoundaryConditionDoNothing - }, + BoundaryConditionDoNothing}, mesh::P4estMesh, equations, surface_integral, dg::DG) @assert isempty(eachboundary(dg, cache)) end diff --git a/src/solvers/dgsem_p4est/dg_parallel.jl b/src/solvers/dgsem_p4est/dg_parallel.jl index 324bc7f3cd6..712ede2bfce 100644 --- a/src/solvers/dgsem_p4est/dg_parallel.jl +++ b/src/solvers/dgsem_p4est/dg_parallel.jl @@ -342,8 +342,7 @@ function InitNeighborRankConnectivityIterFaceUserData(mpi_interfaces, mpi_mortar global_mortar_ids = fill(-1, nmpimortars(mpi_mortars)) neighbor_ranks_mortar = Vector{Vector{Int}}(undef, nmpimortars(mpi_mortars)) - return InitNeighborRankConnectivityIterFaceUserData{ - typeof(mpi_interfaces), + return InitNeighborRankConnectivityIterFaceUserData{typeof(mpi_interfaces), typeof(mpi_mortars), typeof(mesh)}(mpi_interfaces, 1, global_interface_ids, diff --git a/src/solvers/dgsem_structured/containers.jl b/src/solvers/dgsem_structured/containers.jl index 41eabf7c6bf..8adf005b782 100644 --- a/src/solvers/dgsem_structured/containers.jl +++ b/src/solvers/dgsem_structured/containers.jl @@ -5,8 +5,8 @@ @muladd begin #! format: noindent -struct ElementContainer{NDIMS, RealT <: Real, uEltype <: Real, NDIMSP1, NDIMSP2, NDIMSP3 - } +struct ElementContainer{NDIMS, RealT <: Real, uEltype <: Real, NDIMSP1, NDIMSP2, + NDIMSP3} # Physical coordinates at each node node_coordinates::Array{RealT, NDIMSP2} # [orientation, node_i, node_j, node_k, element] # ID of neighbor element in negative direction in orientation diff --git a/src/solvers/dgsem_tree/dg_1d_parabolic.jl b/src/solvers/dgsem_tree/dg_1d_parabolic.jl index 90007b05b3d..0017f9ca88e 100644 --- a/src/solvers/dgsem_tree/dg_1d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_1d_parabolic.jl @@ -290,10 +290,8 @@ function calc_boundary_flux_gradients!(cache, t, 2, firsts[2], lasts[2]) end -function calc_boundary_flux_by_direction_gradient!(surface_flux_values::AbstractArray{ - <:Any, - 3 - }, +function calc_boundary_flux_by_direction_gradient!(surface_flux_values::AbstractArray{<:Any, + 3}, t, boundary_condition, equations_parabolic::AbstractEquationsParabolic, @@ -358,10 +356,8 @@ function calc_boundary_flux_divergence!(cache, t, dg, cache, 2, firsts[2], lasts[2]) end -function calc_boundary_flux_by_direction_divergence!(surface_flux_values::AbstractArray{ - <:Any, - 3 - }, +function calc_boundary_flux_by_direction_divergence!(surface_flux_values::AbstractArray{<:Any, + 3}, t, boundary_condition, equations_parabolic::AbstractEquationsParabolic, diff --git a/src/solvers/dgsem_tree/dg_2d.jl b/src/solvers/dgsem_tree/dg_2d.jl index 7ecf4c00032..547ed352ef3 100644 --- a/src/solvers/dgsem_tree/dg_2d.jl +++ b/src/solvers/dgsem_tree/dg_2d.jl @@ -391,8 +391,8 @@ end @inline function fv_kernel!(du, u, mesh::Union{TreeMesh{2}, StructuredMesh{2}, - UnstructuredMesh2D, P4estMesh{2}, T8codeMesh{2} - }, + UnstructuredMesh2D, P4estMesh{2}, + T8codeMesh{2}}, nonconservative_terms, equations, volume_flux_fv, dg::DGSEM, cache, element, alpha = true) @unpack fstar1_L_threaded, fstar1_R_threaded, fstar2_L_threaded, fstar2_R_threaded = cache diff --git a/src/solvers/dgsem_tree/dg_2d_parabolic.jl b/src/solvers/dgsem_tree/dg_2d_parabolic.jl index 06abff5e85b..3083ae30680 100644 --- a/src/solvers/dgsem_tree/dg_2d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_2d_parabolic.jl @@ -384,10 +384,8 @@ function calc_boundary_flux_gradients!(cache, t, cache, 4, firsts[4], lasts[4]) end -function calc_boundary_flux_by_direction_gradient!(surface_flux_values::AbstractArray{ - <:Any, - 4 - }, +function calc_boundary_flux_by_direction_gradient!(surface_flux_values::AbstractArray{<:Any, + 4}, t, boundary_condition, equations_parabolic::AbstractEquationsParabolic, @@ -464,10 +462,8 @@ function calc_boundary_flux_divergence!(cache, t, dg, cache, 4, firsts[4], lasts[4]) end -function calc_boundary_flux_by_direction_divergence!(surface_flux_values::AbstractArray{ - <:Any, - 4 - }, +function calc_boundary_flux_by_direction_divergence!(surface_flux_values::AbstractArray{<:Any, + 4}, t, boundary_condition, equations_parabolic::AbstractEquationsParabolic, diff --git a/src/solvers/dgsem_tree/dg_3d.jl b/src/solvers/dgsem_tree/dg_3d.jl index 3364187e93c..0955dc38655 100644 --- a/src/solvers/dgsem_tree/dg_3d.jl +++ b/src/solvers/dgsem_tree/dg_3d.jl @@ -209,8 +209,8 @@ function rhs!(du, u, t, end function calc_volume_integral!(du, u, - mesh::Union{TreeMesh{3}, StructuredMesh{3}, P4estMesh{3} - }, + mesh::Union{TreeMesh{3}, StructuredMesh{3}, + P4estMesh{3}}, nonconservative_terms, equations, volume_integral::VolumeIntegralWeakForm, dg::DGSEM, cache) @@ -264,8 +264,8 @@ See also https://github.com/trixi-framework/Trixi.jl/issues/1671#issuecomment-17 end function calc_volume_integral!(du, u, - mesh::Union{TreeMesh{3}, StructuredMesh{3}, P4estMesh{3} - }, + mesh::Union{TreeMesh{3}, StructuredMesh{3}, + P4estMesh{3}}, nonconservative_terms, equations, volume_integral::VolumeIntegralFluxDifferencing, dg::DGSEM, cache) @@ -378,8 +378,8 @@ end # TODO: Taal dimension agnostic function calc_volume_integral!(du, u, - mesh::Union{TreeMesh{3}, StructuredMesh{3}, P4estMesh{3} - }, + mesh::Union{TreeMesh{3}, StructuredMesh{3}, + P4estMesh{3}}, nonconservative_terms, equations, volume_integral::VolumeIntegralShockCapturingHG, dg::DGSEM, cache) diff --git a/src/solvers/dgsem_tree/dg_3d_parabolic.jl b/src/solvers/dgsem_tree/dg_3d_parabolic.jl index 2561c5fe5b0..9ad28c6aa8e 100644 --- a/src/solvers/dgsem_tree/dg_3d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_3d_parabolic.jl @@ -454,10 +454,8 @@ function calc_boundary_flux_gradients!(cache, t, 6, firsts[6], lasts[6]) end -function calc_boundary_flux_by_direction_gradient!(surface_flux_values::AbstractArray{ - <:Any, - 5 - }, +function calc_boundary_flux_by_direction_gradient!(surface_flux_values::AbstractArray{<:Any, + 5}, t, boundary_condition, equations_parabolic::AbstractEquationsParabolic, @@ -546,10 +544,8 @@ function calc_boundary_flux_divergence!(cache, t, dg, cache, 6, firsts[6], lasts[6]) end -function calc_boundary_flux_by_direction_divergence!(surface_flux_values::AbstractArray{ - <:Any, - 5 - }, +function calc_boundary_flux_by_direction_divergence!(surface_flux_values::AbstractArray{<:Any, + 5}, t, boundary_condition, equations_parabolic::AbstractEquationsParabolic, diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index 4006932352e..dff87bfe06c 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -29,8 +29,8 @@ end # full FV element. # # TODO: TrixiShallowWater: move new indicator type -function (indicator_hg::IndicatorHennemannGassnerShallowWater)(u::AbstractArray{<:Any, 3 - }, +function (indicator_hg::IndicatorHennemannGassnerShallowWater)(u::AbstractArray{<:Any, + 3}, mesh, equations::ShallowWaterEquations1D, dg::DGSEM, cache; diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index 8333bb515d3..fa8ed481eb9 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -33,8 +33,8 @@ end # full FV element. # # TODO: TrixiShallowWater: move new indicator type -function (indicator_hg::IndicatorHennemannGassnerShallowWater)(u::AbstractArray{<:Any, 4 - }, +function (indicator_hg::IndicatorHennemannGassnerShallowWater)(u::AbstractArray{<:Any, + 4}, mesh, equations::ShallowWaterEquations2D, dg::DGSEM, cache; diff --git a/src/solvers/dgsem_tree/subcell_limiters_2d.jl b/src/solvers/dgsem_tree/subcell_limiters_2d.jl index bc69e55f264..384f4178bc9 100644 --- a/src/solvers/dgsem_tree/subcell_limiters_2d.jl +++ b/src/solvers/dgsem_tree/subcell_limiters_2d.jl @@ -8,10 +8,9 @@ # this method is used when the limiter is constructed as for shock-capturing volume integrals function create_cache(limiter::Type{SubcellLimiterIDP}, equations::AbstractEquations{2}, basis::LobattoLegendreBasis, bound_keys) - subcell_limiter_coefficients = Trixi.ContainerSubcellLimiterIDP2D{real(basis) - }(0, - nnodes(basis), - bound_keys) + subcell_limiter_coefficients = Trixi.ContainerSubcellLimiterIDP2D{real(basis)}(0, + nnodes(basis), + bound_keys) # Memory for bounds checking routine with `BoundsCheckCallback`. # The first entry of each vector contains the maximum deviation since the last export. diff --git a/src/visualization/recipes_plots.jl b/src/visualization/recipes_plots.jl index d15f7e542e1..0e9b5a66a8d 100644 --- a/src/visualization/recipes_plots.jl +++ b/src/visualization/recipes_plots.jl @@ -57,11 +57,8 @@ end # Visualize the mesh in a 2D plot # # Note: This is an experimental feature and may be changed in future releases without notice. -RecipesBase.@recipe function f(pm::PlotMesh{ - <:PlotData2DCartesian{<:Any, - <:AbstractVector{ - <:AbstractVector - }}}) +RecipesBase.@recipe function f(pm::PlotMesh{<:PlotData2DCartesian{<:Any, + <:AbstractVector{<:AbstractVector}}}) @unpack plot_data = pm @unpack x, y, mesh_vertices_x, mesh_vertices_y = plot_data diff --git a/test/test_tree_3d_fdsbp.jl b/test/test_tree_3d_fdsbp.jl index 16508df300e..e0e2bfe4b88 100644 --- a/test/test_tree_3d_fdsbp.jl +++ b/test/test_tree_3d_fdsbp.jl @@ -32,8 +32,8 @@ end xmax = 1.0, N = 10) @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_extended.jl"), - l2=[1.3819894522373702e-8], - linf=[3.381866298113323e-8], + l2=[5.228248923012878e-9], + linf=[9.24430243465224e-9], D_SBP=D, initial_refinement_level=0, tspan=(0.0, 5.0))