Bug in my Lax-Wendroff solver?
Hi,
I am trying to implement a one step and a two-step (predictor-corrector) Lax-Wendroff solver. The one step method works perfectly, but the two-step-method produces heavy oscillations near the boundaries (dirichlet conditions) and in the vicinity of the shock when trying to solve the shock tube problem. Here some code... The timestep is chosen such that the CFL condition is satisfied. void Solver::updateLW1(double const& dt) { u0=u; for(unsigned i = 1; i < nx - 1; ++i) u[i] = 0.5*(u0[i+1] + u0[i-1]) - 0.5*dt/dx*(flux(i+1, u0)-flux(i-1, u0)) - dt*rhs(i, u0); } void Solver::updateLW2(double const& dt) { // predictor for(unsigned i = 1; i < nx - 1; ++i) u0[i] = 0.5*(u[i+1] + u[i]) - 0.5*dt/dx*(flux(i+1, u)-flux(i, u)) - 0.25*dt*(rhs(i+1, u)+rhs(i, u)); // corrector for(unsigned i = 1; i < nx - 1; ++i) u[i] = u[i] - dt/dx*(flux(i+1, u0)-flux(i-1, u0)) + dt*rhs(i, u0); } Can anyone give me a hint or a link to an implementation of the predictor corrector LW-method? Cheers, Chris |
Re: Bug in my Lax-Wendroff solver?
I just solved the problem by myself. It should be flux(i, u0) instead of flux(i+1, u0) in the corrector step.
|
HI Chris,
Can you please send me the 1D code for shock tube problem at babuu.nishu@gmail.com? I need it for my research. Thanks alot Nishant |
All times are GMT -4. The time now is 19:11. |