Skip to content

Commit

Permalink
make const_grav in the r direction for 2D r-theta
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Sep 10, 2024
1 parent 45f0991 commit 1217e8a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Source/gravity/Gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,13 @@ Gravity::get_old_grav_vector(int level, MultiFab& grav_vector, Real time)

if (gravity::gravity_type == "ConstantGrav") {

// Set to constant value in the AMREX_SPACEDIM direction and zero in all others.

grav.setVal(gravity::const_grav,AMREX_SPACEDIM-1,1,ng);
if (AMREX_SPACEDIM == 2 && geom.Coord() == 2) {
// 2D spherical r-theta, we want g in the radial direction
grav.setVal(gravity::const_grav, 0, 1, ng);
} else {
// Set to constant value in the AMREX_SPACEDIM direction and zero in all others.
grav.setVal(gravity::const_grav, AMREX_SPACEDIM-1, 1, ng);
}

} else if (gravity::gravity_type == "MonopoleGrav") {

Expand Down Expand Up @@ -955,8 +959,13 @@ Gravity::get_new_grav_vector(int level, MultiFab& grav_vector, Real time)

if (gravity::gravity_type == "ConstantGrav") {

// Set to constant value in the AMREX_SPACEDIM direction
grav.setVal(gravity::const_grav,AMREX_SPACEDIM-1,1,ng);
if (AMREX_SPACEDIM == 2 && geom.Coord() == 2) {
// 2D spherical r-theta, we want g in the radial direction
grav.setVal(gravity::const_grav, 0, 1, ng);
} else {
// Set to constant value in the AMREX_SPACEDIM direction
grav.setVal(gravity::const_grav, AMREX_SPACEDIM-1, 1, ng);
}

} else if (gravity::gravity_type == "MonopoleGrav") {

Expand Down

0 comments on commit 1217e8a

Please sign in to comment.