# How to verify your codes

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes
 August 21, 2008, 03:33 How to verify your codes #1 risklotus Guest   Posts: n/a Hi all: I am new in CFD area and try to write my own codes. Right now, I try to verify my 1D Navier-Stokes code but I barely can find a existing case to compare with. I want to ask you guys where to find these resources? Thanks. Another question is that is there a method called finite difference-control volume method? I just know finite difference or finite volume methods. But the book I am reading uses "finite difference-control volume method" to discretize the governing eqs. I want to ask this is finite difference method or finite volume method or neither? Thanks.

 August 21, 2008, 04:18 Re: How to verify your codes #2 Jed Guest   Posts: n/a This reference provides a fantastic perspective. Just pick a velocity field (I assume you are doing compressible flow since 1D incompressible flow is boring) and differentiate it to get the distributed load required for an exact solution. Choose the boundary conditions by the exact solution (any type works) and check for convergence rates. @article{roache2002cvm, title={{Code Verification by the Method of Manufactured Solutions}}, author={Roache, P.J.}, journal={Journal of Fluids Engineering}, volume={124}, pages={4}, year={2002}, publisher={ASME} } In 1D, it is both (and finite element while we're at it).

 August 21, 2008, 14:56 Re: How to verify your codes #3 risklotus Guest   Posts: n/a Thanks Jed. I have checked this article. It's a good article, but do you have any idea about 1D Navier-Stokes verification. I think I can verify Burger eq. but for coupling pressure gradient term, I am not sure whether I applied SIMPLE correct or not. Thanks

 August 21, 2008, 15:17 Re: How to verify your codes #4 su Guest   Posts: n/a what is coupling pressure gradient term? can you email me your SIMPLE please!

 August 22, 2008, 05:18 Re: How to verify your codes #5 Jed Guest   Posts: n/a Incompressible flow in 1D is boring because all flows are constant, therefore I'll assume we can have a mass source term. This example is a steady state flow, but you can add time dependence. Choose solutions u and p. They can be almost anything, but preferably with nontrivial derivatives: u = atan(x) p = tanh(x) differentiate to get a distributed force: f = rho * u * u_x - eta * u_xx + p_x f = sech^2(x) + rho*atan(x)/(1+x^2) + 2*eta*x/(1+x^2)^2 differentiate to get a mass source: g = rho*u_x g = rho / (1+x^2) You now have an exact solution to a completely nontrivial 1D flow. For boundary conditions, use the manufactured solutions (Dirichlet) or differentiate them (Neumann). If you want to satisfy incompressibility, then just choose u to be a divergence free field. A canonical source of such fields is the curl of an arbitrary vector field. So pick a vector potential A arbitrarily and use u=curl(A) as a solution function. Then pick pressure arbitrarily (some calculus will tell you how to choose p so as to minimize the forcing term if that is of concern to you.

 September 2, 2008, 10:54 Re: How to verify your codes #6 Vasilis Guest   Posts: n/a The simplest way to verify your solution is to increase the number of elements (or points or unknowns) and compare the two solutions. If there is a good agreement then your code has converged to the correct solution.

 September 3, 2008, 11:53 Re: How to verify your codes #7 Hendrik Guest   Posts: n/a No it says nothing about the correctness of a solution. The beauty of Roache's work is that it is so fundamental. If your code is based on a second order in space scheme (O(h^2), or second order in time, or third order whatever) then by increasing the number of cells/elements the solution has to approach the final value linearly when plotting against h^2 (and the "final value" is simple the extrapolated result when h=0). If the code doesnot exhibit this behaviour than something is wrong somewhere. If it does than you'll have "verified" the code (it does what you planned when solving the equations). A different question is if these were the "correct equations"; that's called "validation". But there's a catch, several actually: when the mesh is too coarse then the solution will not approach a result asymptotically (or you are not fine enough). When using schemes which switch according to a Peclet number, Courant number or any other flow state, then, again, there's no asymptotical behaviour. Finally when your mesh is very, very fine, and your Reynolds number is increased than you'll have the danger of natural instability and then a converged steady-state solution is not possible anymore.

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Jason Bardis Main CFD Forum 47 July 27, 2011 04:52 Kerem Main CFD Forum 9 May 9, 2003 04:29 bobby Main CFD Forum 3 April 2, 2002 08:55 Bert Laney Main CFD Forum 5 September 15, 1999 15:24 S. Langsford Main CFD Forum 3 October 19, 1998 20:51

All times are GMT -4. The time now is 18:11.

 Contact Us - CFD Online - Privacy Statement - Top