Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
898bafbb
Commit
898bafbb
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Document the accuracy achieved by the new approximation
parent
fedce813
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1077
Improved multipole acceptance criterion (MAC)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/kernel_long_gravity.h
+4
-1
4 additions, 1 deletion
src/kernel_long_gravity.h
tests/testKernelLongGrav.c
+5
-3
5 additions, 3 deletions
tests/testKernelLongGrav.c
with
9 additions
and
4 deletions
src/kernel_long_gravity.h
+
4
−
1
View file @
898bafbb
...
...
@@ -86,7 +86,10 @@ kernel_long_grav_derivatives(const float r, const float r_s_inv,
const
float
e
=
expf
(
-
u2
);
/* Compute erfcf(u) using eq. 7.1.25 of
Abramowitz & Stegun, 1972. */
* Abramowitz & Stegun, 1972.
*
* This has a *relative* error of less than 4e-3 over
* the range of interest (0 < u < 5) */
const
float
t
=
1
.
f
/
(
1
.
f
+
0
.
47047
f
*
u
);
...
...
This diff is collapsed.
Click to expand it.
tests/testKernelLongGrav.c
+
5
−
3
View file @
898bafbb
...
...
@@ -37,8 +37,10 @@ const int num_tests = 1 << 10;
void
check_value
(
double
a
,
double
b
,
const
char
*
s
,
const
double
tol
,
const
double
r
,
const
double
r_s
)
{
if
(
fabs
(
a
-
b
)
/
fabs
(
a
+
b
)
>
tol
)
error
(
"Values are inconsistent: %12.15e %12.15e rel=%e (%s for r_s=%e r/r_s=%e)!"
,
a
,
b
,
fabs
(
a
-
b
)
/
fabs
(
a
+
b
),
s
,
r_s
,
r
/
r_s
);
error
(
"Values are inconsistent: %12.15e %12.15e rel=%e (%s for r_s=%e "
"r/r_s=%e)!"
,
a
,
b
,
fabs
(
a
-
b
)
/
fabs
(
a
+
b
),
s
,
r_s
,
r
/
r_s
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -92,7 +94,7 @@ int main(int argc, char* argv[]) {
(
12
.
*
pow
(
r_s
,
4
.)
-
12
.
*
r_s
*
r_s
*
r
*
r
+
pow
(
r
,
4
.))
*
pow
(
r_s
,
-
9
.);
check_value
(
chi_swift
.
chi_0
,
chi_0
,
"chi_0"
,
4e-3
,
r
,
r_s
);
check_value
(
chi_swift
.
chi_0
,
chi_0
,
"chi_0"
,
3.
4e-3
,
r
,
r_s
);
check_value
(
chi_swift
.
chi_1
,
chi_1
,
"chi_1"
,
1e-5
,
r
,
r_s
);
check_value
(
chi_swift
.
chi_2
,
chi_2
,
"chi_2"
,
1e-5
,
r
,
r_s
);
check_value
(
chi_swift
.
chi_3
,
chi_3
,
"chi_3"
,
1e-4
,
r
,
r_s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment