Skip to content

Solving 1D inviscid Burger's equation with time dependent BC #2492

@ErikQ97

Description

@ErikQ97

Hello,

I am trying to solve 1D inviscid Burger's equation with time dependent BC (i.e. u(x=0,t) = sin(2 pi t)), while initially everywhere is zero i.e. u(x,t=0) = 0. However, the solution (t=1) is non-physical as shown below:

Image

The codes is shown as follows:

using Trixi, OrdinaryDiffEq, Plots

function inlet_sine_bc(u_inner, orientation, direction, x, t, surface_flux::FluxLaxFriedrichs, equations::InviscidBurgersEquation1D)
    return SVector(sin(2π * t))
end

equations = InviscidBurgersEquation1D()

solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
initial_condition(x, t, equations) = 0.0

boundary_conditions = (
    x_neg = inlet_sine_bc,
    x_pos = Trixi.BoundaryConditionDoNothing(),
)

semi = SemidiscretizationHyperbolic(
    TreeMesh(0.0, 1.0, initial_refinement_level=5, n_cells_max = 10^4, periodicity = false),
    equations, initial_condition, solver;
    boundary_conditions = boundary_conditions
)

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

controller = StepsizeCallback(cfl = 0.25)  
save_times = 0:0.01:1.0
sol = solve(ode, SSPRK33(), dt=1e-3, saveat=save_times, callback=controller)

plot(sol)

Any comments are appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions