Off topic - Some advice on solving Navier-Stokes with FiniteDifference

Berend van Wachem b.van-wachem at imperial.ac.uk
Thu Aug 13 03:03:19 CDT 2009


Dear Stephen, Farshid,

Because you have an equation for grad p (or nabla^2 p for most pressure 
solvers), you need to specify a value for p somewhere in the problem: 
otherwise p is under-determined. (e.g. if grad p need to be 100, the 
values of p of 0 and 100 satisfy this, but also 1100 and 1000).

You can specify the value p at a point, at a face, or at a boundary, 
depending on the problem you are looking at.

If you want to develop a Navier-Stokes solver in terms of a few months, 
e.g. for an MSc project, I recommend you to do it in a staggered 
fashion. On of the best references, I think, still is Patankar,
@BOOK{patankar80,
   title = {Numerical Heat Transfer and Fluid Flow},
   publisher = {Hemisphere Publising Corporation},
   year = {1980},
   author = {S.V. Patankar}
   owner = {berend}
}


However, staggered gets messy for non-Cartesian domains/grids. Then I 
would recommend collocated - but this is really a lot more difficult 
than staggered. The pressure-velocity coupling algorithm is not 
straightforward and I see many mistakes in this, even in journal papers. 
For collocated grids, there is a nice chapter in Ferziger&Peric:
@BOOK{ferziger02,
   title = {Computational Methods for Fluid Dynamics},
   publisher = {Springer},
   year = {2002},
   author = {J.H. Ferziger and M. Peric},
   owner = {berend}
}

Let me know if you have any specific questions.

Best regards,

Berend van Wachem.


