New answers tagged

1

Your code does not solve the BVP you posted. Here is the revised version that works well. function bvp(N) [D,x] = cheb(N); % Set up differentiation matrix D2 = D^2; % Insert boundary condition: u(-1) = 0, u(1) = 2 D2(1,:) = zeros(1,N+1); D2(1,1) = 1; D2(N,:) = zeros(1,N+1); D2(N,N) = 1; % right hand side f = zeros(N+1,1); f(1) = 2; ...


2

You cannot specify just a boundary condition on $\partial_x u$ at $x_L$. Remember that in DG your solution is composed of piecewise discontinuous polynomials; at every interface you can have effectively any jump in $u$, which is separate from the slope of u to the left or right of the interface. Unless $f(u,x)$ has any dependence on $\partial_x u$ (in which ...


3

The Lax-Friedrichs flux roughly approximates a situation where the propagation of information can occur in both directions. This is why on the right face at $x_{N+1}$ you need to also know $u^{N+1}_h$ in order to compute this numerical flux. As an alternative, you could use an upwinding flux (either just at the boundaries or in your entire domain). These ...


Top 50 recent answers are included