Skip to content

Commit

Permalink
Updating density perturbations
Browse files Browse the repository at this point in the history
  • Loading branch information
HPC user committed Oct 11, 2023
1 parent 00b4711 commit 312fab3
Show file tree
Hide file tree
Showing 6 changed files with 1,814 additions and 53 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_executable(
refinement/gradient.cpp
refinement/other.cpp
utils/few_modes_ft.cpp
utils/few_modes_ft_lognormal.cpp
)

add_subdirectory(pgen)
Expand Down
10 changes: 5 additions & 5 deletions src/hydro/srcterms/tabular_cooling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,19 @@ class CoolingTableObj {
log_lambda = 0.5 * log_temp - 0.5 * log_temp_final_ + log_lambdas_(n_temp_ - 1);
} else {
// Inside table, interpolate assuming log spaced temperatures

// Determine where temp is in the table
const unsigned int i_temp =
static_cast<unsigned int>((log_temp - log_temp_start_) / d_log_temp_);
const Real log_temp_i = log_temp_start_ + d_log_temp_ * i_temp;

// log_temp should be between log_temps[i_temp] and log_temps[i_temp+1]
PARTHENON_REQUIRE(log_temp >= log_temp_i && log_temp <= log_temp_i + d_log_temp_,
"FATAL ERROR in [CoolingTable::DeDt]: Failed to find log_temp");

const Real log_lambda_i = log_lambdas_(i_temp);
const Real log_lambda_ip1 = log_lambdas_(i_temp + 1);

// Linearly interpolate lambda at log_temp
log_lambda = log_lambda_i + (log_temp - log_temp_i) *
(log_lambda_ip1 - log_lambda_i) / d_log_temp_;
Expand All @@ -181,7 +181,7 @@ class CoolingTableObj {

return de_dt;
}

KOKKOS_INLINE_FUNCTION parthenon::Real DeDt(const parthenon::Real &e,
const parthenon::Real &rho) const {
bool is_valid = true;
Expand Down
Loading

0 comments on commit 312fab3

Please sign in to comment.