Skip to content

Commit

Permalink
WIP:Spherical coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
Forrest Wolfgang Glines committed Nov 5, 2023
1 parent 4a01ed5 commit 2cf79a7
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/coordinates/uniform_spherical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,27 @@ class UniformSpherical {
: istart_[2];
}

//----------------------------------------
// Terms for Source Terms
//----------------------------------------

KOKKOS_INLINE_FUNCTION Real Coord_vol_i_(const int i) const {
const Real rm = Xf<X1DIR>(i);
const Real rp = Xf<X1DIR>(i+1);
return ONE_3RD*( std::pow(rp,3) - std::pow(rm,3));
}

KOKKOS_INLINE_FUNCTION Real CoordSrc1i(const int i) const {
const Real rm = Xf<X1DIR>(i);
const Real rp = Xf<X1DIR>(i+1);
return 0.5*(SQR(rp) - SQR(rm))/Coord_vol_i_(i);
}
KOKKOS_INLINE_FUNCTION Real CoordSrc2i(const int i) const {
const Real rm = Xf<X1DIR>(i);
const Real rp = Xf<X1DIR>(i+1);
return Dxf<X1DIR,X1DIR>(i)/( (rm + rp)*Coord_vol_i_(i));
}

const std::array<Real, 3> &GetXmin() const { return xmin_; }
const std::array<int, 3> &GetStartIndex() const { return istart_; }
const char *Name() const { return name_; }
Expand Down Expand Up @@ -547,25 +568,6 @@ class UniformSpherical {
return TWO_3RD*(std::pow(rp,3) - std::pow(rm,3))/(SQR(rp) - SQR(rm));
}

KOKKOS_INLINE_FUNCTION
Real Coord_vol_i_(const int i) const {
const Real rm = xmin_[0] + i * dx_[0];
const Real rp = rm + dx_[0];
return (ONE_3RD)*(rp*rp*rp - rm*rm*rm);
}

KOKKOS_INLINE_FUNCTION
Real Coord_area2_i_(const int i) const {
const Real rm = xmin_[0] + i * dx_[0];
const Real rp = rm + dx_[0];
return (ONE_3RD)*(rp*rp*rp - rm*rm*rm);
}

KOKKOS_INLINE_FUNCTION
Real Coord_area1_j_(const int j) const {
return std::abs( Cos_theta_f_(j) - Cos_theta_f_(j+1));
}

KOKKOS_INLINE_FUNCTION
Real Cos_theta_f_(const int j) const {
const Real theta = xmin_[1] + j * dx_[1];
Expand Down

0 comments on commit 2cf79a7

Please sign in to comment.