Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
0a234e1b
Commit
0a234e1b
authored
Aug 08, 2019
by
Matthieu Schaller
Browse files
Update the gravity_props_init() function.
parent
8aefe1c3
Changes
4
Hide whitespace changes
Inline
Side-by-side
examples/main.c
View file @
0a234e1b
...
...
@@ -971,7 +971,8 @@ int main(int argc, char *argv[]) {
bzero
(
&
gravity_properties
,
sizeof
(
struct
gravity_props
));
if
(
with_self_gravity
)
gravity_props_init
(
&
gravity_properties
,
params
,
&
prog_const
,
&
cosmo
,
high_res_DM_mass
,
with_cosmology
,
periodic
);
with_cosmology
,
with_DM_background_particles
,
periodic
);
/* Initialise the external potential properties */
bzero
(
&
potential
,
sizeof
(
struct
external_potential
));
...
...
examples/main_fof.c
View file @
0a234e1b
...
...
@@ -519,7 +519,8 @@ int main(int argc, char *argv[]) {
/* Initialise the gravity scheme */
bzero
(
&
gravity_properties
,
sizeof
(
struct
gravity_props
));
gravity_props_init
(
&
gravity_properties
,
params
,
&
prog_const
,
&
cosmo
,
high_res_DM_mass
,
/*with_cosmology=*/
1
,
periodic
);
/*with_cosmology=*/
1
,
with_DM_background_particles
,
periodic
);
/* Initialise the long-range gravity mesh */
if
(
periodic
)
{
...
...
src/gravity_properties.c
View file @
0a234e1b
...
...
@@ -40,9 +40,8 @@
void
gravity_props_init
(
struct
gravity_props
*
p
,
struct
swift_params
*
params
,
const
struct
phys_const
*
phys_const
,
const
struct
cosmology
*
cosmo
,
const
double
high_res_DM_mass
,
const
int
with_cosmology
,
const
int
periodic
)
{
const
struct
cosmology
*
cosmo
,
const
int
with_cosmology
,
const
int
is_zoom_simulation
,
const
int
periodic
)
{
/* Tree updates */
p
->
rebuild_frequency
=
...
...
@@ -103,20 +102,23 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params,
p
->
epsilon_baryon_comoving
=
parser_get_param_double
(
params
,
"Gravity:comoving_baryon_softening"
);
/* Compute the comoving softening length for background particles as
* a fraction of the mean inter-particle density of the background DM
* particles Since they have variable masses the mass factor will be
* multiplied in later on. Note that we already multiply in the conversion
* from Plummer -> real softening length */
const
double
ratio_background
=
parser_get_param_double
(
params
,
"Gravity:softening_ratio_background"
);
if
(
is_zoom_simulation
)
{
const
double
mean_matter_density
=
cosmo
->
Omega_m
*
cosmo
->
critical_density_0
;
/* Compute the comoving softening length for background particles as
* a fraction of the mean inter-particle density of the background DM
* particles Since they have variable masses the mass factor will be
* multiplied in later on. Note that we already multiply in the conversion
* from Plummer -> real softening length */
const
double
ratio_background
=
parser_get_param_double
(
params
,
"Gravity:softening_ratio_background"
);
p
->
epsilon_background_fac
=
kernel_gravity_softening_plummer_equivalent
*
ratio_background
*
cbrt
(
1
.
/
mean_matter_density
);
const
double
mean_matter_density
=
cosmo
->
Omega_m
*
cosmo
->
critical_density_0
;
p
->
epsilon_background_fac
=
kernel_gravity_softening_plummer_equivalent
*
ratio_background
*
cbrt
(
1
.
/
mean_matter_density
);
}
}
else
{
...
...
src/gravity_properties.h
View file @
0a234e1b
...
...
@@ -119,9 +119,8 @@ struct gravity_props {
void
gravity_props_print
(
const
struct
gravity_props
*
p
);
void
gravity_props_init
(
struct
gravity_props
*
p
,
struct
swift_params
*
params
,
const
struct
phys_const
*
phys_const
,
const
struct
cosmology
*
cosmo
,
const
double
high_res_DM_mass
,
const
int
with_cosmology
,
const
int
periodic
);
const
struct
cosmology
*
cosmo
,
const
int
with_cosmology
,
const
int
is_zoom_simulation
,
const
int
periodic
);
void
gravity_props_update
(
struct
gravity_props
*
p
,
const
struct
cosmology
*
cosmo
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment