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

Added the new cooling parameters to the parameter documentation. Renamed the...

Added the new cooling parameters to the parameter documentation. Renamed the parameters to differentiate them.
parent f3735379
No related branches found
No related tags found
1 merge request!242Add the cooling infrastructure and the const_du and const_lambda
......@@ -15,7 +15,7 @@ TimeIntegration:
# Parameters governing the snapshots
Snapshots:
basename: uniformBox # Common part of the name of output files
basename: coolingBox # Common part of the name of output files
time_first: 0. # Time of the first output (in internal units)
delta_time: 1.0e-1 # Time difference between consecutive outputs (in internal units)
......@@ -32,20 +32,13 @@ SPH:
# Parameters related to the initial conditions
InitialConditions:
file_name: ./uniformBox.hdf5 # The file to read
file_name: ./coolingBox.hdf5 # The file to read
# External potential parameters
PointMass:
position_x: 50. # location of external point mass in internal units
position_y: 50.
position_z: 50.
mass: 1e10 # mass of external point mass in internal units
# Cooling parameters (Creasey cooling) (always in cgs)
Cooling:
lambda: 0.0
minimum_temperature: 1.0e4
mean_molecular_weight: 0.59
hydrogen_mass_abundance: 0.75
cooling_tstep_mult: 1.0
\ No newline at end of file
# Dimensionless pre-factor for the time-step condition
LambdaCooling:
lambda: 0.0 # Cooling rate (in cgs units)
minimum_temperature: 1.0e4 # Minimal temperature (Kelvin)
mean_molecular_weight: 0.59 # Mean molecular weight
hydrogen_mass_abundance: 0.75 # Hydrogen mass abundance (dimensionless)
cooling_tstep_mult: 1.0 # Dimensionless pre-factor for the time-step condition
......@@ -4,7 +4,7 @@ import h5py as h5
import sys
stats_filename = "./energy.txt"
snap_filename = "uniformBox_000.hdf5"
snap_filename = "coolingBox_000.hdf5"
#plot_dir = "./"
#some constants in cgs units
......@@ -24,10 +24,10 @@ unit_mass = units.attrs["Unit mass in cgs (U_M)"]
unit_length = units.attrs["Unit length in cgs (U_L)"]
unit_time = units.attrs["Unit time in cgs (U_t)"]
parameters = f["Parameters"]
cooling_lambda = float(parameters.attrs["Cooling:lambda"])
min_T = float(parameters.attrs["Cooling:minimum_temperature"])
mu = float(parameters.attrs["Cooling:mean_molecular_weight"])
X_H = float(parameters.attrs["Cooling:hydrogen_mass_abundance"])
cooling_lambda = float(parameters.attrs["LambdaCooling:lambda"])
min_T = float(parameters.attrs["LambdaCooling:minimum_temperature"])
mu = float(parameters.attrs["LambdaCooling:mean_molecular_weight"])
X_H = float(parameters.attrs["LambdaCooling:hydrogen_mass_abundance"])
#get number of particles
header = f["Header"]
......
......@@ -33,7 +33,7 @@ rho = 3.2e3 # Density in code units (0.01 hydrogen atoms per cm^3)
P = 4.5e6 # Pressure in code units (at 10^5K)
gamma = 5./3. # Gas adiabatic index
eta = 1.2349 # 48 ngbs with cubic spline kernel
fileName = "uniformBox.hdf5"
fileName = "coolingBox.hdf5"
#---------------------------------------------------
numPart = L**3
......
......@@ -8,5 +8,3 @@ python makeIC.py 10
../swift -s -t 1 coolingBox.yml -C
python energy_plot.py 0
python add_energy_column
......@@ -63,7 +63,7 @@ DomainDecomposition:
initial_grid_z: 10
repartition_type: b # (Optional) The re-decomposition strategy ("n", "b", "v", "e" or "x").
# Parameters related to external potentials
# Parameters related to external potentials --------------------------------------------
# Point mass external potentials
PointMass:
......@@ -73,6 +73,7 @@ PointMass:
mass: 1e10 # mass of external point mass (internal units)
timestep_mult: 0.03 # Dimensionless pre-factor for the time-step condition
# Isothermal potential parameters
IsothermalPotential:
position_x: 100. # Location of centre of isothermal potential (internal units)
position_y: 100.
......@@ -80,9 +81,27 @@ IsothermalPotential:
vrot: 200. # Rotation speed of isothermal potential (internal units)
timestep_mult: 0.03 # Dimensionless pre-factor for the time-step condition
# Disk-patch potential parameters
Disk-PatchPotential:
surface_density: 10. # Surface density of the disk (internal units)
scale_height: 100. # Scale height of the disk (internal units)
z_disk: 200. # Disk height (internal units)
timestep_mult: 0.03 # Dimensionless pre-factor for the time-step condition
growth_time: 5. # (Optional) Time for the disk to grow to its final size (multiple of the dynamical time)
# Parameters related to cooling function ----------------------------------------------
# Constant du/dt cooling function
ConstCooling:
cooling_rate: 1. # Cooling rate (du/dt) (internal units)
min_energy: 1. # Minimal internal energy per unit mass (internal units)
cooling_tstep_mult: 1. # Dimensionless pre-factor for the time-step condition
# Constant lambda cooling function
LambdaCooling:
lambda: 2.0 # Cooling rate (in cgs units)
minimum_temperature: 1.0e4 # Minimal temperature (Kelvin)
mean_molecular_weight: 0.59 # Mean molecular weight
hydrogen_mass_abundance: 0.75 # Hydrogen mass abundance (dimensionless)
cooling_tstep_mult: 1.0 # Dimensionless pre-factor for the time-step condition
......@@ -119,11 +119,11 @@ INLINE void cooling_init(const struct swift_params* parameter_file,
struct cooling_data* cooling) {
cooling->cooling_rate =
parser_get_param_double(parameter_file, "Cooling:cooling_rate");
parser_get_param_double(parameter_file, "ConstCooling:cooling_rate");
cooling->min_energy =
parser_get_param_double(parameter_file, "Cooling:min_energy");
cooling->cooling_tstep_mult =
parser_get_param_double(parameter_file, "Cooling:cooling_tstep_mult");
parser_get_param_double(parameter_file, "ConstCooling:min_energy");
cooling->cooling_tstep_mult = parser_get_param_double(
parameter_file, "ConstCooling:cooling_tstep_mult");
}
/**
......
......@@ -117,6 +117,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
/* Calculate du_dt */
const float du_dt = cooling_rate(phys_const, us, cooling, p);
/* Intergrate cooling equation, but enforce energy floor */
float u_new;
if (u_old + du_dt * dt > u_floor) {
......@@ -127,13 +128,13 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
/* Update the internal energy */
hydro_set_internal_energy(p, u_new);
// const float u_new_test = hydro_get_internal_energy(p, 0.f);
/* if (-(u_new_test - u_old)/u_old > 1.0e-6){ */
/* printf("Particle has successfully cooled: u_old = %g , du_dt = %g , dt = %g
* , du_dt*dt = %g, u_old + du_dt*dt = %g, u_new =
* %g\n",u_old,du_dt,dt,du_dt*dt,u_new,u_new_test); */
/* exit(-1); */
/* } */
/* if (-(u_new_test - u_old) / u_old > 1.0e-6) */
/* error( */
/* "Particle has not successfully cooled: u_old = %g , du_dt = %g , dt =
* " */
/* "%g, du_dt*dt = %g, u_old + du_dt*dt = %g, u_new = %g\n", */
/* u_old, du_dt, dt, du_dt * dt, u_new, u_new_test); */
}
/**
......@@ -171,15 +172,16 @@ INLINE void cooling_init(const struct swift_params* parameter_file,
const struct phys_const* phys_const,
struct cooling_data* cooling) {
cooling->lambda = parser_get_param_double(parameter_file, "Cooling:lambda");
cooling->min_temperature =
parser_get_param_double(parameter_file, "Cooling:minimum_temperature");
cooling->lambda =
parser_get_param_double(parameter_file, "LambdaCooling:lambda");
cooling->min_temperature = parser_get_param_double(
parameter_file, "LambdaCooling:minimum_temperature");
cooling->hydrogen_mass_abundance = parser_get_param_double(
parameter_file, "Cooling:hydrogen_mass_abundance");
cooling->mean_molecular_weight =
parser_get_param_double(parameter_file, "Cooling:mean_molecular_weight");
cooling->cooling_tstep_mult =
parser_get_param_double(parameter_file, "Cooling:cooling_tstep_mult");
parameter_file, "LambdaCooling:hydrogen_mass_abundance");
cooling->mean_molecular_weight = parser_get_param_double(
parameter_file, "LambdaCooling:mean_molecular_weight");
cooling->cooling_tstep_mult = parser_get_param_double(
parameter_file, "LambdaCooling:cooling_tstep_mult");
/*convert minimum temperature into minimum internal energy*/
const float u_floor =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment