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

Matthew Knepley knepley at gmail.com
Wed Aug 12 10:29:19 CDT 2009

```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

Matt

On Wed, Aug 12, 2009 at 10:19 AM, William A. Perkins <
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
> 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> 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>> 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
> 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