Skip to content

Commit

Permalink
Merge pull request #155 from laristra/feature/eos_t
Browse files Browse the repository at this point in the history
(+) eos_t templated class, eos_type keyword
  • Loading branch information
hlim88 authored Jul 8, 2020
2 parents 047c27a + cb850b7 commit 62f2f2c
Show file tree
Hide file tree
Showing 7 changed files with 536 additions and 262 deletions.
2 changes: 1 addition & 1 deletion app/drivers/hydro/main_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ set_derived_params() {
analysis::set_initial_time_iteration();

// set equation of state
eos::select(eos_type);
eos::select();

// set external force
external_force::select(external_force_type);
Expand Down
2 changes: 1 addition & 1 deletion app/drivers/newtonian/main_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ set_derived_params() {
analysis::set_initial_time_iteration();

// set equation of state
eos::select(eos_type);
eos::select();

// set gravitational constant
fmm::gc = gravitational_constant;
Expand Down
2 changes: 1 addition & 1 deletion app/drivers/tree/main_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ set_derived_params() {
physics::dt = initial_dt;

// set equation of state
eos::select(eos_type);
eos::select();

// set external force
external_force::select(external_force_type);
Expand Down
2 changes: 1 addition & 1 deletion app/drivers/wvt/main_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ set_derived_params() {
physics::dt = initial_dt; // TODO: use particle separation and Courant factor

// set equation of state
eos::select(eos_type);
eos::select();

// set external force
external_force::select(external_force_type);
Expand Down
60 changes: 51 additions & 9 deletions include/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ typedef enum sph_kernel_keyword_enum {
sinc_ker
} sph_kernel_keyword;

typedef enum eos_type_keyword_enum{
eos_ideal,
eos_polytropic,
eos_wd,
eos_ppt,
eos_no_eos
} eos_type_keyword;

//////////////////////////////////////////////////////////////////////
//
// Parameters controlling timestepping and iterations
Expand Down Expand Up @@ -444,9 +452,10 @@ DECLARE_PARAM(double, wvt_radius, 1.0)
// * "white dwarf"
// * "piecewise polytropic"
#ifndef eos_type
DECLARE_STRING_PARAM(eos_type, "ideal fluid")
DECLARE_KEYWORD_PARAM(eos_type, eos_ideal)
#endif


// - file for tabulated EOS
#ifndef eos_tab_file_path
DECLARE_STRING_PARAM(eos_tab_file_path, ".")
Expand All @@ -458,13 +467,13 @@ DECLARE_PARAM(double, poly_gamma, 1.4)
#endif

//- additional polytropic index for piecewise polytrope
#ifndef poly_gamma
#ifndef poly_gamma2
DECLARE_PARAM(double, poly_gamma2, 2.5)
#endif

// Gamma value for stitched polytrope when SC reader is used
#ifndef gamma_poly_thresh
DECLARE_PARAM(double, gamma_poly_thresh, 1.4)
//- in piecewise polytropic equationa of state: threshold density
#ifndef ppt_density_thr
DECLARE_PARAM(double, ppt_density_thr, 5e+14)
#endif

// - which viscosity computation to use?
Expand Down Expand Up @@ -589,7 +598,7 @@ DECLARE_PARAM(double, gravitational_constant, 1)
#endif

//
// Parameters for the white dwarf / neutron star binary setup
// Parameters for the orbiting binary star setup
//
// binary orbital separation (in cm)
#ifndef orbital_separation
Expand Down Expand Up @@ -1028,9 +1037,42 @@ set_param(const std::string & param_name, const std::string & param_value) {
#endif

// viscosity and equation of state ----------------------------------------
if(param_name == "eos_type") {
for(int c = 0; c < str_value.length(); ++c)
if(str_value[c] == ' ')
str_value[c] = '_';

std::cout << "STR = " << str_value << std::endl;
#ifndef eos_type
READ_STRING_PARAM(eos_type)
if(boost::iequals(str_value, "ideal_fluid"))
_eos_type = eos_ideal;

else if(boost::iequals(str_value, "polytropic"))
_eos_type = eos_polytropic;

else if(boost::iequals(str_value, "wd"))
_eos_type = eos_wd;

else if(boost::iequals(str_value, "ppt"))
_eos_type = eos_ppt;

else if(boost::iequals(str_value, "no_eos"))
_eos_type = eos_no_eos;

else {
assert(false);
}
#else
if(not boost::iequals(str_value, QUOTE(eos_type))) {
log_one(error) << "ERROR: eos_type #defined as \"" << QUOTE(eos_type)
<< "\" "
<< "but is reset to \"" << str_value
<< "\" in parameter file" << std::endl;
exit(2);
}
#endif
unknown_param = false;
}

#ifndef eos_tab_file_path
READ_STRING_PARAM(eos_tab_file_path)
Expand All @@ -1044,8 +1086,8 @@ set_param(const std::string & param_name, const std::string & param_value) {
READ_NUMERIC_PARAM(poly_gamma2)
#endif

#ifndef gamma_poly_thresh
READ_NUMERIC_PARAM(gamma_poly_thresh)
#ifndef ppt_density_thr
READ_NUMERIC_PARAM(ppt_density_thr)
#endif

#ifndef sph_viscosity
Expand Down
Loading

0 comments on commit 62f2f2c

Please sign in to comment.