@@ -57,8 +57,8 @@ Create a solver, where the three summation-by-parts (SBP) first-, second-, and t
5757are of accuracy order `accuracy_order` and associated to the `mesh`.
5858
5959!!! warning "Periodic operators only"
60- This constructor creates periodic derivative operators that are only compatible with periodic
61- boundary conditions. For non-periodic boundary conditions, use the `Solver(D1, D2, D3)`
60+ This constructor creates periodic derivative operators that are only compatible with periodic
61+ boundary conditions. For non-periodic boundary conditions, use the `Solver(D1, D2, D3)`
6262 constructor with appropriate non-periodic operators (or `nothing`).
6363"""
6464function Solver (mesh, accuracy_order)
7878
7979Create a solver, where `D1` is an `AbstractDerivativeOperator`
8080from [SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl)
81- of first `derivative_order`, `D2` is an `AbstractDerivativeOperator`
81+ of first `derivative_order`, `D2` is an `AbstractDerivativeOperator`
8282of second `derivative_order` or an `AbstractMatrix`, and `D3` is an `AbstractDerivativeOperator`
8383of third `derivative_order` or an `AbstractMatrix`. `D2` and `D3` can also be `nothing`
8484if that derivative is not used by the discretization.
@@ -135,28 +135,34 @@ end
135135 return nothing
136136end
137137
138- function allocate_coefficients (mesh:: Mesh1D , equations, solver:: AbstractSolver )
138+ function allocate_coefficients (mesh, equations, solver)
139139 return ArrayPartition (ntuple (_ -> zeros (real (solver), nnodes (mesh)),
140140 Val (nvariables (equations))))
141141end
142142
143- function compute_coefficients! (q, func, t, mesh:: Mesh1D ,
143+ function compute_coefficients! (q, func, t, mesh,
144144 is_hyperbolic_appproximation:: Val{false} ,
145- equations, solver:: AbstractSolver )
145+ equations, solver)
146146 x = grid (solver)
147147 for i in eachnode (solver)
148148 q_node = func (x[i], t, equations, mesh)
149149 set_node_vars! (q, q_node, equations, i)
150150 end
151151end
152152
153+ # `set_approximation_variables!` is defined for equations, which are hyperbolic
154+ # approximations, but below it is called for `equations` for which the compiler
155+ # doesn't know from type annotations that these are hyperbolic approximations.
156+ # Therefore, JET.jl fails. We provide a fallback definition here that does nothing.
157+ set_approximation_variables! (q, mesh, equations, solver) = nothing
158+
153159# For a hyperbolic approximation, we allow returning either the full set
154160# of variables or a reduced number determining only the limit system.
155161# In the second case, we compute the remaining variables using the default
156162# initialization specific to the equations.
157- function compute_coefficients! (q, func, t, mesh:: Mesh1D ,
163+ function compute_coefficients! (q, func, t, mesh,
158164 is_hyperbolic_appproximation:: Val{true} ,
159- equations, solver:: AbstractSolver )
165+ equations, solver)
160166 x = grid (solver)
161167 q_node = func (x[begin ], t, equations, mesh)
162168 if length (q_node) == nvariables (equations)
@@ -176,8 +182,8 @@ function compute_coefficients!(q, func, t, mesh::Mesh1D,
176182 end
177183end
178184
179- function calc_error_norms (q, t, initial_condition, mesh:: Mesh1D , equations,
180- solver:: AbstractSolver )
185+ function calc_error_norms (q, t, initial_condition, mesh, equations,
186+ solver)
181187 q_exact = similar (q)
182188 compute_coefficients! (q_exact, initial_condition, t, mesh,
183189 is_hyperbolic_appproximation (equations), equations,
@@ -192,13 +198,11 @@ function calc_error_norms(q, t, initial_condition, mesh::Mesh1D, equations,
192198 return l2_error, linf_error
193199end
194200
195- function calc_sources! (dq, q, t, source_terms:: Nothing ,
196- equations:: AbstractEquations{1} , solver:: Solver )
201+ function calc_sources! (dq, q, t, source_terms:: Nothing , equations, solver)
197202 return nothing
198203end
199204
200- function calc_sources! (dq, q, t, source_terms,
201- equations:: AbstractEquations{1} , solver:: Solver )
205+ function calc_sources! (dq, q, t, source_terms, equations, solver)
202206 x = grid (solver)
203207 for i in eachnode (solver)
204208 local_source = source_terms (get_node_vars (q, equations, i), x[i], t, equations)
0 commit comments