diff --git a/Src/Kernels/Taylor/FTaylorKernel.hpp b/Src/Kernels/Taylor/FTaylorKernel.hpp index d256bb70efc9c45a9104ec82949c160487549614..c3e444e46baa461122d3cd9d1bd6319b2678ee45 100644 --- a/Src/Kernels/Taylor/FTaylorKernel.hpp +++ b/Src/Kernels/Taylor/FTaylorKernel.hpp @@ -301,7 +301,7 @@ public: * * Formula : * \f[ - * M_{k} = \sum_{j=0}^{nb_{particule}}{ q_j * \frac{|k|!}{k! k!} (x_j-x_c)^{k}} + * M_{k} = \sum_{j=0}^{nb_{particule}}{ q_j * \frac{|k|!}{k! k!} (x_c-x_j)^{k}} * \f] * where \f$x_c\f$ is the centre of the cell and \f$x_j\f$ the \f$j^{th}\f$ particles and \f$q_j\f$ its charge. */ @@ -332,9 +332,9 @@ public: // for(int idPart=0 ; idPartgetMultipole(); - + FReal psi, tmp = 0.0 ; //Iterating over multipole array : k - for(int j = 0 ; j < SizeVector ; j++){ //corresponding powers am,bm,cm - FReal psi = computeDerivative(al+am,bl+bm,cl+cm,curDistCenter,locCenter,yetComputed); //psi is the derivative of 1/R. - psi *= multipole[j]*coeffN; //Psi = M[am,bm,cm] * N(al,bl,cl)/(al,bl,cl)! - iterLocal[i]+=psi; - count++; + // Loc(al,bl,cl) = sum_ Psi* M[am,bm,cm] * N(al,bl,cl)/(al,bl,cl)! + for(int j = 0 ; j < SizeVector ; ++j){ //corresponding powers am,bm,cm + //psi is the derivative of 1/R,al+am,bl+bm,cl+cm. + psi = computeDerivative(al+am,bl+bm,cl+cm,curDistCenter,locCenter,yetComputed); + tmp += psi*multipole[j]; + ++count; //printf("count : %d, al+am = %d, bl+bm=%d, cl+cm=%d\n",count,al+am,bl+bm,cl+cm); //updating a,b,c incPowers(&am,&bm,&cm); } - am=0; - bm=0; - cm=0; + iterLocal[i] = tmp*coeffL ; incPowers(&al,&bl,&cl); } // For Debugging .......................................................... @@ -637,10 +638,6 @@ public: FReal dz = posZ[i] - locCenter.getZ(); printf("dx = %f, dy = %f, dz = %f\n",dx,dy,dz); int a=0,b=0,c=0; - - forceX[i] = 0.0 ; - forceY[i] = 0.0 ; - forceZ[i] = 0.0 ; // // Precompute an arrays of Array[i] = dx^(i-1) arrayDX[0] = 0.0 ; @@ -655,8 +652,9 @@ public: arrayDY[d] = dy * arrayDY[d-1] ; arrayDZ[d] = dz * arrayDZ[d-1] ; } - + // //Iteration over Local array + // const FReal * iterLocal = local->getLocal(); FReal partPhyValue = phyValues[i]; // diff --git a/Tests/Kernels/testTaylorSimple.cpp b/Tests/Kernels/testTaylorSimple.cpp index f57673d272ec2bbe84e67ef75c008323de3fdd2e..61b87525fb4a4ac6cf0bd6e6b81adefd805cd975 100644 --- a/Tests/Kernels/testTaylorSimple.cpp +++ b/Tests/Kernels/testTaylorSimple.cpp @@ -89,7 +89,8 @@ int main(int argc,char* argv[]){ FReal dz = part1Pos.getZ() - part2Pos.getZ(); // FReal potTheo = physVal2*physVal1*FMath::Sqrt(1.0 / (dx*dx + dy*dy + dz*dz)); - printf("Exact potential : %f Computed potential : %f Error: %f \n",potTheo, potential,potTheo- potential); + potential *=0.5 ; + printf("Exact potential : %f Computed potential : %f Error: %f \n",potTheo, potential,std::abs(potTheo- potential)); }