diff --git a/examples/CosmoVolume/cosmoVolume.yml b/examples/CosmoVolume/cosmoVolume.yml index a2f0ad9cccca9f4e7a709545104f199c09363155..83d70f35c0d7ed5f0c81eb138b37eb0881125e85 100644 --- a/examples/CosmoVolume/cosmoVolume.yml +++ b/examples/CosmoVolume/cosmoVolume.yml @@ -37,10 +37,8 @@ Statistics: SPH: resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. - max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length. max_smoothing_length: 0.705 # Maximal smoothing length allowed (in internal units). CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. - max_volume_change: 2. # Maximal allowed change of volume over one time-step # Parameters related to the initial conditions InitialConditions: diff --git a/examples/ExternalPointMass/externalPointMass.yml b/examples/ExternalPointMass/externalPointMass.yml index e4c3abc28362801ee53320f9e547bf6d01670ec7..52330163caa13609fd7674a5cdf2921743fbe227 100644 --- a/examples/ExternalPointMass/externalPointMass.yml +++ b/examples/ExternalPointMass/externalPointMass.yml @@ -32,10 +32,8 @@ Statistics: SPH: resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. - max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length. max_smoothing_length: 10. # Maximal smoothing length allowed (in internal units). CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. - max_volume_change: 2. # Maximal allowed change of volume over one time-step # Parameters related to the initial conditions InitialConditions: diff --git a/examples/SedovBlast/sedov.yml b/examples/SedovBlast/sedov.yml index 96b16c5b85b2e534e5ac8b7680f61ed9912da3d6..9fbabb4969b6accdb7323d8270b735951ac0693a 100644 --- a/examples/SedovBlast/sedov.yml +++ b/examples/SedovBlast/sedov.yml @@ -32,10 +32,8 @@ Statistics: SPH: resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. - max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length. max_smoothing_length: 1. # Maximal smoothing length allowed (in internal units). CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. - max_volume_change: 2. # Maximal allowed change of volume over one time-step # Parameters related to the initial conditions InitialConditions: diff --git a/examples/SodShock/sodShock.yml b/examples/SodShock/sodShock.yml index 62ed0c68cad8e063f49ab0655aee0e10f57e6314..003b7286777230ceb3b84ee01c6a1f335aeb9476 100644 --- a/examples/SodShock/sodShock.yml +++ b/examples/SodShock/sodShock.yml @@ -32,10 +32,8 @@ Statistics: SPH: resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. - max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length. max_smoothing_length: 0.01 # Maximal smoothing length allowed (in internal units). CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. - max_volume_change: 2. # Maximal allowed change of volume over one time-step # Parameters related to the initial conditions InitialConditions: diff --git a/examples/UniformBox/uniformBox.yml b/examples/UniformBox/uniformBox.yml index 64f9a135fff6ecb2e4500ade95d1500a0712f2c8..50afbee02ddc8a801ca77ed4900b7d2e0e3b50b5 100644 --- a/examples/UniformBox/uniformBox.yml +++ b/examples/UniformBox/uniformBox.yml @@ -32,10 +32,8 @@ Statistics: SPH: resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. - max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length. max_smoothing_length: 0.1 # Maximal smoothing length allowed (in internal units). CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. - max_volume_change: 2. # Maximal allowed change of volume over one time-step # Parameters related to the initial conditions InitialConditions: diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 9b2ebd028a3506e231aa36ed2078bb44faf4eb49..fb1e6ff6931b2fdee00792eed7f178872ee6d950 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -39,10 +39,10 @@ Statistics: SPH: resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel). delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. - max_ghost_iterations: 30 # 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. max_smoothing_length: 0.1 # Maximal smoothing length allowed (in internal units). CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. - max_volume_change: 2. # Maximal allowed change of kernel volume over one time-step + max_volume_change: 2. # (Optional) Maximal allowed change of kernel volume over one time-step # Parameters related to the initial conditions InitialConditions: diff --git a/src/hydro_properties.c b/src/hydro_properties.c index b4e37d672408ad3c0adf1f37fcd4fcbd50095d92..16216f81a5b505fc3a887e86ca4898bc4179e4d5 100644 --- a/src/hydro_properties.c +++ b/src/hydro_properties.c @@ -29,6 +29,9 @@ #include "hydro.h" #include "kernel_hydro.h" +#define hydro_props_default_max_iterations 30 +#define hydro_props_default_volume_change 2.0f + void hydro_props_init(struct hydro_props *p, const struct swift_params *params) { @@ -39,13 +42,13 @@ void hydro_props_init(struct hydro_props *p, p->delta_neighbours = parser_get_param_float(params, "SPH:delta_neighbours"); /* Ghost stuff */ - p->max_smoothing_iterations = - parser_get_param_int(params, "SPH:max_ghost_iterations"); + p->max_smoothing_iterations = parser_get_opt_param_int( + params, "SPH:max_ghost_iterations", hydro_props_default_max_iterations); /* Time integration properties */ p->CFL_condition = parser_get_param_float(params, "SPH:CFL_condition"); - const float max_volume_change = - parser_get_param_float(params, "SPH:max_volume_change"); + const float max_volume_change = parser_get_opt_param_float( + params, "SPH:max_volume_change", hydro_props_default_volume_change); p->log_max_h_change = logf(powf(max_volume_change, 0.33333333333f)); } @@ -60,4 +63,8 @@ void hydro_props_print(const struct hydro_props *p) { "Hydrodynamic integration: Max change of volume: %.2f " "(max|dlog(h)/dt|=%f).", powf(expf(p->log_max_h_change), 3.f), p->log_max_h_change); + + if (p->max_smoothing_iterations != hydro_props_default_max_iterations) + message("Maximal iterations in ghost task set to %d (default is %d)", + p->max_smoothing_iterations, hydro_props_default_max_iterations); }