@@ -41,36 +41,44 @@ For details see the paper:
4141 Entropy analysis and entropy stable DG methods for the shallow water moment equations
4242 [DOI: 10.48550/arXiv.2602.06513](https://doi.org/10.48550/arXiv.2602.06513)
4343"""
44- struct ShallowWaterMomentEquations1D{NVARS, NMOMENTS, RealT <: Real } < :
44+ struct ShallowWaterMomentEquations1D{NVARS, NMOMENTS, RealT <: Real ,
45+ Array3 <: AbstractArray{RealT, 3} ,
46+ Array2 <: AbstractArray{RealT, 2} } < :
4547 AbstractMomentEquations{1 , NVARS, NMOMENTS}
4648 gravity:: RealT # gravitational acceleration
4749 H0:: RealT # constant "lake-at-rest" total water height
4850 n_moments:: Integer # number of moments
4951 # Moment matrices
50- A:: Array{RealT, 3}
51- B:: Array{RealT, 3}
52- C:: Array{RealT, 2}
52+ A:: Array3
53+ B:: Array3
54+ C:: Array2
5355 # Friction related quantities
5456 nu:: RealT # kinematic viscosity
5557 lambda:: RealT # slip length
5658 rho:: RealT # fluid density (relevant for Manning friction)
5759 nman:: RealT # Manning roughness coefficient
5860
59- function ShallowWaterMomentEquations1D {NVARS, NMOMENTS, RealT} (gravity:: RealT ,
60- H0:: RealT ,
61- n_moments:: Integer ,
62- A:: Array{RealT, 3} ,
63- B:: Array{RealT, 3} ,
64- C:: Array{RealT, 2} ,
65- nu:: RealT ,
66- lambda:: RealT ,
67- rho:: RealT ,
68- nman:: RealT ) where {
69- NVARS,
70- NMOMENTS,
71- RealT < :
72- Real
73- }
61+ function ShallowWaterMomentEquations1D {NVARS, NMOMENTS, RealT, Array3, Array2} (gravity:: RealT ,
62+ H0:: RealT ,
63+ n_moments:: Integer ,
64+ A:: Array3 ,
65+ B:: Array3 ,
66+ C:: Array2 ,
67+ nu:: RealT ,
68+ lambda:: RealT ,
69+ rho:: RealT ,
70+ nman:: RealT ) where {
71+ NVARS,
72+ NMOMENTS,
73+ RealT < :
74+ Real,
75+ Array3 < :
76+ AbstractArray{RealT,
77+ 3 },
78+ Array2 < :
79+ AbstractArray{RealT,
80+ 2 }
81+ }
7482 new (gravity, H0, n_moments, A, B, C, nu, lambda, rho, nman)
7583 end
7684end
@@ -93,24 +101,33 @@ function ShallowWaterMomentEquations1D(; gravity, H0 = zero(gravity), n_moments,
93101 A = compute_A_tensor (B)
94102 C = compute_C_matrix (n_moments)
95103
96- return ShallowWaterMomentEquations1D {NVARS, NMOMENTS, RealT} (gravity,
97- H0,
98- n_moments,
99- A,
100- B,
101- C,
102- nu,
103- lambda,
104- rho,
105- nman)
104+ Array3 = promote_type (typeof (A), typeof (B))
105+ Array2 = typeof (C)
106+ return ShallowWaterMomentEquations1D {NVARS, NMOMENTS, RealT, Array3, Array2} (gravity,
107+ H0,
108+ n_moments,
109+ A,
110+ B,
111+ C,
112+ nu,
113+ lambda,
114+ rho,
115+ nman)
106116end
107117
108- @inline function Base. real (:: ShallowWaterMomentEquations1D{NVARS, NMOMENTS, RealT} ) where {
109- NVARS,
110- NMOMENTS,
111- RealT < :
112- Real
113- }
118+ @inline function Base. real (:: ShallowWaterMomentEquations1D {NVARS, NMOMENTS, RealT,
119+ Array3, Array2}) where {
120+ NVARS,
121+ NMOMENTS,
122+ RealT < :
123+ Real,
124+ Array3 < :
125+ AbstractArray{RealT,
126+ 3 },
127+ Array2 < :
128+ AbstractArray{RealT,
129+ 2 }
130+ }
114131 RealT
115132end
116133
0 commit comments