Skip to content
Snippets Groups Projects
Commit 5e708520 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Moved some more hydro parameters as optional

parent 7e62ff74
No related branches found
No related tags found
1 merge request!184Moved some more hydro parameters as optional
...@@ -37,10 +37,8 @@ Statistics: ...@@ -37,10 +37,8 @@ Statistics:
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).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. 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). max_smoothing_length: 0.705 # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. 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 # Parameters related to the initial conditions
InitialConditions: InitialConditions:
......
...@@ -32,10 +32,8 @@ Statistics: ...@@ -32,10 +32,8 @@ Statistics:
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).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. 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). max_smoothing_length: 10. # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. 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 # Parameters related to the initial conditions
InitialConditions: InitialConditions:
......
...@@ -32,10 +32,8 @@ Statistics: ...@@ -32,10 +32,8 @@ Statistics:
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).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. 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). max_smoothing_length: 1. # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. 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 # Parameters related to the initial conditions
InitialConditions: InitialConditions:
......
...@@ -32,10 +32,8 @@ Statistics: ...@@ -32,10 +32,8 @@ Statistics:
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).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. 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). max_smoothing_length: 0.01 # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. 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 # Parameters related to the initial conditions
InitialConditions: InitialConditions:
......
...@@ -32,10 +32,8 @@ Statistics: ...@@ -32,10 +32,8 @@ Statistics:
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).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. 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). max_smoothing_length: 0.1 # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. 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 # Parameters related to the initial conditions
InitialConditions: InitialConditions:
......
...@@ -39,10 +39,10 @@ Statistics: ...@@ -39,10 +39,10 @@ Statistics:
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).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours. 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). max_smoothing_length: 0.1 # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. 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 # Parameters related to the initial conditions
InitialConditions: InitialConditions:
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#include "hydro.h" #include "hydro.h"
#include "kernel_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, void hydro_props_init(struct hydro_props *p,
const struct swift_params *params) { const struct swift_params *params) {
...@@ -39,13 +42,13 @@ void hydro_props_init(struct hydro_props *p, ...@@ -39,13 +42,13 @@ void hydro_props_init(struct hydro_props *p,
p->delta_neighbours = parser_get_param_float(params, "SPH:delta_neighbours"); p->delta_neighbours = parser_get_param_float(params, "SPH:delta_neighbours");
/* Ghost stuff */ /* Ghost stuff */
p->max_smoothing_iterations = p->max_smoothing_iterations = parser_get_opt_param_int(
parser_get_param_int(params, "SPH:max_ghost_iterations"); params, "SPH:max_ghost_iterations", hydro_props_default_max_iterations);
/* Time integration properties */ /* Time integration properties */
p->CFL_condition = parser_get_param_float(params, "SPH:CFL_condition"); p->CFL_condition = parser_get_param_float(params, "SPH:CFL_condition");
const float max_volume_change = const float max_volume_change = parser_get_opt_param_float(
parser_get_param_float(params, "SPH:max_volume_change"); params, "SPH:max_volume_change", hydro_props_default_volume_change);
p->log_max_h_change = logf(powf(max_volume_change, 0.33333333333f)); 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) { ...@@ -60,4 +63,8 @@ void hydro_props_print(const struct hydro_props *p) {
"Hydrodynamic integration: Max change of volume: %.2f " "Hydrodynamic integration: Max change of volume: %.2f "
"(max|dlog(h)/dt|=%f).", "(max|dlog(h)/dt|=%f).",
powf(expf(p->log_max_h_change), 3.f), p->log_max_h_change); 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);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment