trixi-framework / trixi-framework/Trixi.jl
Solving 1D inviscid Burger's equation with time dependent BC
- Dominant language
- Julia
- Stars
- 731
- Forks
- 167
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 25
Description
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:
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!
Contributor guide
Research direction
Run the provided Julia reproduction with Trixi, OrdinaryDiffEq, and Plots, then inspect the handling of `inlet_sine_bc`, `BoundaryConditionDoNothing()`, and `InviscidBurgersEquation1D` with `DGSEM`. Compare the result against the expected boundary-driven solution and determine whether the behavior is physical or indicates a boundary-condition issue; completion would require a documented explanation or a reproducible fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100