CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Bugs

Maybe some bug in leastSquaresVectorsc

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   December 24, 2007, 22:25
Default Maybe some bug in leastSquares
New Member
Liu Huafei
Join Date: Mar 2009
Location: Shanghai, China
Posts: 20
Rep Power: 8
liuhuafei is on a distinguished road
Maybe some bug in leastSquaresVectors.c

some error in calculation of dd in leastsquare vector

Source file:

void Foam::leastSquaresVectors::makeLeastSquaresVectors () const

if (p.coupled())
forAll(pd, patchFacei)
const vector& d = pd[patchFacei];

dd[faceCells[patchFacei]] +=

dd maybe done by the following:
dd[faceCells[patchFacei]] +=

also a question:
for the couple boundary,dd is calculated only for P cell(owner),why not for N cell(neighbour)?
liuhuafei is offline   Reply With Quote

Old   December 27, 2007, 18:47
Default Yes you are right this is a bu
Senior Member
Join Date: Mar 2009
Posts: 854
Rep Power: 13
henry is on a distinguished road
Yes you are right this is a bug, the second use of pw[patchFacei] is as (1 - pw[patchFacei]) but the first is inconsistent and incorrect. Here is the corrected leastSquaresVectors.C to replace the file in OpenFOAM-1.4.1/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad

On the coupled boundaries only the owner contribution needs to be calculated, the neighbour contribution being calculated by the "other-side" of the couple.

Thanks for the bug report and proposed solution

henry is offline   Reply With Quote


Thread Tools
Display Modes

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

All times are GMT -4. The time now is 19:44.