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

Merge branch 'master' into gravity_multi_dt

parents 8b0a582b fe18b735
No related branches found
No related tags found
1 merge request!324Gravity multi dt
...@@ -29,9 +29,9 @@ examples/*/*.txt ...@@ -29,9 +29,9 @@ examples/*/*.txt
examples/*/used_parameters.yml examples/*/used_parameters.yml
examples/*/*/*.xmf examples/*/*/*.xmf
examples/*/*/*.hdf5 examples/*/*/*.hdf5
examples/*/*/*.png
examples/*/*/*.txt examples/*/*/*.txt
examples/*/*/used_parameters.yml examples/*/*/used_parameters.yml
examples/*/*.png
tests/testPair tests/testPair
tests/brute_force_standard.dat tests/brute_force_standard.dat
......
...@@ -105,8 +105,9 @@ if test "$enable_mpi" = "yes"; then ...@@ -105,8 +105,9 @@ if test "$enable_mpi" = "yes"; then
AC_PATH_PROG([MPIRUN],[mpirun],[notfound]) AC_PATH_PROG([MPIRUN],[mpirun],[notfound])
fi fi
if test "$MPIRUN" = "notfound"; then if test "$MPIRUN" = "notfound"; then
# This may not be fatal (some systems do not allow mpirun on
# development nodes)., so push on.
AC_MSG_WARN([Cannot find mpirun command on PATH, thread support may not be correct]) AC_MSG_WARN([Cannot find mpirun command on PATH, thread support may not be correct])
enable_mpi="no"
else else
# Special options we know about. # Special options we know about.
# Intel: -mt_mpi # Intel: -mt_mpi
......
...@@ -11,7 +11,7 @@ TimeIntegration: ...@@ -11,7 +11,7 @@ TimeIntegration:
time_begin: 0. # The starting time of the simulation (in internal units). time_begin: 0. # The starting time of the simulation (in internal units).
time_end: 5e-2 # The end time of the simulation (in internal units). time_end: 5e-2 # The end time of the simulation (in internal units).
dt_min: 1e-7 # The minimal time-step size of the simulation (in internal units). dt_min: 1e-7 # The minimal time-step size of the simulation (in internal units).
dt_max: 1e-4 # The maximal time-step size of the simulation (in internal units). dt_max: 1e-5 # The maximal time-step size of the simulation (in internal units).
# Parameters governing the snapshots # Parameters governing the snapshots
Snapshots: Snapshots:
......
...@@ -88,7 +88,7 @@ file = h5py.File(fileName, 'w') ...@@ -88,7 +88,7 @@ file = h5py.File(fileName, 'w')
# Header # Header
grp = file.create_group("/Header") grp = file.create_group("/Header")
grp.attrs["BoxSize"] = [boxSize, 0.5, 0.1] grp.attrs["BoxSize"] = [boxSize, 0.5, 1.0]
grp.attrs["NumPart_Total"] = [numPart, 0, 0, 0, 0, 0] grp.attrs["NumPart_Total"] = [numPart, 0, 0, 0, 0, 0]
grp.attrs["NumPart_Total_HighWord"] = [0, 0, 0, 0, 0, 0] grp.attrs["NumPart_Total_HighWord"] = [0, 0, 0, 0, 0, 0]
grp.attrs["NumPart_ThisFile"] = [numPart, 0, 0, 0, 0, 0] grp.attrs["NumPart_ThisFile"] = [numPart, 0, 0, 0, 0, 0]
......
...@@ -39,23 +39,26 @@ ...@@ -39,23 +39,26 @@
#define hydro_dimension 3.f #define hydro_dimension 3.f
#define hydro_dimension_inv 0.3333333333f #define hydro_dimension_inv 0.3333333333f
#define hydro_dimention_unit_sphere ((float)(4. * M_PI / 3.)) #define hydro_dimension_unit_sphere ((float)(4. * M_PI / 3.))
#define hydro_dimension_unit_sphere_inv ((float)(3. * M_1_PI / 4.))
#elif defined(HYDRO_DIMENSION_2D) #elif defined(HYDRO_DIMENSION_2D)
#define hydro_dimension 2.f #define hydro_dimension 2.f
#define hydro_dimension_inv 0.5f #define hydro_dimension_inv 0.5f
#define hydro_dimention_unit_sphere ((float)M_PI) #define hydro_dimension_unit_sphere ((float)M_PI)
#define hydro_dimension_unit_sphere_inv ((float)M_1_PI)
#elif defined(HYDRO_DIMENSION_1D) #elif defined(HYDRO_DIMENSION_1D)
#define hydro_dimension 1.f #define hydro_dimension 1.f
#define hydro_dimension_inv 1.f #define hydro_dimension_inv 1.f
#define hydro_dimention_unit_sphere 2.f #define hydro_dimension_unit_sphere 2.f
#define hydro_dimension_unit_sphere_inv 0.5f
#else #else
#error "A problem dimensionality must be chosen in const.h !" #error "A problem dimensionality must be chosen in config.h !"
#endif #endif
...@@ -201,6 +204,35 @@ invert_dimension_by_dimension_matrix(float A[3][3]) { ...@@ -201,6 +204,35 @@ invert_dimension_by_dimension_matrix(float A[3][3]) {
#endif #endif
} }
/**
* @brief Get the radius of a dimension sphere with the given volume
*
* @param volume Volume of the dimension sphere
* @return Radius of the dimension sphere
*/
__attribute__((always_inline)) INLINE static float get_radius_dimension_sphere(
float volume) {
#if defined(HYDRO_DIMENSION_3D)
return cbrtf(volume * hydro_dimension_unit_sphere_inv);
#elif defined(HYDRO_DIMENSION_2D)
return sqrtf(volume * hydro_dimension_unit_sphere_inv);
#elif defined(HYDRO_DIMENSION_1D)
return volume * hydro_dimension_unit_sphere_inv;
#else
error("The dimension is not defined !");
return 0.f;
#endif
}
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#ifdef WITH_VECTORIZATION #ifdef WITH_VECTORIZATION
......
...@@ -69,6 +69,21 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy( ...@@ -69,6 +69,21 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
return entropy * pow_gamma(density); return entropy * pow_gamma(density);
} }
/**
* @brief Returns the entropy given density and pressure.
*
* Computes \f$A = \frac{P}{\rho^\gamma}\f$.
*
* @param density The density \f$\rho\f$.
* @param pressure The pressure \f$P\f$.
* @return The entropy \f$A\f$.
*/
__attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
float density, float pressure) {
return pressure * pow_minus_gamma(density);
}
/** /**
* @brief Returns the sound speed given density and entropy * @brief Returns the sound speed given density and entropy
* *
...@@ -111,6 +126,20 @@ gas_pressure_from_internal_energy(float density, float u) { ...@@ -111,6 +126,20 @@ gas_pressure_from_internal_energy(float density, float u) {
return hydro_gamma_minus_one * u * density; return hydro_gamma_minus_one * u * density;
} }
/**
* @brief Returns the internal energy given density and pressure.
*
* Computes \f$u = \frac{1}{\gamma - 1}\frac{P}{\rho}\f$.
*
* @param density The density \f$\rho\f$.
* @param pressure The pressure \f$P\f$.
* @return The internal energy \f$u\f$.
*/
__attribute__((always_inline)) INLINE static float
gas_internal_energy_from_pressure(float density, float pressure) {
return hydro_one_over_gamma_minus_one * pressure / density;
}
/** /**
* @brief Returns the sound speed given density and internal energy * @brief Returns the sound speed given density and internal energy
* *
...@@ -172,6 +201,22 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy( ...@@ -172,6 +201,22 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
return hydro_gamma_minus_one * const_isothermal_internal_energy * density; return hydro_gamma_minus_one * const_isothermal_internal_energy * density;
} }
/**
* @brief Returns the entropy given density and pressure.
*
* Computes \f$A = \frac{P}{\rho^\gamma}\f$.
*
* @param density The density \f$\rho\f$.
* @param pressure The pressure \f$P\f$ (ignored).
* @return The entropy \f$A\f$.
*/
__attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
float density, float pressure) {
return hydro_gamma_minus_one * const_isothermal_internal_energy *
pow_minus_gamma_minus_one(density);
}
/** /**
* @brief Returns the sound speed given density and entropy * @brief Returns the sound speed given density and entropy
* *
...@@ -219,6 +264,20 @@ gas_pressure_from_internal_energy(float density, float u) { ...@@ -219,6 +264,20 @@ gas_pressure_from_internal_energy(float density, float u) {
return hydro_gamma_minus_one * const_isothermal_internal_energy * density; return hydro_gamma_minus_one * const_isothermal_internal_energy * density;
} }
/**
* @brief Returns the internal energy given density and pressure.
*
* Just returns the constant internal energy.
*
* @param density The density \f$\rho\f$ (ignored).
* @param pressure The pressure \f$P\f$ (ignored).
* @return The internal energy \f$u\f$ (which is constant).
*/
__attribute__((always_inline)) INLINE static float
gas_internal_energy_from_pressure(float density, float pressure) {
return const_isothermal_energy;
}
/** /**
* @brief Returns the sound speed given density and internal energy * @brief Returns the sound speed given density and internal energy
* *
......
...@@ -230,7 +230,7 @@ static const float kernel_coeffs[(kernel_degree + 1) * (kernel_ivals + 1)] ...@@ -230,7 +230,7 @@ static const float kernel_coeffs[(kernel_degree + 1) * (kernel_ivals + 1)]
kernel_gamma_inv_dim) kernel_gamma_inv_dim)
/* Kernel normalisation constant (volume term) */ /* Kernel normalisation constant (volume term) */
#define kernel_norm ((float)(hydro_dimention_unit_sphere * kernel_gamma_dim)) #define kernel_norm ((float)(hydro_dimension_unit_sphere * kernel_gamma_dim))
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment