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
46c54fb0
Commit
46c54fb0
authored
7 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Inserted ccosmological factors in the Gadget2 force interactions.
parent
ed244139
No related branches found
No related tags found
1 merge request
!509
Cosmological time integration
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/adiabatic_index.h
+35
-1
35 additions, 1 deletion
src/adiabatic_index.h
src/hydro/Gadget2/hydro_iact.h
+6
-6
6 additions, 6 deletions
src/hydro/Gadget2/hydro_iact.h
with
41 additions
and
7 deletions
src/adiabatic_index.h
+
35
−
1
View file @
46c54fb0
...
...
@@ -437,7 +437,6 @@ __attribute__((always_inline)) INLINE static float pow_one_over_gamma(float x) {
* Computes \f$x^{3\gamma - 2}\f$.
*
* @param x Argument
* @return Argument to the power one over the adiabatic index
*/
__attribute__
((
always_inline
))
INLINE
static
float
pow_three_gamma_minus_two
(
float
x
)
{
...
...
@@ -466,4 +465,39 @@ __attribute__((always_inline)) INLINE static float pow_three_gamma_minus_two(
#endif
}
/**
* @brief Return the argument to the power three adiabatic index minus five over
* two.
*
* Computes \f$x^{(3\gamma - 5)/2}\f$.
*
* @param x Argument
*/
__attribute__
((
always_inline
))
INLINE
static
float
pow_three_gamma_minus_five_over_two
(
float
x
)
{
#if defined(HYDRO_GAMMA_5_3)
return
1
.
f
;
/* x^(0) */
#elif defined(HYDRO_GAMMA_7_5)
return
powf
(
x
,
-
0
.
4
f
);
/* x^(-2/5) */
#elif defined(HYDRO_GAMMA_4_3)
return
1
.
f
/
sqrtf
(
x
);
/* x^(-1/2) */
#elif defined(HYDRO_GAMMA_2_1)
return
sqrtf
(
x
);
/* x^(1/2) */
#else
error
(
"The adiabatic index is not defined !"
);
return
0
.
f
;
#endif
}
#endif
/* SWIFT_ADIABATIC_INDEX_H */
This diff is collapsed.
Click to expand it.
src/hydro/Gadget2/hydro_iact.h
+
6
−
6
View file @
46c54fb0
...
...
@@ -436,9 +436,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
float
wi
,
wj
,
wi_dx
,
wj_dx
;
/*
Will change with cosmological integration
*/
const
float
fac_mu
=
1
.
f
;
const
float
a2_Hubble
=
0
.
f
;
/*
Cosmological factors entering the EoMs
*/
const
float
fac_mu
=
pow_three_gamma_minus_five_over_two
(
a
)
;
const
float
a2_Hubble
=
a
*
a
*
H
;
const
float
r
=
sqrtf
(
r2
);
const
float
r_inv
=
1
.
0
f
/
r
;
...
...
@@ -555,9 +555,9 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
float
wi
,
wj
,
wi_dx
,
wj_dx
;
/*
Will change with cosmological integration
*/
const
float
fac_mu
=
1
.
f
;
const
float
a2_Hubble
=
0
.
f
;
/*
Cosmological factors entering the EoMs
*/
const
float
fac_mu
=
pow_three_gamma_minus_five_over_two
(
a
)
;
const
float
a2_Hubble
=
a
*
a
*
H
;
const
float
r
=
sqrtf
(
r2
);
const
float
r_inv
=
1
.
0
f
/
r
;
...
...
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