diff --git a/.gitignore b/.gitignore index b44b5189190bd6593368c9ce8fbbd19d1d34d6ce..3c6ecf6ece8e10520e37bd5f305a533e28976e33 100644 --- a/.gitignore +++ b/.gitignore @@ -29,9 +29,9 @@ examples/*/*.txt examples/*/used_parameters.yml examples/*/*/*.xmf examples/*/*/*.hdf5 +examples/*/*/*.png examples/*/*/*.txt examples/*/*/used_parameters.yml -examples/*/*.png tests/testPair tests/brute_force_standard.dat diff --git a/configure.ac b/configure.ac index 3247ed25bd4475d2955c744e112d068425e55043..9a7f2ba702151a27f2ae702756cfb3c3bc95bcf3 100644 --- a/configure.ac +++ b/configure.ac @@ -105,8 +105,9 @@ if test "$enable_mpi" = "yes"; then AC_PATH_PROG([MPIRUN],[mpirun],[notfound]) fi 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]) - enable_mpi="no" else # Special options we know about. # Intel: -mt_mpi diff --git a/examples/SedovBlast_1D/sedov.yml b/examples/SedovBlast_1D/sedov.yml index 2a15d6ed22e71735c04274cee3f719b9d21f170e..87ab2e81e11e184eebbe024ea75ac9205f7530c5 100644 --- a/examples/SedovBlast_1D/sedov.yml +++ b/examples/SedovBlast_1D/sedov.yml @@ -11,7 +11,7 @@ TimeIntegration: 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). 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 Snapshots: diff --git a/examples/SodShock_2D/makeIC.py b/examples/SodShock_2D/makeIC.py index fdc1610df8cb87b3057323b1330e4c3044f36241..850ca24f54c39990a9b0c54c0d2f361a2aa01e95 100644 --- a/examples/SodShock_2D/makeIC.py +++ b/examples/SodShock_2D/makeIC.py @@ -88,7 +88,7 @@ file = h5py.File(fileName, 'w') # 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_HighWord"] = [0, 0, 0, 0, 0, 0] grp.attrs["NumPart_ThisFile"] = [numPart, 0, 0, 0, 0, 0] diff --git a/src/dimension.h b/src/dimension.h index f81f953f664c458f426a83e345e91921b28a55b8..7c58b5b846490e8f5227a232eaaeb3df5995f795 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -39,23 +39,26 @@ #define hydro_dimension 3.f #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) #define hydro_dimension 2.f #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) #define hydro_dimension 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 -#error "A problem dimensionality must be chosen in const.h !" +#error "A problem dimensionality must be chosen in config.h !" #endif @@ -201,6 +204,35 @@ invert_dimension_by_dimension_matrix(float A[3][3]) { #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 diff --git a/src/equation_of_state.h b/src/equation_of_state.h index 5e570fc6343f11eb2c71720cfd51afe52161ff02..28c97c7b96b778c7bbb7bcbfb6ffe682ce54ba22 100644 --- a/src/equation_of_state.h +++ b/src/equation_of_state.h @@ -69,6 +69,21 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy( 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 * @@ -111,6 +126,20 @@ gas_pressure_from_internal_energy(float density, float u) { 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 * @@ -172,6 +201,22 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy( 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 * @@ -219,6 +264,20 @@ gas_pressure_from_internal_energy(float density, float u) { 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 * diff --git a/src/kernel_hydro.h b/src/kernel_hydro.h index 7bf2e01a719a29b731bb437096093b13ca086e37..ceaa3b7b46279e3dfe063bbda34d97233f33acbb 100644 --- a/src/kernel_hydro.h +++ b/src/kernel_hydro.h @@ -230,7 +230,7 @@ static const float kernel_coeffs[(kernel_degree + 1) * (kernel_ivals + 1)] kernel_gamma_inv_dim) /* 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)) /* ------------------------------------------------------------------------- */