fix ave/euler

Submitted by Daniel Queteschiner on Wed, 07/15/2015 - 15:22

The average velocity gets divided by the number of particles, but it also gets divided by the sum of particle masses. That's too much, hence
https://github.com/CFDEMproject/LIGGGHTS-PUBLIC/blob/master/src/fix_ave_...
if(ncount_[icell]) vectorScalarDiv3D(v_av_[icell],static_cast<double>(ncount_[icell])*mass_[icell]);
should read
if(mass_[icell] > 0.) vectorScalarDiv3D(v_av_[icell],mass_[icell]);

ckloss's picture

ckloss | Wed, 07/15/2015 - 22:43

Hi Daniel,

thanks - you are of course right! Will fix this in the next release,

Cheers
Christoph

Daniel Queteschiner | Mon, 07/20/2015 - 10:40

Hi Christoph,

I just noticed that there's another bug in fix ave/euler which is typically hidden by dump custom commands in the input script.
modify->addstep_compute_all which is called in the constructor at
https://github.com/CFDEMproject/LIGGGHTS-PUBLIC/blob/master/src/fix_ave_...
must be invoked only after the internal ComputeStressAtom has been created
https://github.com/CFDEMproject/LIGGGHTS-PUBLIC/blob/master/src/fix_ave_...

I think you can either move the creation of the ComputeStressAtom to the constructor before modify->addstep_compute_all or move modify->addstep_compute_all to the post_create function after https://github.com/CFDEMproject/LIGGGHTS-PUBLIC/blob/master/src/fix_ave_...

Daniel Queteschiner | Mon, 07/20/2015 - 14:48

Even better then use
compute_stress_->addstep(nfirst);
instead of
modify->addstep_compute_all(nfirst);

ckloss's picture

ckloss | Mon, 07/27/2015 - 12:37

Hi Daniel,

thanks a lot! Andreas and I will have a close look for the next release!

Best wishes
Christoph

Daniel Queteschiner | Wed, 03/02/2016 - 19:54

Unfortunately, I have to come back to this command once again and report another bug:
https://github.com/CFDEMproject/LIGGGHTS-PUBLIC/blob/3.3.1/src/fix_ave_e...
else if(j < 14) return stress_[i][j-8];
should be
else if(j < 14) return stress_[i][j-7];
The resulting index (j is in the range 8 to 13) should run from 1 to 6 instead of 0 to 5 because stress_[i][0] is the pressure value (see the preceding code line 662)

aaigner's picture

aaigner | Fri, 04/28/2017 - 13:17

Hello Daniel,
I am so sorry. I did not see your comment.
I fixed it internally. It will be corrected with the next release.

Best wishes
Andreas