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
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:
# Parameters for the hydrodynamics scheme
SPH
:
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.
minimal_temperature
:
100
# (internal units)
...
...
examples/EAGLE_12/eagle_12.yml
View file @
9d95c26c
...
...
@@ -47,6 +47,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
SPH
:
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.
minimal_temperature
:
100
# (internal units)
...
...
examples/EAGLE_25/eagle_25.yml
View file @
9d95c26c
...
...
@@ -54,6 +54,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
SPH
:
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.
minimal_temperature
:
100
# (internal units)
...
...
examples/EAGLE_50/eagle_50.yml
View file @
9d95c26c
...
...
@@ -49,6 +49,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
SPH
:
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.
minimal_temperature
:
100
# (internal units)
...
...
examples/EAGLE_6/eagle_6.yml
View file @
9d95c26c
...
...
@@ -58,6 +58,7 @@ Gravity:
# Parameters for the hydrodynamics scheme
SPH
:
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.
minimal_temperature
:
100
# (internal units)
...
...
examples/IsolatedGalaxy_starformation/isolated_galaxy.yml
View file @
9d95c26c
...
...
@@ -42,13 +42,10 @@ InitialConditions:
SPH
:
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.
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.
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.
h_min_ratio
:
0.1
# Minimal smoothing in units of softening.
h_max
:
10.
# Standard EAGLE cooling options
EAGLECooling
:
dir_name
:
./coolingtables/
# Location of the Wiersma+08 cooling tables
H_reion_z
:
11.5
# Redshift of Hydrogen re-ionization
...
...
examples/SantaBarbara/santa_barbara.yml
View file @
9d95c26c
...
...
@@ -46,6 +46,7 @@ Gravity:
# Parameters of the hydro scheme
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
h_min_ratio
:
0.1
CFL_condition
:
0.1
initial_temperature
:
1200.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
...
...
examples/SantaBarbara_low/santa_barbara.yml
View file @
9d95c26c
...
...
@@ -47,6 +47,7 @@ Gravity:
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
CFL_condition
:
0.1
h_min_ratio
:
0.1
initial_temperature
:
1200.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
...
...
examples/SmallCosmoVolume/small_cosmo_volume.yml
View file @
9d95c26c
...
...
@@ -30,6 +30,7 @@ Gravity:
# Parameters of the hydro scheme
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
h_min_ratio
:
0.1
CFL_condition
:
0.1
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
...
...
examples/SmallCosmoVolume_VELOCIraptor/small_cosmo_volume.yml
View file @
9d95c26c
...
...
@@ -30,6 +30,7 @@ Gravity:
# Parameters of the hydro scheme
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
h_min_ratio
:
0.1
CFL_condition
:
0.1
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
...
...
examples/SmallCosmoVolume_cooling/small_cosmo_volume.yml
View file @
9d95c26c
...
...
@@ -30,6 +30,7 @@ Gravity:
# Parameters of the hydro scheme
SPH
:
resolution_eta
:
1.2348
# "48 Ngb" with the cubic spline kernel
h_min_ratio
:
0.1
CFL_condition
:
0.1
initial_temperature
:
7075.
# (1 + z_ini)^2 * 2.72K
minimal_temperature
:
100.
...
...
examples/ZeldovichPancake_3D/zeldovichPancake.yml
View file @
9d95c26c
...
...
@@ -35,6 +35,7 @@ Statistics:
SPH
:
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.
h_min_ratio
:
0.1
# Parameters related to the initial conditions
InitialConditions
:
...
...
examples/parameter_example.yml
View file @
9d95c26c
...
...
@@ -28,6 +28,7 @@ SPH:
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_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_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.
...
...
src/cell.c
View file @
9d95c26c
...
...
@@ -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
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
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_current
=
e
->
ti_current
;
struct
part
*
const
parts
=
c
->
hydro
.
parts
;
...
...
@@ -3776,6 +3777,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
/* Limit h to within the allowed range */
p
->
h
=
min
(
p
->
h
,
hydro_h_max
);
p
->
h
=
max
(
p
->
h
,
hydro_h_min
);
/* Compute (square of) motion since last cell construction */
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,
/* Update the softening lengths */
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 */
if
(
e
->
nodeID
==
0
)
message
(
"Setting particles to a valid state..."
);
...
...
@@ -3085,7 +3090,12 @@ void engine_step(struct engine *e) {
/* Update the softening lengths */
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 */
if
((
e
->
policy
&
engine_policy_self_gravity
)
&&
...
...
@@ -4088,7 +4098,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
int
policy
,
int
verbose
,
struct
repartition
*
reparttype
,
const
struct
unit_system
*
internal_units
,
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
,
struct
gravity_props
*
gravity
,
const
struct
stars_props
*
stars
,
struct
pm_mesh
*
mesh
,
...
...
src/engine.h
View file @
9d95c26c
...
...
@@ -343,7 +343,7 @@ struct engine {
struct
cosmology
*
cosmology
;
/* Properties of the hydro scheme */
const
struct
hydro_props
*
hydro_properties
;
struct
hydro_props
*
hydro_properties
;
/* Properties of the 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,
int
policy
,
int
verbose
,
struct
repartition
*
reparttype
,
const
struct
unit_system
*
internal_units
,
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
,
struct
gravity_props
*
gravity
,
const
struct
stars_props
*
stars
,
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(
}
/**
* @brief Returns the softening of a particle
* @brief Returns the
current co-moving
softening of a particle
*
* @param gp The particle of interest
* @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(
}
/**
* @brief Returns the softening of a particle
* @brief Returns the
current co-moving
softening of a particle
*
* @param gp The particle of interest
* @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,
}
/* 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 */
double
softening
;
...
...
src/gravity_properties.h
View file @
9d95c26c
...
...
@@ -73,7 +73,7 @@ struct gravity_props {
/*! Maxium physical softening */
double
epsilon_max_physical
;
/*! Current sftening length */
/*! Current s
o
ftening length */
float
epsilon_cur
;
/*! Square of current softening length */
...
...
@@ -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
,
const
struct
cosmology
*
cosmo
,
int
with_cosmology
,
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)
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
.
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