tavoid chi=-nan - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
 (HTM) git clone git://src.adamsgaard.dk/sphere
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit e728720b1d67c2781a1533aaf5d3b1b1dc972736
 (DIR) parent 7f97f62efc8a5cc8c92bd7040a22612d86a6c1e2
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Fri, 23 May 2014 13:30:50 +0200
       
       avoid chi=-nan
       
       Diffstat:
         M src/navierstokes.cuh                |      14 ++++++++------
         M tests/cfd_tests.py                  |       3 ++-
       
       2 files changed, 10 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/src/navierstokes.cuh b/src/navierstokes.cuh
       t@@ -2830,8 +2830,10 @@ __global__ void findInteractionForce(
                Float Cd  = pow(0.63 + 4.8/pow(Re, 0.5), 2.0);
                const Float chi = 3.7 - 0.65*exp(-pow(1.5 - log10(Re), 2.0)/2.0);
        
       -        if (v_rel_length < 1.0e-6) // avoid Re=0 -> Cd=inf
       +        if (v_rel_length < 1.0e-6) { // avoid Re=0 -> Cd=inf, chi=-nan
                    Cd = 0.0;
       +            chi = 0.0;
       +        }
        
                // Drag force
                const Float3 f_d = 0.125*Cd*devC_params.rho_f*M_PI*d*d*phi*phi
       t@@ -2855,11 +2857,11 @@ __global__ void findInteractionForce(
                const Float3 f_pf = f_d + f_p + f_v;
        
        #ifdef CHECK_NS_FINITE
       -        //printf("%d [%d,%d,%d]\tV_p=%f Re=%f Cd=%f chi=%f\n",
       -         //       i, i_x, i_y, i_z, V_p, Re, Cd, chi);
       -        //checkFiniteFloat3("f_d", i_x, i_y, i_z, f_d);
       -        //checkFiniteFloat3("f_p", i_x, i_y, i_z, f_p);
       -        //checkFiniteFloat3("f_v", i_x, i_y, i_z, f_v);
       +        printf("%d [%d,%d,%d]\tV_p=%f Re=%f Cd=%f chi=%f\n",
       +                i, i_x, i_y, i_z, V_p, Re, Cd, chi);
       +        checkFiniteFloat3("f_d", i_x, i_y, i_z, f_d);
       +        checkFiniteFloat3("f_p", i_x, i_y, i_z, f_p);
       +        checkFiniteFloat3("f_v", i_x, i_y, i_z, f_v);
                checkFiniteFloat3("f_pf", i_x, i_y, i_z, f_pf);
        #endif
        
 (DIR) diff --git a/tests/cfd_tests.py b/tests/cfd_tests.py
       t@@ -22,7 +22,8 @@ orig.initTemporal(total = 0.2, file_dt = 0.01)
        orig.time_file_dt = orig.time_dt*0.99
        orig.time_total = orig.time_dt*10
        #orig.run(dry=True)
       -orig.run(verbose=False)
       +#orig.run(verbose=False)
       +orig.run(verbose=True)
        py = sphere.sim(sid = orig.sid, fluid = True)
        
        ones = numpy.ones((orig.num))