Stephen Wornom wrote:
> Matthew Knepley wrote:
>> On Wed, Aug 12, 2009 at 10:39 AM, Stephen Wornom 
>> <stephen.wornom at sophia.inria.fr 
>> <mailto:stephen.wornom at sophia.inria.fr>> wrote:
>>
>>     Matthew Knepley wrote:
>>
>>         1) You should really handle this by creating the constant
>>         vector on the pressure
>>             space and using MatNullSpaceCreate()
>>
>>         2) You can also easily handle this by fixing the pressure at
>>         one point
>>
>>     At what indices or location does one fix the pressure? What value
>>     is it set. Usually pressure is part of the solution. It would seem
>>     to introduce an inconsistency.
>>     I would like to understand how to do it.
>>
>>
>> It does not matter where you fix it or to what value. The absolute 
>> value of the pressure is not physically
>> relevant, only pressure differences (which is why only grad p appears).
> Thanks for clarification on this point which is confusing to many of us. 
> So why is it necessary to fix a value at a point since as you point out 
> that only the grad p appears? If the pressure is not set in the 
> numerical eqns, will you agree that the initial pressure sets the value 
> for the numerical pressure at least in  time accurate solutions.
>> Fixing the pressure at any point
>> to any value just sets the scale. There is no inconsistency. This is 
>> in many many elementary fluid mechanics
>> books.
> Pass along a reference for myself and students.
> Thanks again,
> Stephen
>> To do this mechanically. Change one row in the operator div (from the 
>> div u = 0 equation) to the identity.
>>
>>    Matt
>>  
>>
>>
>>     Stephen
>>
>>
>>          Matt
>>
>>
>>         On Wed, Aug 12, 2009 at 10:19 AM, William A. Perkins
>>         <william.perkins at pnl.gov <mailto:william.perkins at pnl.gov>
>>         <mailto:william.perkins at pnl.gov
>>         <mailto:william.perkins at pnl.gov>>> wrote:
>>
>>
>>            Stephen,
>>
>>            There are two ways that I know of to deal with pressure checker
>>            boarding: staggered grids or some form of Rhie-Chow
>>         interpolation.
>>            IMO, these are simple only for uniform, Cartesian grids.
>>          For grids
>>            that are curvilinear, unstructured, non-uniform, and/or
>>            non-orthogonal, things get real complicated. There may be other
>>            methods, but something is required.
>>
>>            Regarding boundary conditions, I would suggest this text book:
>>
>>               H. K. Versteeg and W. Malalasekera. An Introduction to
>>               Computational Fluid Dynamics, the Finite Volume Method. 2nd
>>               edition. Prentice-Hall. 2007
>>
>>            While this book uses the finite volume method, the
>>         explanation of
>>            boundary conditions and staggered grids is very good and
>>         relatively
>>            easy to interpret for finite difference.  I would also
>>         recommend
>>
>>               Joel H. Ferziger and Milovan Peric. Computational
>>         Methods for
>>               Fluid Dynamics. Springer-Verlag, 3rd edition, 2002.
>>
>>            This is a little more general with regard to method
>>         discussing finite
>>            difference and finite volume, but still settling on finite
>>         volume.
>>
>>            My $0.02: I question the use of finite difference.  For
>>         Navier-Stokes,
>>            the use of finite volume is much more prevalent in
>>         commercial and
>>            research codes.  If your student follows Versteeg and
>>         Malalasekera a
>>            simple, working, staggered grid FV code could be built in a
>>         very short
>>            time.  If something more complicated is needed, it's probably
>>            explained in Ferziger and Peric.
>>
>>            Also My $0.02: Unless the point of your student's work is to
>>            experience building her own code, why not download
>>         something like
>>            OpenFOAM (http://www.opencfd.co.uk/openfoam/) and just use
>>         it?  I
>>            expect the effort to learn something like OpenFOAM for a simple
>>            application will be much less than writing a new code.
>>
>>            Hope this helps.
>>
>>            Bill
>>
>>            >>>>> "Stephen" == Stephen Wornom
>>         <stephen.wornom at sophia.inria.fr
>>         <mailto:stephen.wornom at sophia.inria.fr>
>>            <mailto:stephen.wornom at sophia.inria.fr
>>         <mailto:stephen.wornom at sophia.inria.fr>>> writes:
>>
>>               Stephen> Shengyong wrote:
>>               >> Hi, Farshid
>>               >>
>>               >> Maybe she should use the staggered grid method which
>>         is very
>>            simple to
>>               >> implement.
>>               Stephen> Does it remain simple for curvilinear meshes?
>>               Stephen> Stephen
>>               >>
>>               >> On Tue, Aug 11, 2009 at 5:16 AM, Farshid Mossaiby
>>            <mossaiby at yahoo.com <mailto:mossaiby at yahoo.com>
>>         <mailto:mossaiby at yahoo.com <mailto:mossaiby at yahoo.com>>
>>               >> <mailto:mossaiby at yahoo.com
>>         <mailto:mossaiby at yahoo.com> <mailto:mossaiby at yahoo.com
>>         <mailto:mossaiby at yahoo.com>>>> wrote:
>>               >>
>>               >> Hi all,
>>               >>
>>               >> Sorry for this off-topic post.
>>               >>
>>               >> I am helping a master studnet which is working on solving
>>               >> Navier-Stokes equation with Finite Difference method.
>>         She is
>>               >> trying to eliminate spourious pressure modes from the
>>         solution.
>>               >> She needs to know some details that are not usually
>>         found in the
>>               >> papers but important when programming, e.g. boundary
>>            condition for
>>               >> pressure. If someone has expertise on this or know a
>>         *simple* FD
>>               >> code, I would be thankful to let me know.
>>               >>
>>               >> Best regards,
>>               >> Farshid Mossaiby
>>               >>
>>               >>
>>               >>
>>               >>
>>               >>
>>               >>
>>               >> --
>>               >> Pang Shengyong
>>               >> Solidification  Simulation Lab,
>>               >> State Key Lab of  Mould & Die Technology,
>>               >> Huazhong Univ. of Sci. & Tech. China
>>
>>
>>            --
>>            Bill Perkins
>>            Research Engineer
>>            Hydrology Group
>>
>>            Pacific Northwest National Laboratory
>>            902 Battelle Boulevard
>>            P.O. Box 999, MSIN K9-36
>>            Richland, WA  99352 USA
>>            Tel:  509-372-6131
>>            Fax: 509-372-6089
>>            william.perkins at pnl.gov <mailto:william.perkins at pnl.gov>
>>         <mailto:william.perkins at pnl.gov <mailto:william.perkins at pnl.gov>>
>>            www.pnl.gov <http://www.pnl.gov> <http://www.pnl.gov>
>>
>>
>>
>>
>>
>>         -- 
>>         What most experimenters take for granted before they begin
>>         their experiments is infinitely more interesting than any
>>         results to which their experiments lead.
>>         -- Norbert Wiener
>>
>>
>>
>>
>>
>> -- 
>> What most experimenters take for granted before they begin their 
>> experiments is infinitely more interesting than any results to which 
>> their experiments lead.
>> -- Norbert Wiener
> 


More information about the petsc-users mailing list