Skip to content

Commit

Permalink
revert Castro_util.H to development
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 committed Sep 8, 2024
1 parent 9423c9a commit fea3b4d
Showing 1 changed file with 7 additions and 39 deletions.
46 changes: 7 additions & 39 deletions Source/driver/Castro_util.H
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,10 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
Real volume(const int& i, const int& j, const int& k,
const GeometryData& geomdata)
{
//
// Given 3D cell-centered indices (i,j,k), return the volume of the zone.
// this function only provides Cartesian in 1D/2D/3D,
// Cylindrical (R-Z) in 2D,
// and Spherical in 1D and 2D (R-THETA).
//
// Note that Castro has no support for angular coordinates, so
// this function only provides Cartesian in 1D/2D/3D, Cylindrical (R-Z)
// in 2D, and Spherical in 1D.

amrex::ignore_unused(i);
amrex::ignore_unused(j);
Expand Down Expand Up @@ -212,7 +210,8 @@ Real volume(const int& i, const int& j, const int& k,

vol = dx[0] * dx[1];

} else if (coord == 1) {
}
else {

// Cylindrical

Expand All @@ -221,20 +220,6 @@ Real volume(const int& i, const int& j, const int& k,

vol = M_PI * (r_l + r_r) * dx[0] * dx[1];

} else {

// Spherical

constexpr Real twoThirdsPi = 2.0_rt * M_PI / 3.0_rt;

Real r_l = geomdata.ProbLo()[0] + static_cast<Real>(i) * dx[0];
Real r_r = geomdata.ProbLo()[0] + static_cast<Real>(i+1) * dx[0];
Real theta_l = geomdata.ProbLo()[1] + static_cast<Real>(j) * dx[1];
Real theta_r = geomdata.ProbLo()[1] + static_cast<Real>(j+1) * dx[1];

vol = twoThirdsPi * (std::cos(theta_l) - std::cos(theta_r)) * dx[0] *
(r_r * r_r + r_r * r_l + r_l * r_l);

}

#else
Expand Down Expand Up @@ -305,7 +290,8 @@ Real area(const int& i, const int& j, const int& k,
a = dx[0];
}

} else if (coord == 1) {
}
else {

// Cylindrical

Expand All @@ -318,24 +304,6 @@ Real area(const int& i, const int& j, const int& k,
a = 2.0_rt * M_PI * r * dx[0];
}

} else {

// Spherical

if (idir == 0) {
Real r = geomdata.ProbLo()[0] + static_cast<Real>(i) * dx[0];
Real theta_l = geomdata.ProbLo()[1] + static_cast<Real>(j) * dx[1];
Real theta_r = geomdata.ProbLo()[1] + static_cast<Real>(j+1) * dx[1];

a = 2.0_rt * M_PI * r * r * (std::cos(theta_l) - std::cos(theta_r));
}
else {
Real r = geomdata.ProbLo()[0] + (static_cast<Real>(i) + 0.5_rt) * dx[0];
Real theta = geomdata.ProbLo()[1] + static_cast<Real>(j) * dx[1];

a = 2.0_rt * M_PI * std::sin(theta) * r * dx[0];
}

}

#else
Expand Down

0 comments on commit fea3b4d

Please sign in to comment.