|
[Sponsors] |
Noticeable difference between div(phi, U) and U&grad(U) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 1, 2018, 21:18 |
Noticeable difference between div(phi, U) and U&grad(U)
|
#1 |
Member
Charlie
Join Date: Dec 2010
Location: USA
Posts: 85
Rep Power: 15 |
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? |
|
January 2, 2018, 22:02 |
|
#2 |
Member
Charlie
Join Date: Dec 2010
Location: USA
Posts: 85
Rep Power: 15 |
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.
|
|
January 7, 2018, 10:21 |
|
#3 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33 |
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
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
|
|