Skip to content

Commit

Permalink
Improved initialization of P4estElementContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
amrueda committed Dec 8, 2023
1 parent d959d77 commit 500db95
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/solvers/dgsem_p4est/containers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
#! format: noindent

mutable struct P4estElementContainer{NDIMS, RealT <: Real, uEltype <: Real, NDIMSP1,
NDIMSP2, NDIMSP3, R, S, X, O} <: AbstractContainer
NDIMSP2, NDIMSP3,
ContravariantVectors <:
AbstractArray{RealT, NDIMSP3}} <: AbstractContainer
# Physical coordinates at each node
node_coordinates::Array{RealT, NDIMSP2} # [orientation, node_i, node_j, node_k, element]
# Jacobian matrix of the transformation
# [jacobian_i, jacobian_j, node_i, node_j, node_k, element] where jacobian_i is the first index of the Jacobian matrix,...
jacobian_matrix::Array{RealT, NDIMSP3}
# Contravariant vectors, scaled by J, in Kopriva's blue book called Ja^i_n (i index, n dimension)
contravariant_vectors::PtrArray{RealT, NDIMSP3, R, S, X, O} # [dimension, index, node_i, node_j, node_k, element]
contravariant_vectors::ContravariantVectors # [dimension, index, node_i, node_j, node_k, element]
# 1/J where J is the Jacobian determinant (determinant of Jacobian matrix)
inverse_jacobian::Array{RealT, NDIMSP1} # [node_i, node_j, node_k, element]
# Buffer for calculated surface flux
Expand Down Expand Up @@ -125,20 +127,16 @@ function init_elements(mesh::Union{P4estMesh{NDIMS, RealT}, T8codeMesh{NDIMS, Re
NDIMS * 2, nelements))

elements = P4estElementContainer{NDIMS, RealT, uEltype, NDIMS + 1, NDIMS + 2,
NDIMS + 3, ntuple(@inline(i->i), NDIMS + 3),
Tuple{StaticInt{ndims_spa},
ntuple(i -> Int64, NDIMS + 2)...
}, NTuple{NDIMS + 3, Nothing},
NTuple{NDIMS + 3, StaticInt{1}}}(node_coordinates,
jacobian_matrix,
contravariant_vectors,
inverse_jacobian,
surface_flux_values,
_node_coordinates,
_jacobian_matrix,
_contravariant_vectors,
_inverse_jacobian,
_surface_flux_values)
NDIMS + 3, typeof(contravariant_vectors)}(node_coordinates,
jacobian_matrix,
contravariant_vectors,
inverse_jacobian,
surface_flux_values,
_node_coordinates,
_jacobian_matrix,
_contravariant_vectors,
_inverse_jacobian,
_surface_flux_values)

init_elements!(elements, mesh, basis)
return elements
Expand Down

0 comments on commit 500db95

Please sign in to comment.