Skip to content

Commit

Permalink
fix: error code was broken with radiation off. unrrelated to PR, but …
Browse files Browse the repository at this point in the history
…necessary
  • Loading branch information
AstroBarker committed Jul 6, 2024
1 parent 6da343e commit d39f0ec
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/utils/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ class Error : public std::runtime_error {
};

template <typename T>
void check_state( T state, const int ihi ) {
void check_state( T state, const int ihi, const bool do_rad ) {

auto uCR = state->Get_uCR( );
auto uCF = state->Get_uCF( );

const Real c = constants::c_cgs;

Kokkos::parallel_for(
"check_state", ihi + 2, KOKKOS_LAMBDA( const int iX ) {
"check_state", ihi, KOKKOS_LAMBDA( const int i ) {
const int iX = i + 1; // hack
//
const Real tau = uCF( 0, iX, 0 ); // cell averages checked
const Real vel = uCF( 1, iX, 0 );
const Real e_m = uCF( 2, iX, 0 );
Expand All @@ -52,17 +54,19 @@ void check_state( T state, const int ihi ) {
assert( !std::isnan( e_m ) &&
" ! Check state :: Specific energy NaN!" );

assert(
e_rad > 0.0 &&
" ! Check state :: Negative or zero radiation energy density!" );
assert( !std::isnan( e_rad ) &&
" ! Check state :: Radiation energy NaN!" );
if ( do_rad ) {
assert(
e_rad > 0.0 &&
" ! Check state :: Negative or zero radiation energy density!" );
assert( !std::isnan( e_rad ) &&
" ! Check state :: Radiation energy NaN!" );

// TODO: radiation flux bound
// assert ( f_rad >= 0.0 && " Check state :: ! Negative or zero
// radiation energy density!" );
assert( !std::isnan( f_rad ) &&
" ! Check state :: Radiation flux NaN!" );
// TODO: radiation flux bound
// assert ( f_rad >= 0.0 && " Check state :: ! Negative or zero
// radiation energy density!" );
assert( !std::isnan( f_rad ) &&
" ! Check state :: Radiation flux NaN!" );
}
} );
}

Expand Down

0 comments on commit d39f0ec

Please sign in to comment.