Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
df8dd61a
Commit
df8dd61a
authored
Jul 01, 2013
by
COULAUD Olivier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Taylor : Correction du P2M, amélioration du M2L, Bug dans la formule pour calculer PSI
parent
86ca0e6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
23 deletions
+22
-23
Src/Kernels/Taylor/FTaylorKernel.hpp
Src/Kernels/Taylor/FTaylorKernel.hpp
+20
-22
Tests/Kernels/testTaylorSimple.cpp
Tests/Kernels/testTaylorSimple.cpp
+2
-1
No files found.
Src/Kernels/Taylor/FTaylorKernel.hpp
View file @
df8dd61a
...
...
@@ -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
;
idPart
<
nbPart
;
idPart
++
){
// compute the distance to the centre
FReal
dx
=
posX
[
idPart
]
-
cellCenter
.
getX
()
;
FReal
dy
=
posY
[
idPart
]
-
cellCenter
.
getY
()
;
FReal
dz
=
posZ
[
idPart
]
-
cellCenter
.
getZ
()
;
FReal
dx
=
cellCenter
.
getX
()
-
posX
[
idPart
]
;
FReal
dy
=
cellCenter
.
getY
()
-
posY
[
idPart
]
;
FReal
dz
=
cellCenter
.
getZ
()
-
posZ
[
idPart
]
;
const
FReal
potential
=
phyValue
[
idPart
];
//
// Precompute the an arrays of dx^i
...
...
@@ -514,30 +514,31 @@ public:
//Iteration over Multipole / Local
int
al
=
0
,
bl
=
0
,
cl
=
0
;
//For local array
int
am
=
0
,
bm
=
0
,
cm
=
0
;
//For distant array
int
am
,
bm
,
cm
;
//For distant array
//
int
count
=
0
;
//Iterating over local array : n
for
(
int
i
=
0
;
i
<
SizeVector
;
i
++
){
FReal
fctl
=
fact3int
(
al
,
bl
,
cl
);
FReal
coeffN
=
factorials
[
al
+
bl
+
cl
]
/
(
fctl
*
fctl
);
FReal
fctl
=
fact3int
(
al
,
bl
,
cl
);
FReal
coeffL
=
factorials
[
al
+
bl
+
cl
]
/
(
fctl
*
fctl
);
//
am
=
0
;
bm
=
0
;
cm
=
0
;
//
//Iterator over multipole array
const
FReal
*
multipole
=
distantNeighbors
[
idxNeigh
]
->
getMultipole
();
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
];
//
...
...
Tests/Kernels/testTaylorSimple.cpp
View file @
df8dd61a
...
...
@@ -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
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment