Fluid: got to the real problem of the issue --> wrong float epsilon resulted in norma...
authorDaniel Genrich <daniel.genrich@gmx.net>
Fri, 18 Apr 2008 18:25:11 +0000 (18:25 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Fri, 18 Apr 2008 18:25:11 +0000 (18:25 +0000)
intern/elbeem/intern/ntl_vector3dim.h
intern/elbeem/intern/solver_util.cpp

index 27c3be0d71f143758b8e8ec3e1f53738bd115a31..35a3ad59ec916cc5b171db800e6c79fec79fe73d 100644 (file)
@@ -825,7 +825,7 @@ template<class T> inline ntlColor vec2Col(T v) { return ntlColor(v[0],v[1],v[2])
 #endif
 #endif
 #endif
-
+               
 #if GFX_PRECISION==1
 typedef float gfxReal;
 #define GFX_REAL_MAX __FLT_MAX__
@@ -833,7 +833,7 @@ typedef float gfxReal;
 //#define vecGfx2F(x) (x)
 //#define vecD2Gfx(x) vecD2F(x)
 //#define vecGfx2D(x) vecF2D(x)
-#define VECTOR_EPSILON (1e-5f)
+#define VECTOR_EPSILON (1.192092896e-07F)
 #else
 typedef double gfxReal;
 #define GFX_REAL_MAX __DBL_MAX__
@@ -841,7 +841,7 @@ typedef double gfxReal;
 //#define vecGfx2F(x) vecF2D(x)
 //#define vecD2Gfx(x) (x)
 //#define vecGfx2D(x) (x)
-#define VECTOR_EPSILON (1e-10)
+#define VECTOR_EPSILON (2.2204460492503131e-016)
 #endif
 
 /* fixed double prec. type, for epxlicitly double values */
index ef98b7f21d0e86e53a884e887edaef7e8f91e175..e74875a0dbfbd74d755f1e33cf830ba7261ceeca 100644 (file)
@@ -37,10 +37,10 @@ void LbmFsgrSolver::prepareVisualization( void ) {
        int lev = mMaxRefine;
        int workSet = mLevel[lev].setCurr;
 
-       int mainGravDir=0;
+       int mainGravDir=6; // if normalizing fails, we asume z-direction gravity
        LbmFloat mainGravLen = 0.;
        FORDF1{
-               LbmFloat thisGravLen = dot(LbmVec(dfVecX[l],dfVecY[l],dfVecZ[l]), getNormalized(mLevel[mMaxRefine].gravity) );
+               LbmFloat thisGravLen = dot(LbmVec(dfVecX[l],dfVecY[l],dfVecZ[l]), getNormalized(mLevel[mMaxRefine].gravity) );  
                if(thisGravLen>mainGravLen) {
                        mainGravLen = thisGravLen;
                        mainGravDir = l;
@@ -113,7 +113,7 @@ void LbmFsgrSolver::prepareVisualization( void ) {
                                        if(nbflag&CFInter){ intercnt++; }
 
                                        // check all directions otherwise we get bugs with splashes on obstacles
-                                       // if(l!=mainGravDir) continue; // only check bnd along main grav. dir
+                                       if(l!=mainGravDir) continue; // only check bnd along main grav. dir
                                        //if((nbflag&CFBnd)&&(nbflag&CFBndNoslip)){ noslipbnd=1; }
                                        if((nbflag&CFBnd)){ noslipbnd=1; }
                                }