Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MethodError when using flux tuple in combination with BoundaryConditionDirichlet and TreeMesh #1243

Closed
JoshuaLampert opened this issue Oct 20, 2022 · 3 comments · Fixed by #1251
Labels
enhancement New feature or request

Comments

@JoshuaLampert
Copy link
Member

It seems like there is a problem with the BoundaryConditionDirichlet when using a TreeMesh and a tuple of surface flux functions. The following Code, e.g., gives the error message LoadError: MethodError: objects of type Tuple{FluxHLL{typeof(min_max_speed_naive)}, typeof(flux_nonconservative_fjordholm_etal)} are not callable:

using OrdinaryDiffEq
using Trixi

equations = ShallowWaterEquations2D(gravity_constant=1.0, H0=3.0)

function initial_condition_well_balancedness(x, t, equations::ShallowWaterEquations2D)
  H = equations.H0
  v1 = 0.0
  v2 = 0.0
  x1, x2 = x
  b = (  1.5 / exp( 0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2) )
       + 0.75 / exp( 0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2) ) )
  return prim2cons(SVector(H, v1, v2, b), equations)
end

initial_condition = initial_condition_well_balancedness
boundary_condition = BoundaryConditionDirichlet(initial_condition)

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
solver = DGSEM(polydeg=4, surface_flux=(flux_hll, flux_nonconservative_fjordholm_etal),
               volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
L = 4
coordinates_min = (-L, -L)
coordinates_max = (L, L)
mesh = TreeMesh(coordinates_min, coordinates_max,
                initial_refinement_level=3,
                n_cells_max=10_000,
                periodicity=false)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
                                    boundary_conditions=boundary_condition)

tspan = (0.0, 5.0)
ode = semidiscretize(semi, tspan)

sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-8, reltol=1.0e-8,
            save_everystep=false);
@sloede
Copy link
Member

sloede commented Oct 21, 2022

Without having looked at the code yet, is it possible that this is due to the fact that non-cons systems of equations pass a tuple of surface flux functions instead of a single surface flux function and that BoundaryConditionDirichlet does not know about this and does not try to peel off the correct one, instead trying to call the tuple?

cc @andrewwinters5000

@andrewwinters5000
Copy link
Member

The routines for computing the physical boundary fluxes on TreeMesh need modified in order to handle the nonconservative terms. Specifically, one needs to modify the existing calc_boundary_flux_by_direction! to dispatch on nonconservative_terms::Val{false} and a new routine needs written that dispatches on nonconservative_terms::Val{true}.

@andrewwinters5000 andrewwinters5000 added the enhancement New feature or request label Oct 21, 2022
@maxbertrand1996
Copy link
Contributor

I think I fixed this.
Please have a look at my PR.

@andrewwinters5000 andrewwinters5000 linked a pull request Nov 23, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants