CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Noticeable difference between div(phi, U) and U&grad(U)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By hjasak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 1, 2018, 21:18
Default Noticeable difference between div(phi, U) and U&grad(U)
  #1
Member
 
Charlie
Join Date: Dec 2010
Location: USA
Posts: 85
Rep Power: 15
cheng1988sjtu is on a distinguished road
Hi Foamers,

I wonder if anyone have the same problem as mine. In Gaussian Theorem, the following equality should hold for any incompressible flow:

fvc::div(phi, U) = U & fvc::grad(U)

However, If I directly output the results calculated by these two methods, I always get that a noticeable difference, their biggest difference is about 10%.

The following is the basic setup in my simulation:

I'm trying to simulate a wave boundary layer flow using pimpleFoam by specifying the pressure field on the top boundary (obtained from the wave simulation). The simulation box is 2D, with bottom wall BC, and lateral BC are cyclic. top BC for the velocity is zeroGradient, and I first tried to compare the results with analytical solution with constant viscosity nu=1e-4;

The numerical scheme I used:

grad(U) Gauss linear

div(phi,U) Gauss linear

The simulation runs OK with no instability because of the low Reynolds number, but I do see the difference in the wave averaged vertical profile of div(phi, U) and U & fvc::grad(U), as you see in the attached figure. In the figure, U & fvc::grad(U) is exactly matches the analytical solution, and div(phi, U) is clearly wrong. Even though the magnitude is about small (on the order of 1e-4), but if I normalize by the analytical solution, and integrate in the vertical direction, the result of div(phi, U) is wrong by 20%!

This is the basis of finite volume method, so the accuracy of the advection term should be very important, anyone throw some lights? Is this a possible bug in OpenFOAM?
Attached Images
File Type: jpg Advection_Problem.jpg (36.3 KB, 29 views)
cheng1988sjtu is offline   Reply With Quote

Old   January 2, 2018, 22:02
Default
  #2
Member
 
Charlie
Join Date: Dec 2010
Location: USA
Posts: 85
Rep Power: 15
cheng1988sjtu is on a distinguished road
Sorry, turns out, it's due to the time step, I have to use a really small time step to minimize the effect of advection term.
cheng1988sjtu is offline   Reply With Quote

Old   January 7, 2018, 10:21
Default
  #3
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
No bug, of course. The two definitions are the same if div(U) = 0.

Beware: grad(U) uses a cell centre velocity and div(U) the face flux. Are you doing the check consistently?

Hrv
Taataa likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Reply


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



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