Skip to content

Commit 6ea903d

Browse files
authored
update thermo source for spherical2d geometry, this adds -p divU source term to internal energy (#2965)
This updates fill_thermo_source for spherical2d geometry, even though this seems to only affect sdc instead of ctu.
1 parent 12666ac commit 6ea903d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Diff for: Source/sources/Castro_thermo.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,18 @@ Castro::fill_thermo_source (MultiFab& state_in, MultiFab& thermo_src)
169169
}
170170

171171
#if AMREX_SPACEDIM >= 2
172-
src(i,j,k,UEINT) += -0.5_rt*(U(i,j+1,k,UMY)/U(i,j+1,k,URHO) -
173-
U(i,j-1,k,UMY)/U(i,j-1,k,URHO))/dx[1];
172+
if (coord == 2) {
173+
Real thetap = prob_lo[1] + (static_cast<Real>(j) + 1.5_rt)*dx[1];
174+
Real thetam = prob_lo[1] + (static_cast<Real>(j) - 0.5_rt)*dx[1];
175+
Real theta = 0.5_rt*(thetam + thetap);
176+
177+
src(i,j,k,UEINT) += -0.5_rt*(std::sin(thetap)*U(i,j+1,k,UMY)/U(i,j+1,k,URHO) -
178+
std::sin(thetam)*U(i,j-1,k,UMY)/U(i,j-1,k,URHO)) /
179+
(r*std::sin(theta)*dx[1]);
180+
} else {
181+
src(i,j,k,UEINT) += -0.5_rt*(U(i,j+1,k,UMY)/U(i,j+1,k,URHO) -
182+
U(i,j-1,k,UMY)/U(i,j-1,k,URHO))/dx[1];
183+
}
174184
#endif
175185
#if AMREX_SPACEDIM == 3
176186
src(i,j,k,UEINT) += -0.5_rt*(U(i,j,k+1,UMZ)/U(i,j,k+1,URHO) -

0 commit comments

Comments
 (0)