Skip to content
GitLab
Menu
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
9d95c26c
Commit
9d95c26c
authored
Feb 07, 2019
by
Matthieu Schaller
Browse files
Implement an optional minimal smoothing length based on the softening of the particle
parent
97f3111f
Changes
24
Show whitespace changes
Inline
Side-by-side
examples/EAGLE_100/eagle_100.yml
View file @
9d95c26c
...
@@ -49,6 +49,7 @@ Gravity:
...
@@ -49,6 +49,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
# Parameters for the hydrodynamics scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
h_min_ratio
:
0.1
# Minimal smoothing in units of softening.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
minimal_temperature
:
100
# (internal units)
minimal_temperature
:
100
# (internal units)
...
...
examples/EAGLE_12/eagle_12.yml
View file @
9d95c26c
...
@@ -47,6 +47,7 @@ Gravity:
...
@@ -47,6 +47,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
# Parameters for the hydrodynamics scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
h_min_ratio
:
0.1
# Minimal smoothing in units of softening.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
minimal_temperature
:
100
# (internal units)
minimal_temperature
:
100
# (internal units)
...
...
examples/EAGLE_25/eagle_25.yml
View file @
9d95c26c
...
@@ -54,6 +54,7 @@ Gravity:
...
@@ -54,6 +54,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
# Parameters for the hydrodynamics scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
h_min_ratio
:
0.1
# Minimal smoothing in units of softening.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
minimal_temperature
:
100
# (internal units)
minimal_temperature
:
100
# (internal units)
...
...
examples/EAGLE_50/eagle_50.yml
View file @
9d95c26c
...
@@ -49,6 +49,7 @@ Gravity:
...
@@ -49,6 +49,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
# Parameters for the hydrodynamics scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
h_min_ratio
:
0.1
# Minimal smoothing in units of softening.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
minimal_temperature
:
100
# (internal units)
minimal_temperature
:
100
# (internal units)
...
...
examples/EAGLE_6/eagle_6.yml
View file @
9d95c26c
...
@@ -58,6 +58,7 @@ Gravity:
...
@@ -58,6 +58,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
# Parameters for the hydrodynamics scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
h_min_ratio
:
0.1
# Minimal smoothing in units of softening.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
minimal_temperature
:
100
# (internal units)
minimal_temperature
:
100
# (internal units)
...
...
examples/IsolatedGalaxy_starformation/isolated_galaxy.yml
View file @
9d95c26c
...
@@ -42,13 +42,10 @@ InitialConditions:
...
@@ -42,13 +42,10 @@ InitialConditions:
SPH
:
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
h_tolerance
:
1e-4
# (Optional) Relative accuracy of the Netwon-Raphson scheme for the smoothing lengths.
h_min_ratio
:
0.1
# Minimal smoothing in units of softening.
h_max
:
10.
# (Optional) Maximal allowed smoothing length in internal units. Defaults to FLT_MAX if unspecified.
h_max
:
10.
max_volume_change
:
1.4
# (Optional) Maximal allowed change of kernel volume over one time-step.
max_ghost_iterations
:
30
# (Optional) Maximal number of iterations allowed to converge towards the smoothing length.
minimal_temperature
:
100
# (Optional) Minimal temperature (in internal units) allowed for the gas particles. Value is ignored if set to 0.
H_ionization_temperature
:
1e4
# (Optional) Temperature of the transition from neutral to ionized Hydrogen for primoridal gas.
# Standard EAGLE cooling options
EAGLECooling
:
EAGLECooling
:
dir_name
:
./coolingtables/
# Location of the Wiersma+08 cooling tables
dir_name
:
./coolingtables/
# Location of the Wiersma+08 cooling tables
H_reion_z
:
11.5
# Redshift of Hydrogen re-ionization
H_reion_z
:
11.5
# Redshift of Hydrogen re-ionization
...
...
examples/SantaBarbara/santa_barbara.yml
View file @
9d95c26c
...
@@ -46,6 +46,7 @@ Gravity:
...
@@ -46,6 +46,7 @@ Gravity:
# Parameters of the hydro scheme
# Parameters of the hydro scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
h_min_ratio
:
0.1
CFL_condition
:
0.1
CFL_condition
:
0.1
initial_temperature
:
1200.
# (1 + z_ini)^2 * 2.72K
initial_temperature
:
1200.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
minimal_temperature
:
100.
...
...
examples/SantaBarbara_low/santa_barbara.yml
View file @
9d95c26c
...
@@ -47,6 +47,7 @@ Gravity:
...
@@ -47,6 +47,7 @@ Gravity:
SPH
:
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
CFL_condition
:
0.1
CFL_condition
:
0.1
h_min_ratio
:
0.1
initial_temperature
:
1200.
# (1 + z_ini)^2 * 2.72K
initial_temperature
:
1200.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
minimal_temperature
:
100.
...
...
examples/SmallCosmoVolume/small_cosmo_volume.yml
View file @
9d95c26c
...
@@ -30,6 +30,7 @@ Gravity:
...
@@ -30,6 +30,7 @@ Gravity:
# Parameters of the hydro scheme
# Parameters of the hydro scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
h_min_ratio
:
0.1
CFL_condition
:
0.1
CFL_condition
:
0.1
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
minimal_temperature
:
100.
...
...
examples/SmallCosmoVolume_VELOCIraptor/small_cosmo_volume.yml
View file @
9d95c26c
...
@@ -30,6 +30,7 @@ Gravity:
...
@@ -30,6 +30,7 @@ Gravity:
# Parameters of the hydro scheme
# Parameters of the hydro scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
h_min_ratio
:
0.1
CFL_condition
:
0.1
CFL_condition
:
0.1
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
minimal_temperature
:
100.
...
...
examples/SmallCosmoVolume_cooling/small_cosmo_volume.yml
View file @
9d95c26c
...
@@ -30,6 +30,7 @@ Gravity:
...
@@ -30,6 +30,7 @@ Gravity:
# Parameters of the hydro scheme
# Parameters of the hydro scheme
SPH
:
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
h_min_ratio
:
0.1
CFL_condition
:
0.1
CFL_condition
:
0.1
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
minimal_temperature
:
100.
...
...
examples/ZeldovichPancake_3D/zeldovichPancake.yml
View file @
9d95c26c
...
@@ -35,6 +35,7 @@ Statistics:
...
@@ -35,6 +35,7 @@ Statistics:
SPH
:
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
h_min_ratio
:
0.1
# Parameters related to the initial conditions
# Parameters related to the initial conditions
InitialConditions
:
InitialConditions
:
...
...
examples/parameter_example.yml
View file @
9d95c26c
...
@@ -28,6 +28,7 @@ SPH:
...
@@ -28,6 +28,7 @@ SPH:
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
CFL_condition
:
0.1
# Courant-Friedrich-Levy condition for time integration.
h_tolerance
:
1e-4
# (Optional) Relative accuracy of the Netwon-Raphson scheme for the smoothing lengths.
h_tolerance
:
1e-4
# (Optional) Relative accuracy of the Netwon-Raphson scheme for the smoothing lengths.
h_max
:
10.
# (Optional) Maximal allowed smoothing length in internal units. Defaults to FLT_MAX if unspecified.
h_max
:
10.
# (Optional) Maximal allowed smoothing length in internal units. Defaults to FLT_MAX if unspecified.
h_min_ratio
:
0.
# (Optional) Minimal allowed smoothing length in units of the softening. Defaults to 0 if unspecified.
max_volume_change
:
1.4
# (Optional) Maximal allowed change of kernel volume over one time-step.
max_volume_change
:
1.4
# (Optional) Maximal allowed change of kernel volume over one time-step.
max_ghost_iterations
:
30
# (Optional) Maximal number of iterations allowed to converge towards the smoothing length.
max_ghost_iterations
:
30
# (Optional) Maximal number of iterations allowed to converge towards the smoothing length.
initial_temperature
:
0
# (Optional) Initial temperature (in internal units) to set the gas particles at start-up. Value is ignored if set to 0.
initial_temperature
:
0
# (Optional) Initial temperature (in internal units) to set the gas particles at start-up. Value is ignored if set to 0.
...
...
src/cell.c
View file @
9d95c26c
...
@@ -3642,6 +3642,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
...
@@ -3642,6 +3642,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
const
double
dim
[
3
]
=
{
e
->
s
->
dim
[
0
],
e
->
s
->
dim
[
1
],
e
->
s
->
dim
[
2
]};
const
double
dim
[
3
]
=
{
e
->
s
->
dim
[
0
],
e
->
s
->
dim
[
1
],
e
->
s
->
dim
[
2
]};
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
float
hydro_h_max
=
e
->
hydro_properties
->
h_max
;
const
float
hydro_h_max
=
e
->
hydro_properties
->
h_max
;
const
float
hydro_h_min
=
e
->
hydro_properties
->
h_min
;
const
integertime_t
ti_old_part
=
c
->
hydro
.
ti_old_part
;
const
integertime_t
ti_old_part
=
c
->
hydro
.
ti_old_part
;
const
integertime_t
ti_current
=
e
->
ti_current
;
const
integertime_t
ti_current
=
e
->
ti_current
;
struct
part
*
const
parts
=
c
->
hydro
.
parts
;
struct
part
*
const
parts
=
c
->
hydro
.
parts
;
...
@@ -3776,6 +3777,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
...
@@ -3776,6 +3777,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
/* Limit h to within the allowed range */
/* Limit h to within the allowed range */
p
->
h
=
min
(
p
->
h
,
hydro_h_max
);
p
->
h
=
min
(
p
->
h
,
hydro_h_max
);
p
->
h
=
max
(
p
->
h
,
hydro_h_min
);
/* Compute (square of) motion since last cell construction */
/* Compute (square of) motion since last cell construction */
const
float
dx2
=
xp
->
x_diff
[
0
]
*
xp
->
x_diff
[
0
]
+
const
float
dx2
=
xp
->
x_diff
[
0
]
*
xp
->
x_diff
[
0
]
+
...
...
src/engine.c
View file @
9d95c26c
...
@@ -2792,7 +2792,12 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
...
@@ -2792,7 +2792,12 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
/* Update the softening lengths */
/* Update the softening lengths */
if
(
e
->
policy
&
engine_policy_self_gravity
)
if
(
e
->
policy
&
engine_policy_self_gravity
)
gravity_update
(
e
->
gravity_properties
,
e
->
cosmology
);
gravity_props_update
(
e
->
gravity_properties
,
e
->
cosmology
);
/* Udpate the hydro properties */
if
(
e
->
policy
&
engine_policy_hydro
)
hydro_props_update
(
e
->
hydro_properties
,
e
->
gravity_properties
,
e
->
cosmology
);
/* Start by setting the particles in a good state */
/* Start by setting the particles in a good state */
if
(
e
->
nodeID
==
0
)
message
(
"Setting particles to a valid state..."
);
if
(
e
->
nodeID
==
0
)
message
(
"Setting particles to a valid state..."
);
...
@@ -3085,7 +3090,12 @@ void engine_step(struct engine *e) {
...
@@ -3085,7 +3090,12 @@ void engine_step(struct engine *e) {
/* Update the softening lengths */
/* Update the softening lengths */
if
(
e
->
policy
&
engine_policy_self_gravity
)
if
(
e
->
policy
&
engine_policy_self_gravity
)
gravity_update
(
e
->
gravity_properties
,
e
->
cosmology
);
gravity_props_update
(
e
->
gravity_properties
,
e
->
cosmology
);
/* Udpate the hydro properties */
if
(
e
->
policy
&
engine_policy_hydro
)
hydro_props_update
(
e
->
hydro_properties
,
e
->
gravity_properties
,
e
->
cosmology
);
/* Trigger a tree-rebuild if we passed the frequency threshold */
/* Trigger a tree-rebuild if we passed the frequency threshold */
if
((
e
->
policy
&
engine_policy_self_gravity
)
&&
if
((
e
->
policy
&
engine_policy_self_gravity
)
&&
...
@@ -4088,7 +4098,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
...
@@ -4088,7 +4098,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
int
policy
,
int
verbose
,
struct
repartition
*
reparttype
,
int
policy
,
int
verbose
,
struct
repartition
*
reparttype
,
const
struct
unit_system
*
internal_units
,
const
struct
unit_system
*
internal_units
,
const
struct
phys_const
*
physical_constants
,
const
struct
phys_const
*
physical_constants
,
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
hydro
,
struct
cosmology
*
cosmo
,
struct
hydro_props
*
hydro
,
const
struct
entropy_floor_properties
*
entropy_floor
,
const
struct
entropy_floor_properties
*
entropy_floor
,
struct
gravity_props
*
gravity
,
const
struct
stars_props
*
stars
,
struct
gravity_props
*
gravity
,
const
struct
stars_props
*
stars
,
struct
pm_mesh
*
mesh
,
struct
pm_mesh
*
mesh
,
...
...
src/engine.h
View file @
9d95c26c
...
@@ -343,7 +343,7 @@ struct engine {
...
@@ -343,7 +343,7 @@ struct engine {
struct
cosmology
*
cosmology
;
struct
cosmology
*
cosmology
;
/* Properties of the hydro scheme */
/* Properties of the hydro scheme */
const
struct
hydro_props
*
hydro_properties
;
struct
hydro_props
*
hydro_properties
;
/* Properties of the entropy floor */
/* Properties of the entropy floor */
const
struct
entropy_floor_properties
*
entropy_floor
;
const
struct
entropy_floor_properties
*
entropy_floor
;
...
@@ -419,7 +419,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
...
@@ -419,7 +419,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
int
policy
,
int
verbose
,
struct
repartition
*
reparttype
,
int
policy
,
int
verbose
,
struct
repartition
*
reparttype
,
const
struct
unit_system
*
internal_units
,
const
struct
unit_system
*
internal_units
,
const
struct
phys_const
*
physical_constants
,
const
struct
phys_const
*
physical_constants
,
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
hydro
,
struct
cosmology
*
cosmo
,
struct
hydro_props
*
hydro
,
const
struct
entropy_floor_properties
*
entropy_floor
,
const
struct
entropy_floor_properties
*
entropy_floor
,
struct
gravity_props
*
gravity
,
const
struct
stars_props
*
stars
,
struct
gravity_props
*
gravity
,
const
struct
stars_props
*
stars
,
struct
pm_mesh
*
mesh
,
struct
pm_mesh
*
mesh
,
...
...
src/gravity/Default/gravity.h
View file @
9d95c26c
...
@@ -40,7 +40,7 @@ __attribute__((always_inline)) INLINE static float gravity_get_mass(
...
@@ -40,7 +40,7 @@ __attribute__((always_inline)) INLINE static float gravity_get_mass(
}
}
/**
/**
* @brief Returns the softening of a particle
* @brief Returns the
current co-moving
softening of a particle
*
*
* @param gp The particle of interest
* @param gp The particle of interest
* @param grav_props The global gravity properties.
* @param grav_props The global gravity properties.
...
...
src/gravity/Potential/gravity.h
View file @
9d95c26c
...
@@ -39,7 +39,7 @@ __attribute__((always_inline)) INLINE static float gravity_get_mass(
...
@@ -39,7 +39,7 @@ __attribute__((always_inline)) INLINE static float gravity_get_mass(
}
}
/**
/**
* @brief Returns the softening of a particle
* @brief Returns the
current co-moving
softening of a particle
*
*
* @param gp The particle of interest
* @param gp The particle of interest
* @param grav_props The global gravity properties.
* @param grav_props The global gravity properties.
...
...
src/gravity_properties.c
View file @
9d95c26c
...
@@ -99,10 +99,11 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params,
...
@@ -99,10 +99,11 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params,
}
}
/* Set the softening to the current time */
/* Set the softening to the current time */
gravity_update
(
p
,
cosmo
);
gravity_
props_
update
(
p
,
cosmo
);
}
}
void
gravity_update
(
struct
gravity_props
*
p
,
const
struct
cosmology
*
cosmo
)
{
void
gravity_props_update
(
struct
gravity_props
*
p
,
const
struct
cosmology
*
cosmo
)
{
/* Current softening lengths */
/* Current softening lengths */
double
softening
;
double
softening
;
...
...
src/gravity_properties.h
View file @
9d95c26c
...
@@ -73,7 +73,7 @@ struct gravity_props {
...
@@ -73,7 +73,7 @@ struct gravity_props {
/*! Maxium physical softening */
/*! Maxium physical softening */
double
epsilon_max_physical
;
double
epsilon_max_physical
;
/*! Current sftening length */
/*! Current s
o
ftening length */
float
epsilon_cur
;
float
epsilon_cur
;
/*! Square of current softening length */
/*! Square of current softening length */
...
@@ -90,7 +90,8 @@ void gravity_props_print(const struct gravity_props *p);
...
@@ -90,7 +90,8 @@ void gravity_props_print(const struct gravity_props *p);
void
gravity_props_init
(
struct
gravity_props
*
p
,
struct
swift_params
*
params
,
void
gravity_props_init
(
struct
gravity_props
*
p
,
struct
swift_params
*
params
,
const
struct
cosmology
*
cosmo
,
int
with_cosmology
,
const
struct
cosmology
*
cosmo
,
int
with_cosmology
,
int
periodic
);
int
periodic
);
void
gravity_update
(
struct
gravity_props
*
p
,
const
struct
cosmology
*
cosmo
);
void
gravity_props_update
(
struct
gravity_props
*
p
,
const
struct
cosmology
*
cosmo
);
#if defined(HAVE_HDF5)
#if defined(HAVE_HDF5)
void
gravity_props_print_snapshot
(
hid_t
h_grpsph
,
void
gravity_props_print_snapshot
(
hid_t
h_grpsph
,
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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