Skip to content

Commit

Permalink
EOSX: Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaykalinani committed Jul 23, 2024
1 parent 2cc5ee4 commit 753e9e7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion EOSX/configuration.ccl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration definitions for thorn EOSX

REQUIRES HDF5 MPI
REQUIRES HDF5 MPI Loop
PROVIDES EOSX
{
}
Expand Down
2 changes: 1 addition & 1 deletion EOSX/src/eos_3p.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and electron fraction.
*/

#ifndef EOS_3P_XX
#ifndef EOS_3P_HXX
#define EOS_3P_HXX
#include <cctk.h>
#include <cctk_Arguments.h>
Expand Down
2 changes: 1 addition & 1 deletion EOSX/src/eos_3p_hybrid.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ eps_from_valid_rho_temp_ye(const CCTK_REAL rho,
}

// edited
CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline eos::range
CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline eos_3p::range
range_eps_from_valid_rho_ye(const CCTK_REAL rho,
const CCTK_REAL ye) const {
return rgeps;
Expand Down
2 changes: 1 addition & 1 deletion EOSX/src/eos_3p_idealgas.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ eos_3p_idealgas::eps_from_valid_rho_temp_ye(const CCTK_REAL rho,
return temp / temp_over_eps;
}

CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline eos::range
CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline eos_3p::range
eos_3p_idealgas::range_eps_from_valid_rho_ye(const CCTK_REAL rho,
const CCTK_REAL ye) const {
return rgeps;
Expand Down
4 changes: 2 additions & 2 deletions EOSX/src/eos_utils.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#include <cctk_Parameters.h>

#include <loop_device.hxx>

#include <hdf5.h>


namespace EOSX {

using namespace std;
using namespace Loop;
using namespace Arith;

// Macro checking for errors coming from routines returning error codes
#define CHECK_ERROR(routine) \
Expand Down
30 changes: 15 additions & 15 deletions EOSX/src/setup_eos.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace EOSX {

using namespace amrex;

enum class eos_1p {Polytropic, PWPolytropic};
enum class eos_3p { IdealGas, Hybrid, Tabulated };
enum class eos_1param {Polytropic, PWPolytropic};
enum class eos_3param { IdealGas, Hybrid, Tabulated };

// initial data EOS
AMREX_GPU_MANAGED eos_1p_polytrope *eos_1p_poly = nullptr;
Expand All @@ -25,25 +25,25 @@ AMREX_GPU_MANAGED eos_3p_tabulated3d *eos_3p_tab3d = nullptr;

extern "C" void EOSX_Setup_EOSID(CCTK_ARGUMENTS) {
DECLARE_CCTK_PARAMETERS;
eos_1p eos_1p_type;
eos_1param eos_1p_type;
if (CCTK_EQUALS(initial_data_eos, "Polytropic")) {
eos_1p_type = eos_1p::Polytropic;
eos_1p_type = eos_1param::Polytropic;
} else if (CCTK_EQUALS(initial_data_eos, "PWPolytropic")) {
eos_1p_type = eos_1p::PWPolytropic;
eos_1p_type = eos_1param::PWPolytropic;
} else {
CCTK_ERROR("Unknown value for parameter \"initial_data_eos\"");
}

switch (eos_1p_type) {
case eos_1p::Polytropic: {
case eos_1param::Polytropic: {
CCTK_INFO("Setting initial data EOS to Polytropic");
eos_1p_poly = (eos_1p_polytrope*)The_Managed_Arena()->alloc(sizeof *eos_1p_poly);
new (eos_1p_poly) eos_1p_polytrope;
assert(eos_1p_poly);
eos_1p_poly->init(poly_gamma, poly_k, rho_max);
break;
}
case eos_1p::PWPolytropic: {
case eos_1param::PWPolytropic: {
CCTK_ERROR("Piecewise Polytrope EOS is not supported yet!");
break;
}
Expand All @@ -54,37 +54,37 @@ extern "C" void EOSX_Setup_EOSID(CCTK_ARGUMENTS) {

extern "C" void EOSX_Setup_EOS(CCTK_ARGUMENTS) {
DECLARE_CCTK_PARAMETERS;
eos_3p eos_3p_type;
eos_3param eos_3p_type;
eos_3p::range rgeps(eps_min, eps_max), rgrho(rho_min, rho_max),
rgye(ye_min, ye_max);

if (CCTK_EQUALS(evolution_eos, "IdealGas")) {
eos_3p_type = eos_3p::IdealGas;
eos_3p_type = eos_3param::IdealGas;
} else if (CCTK_EQUALS(evolution_eos, "Hybrid")) {
eos_3p_type = eos_3p::Hybrid;
eos_3p_type = eos_3param::Hybrid;
} else if (CCTK_EQUALS(evolution_eos, "Tabulated3d")) {
eos_3p_type = eos_3p::Tabulated;
eos_3p_type = eos_3param::Tabulated;
} else {
CCTK_ERROR("Unknown value for parameter \"evolution_eos\"");
}

switch (eos_3p_type) {
case eos_3p::IdealGas: {
case eos_3param::IdealGas: {
CCTK_INFO("Setting evolution EOS to Ideal Gas");
eos_3p_ig = (eos_3p_idealgas*)The_Managed_Arena()->alloc(sizeof *eos_3p_ig);
new (eos_3p_ig) eos_3p_idealgas;
assert(eos_3p_ig);
eos_3p_ig->init(gl_gamma, particle_mass, rgeps, rgrho, rgye);
break;
}
case eos_3p::Hybrid: {
case eos_3param::Hybrid: {
CCTK_INFO("Setting evolution EOS to Hybrid");
eos_3p_hyb = (eos_3p_hybrid*)The_Managed_Arena()->alloc(sizeof *eos_3p_hyb);
new (eos_3p_hyb) eos_3p_hybrid(eos_poly, gamma_th, rgeps, rgrho, rgye);
new (eos_3p_hyb) eos_3p_hybrid(eos_1p_poly, gamma_th, rgeps, rgrho, rgye);
assert(eos_3p_hyb);
break;
}
case eos_3p::Tabulated: {
case eos_3param::Tabulated: {
CCTK_INFO("Setting evolution EOS to Tabulated3D");
const string eos_filename = EOSTable_filename;
eos_3p_tab3d = (eos_3p_tabulated3d*)The_Managed_Arena()->alloc(sizeof *eos_3p_tab3d);
Expand Down

0 comments on commit 753e9e7

Please sign in to comment.