CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

Bug in my Lax-Wendroff solver?

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   April 8, 2008, 03:05
Default Bug in my Lax-Wendroff solver?
Posts: n/a

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)



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
  Reply With Quote

Old   April 8, 2008, 07:31
Default Re: Bug in my Lax-Wendroff solver?
Posts: n/a
I just solved the problem by myself. It should be flux(i, u0) instead of flux(i+1, u0) in the corrector step.
  Reply With Quote

Old   July 8, 2009, 13:32
Nishant Kumar
Join Date: Jun 2009
Posts: 32
Rep Power: 10
Nishu is on a distinguished road
HI Chris,

Can you please send me the 1D code for shock tube problem at I need it for my research.

Thanks alot
Nishu is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating New Solver: For particle-laden compressible jets sankarv OpenFOAM Running, Solving & CFD 17 December 3, 2014 20:41
Quarter Burner mesh with periosic condition SamCanuck FLUENT 2 August 31, 2011 11:34
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 14:08
Error during Solver cfd guy CFX 4 May 8, 2001 06:04

All times are GMT -4. The time now is 13:01.