CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Bugs

Error in DsmcCloud::collisions() in dsmcFoam

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

Like Tree2Likes
  • 2 Post By DSMC123

Reply
 
LinkBack Thread Tools Display Modes
Old   November 20, 2014, 05:08
Default Error in DsmcCloud::collisions() in dsmcFoam
  #1
New Member
 
wenjie
Join Date: Dec 2012
Posts: 12
Rep Power: 5
wenjie is on a distinguished road
Hi all,

I think I just found a possible error in the DsmcCloud::collisions() in DsmcCloud.C .

There, in the number of collision pairs, it should be nC * nC instead of nC* (nC-1) according to Bird's book (p219).

Does anybody agree or disagree with me?

-Wenjie
wenjie is offline   Reply With Quote

Old   November 23, 2014, 16:09
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,736
Blog Entries: 39
Rep Power: 103
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Greetings Wenjie,

I had a look at the source code and took me a while to spot the piece of code you were referring to:
Code:
            scalar selectedPairs =
                collisionSelectionRemainder_[cellI]
              + 0.5*nC*(nC - 1)*nParticle_*sigmaTcRMax*deltaT
               /mesh_.cellVolumes()[cellI];

            label nCandidates(selectedPairs);

            collisionSelectionRemainder_[cellI] = selectedPairs - nCandidates;
To me, the use of "nC-1" is because the current particle isn't counted in possible collisions. Nonetheless, I have no idea which exact book you're referring to
It's possible that the implementation done in OpenFOAM is either based in a more recent paper or version of said book, or it could be the other way around, where they could have based themselves only on the very first edition of the book.

In addition, according to this git blame: https://github.com/wyldckat/OpenFOAM...ud/DsmcCloud.C - that specific part of the code you're referring to exists since the first commit for OpenFOAM 1.6.x, so there is the possibility that this is still pending some additional revision.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   November 24, 2014, 08:16
Default
  #3
New Member
 
wenjie
Join Date: Dec 2012
Posts: 12
Rep Power: 5
wenjie is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings Wenjie,

I had a look at the source code and took me a while to spot the piece of code you were referring to:
Code:
            scalar selectedPairs =
                collisionSelectionRemainder_[cellI]
              + 0.5*nC*(nC - 1)*nParticle_*sigmaTcRMax*deltaT
               /mesh_.cellVolumes()[cellI];

            label nCandidates(selectedPairs);

            collisionSelectionRemainder_[cellI] = selectedPairs - nCandidates;
To me, the use of "nC-1" is because the current particle isn't counted in possible collisions. Nonetheless, I have no idea which exact book you're referring to
It's possible that the implementation done in OpenFOAM is either based in a more recent paper or version of said book, or it could be the other way around, where they could have based themselves only on the very first edition of the book.

In addition, according to this git blame: https://github.com/wyldckat/OpenFOAM...ud/DsmcCloud.C - that specific part of the code you're referring to exists since the first commit for OpenFOAM 1.6.x, so there is the possibility that this is still pending some additional revision.

Best regards,
Bruno
Hi Bruno,

Yes, that's the code that I was talking about. Indeed by using nC*(nC-1) instead of nC*nC, you are not counting the current particle, but it is explained in the Bird's book "Molecular Gas Dynamics and the DIrect Simulation of Gas FLows" on page 219 that the number of choices should be N^2 /2 instead of N(N-1) /2 for large number of gas molecules and this error becomes significant for small values of N. And the whole rest part is about how to increase the probability and decrease the fraction.

So I still think that nC*nC should be the correct one to use here. What do you think?

Best,
Wenjie
wenjie is offline   Reply With Quote

Old   November 25, 2014, 06:57
Default
  #4
New Member
 
Craig White
Join Date: Nov 2013
Posts: 7
Rep Power: 5
DSMC123 is on a distinguished road
It has to be N*(N-1) for the no time counter model to be correct. See section 7 in this document from Graham Bird: http://www.gab.com.au/dsmc07notes.pdf

In addition, a quick look at Bird's 1D source code confirms that he uses the N*(N-1). This is from line 5989 of DS1.f90:

ASEL=0.5D00*ICCELL(2,N)*(ICCELL(2,N)-1)*WFC*FNUM*CCELL(4,N)*DTC/AAA+CCELL(2,N)

Where ICCELL is the number of particles in the cell.
wyldckat and wenjie like this.
DSMC123 is offline   Reply With Quote

Old   November 25, 2014, 12:32
Default
  #5
New Member
 
wenjie
Join Date: Dec 2012
Posts: 12
Rep Power: 5
wenjie is on a distinguished road
Quote:
Originally Posted by DSMC123 View Post
It has to be N*(N-1) for the no time counter model to be correct. See section 7 in this document from Graham Bird: http://www.gab.com.au/dsmc07notes.pdf

In addition, a quick look at Bird's 1D source code confirms that he uses the N*(N-1). This is from line 5989 of DS1.f90:

ASEL=0.5D00*ICCELL(2,N)*(ICCELL(2,N)-1)*WFC*FNUM*CCELL(4,N)*DTC/AAA+CCELL(2,N)

Where ICCELL is the number of particles in the cell.

HI Bruno,

Thanks for the document!. Now it's clear : )
wenjie is offline   Reply With Quote

Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM] - Coupling dsmcFoam and laplacianFoam costrom OpenFOAM 0 October 26, 2014 16:15
ForceCoefficients/MachNumber for dsmcFoam CFDnewbie147 OpenFOAM Running, Solving & CFD 0 April 10, 2014 10:18
dsmcFoam unanswered questions... CFDnewbie147 OpenFOAM 0 February 11, 2014 02:23
dsmcFoam setup hherbol OpenFOAM Pre-Processing 0 July 14, 2013 17:16
how can I Run axisymmetric flow using dsmcFoam ? mechy OpenFOAM 4 September 19, 2011 10:25


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