diff --git a/src/callbacks_step/amr_dg2d.jl b/src/callbacks_step/amr_dg2d.jl index 5b36f22c82e..6395a9f348f 100644 --- a/src/callbacks_step/amr_dg2d.jl +++ b/src/callbacks_step/amr_dg2d.jl @@ -151,8 +151,9 @@ function refine!(u_ode::AbstractVector, adaptor, mesh::Union{TreeMesh{2}, TreeMe # Sanity check if mesh isa TreeMesh && isperiodic(mesh.tree) && nmortars(cache.mortars) == 0 && - !mpi_isparallel() - @assert ninterfaces(cache_parabolic.interfaces)==ndims(mesh) * nelements(dg, cache_parabolic) ("For $(ndims(mesh))D and periodic domains and conforming elements, the number of interfaces must be $(ndims(mesh)) times the number of elements") + !mpi_isparallel() + @assert ninterfaces(cache_parabolic.interfaces)==ndims(mesh) * + nelements(dg, cache_parabolic) ("For $(ndims(mesh))D and periodic domains and conforming elements, the number of interfaces must be $(ndims(mesh)) times the number of elements") end return nothing @@ -312,8 +313,9 @@ function coarsen!(u_ode::AbstractVector, adaptor, mesh::Union{TreeMesh{2}, TreeM # Sanity check if mesh isa TreeMesh && isperiodic(mesh.tree) && nmortars(cache.mortars) == 0 && - !mpi_isparallel() - @assert ninterfaces(cache_parabolic.interfaces)==ndims(mesh) * nelements(dg, cache_parabolic) ("For $(ndims(mesh))D and periodic domains and conforming elements, the number of interfaces must be $(ndims(mesh)) times the number of elements") + !mpi_isparallel() + @assert ninterfaces(cache_parabolic.interfaces)==ndims(mesh) * + nelements(dg, cache_parabolic) ("For $(ndims(mesh))D and periodic domains and conforming elements, the number of interfaces must be $(ndims(mesh)) times the number of elements") end return nothing diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index 6d9ad996973..cef5a268c82 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -975,7 +975,7 @@ end @inline function v1(u, equations::CompressibleEulerEquations1D) rho, rho_v1, _ = u - return rho_v1/rho + return rho_v1 / rho end # Calculate thermodynamic entropy for a conservative state `cons` diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index ccc208d911d..d61bba8e6a6 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1430,12 +1430,12 @@ end @inline function v1(u, equations::CompressibleEulerEquations2D) rho, rho_v1, _, _ = u - return rho_v1/rho + return rho_v1 / rho end @inline function v2(u, equations::CompressibleEulerEquations2D) rho, _, rho_v2, _ = u - return rho_v2/rho + return rho_v2 / rho end # Calculates the entropy flux in direction "orientation" and the entropy variables for a state cons diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 357851a18d7..af746c37025 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1516,17 +1516,17 @@ end @inline function v1(u, equations::CompressibleEulerEquations3D) rho, rho_v1, _, _, _ = u - return rho_v1/rho + return rho_v1 / rho end @inline function v2(u, equations::CompressibleEulerEquations3D) rho, _, rho_v2, _, _ = u - return rho_v2/rho + return rho_v2 / rho end @inline function v3(u, equations::CompressibleEulerEquations3D) rho, _, _, rho_v3, _ = u - return rho_v3/rho + return rho_v3 / rho end # Calculate thermodynamic entropy for a conservative state `u` diff --git a/src/solvers/dgsem_tree/container_viscous_1d.jl b/src/solvers/dgsem_tree/container_viscous_1d.jl index 3f9943aea1c..71c68dfc6df 100644 --- a/src/solvers/dgsem_tree/container_viscous_1d.jl +++ b/src/solvers/dgsem_tree/container_viscous_1d.jl @@ -20,8 +20,8 @@ mutable struct ViscousContainer1D{uEltype <: Real} end function init_viscous_container_1d(n_vars::Integer, n_nodes::Integer, - n_elements::Integer, - ::Type{uEltype}) where {uEltype <: Real} + n_elements::Integer, + ::Type{uEltype}) where {uEltype <: Real} return ViscousContainer1D{uEltype}(n_vars, n_nodes, n_elements) end diff --git a/src/solvers/dgsem_tree/container_viscous_2d.jl b/src/solvers/dgsem_tree/container_viscous_2d.jl index 80554365aa5..eb62178b66d 100644 --- a/src/solvers/dgsem_tree/container_viscous_2d.jl +++ b/src/solvers/dgsem_tree/container_viscous_2d.jl @@ -9,14 +9,15 @@ mutable struct ViscousContainer2D{uEltype <: Real} _gradients::Vector{Vector{uEltype}} _flux_viscous::Vector{Vector{uEltype}} - function ViscousContainer2D{uEltype}(n_vars::Integer, n_nodes::Integer, n_elements::Integer) where {uEltype <: Real} + function ViscousContainer2D{uEltype}(n_vars::Integer, n_nodes::Integer, + n_elements::Integer) where {uEltype <: Real} new(Array{uEltype, 4}(undef, n_vars, n_nodes, n_nodes, n_elements), [Array{uEltype, 4}(undef, n_vars, n_nodes, n_nodes, n_elements) for _ in 1:2], [Array{uEltype, 4}(undef, n_vars, n_nodes, n_nodes, n_elements) for _ in 1:2], Vector{uEltype}(undef, n_vars * n_nodes^2 * n_elements), [Vector{uEltype}(undef, n_vars * n_nodes^2 * n_elements) for _ in 1:2], [Vector{uEltype}(undef, n_vars * n_nodes^2 * n_elements) for _ in 1:2]) - end + end end function init_viscous_container_2d(n_vars::Integer, n_nodes::Integer, @@ -31,31 +32,31 @@ end # `unsafe_wrap`ping multi-dimensional `Array`s around the # internal storage. function Base.resize!(viscous_container::ViscousContainer2D, equations, dg, cache) - capacity = nvariables(equations) * nnodes(dg) * nnodes(dg) * nelements(dg, cache) - resize!(viscous_container._u_transformed, capacity) - for dim in 1:2 - resize!(viscous_container._gradients[dim], capacity) - resize!(viscous_container._flux_viscous[dim], capacity) - end + capacity = nvariables(equations) * nnodes(dg) * nnodes(dg) * nelements(dg, cache) + resize!(viscous_container._u_transformed, capacity) + for dim in 1:2 + resize!(viscous_container._gradients[dim], capacity) + resize!(viscous_container._flux_viscous[dim], capacity) + end - viscous_container.u_transformed = unsafe_wrap(Array, - pointer(viscous_container._u_transformed), - (nvariables(equations), - nnodes(dg), nnodes(dg), - nelements(dg, cache))) + viscous_container.u_transformed = unsafe_wrap(Array, + pointer(viscous_container._u_transformed), + (nvariables(equations), + nnodes(dg), nnodes(dg), + nelements(dg, cache))) - for dim in 1:2 - viscous_container.gradients[dim] = unsafe_wrap(Array, - pointer(viscous_container._gradients[dim]), - (nvariables(equations), - nnodes(dg), nnodes(dg), - nelements(dg, cache))) + for dim in 1:2 + viscous_container.gradients[dim] = unsafe_wrap(Array, + pointer(viscous_container._gradients[dim]), + (nvariables(equations), + nnodes(dg), nnodes(dg), + nelements(dg, cache))) - viscous_container.flux_viscous[dim] = unsafe_wrap(Array, - pointer(viscous_container._flux_viscous[dim]), - (nvariables(equations), - nnodes(dg), nnodes(dg), - nelements(dg, cache))) - end - return nothing -end \ No newline at end of file + viscous_container.flux_viscous[dim] = unsafe_wrap(Array, + pointer(viscous_container._flux_viscous[dim]), + (nvariables(equations), + nnodes(dg), nnodes(dg), + nelements(dg, cache))) + end + return nothing +end diff --git a/src/solvers/dgsem_tree/container_viscous_3d.jl b/src/solvers/dgsem_tree/container_viscous_3d.jl index 30fa864825e..0b44cc6cc18 100644 --- a/src/solvers/dgsem_tree/container_viscous_3d.jl +++ b/src/solvers/dgsem_tree/container_viscous_3d.jl @@ -1,25 +1,27 @@ mutable struct ViscousContainer3D{uEltype <: Real} - u_transformed::Array{uEltype, 5} - # IDEA: Use SVector for fixed sized vectors? - gradients::Vector{Array{uEltype, 5}} - flux_viscous::Vector{Array{uEltype, 5}} + u_transformed::Array{uEltype, 5} + # IDEA: Use SVector for fixed sized vectors? + gradients::Vector{Array{uEltype, 5}} + flux_viscous::Vector{Array{uEltype, 5}} - # internal `resize!`able storage - _u_transformed::Vector{uEltype} - _gradients::Vector{Vector{uEltype}} - _flux_viscous::Vector{Vector{uEltype}} + # internal `resize!`able storage + _u_transformed::Vector{uEltype} + _gradients::Vector{Vector{uEltype}} + _flux_viscous::Vector{Vector{uEltype}} - function ViscousContainer3D{uEltype}(n_vars::Integer, n_nodes::Integer, n_elements::Integer) where {uEltype <: Real} - new(Array{uEltype, 5}(undef, n_vars, n_nodes, n_nodes, n_nodes, n_elements), - [Array{uEltype, 5}(undef, n_vars, n_nodes, n_nodes, n_nodes, n_elements) for _ in 1:3], - [Array{uEltype, 5}(undef, n_vars, n_nodes, n_nodes, n_nodes, n_elements) for _ in 1:3], - Vector{uEltype}(undef, n_vars * n_nodes^3 * n_elements), - [Vector{uEltype}(undef, n_vars * n_nodes^3 * n_elements) for _ in 1:3], - [Vector{uEltype}(undef, n_vars * n_nodes^3 * n_elements) for _ in 1:3]) - end + function ViscousContainer3D{uEltype}(n_vars::Integer, n_nodes::Integer, + n_elements::Integer) where {uEltype <: Real} + new(Array{uEltype, 5}(undef, n_vars, n_nodes, n_nodes, n_nodes, n_elements), + [Array{uEltype, 5}(undef, n_vars, n_nodes, n_nodes, n_nodes, n_elements) + for _ in 1:3], + [Array{uEltype, 5}(undef, n_vars, n_nodes, n_nodes, n_nodes, n_elements) + for _ in 1:3], + Vector{uEltype}(undef, n_vars * n_nodes^3 * n_elements), + [Vector{uEltype}(undef, n_vars * n_nodes^3 * n_elements) for _ in 1:3], + [Vector{uEltype}(undef, n_vars * n_nodes^3 * n_elements) for _ in 1:3]) + end end - function init_viscous_container_3d(n_vars::Integer, n_nodes::Integer, n_elements::Integer, ::Type{uEltype}) where {uEltype <: Real} @@ -32,31 +34,33 @@ end # `unsafe_wrap`ping multi-dimensional `Array`s around the # internal storage. function Base.resize!(viscous_container::ViscousContainer3D, equations, dg, cache) - capacity = nvariables(equations) * nnodes(dg) * nnodes(dg) * nnodes(dg) * nelements(dg, cache) - resize!(viscous_container._u_transformed, capacity) - for dim in 1:3 - resize!(viscous_container._gradients[dim], capacity) - resize!(viscous_container._flux_viscous[dim], capacity) - end - - viscous_container.u_transformed = unsafe_wrap(Array, - pointer(viscous_container._u_transformed), - (nvariables(equations), - nnodes(dg), nnodes(dg), nnodes(dg), - nelements(dg, cache))) + capacity = nvariables(equations) * nnodes(dg) * nnodes(dg) * nnodes(dg) * + nelements(dg, cache) + resize!(viscous_container._u_transformed, capacity) + for dim in 1:3 + resize!(viscous_container._gradients[dim], capacity) + resize!(viscous_container._flux_viscous[dim], capacity) + end - for dim in 1:3 - viscous_container.gradients[dim] = unsafe_wrap(Array, - pointer(viscous_container._gradients[dim]), - (nvariables(equations), - nnodes(dg), nnodes(dg), nnodes(dg), - nelements(dg, cache))) + viscous_container.u_transformed = unsafe_wrap(Array, + pointer(viscous_container._u_transformed), + (nvariables(equations), + nnodes(dg), nnodes(dg), nnodes(dg), + nelements(dg, cache))) - viscous_container.flux_viscous[dim] = unsafe_wrap(Array, - pointer(viscous_container._flux_viscous[dim]), - (nvariables(equations), + for dim in 1:3 + viscous_container.gradients[dim] = unsafe_wrap(Array, + pointer(viscous_container._gradients[dim]), + (nvariables(equations), nnodes(dg), nnodes(dg), nnodes(dg), nelements(dg, cache))) - end - return nothing -end \ No newline at end of file + + viscous_container.flux_viscous[dim] = unsafe_wrap(Array, + pointer(viscous_container._flux_viscous[dim]), + (nvariables(equations), + nnodes(dg), nnodes(dg), + nnodes(dg), + nelements(dg, cache))) + end + return nothing +end diff --git a/src/solvers/dgsem_tree/containers_viscous.jl b/src/solvers/dgsem_tree/containers_viscous.jl index 2a8989db55c..444f2cb7303 100644 --- a/src/solvers/dgsem_tree/containers_viscous.jl +++ b/src/solvers/dgsem_tree/containers_viscous.jl @@ -1,4 +1,4 @@ # Dimension-specific implementations include("container_viscous_1d.jl") include("container_viscous_2d.jl") -include("container_viscous_3d.jl") \ No newline at end of file +include("container_viscous_3d.jl") diff --git a/src/solvers/dgsem_tree/dg_2d_parabolic.jl b/src/solvers/dgsem_tree/dg_2d_parabolic.jl index 3d3e42d1a40..582b624a199 100644 --- a/src/solvers/dgsem_tree/dg_2d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_2d_parabolic.jl @@ -318,7 +318,7 @@ function calc_viscous_fluxes!(flux_viscous, gradients, u_transformed, end end -function calc_viscous_fluxes!(flux_viscous::Vector{Array{uEltype, 4}}, +function calc_viscous_fluxes!(flux_viscous::Vector{Array{uEltype, 4}}, gradients::Vector{Array{uEltype, 4}}, u_transformed, mesh::TreeMesh{2}, equations_parabolic::AbstractEquationsParabolic, diff --git a/src/solvers/dgsem_tree/dg_3d_parabolic.jl b/src/solvers/dgsem_tree/dg_3d_parabolic.jl index 1f625b74b3c..efed90d83aa 100644 --- a/src/solvers/dgsem_tree/dg_3d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_3d_parabolic.jl @@ -375,7 +375,7 @@ function calc_viscous_fluxes!(flux_viscous, gradients, u_transformed, end end -function calc_viscous_fluxes!(flux_viscous::Vector{Array{uEltype, 5}}, +function calc_viscous_fluxes!(flux_viscous::Vector{Array{uEltype, 5}}, gradients::Vector{Array{uEltype, 5}}, u_transformed, mesh::TreeMesh{3}, equations_parabolic::AbstractEquationsParabolic,