possible bugs in template<bool psingle> void JSphCpu::InteractionForcesDEM

HI Dr Canella and team

I am currently looking into your DEM codes in DualSPHysics 4.4,

I believe there could be a possible bug in the tangential force value?

There should be a "negative" signed in front of 'kn', as the friction force should be opposing to the tangential vector <tx, ty, tz>?

float ft_last=2(kn*float(DemDtForce)-gn)*vt/7;


Hopefully I can get your confirmation on the above?



In the following, I append your way on defining the normal and tangential vectors:

-------------------------------------------------------------------------------------------------------------------------

       const float drx=(psingle? psposp1.x-pspos[p2].x: float(posp1.x-pos[p2].x));

       const float dry=(psingle? psposp1.y-pspos[p2].y: float(posp1.y-pos[p2].y));

       const float drz=(psingle? psposp1.z-pspos[p2].z: float(posp1.z-pos[p2].z));

       const float rr2=drx*drx+dry*dry+drz*drz;

       const float rad=sqrt(rr2);


       const float dvx=velrhop[p1].x-velrhop[p2].x, dvy=velrhop[p1].y-velrhop[p2].y, dvz=velrhop[p1].z-velrhop[p2].z; //vji

       const float nx=drx/rad, ny=dry/rad, nz=drz/rad; //normal_ji        

       const float vn=dvxnx+dvyny+dvz*nz; //vji.nji


        //-Tangential.

        float dvxt=dvx-vn*nx, dvyt=dvy-vn*ny, dvzt=dvz-vn*nz; //Vji_t

        float vt=sqrt(dvxt*dvxt + dvyt*dvyt + dvzt*dvzt);

        float tx=0, ty=0, tz=0; //-Tang vel unit vector.

        if(vt!=0){ tx=dvxt/vt; ty=dvyt/vt; tz=dvzt/vt; }

        float ft_last=2(kn*float(DemDtForce)-gn)*vt/7; //-Elastic frictional string --> ft_elast=2*(kn*fdispl-gn*vt)/7; fdispl=dtforce*vt;

Sign In or Register to comment.

Debug Trace

Notice
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead.

#0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array)
#1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384)
#2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...')
#3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"HI ...')
#4 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(197): Gdn_Format::to('[{"insert":"HI ...', 'Rich')
#5 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('1730', 'possible-bugs-i...', '')
#6 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array)
#7 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch()
#8 {main}
Notice
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead.

#0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array)
#1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384)
#2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...')
#3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"HI ...')
#4 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(24): Gdn_Format::to('[{"insert":"HI ...', 'Rich')
#5 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/discussion.php(89): formatBody(Object(stdClass))
#6 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/index.php(31): include('/var/www/forums...')
#7 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(778): include('/var/www/forums...')
#8 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(1382): Gdn_Controller->fetchView('', false, false)
#9 /var/www/forums-dual-sphysics-org/library/core/class.pluggable.php(217): Gdn_Controller->xRender()
#10 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(310): Gdn_Pluggable->__call('render', Array)
#11 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('1730', 'possible-bugs-i...', '')
#12 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array)
#13 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch()
#14 {main}