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
31bacab2
Commit
31bacab2
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Modified the Gadget-2 interaction to be correct when masses differ.
parent
ce8b5ede
No related branches found
No related tags found
2 merge requests
!136
Master
,
!90
Improved multi-timestep SPH
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hydro/Gadget2/hydro_iact.h
+30
-28
30 additions, 28 deletions
src/hydro/Gadget2/hydro_iact.h
with
30 additions
and
28 deletions
src/hydro/Gadget2/hydro_iact.h
+
30
−
28
View file @
31bacab2
...
...
@@ -238,18 +238,19 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
const
float
mu_ij
=
fac_mu
*
dvdr
*
r_inv
;
v_sig
-=
3
.
f
*
mu_ij
;
const
float
rho_ij
=
0
.
5
f
*
(
rhoi
+
rhoj
);
const
float
balsara_i
=
fabsf
(
pi
->
div_v
)
/
(
fabsf
(
pi
->
div_v
)
+
pi
->
force
.
curl_v
+
0
.
0001
*
ci
/
fac_mu
/
hi
);
const
float
balsara_j
=
fabsf
(
pj
->
div_v
)
/
(
fabsf
(
pj
->
div_v
)
+
pj
->
force
.
curl_v
+
0
.
0001
*
cj
/
fac_mu
/
hj
);
const
float
balsara_i
=
fabsf
(
pi
->
div_v
)
/
(
fabsf
(
pi
->
div_v
)
+
pi
->
force
.
curl_v
+
0
.
0001
*
ci
/
fac_mu
/
hi
);
const
float
balsara_j
=
fabsf
(
pj
->
div_v
)
/
(
fabsf
(
pj
->
div_v
)
+
pj
->
force
.
curl_v
+
0
.
0001
*
cj
/
fac_mu
/
hj
);
visc
=
-
0
.
25
f
*
const_viscosity_alpha
*
v_sig
*
mu_ij
/
rho_ij
*
(
balsara_i
+
balsara_j
);
}
/* Now, convolve with the kernel */
const
float
visc_term
=
0
.
5
f
*
mj
*
visc
*
(
wi_dr
+
wj_dr
)
*
r_inv
;
const
float
sph_term
=
mj
*
(
P_over_rho_i
*
wi_dr
+
P_over_rho_j
*
wj_dr
)
*
r_inv
;
const
float
visc_term
=
0
.
5
f
*
visc
*
(
wi_dr
+
wj_dr
)
*
r_inv
;
const
float
sph_term
=
(
P_over_rho_i
*
wi_dr
+
P_over_rho_j
*
wj_dr
)
*
r_inv
;
/* Eventually got the acceleration */
const
float
acc
=
visc_term
+
sph_term
;
...
...
@@ -272,25 +273,25 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
/* message("oO"); */
/* Use the force Luke ! */
pi
->
a_hydro
[
0
]
-=
acc
*
dx
[
0
];
pi
->
a_hydro
[
1
]
-=
acc
*
dx
[
1
];
pi
->
a_hydro
[
2
]
-=
acc
*
dx
[
2
];
pi
->
a_hydro
[
0
]
-=
mj
*
acc
*
dx
[
0
];
pi
->
a_hydro
[
1
]
-=
mj
*
acc
*
dx
[
1
];
pi
->
a_hydro
[
2
]
-=
mj
*
acc
*
dx
[
2
];
pj
->
a_hydro
[
0
]
+=
acc
*
dx
[
0
];
pj
->
a_hydro
[
1
]
+=
acc
*
dx
[
1
];
pj
->
a_hydro
[
2
]
+=
acc
*
dx
[
2
];
pj
->
a_hydro
[
0
]
+=
mi
*
acc
*
dx
[
0
];
pj
->
a_hydro
[
1
]
+=
mi
*
acc
*
dx
[
1
];
pj
->
a_hydro
[
2
]
+=
mi
*
acc
*
dx
[
2
];
/* Get the time derivative for h. */
pi
->
h_dt
-=
mj
*
dvdr
*
r_inv
/
rhoj
*
wi_dr
;
pj
->
h_dt
-=
mi
*
dvdr
*
r_inv
/
rhoi
*
wj_dr
;
/* Update the signal velocity. */
pi
->
force
.
v_sig
=
fmaxf
(
pi
->
force
.
v_sig
,
v_sig
);
pj
->
force
.
v_sig
=
fmaxf
(
pj
->
force
.
v_sig
,
v_sig
);
/* Change in entropy */
pi
->
entropy_dt
+=
0
.
5
f
*
visc_term
*
dvdr
;
pj
->
entropy_dt
-=
0
.
5
f
*
visc_term
*
dvdr
;
pi
->
entropy_dt
+=
0
.
5
f
*
mj
*
visc_term
*
dvdr
;
pj
->
entropy_dt
-=
0
.
5
f
*
mi
*
visc_term
*
dvdr
;
}
/**
...
...
@@ -349,35 +350,36 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
const
float
mu_ij
=
fac_mu
*
dvdr
*
r_inv
;
v_sig
-=
3
.
f
*
mu_ij
;
const
float
rho_ij
=
0
.
5
f
*
(
rhoi
+
rhoj
);
const
float
balsara_i
=
fabsf
(
pi
->
div_v
)
/
(
fabsf
(
pi
->
div_v
)
+
pi
->
force
.
curl_v
+
0
.
0001
*
ci
/
fac_mu
/
hi
);
const
float
balsara_j
=
fabsf
(
pj
->
div_v
)
/
(
fabsf
(
pj
->
div_v
)
+
pj
->
force
.
curl_v
+
0
.
0001
*
cj
/
fac_mu
/
hj
);
const
float
balsara_i
=
fabsf
(
pi
->
div_v
)
/
(
fabsf
(
pi
->
div_v
)
+
pi
->
force
.
curl_v
+
0
.
0001
*
ci
/
fac_mu
/
hi
);
const
float
balsara_j
=
fabsf
(
pj
->
div_v
)
/
(
fabsf
(
pj
->
div_v
)
+
pj
->
force
.
curl_v
+
0
.
0001
*
cj
/
fac_mu
/
hj
);
visc
=
-
0
.
25
f
*
const_viscosity_alpha
*
v_sig
*
mu_ij
/
rho_ij
*
(
balsara_i
+
balsara_j
);
}
/* Now, convolve with the kernel */
const
float
visc_term
=
0
.
5
f
*
mj
*
visc
*
(
wi_dr
+
wj_dr
)
*
r_inv
;
const
float
sph_term
=
mj
*
(
P_over_rho_i
*
wi_dr
+
P_over_rho_j
*
wj_dr
)
*
r_inv
;
const
float
visc_term
=
0
.
5
f
*
visc
*
(
wi_dr
+
wj_dr
)
*
r_inv
;
const
float
sph_term
=
(
P_over_rho_i
*
wi_dr
+
P_over_rho_j
*
wj_dr
)
*
r_inv
;
/* Eventually got the acceleration */
const
float
acc
=
visc_term
+
sph_term
;
/* Use the force Luke ! */
pi
->
a_hydro
[
0
]
-=
acc
*
dx
[
0
];
pi
->
a_hydro
[
1
]
-=
acc
*
dx
[
1
];
pi
->
a_hydro
[
2
]
-=
acc
*
dx
[
2
];
pi
->
a_hydro
[
0
]
-=
mj
*
acc
*
dx
[
0
];
pi
->
a_hydro
[
1
]
-=
mj
*
acc
*
dx
[
1
];
pi
->
a_hydro
[
2
]
-=
mj
*
acc
*
dx
[
2
];
/* Get the time derivative for h. */
pi
->
h_dt
-=
mj
*
dvdr
*
r_inv
/
rhoj
*
wi_dr
;
/* Update the signal velocity. */
pi
->
force
.
v_sig
=
fmaxf
(
pi
->
force
.
v_sig
,
v_sig
);
/* Change in entropy */
pi
->
entropy_dt
+=
0
.
5
f
*
visc_term
*
dvdr
;
pi
->
entropy_dt
+=
0
.
5
f
*
mj
*
visc_term
*
dvdr
;
}
#endif
/* SWIFT_RUNNER_IACT_LEGACY_H */
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