Skip to content

Commit

Permalink
Merge branch 'development' into 2d_spherical_test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 authored Nov 13, 2024
2 parents c1723e1 + 161c875 commit 818c166
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 139 deletions.
21 changes: 21 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# 24.11

* a new well-balanced method was added to the CTU PPM solver. This
does the characteristic projection only on the perturbed pressure
and then adds back in the hydrostatic pressure. It can be enabled
via `castro.ppm_well_balanced` (#2945)

* fixed a bug in the div{U} calculation for artificial viscosity on
symmetry boundaries (#2983)

* more development on 2D spherical geometry (#2973, #2975, #2981)

* updates to the massive star plotting scripts (#2979)

* add some new checks to prevent running unsupported combinations
of solvers (#2978)

* documentation updates (#2977)

* `flame_wave` can now be run in 1D (#2976)

# 24.10

* update initial model for `subchandra` when doing ASE NSE (#2970)
Expand Down
17 changes: 9 additions & 8 deletions Source/driver/Castro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3641,19 +3641,17 @@ Castro::apply_tagging_restrictions(TagBoxArray& tags, [[maybe_unused]] Real time
const Real* probhi = geomdata.ProbHi();
const Real* dx = geomdata.CellSize();

Real loc[3] = {0.0};
GpuArray<Real, 3> loc = {0.0};

loc[0] = problo[0] + (static_cast<Real>(i) + 0.5_rt) * dx[0];
loc[0] = problo[0] + (static_cast<Real>(i) + 0.5_rt) * dx[0] - problem::center[0];
#if AMREX_SPACEDIM >= 2
loc[1] = problo[1] + (static_cast<Real>(j) + 0.5_rt) * dx[1];
loc[1] = problo[1] + (static_cast<Real>(j) + 0.5_rt) * dx[1] - problem::center[1];
#endif
#if AMREX_SPACEDIM == 3
loc[2] = problo[2] + (static_cast<Real>(k) + 0.5_rt) * dx[2];
loc[2] = problo[2] + (static_cast<Real>(k) + 0.5_rt) * dx[2] - problem::center[2];
#endif

Real r = std::sqrt((loc[0] - problem::center[0]) * (loc[0] - problem::center[0]) +
(loc[1] - problem::center[1]) * (loc[1] - problem::center[1]) +
(loc[2] - problem::center[2]) * (loc[2] - problem::center[2]));
Real r = distance(geomdata, loc);

Real max_dist_lo = 0.0;
Real max_dist_hi = 0.0;
Expand Down Expand Up @@ -4357,9 +4355,12 @@ Castro::define_new_center(const MultiFab& S, Real time)
// Now broadcast to everyone else.
ParallelDescriptor::Bcast(&problem::center[0], AMREX_SPACEDIM, owner);

// Make sure if R-Z that center stays exactly on axis
// Make sure if R-Z and SPHERICAL that center stays exactly on axis
if ( Geom().IsRZ() ) {
problem::center[0] = 0;
} else if ( Geom().IsSPHERICAL() ) {
problem::center[0] = 0;
problem::center[1] = 0;
}

}
Expand Down
22 changes: 22 additions & 0 deletions Source/driver/Castro_util.H
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,28 @@ void position(int i, int j, int k,

}


AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
Real distance(GeometryData const& geomdata, GpuArray<Real, 3>& loc)
{
// Returns the distance from the center provided with loc, the position.
// loc is the form of [x, y, z,] in Cartesian, [r, z, phi] in cylindrical
// and [r, theta, phi] in spherical

const auto coord = geomdata.Coord();

if (coord == CoordSys::cartesian) {
return std::sqrt(loc[0]*loc[0] + loc[1]*loc[1] + loc[2]*loc[2]);
}

if (coord == CoordSys::RZ) {
return std::sqrt(loc[0]*loc[0] + loc[1]*loc[1]);
}

return std::abs(loc[0]);
}


namespace geometry_util
{

Expand Down
70 changes: 35 additions & 35 deletions Source/driver/Derive.H
Original file line number Diff line number Diff line change
Expand Up @@ -12,125 +12,125 @@ extern "C"

void ca_derpres
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dereint1
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dereint2
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derlogden
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_deruplusc
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_deruminusc
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dersoundspeed
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dergamma1
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dermachnumber
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derentropy
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

#ifdef DIFFUSION
void ca_dercond
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derdiffcoeff
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derdiffterm
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);
#endif

void ca_derenuc
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derenuctimescale
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dervel
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dermagvel
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dermaggrav
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derradialvel
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dercircvel
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dermagmom
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derangmomx (const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int ncomp,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real time, const int* bcrec, int level);

void ca_derangmomy (const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int ncomp,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real time, const int* bcrec, int level);

void ca_derangmomz (const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int ncomp,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real time, const int* bcrec, int level);

void ca_derkineng (const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int ncomp,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real time, const int* bcrec, int level);

void ca_dernull
Expand All @@ -144,53 +144,53 @@ extern "C"

void ca_derspec
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derabar
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derye
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dermagvort
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derdivu
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derstate
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

#ifdef MHD
void ca_dermagcenx
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dermagceny
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_dermagcenz
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

void ca_derdivb
(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int /*ncomp*/,
const amrex::FArrayBox& datfab, const amrex::Geometry& geomdata,
const amrex::FArrayBox& datfab, const amrex::Geometry& geom,
amrex::Real /*time*/, const int* /*bcrec*/, int /*level*/);

#endif
Expand Down
Loading

0 comments on commit 818c166

Please sign in to comment.