diff --git a/Exec/reacting_tests/reacting_convergence/ci-benchmarks/react_converge_128_true_sdc.out b/Exec/reacting_tests/reacting_convergence/ci-benchmarks/react_converge_128_true_sdc.out index 03efe9ecaa..2aca68930d 100644 --- a/Exec/reacting_tests/reacting_convergence/ci-benchmarks/react_converge_128_true_sdc.out +++ b/Exec/reacting_tests/reacting_convergence/ci-benchmarks/react_converge_128_true_sdc.out @@ -2,58 +2,58 @@ time = 0.000901 variables minimum value maximum value density 499999.99996 1003267.4037 - xmom -1.6405409458e+12 1.6405409458e+12 - ymom -1.6405409458e+12 1.6405409458e+12 + xmom -1.64054094e+12 1.64054094e+12 + ymom -1.64054094e+12 1.64054094e+12 zmom 0 0 - rho_E 2.263117857e+22 7.0166374758e+22 - rho_e 2.263117857e+22 7.0166358804e+22 - Temp 300032898.05 454530912.93 - rho_He4 499997.75752 1002591.9749 - rho_C12 2.2423384483 675.42842495 - rho_O16 5.0001038346e-05 0.00023067823575 + rho_E 2.263117857e+22 7.0166374851e+22 + rho_e 2.263117857e+22 7.0166358897e+22 + Temp 300032898.05 454530914.06 + rho_He4 499997.75752 1002591.9748 + rho_C12 2.2423384483 675.42858349 + rho_O16 5.0001038346e-05 0.00023067858795 rho_Fe56 4.9999999996e-05 0.00010032674037 - rho_enuc 1.4565745423e+21 4.5249964745e+23 - density_sdc_source -544925.80758 78513.247869 - xmom_sdc_source -1.8266340546e+15 1.8266340546e+15 - ymom_sdc_source -1.8266340546e+15 1.8266340546e+15 + rho_enuc 1.4565745423e+21 4.5249954871e+23 + density_sdc_source -544925.79275 78513.247889 + xmom_sdc_source -1.8266340469e+15 1.8266340469e+15 + ymom_sdc_source -1.8266340469e+15 1.8266340469e+15 zmom_sdc_source 0 0 - rho_E_sdc_source -6.1992501236e+22 7.5781242663e+21 - rho_e_sdc_source -6.1984110404e+22 6.3082607836e+21 + rho_E_sdc_source -6.1992456785e+22 7.5781242406e+21 + rho_e_sdc_source -6.1984065959e+22 6.3082607681e+21 Temp_sdc_source 0 0 - rho_He4_sdc_source -543231.23569 78510.973875 - rho_C12_sdc_source -1694.5620221 10.07378628 - rho_O16_sdc_source -0.0098098270645 7.1506434889e-06 - rho_Fe56_sdc_source -5.4492580758e-05 7.8513247869e-06 - pressure 1.4155320805e+22 4.2608130805e+22 - kineng 2.4519179612e-13 1.6647276308e+18 - soundspeed 212069503.63 257404342.05 + rho_He4_sdc_source -543231.29383 78510.973919 + rho_C12_sdc_source -1694.4890575 10.073635147 + rho_O16_sdc_source -0.0098093776861 7.1506350196e-06 + rho_Fe56_sdc_source -5.4492579275e-05 7.8513247889e-06 + pressure 1.4155320805e+22 4.2608130858e+22 + kineng 3.2091279198e-13 1.6647276226e+18 + soundspeed 212069503.63 257404342.21 Gamma_1 1.5601126452 1.5885713572 - MachNumber 4.669869489e-18 0.008698277168 - entropy 348439780.9 349209883.38 - magvort 0 0.00018541051834 - divu -0.11633879117 0.55816307483 - eint_E 4.5262357143e+16 6.9937847586e+16 - eint_e 4.5262357143e+16 6.9937843636e+16 + MachNumber 5.3425093423e-18 0.0086982771596 + entropy 348439780.9 349209883.57 + magvort 0 0.00018541051835 + divu -0.1163387912 0.55816306007 + eint_E 4.5262357143e+16 6.9937847678e+16 + eint_e 4.5262357143e+16 6.9937843728e+16 logden 5.6989700043 6.0014167022 StateErr_0 499999.99996 1003267.4037 - StateErr_1 300032898.05 454530912.93 - StateErr_2 0.99932677096 0.99999551512 - X(He4) 0.99932677096 0.99999551512 - X(C12) 4.484676897e-06 0.00067322871496 - X(O16) 1.000020767e-10 2.2992697152e-10 + StateErr_1 300032898.05 454530914.06 + StateErr_2 0.9993267708 0.99999551512 + X(He4) 0.9993267708 0.99999551512 + X(C12) 4.484676897e-06 0.00067322887298 + X(O16) 1.000020767e-10 2.2992732257e-10 X(Fe56) 1e-10 1e-10 - abar 4.0000119598 4.0017960838 + abar 4.0000119598 4.0017960842 Ye 0.5 0.5 - x_velocity -2064636.8156 2064636.8156 - y_velocity -2064636.8156 2064636.8156 + x_velocity -2064636.8122 2064636.8122 + y_velocity -2064636.8122 2064636.8122 z_velocity 0 0 - t_sound_t_enuc 0.00023710316663 0.019573273608 - enuc 2.9131490847e+15 4.5102596355e+17 - magvel 9.9033690456e-10 2067446.1392 - radvel -0.00067838913019 2067446.1391 - circvel 0 11.820185992 - magmom 0.00049516845224 1.6422547294e+12 + t_sound_t_enuc 0.00023710316663 0.0195732693 + enuc 2.9131490847e+15 4.5102586513e+17 + magvel 1.1329833044e-09 2067446.1363 + radvel -0.00067837531107 2067446.1363 + circvel 0 11.820124028 + magmom 0.00056649165215 1.6422547233e+12 angular_momentum_x -0 -0 - angular_momentum_y -0 -0 - angular_momentum_z -1.2410867567e+14 1.2410867593e+14 + angular_momentum_y 0 0 + angular_momentum_z -1.2410862711e+14 1.2410862711e+14 diff --git a/Source/problems/Castro_bc_fill_nd.cpp b/Source/problems/Castro_bc_fill_nd.cpp index da8d76f2f8..fda142da03 100644 --- a/Source/problems/Castro_bc_fill_nd.cpp +++ b/Source/problems/Castro_bc_fill_nd.cpp @@ -23,7 +23,7 @@ void ca_statefill(Box const& bx, FArrayBox& data, // valid data is always present. Vector bcr_noinflow{bcr}; - for (auto bc : bcr_noinflow) { + for (auto & bc : bcr_noinflow) { for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) { if (bc.lo(dir) == EXT_DIR) { bc.setLo(dir, FOEXTRAP); diff --git a/Source/radiation/HABEC.H b/Source/radiation/HABEC.H new file mode 100644 index 0000000000..0b3d718099 --- /dev/null +++ b/Source/radiation/HABEC.H @@ -0,0 +1,203 @@ +#ifndef _HABEC_H_ +#define _HABEC_H_ + +#include +#include + +using namespace amrex; + +namespace HABEC +{ + // habec is Hypre abec, where abec is the form of the linear equation + // we are solving: + // + // alpha*phi - div(beta*grad phi) + div(\vec{c}*phi) + + AMREX_INLINE + void hbflx (Array4 const flux, + Array4 const er, + const Box& reg, + int cdir, int bct, int bho, Real bcl, + Array4 const bcval, + Array4 const mask, + Array4 const b, + Real beta, const Real* dx, int inhom) + { + Real h; + + bool x_left = false; + bool x_right = false; + bool y_left = false; + bool y_right = false; + bool z_left = false; + bool z_right = false; + +#if AMREX_SPACEDIM == 1 + if (cdir == 0) { + h = dx[0]; + x_left= true; + } + else if (cdir == 1) { + h = dx[0]; + x_right= true; + } +#elif AMREX_SPACEDIM == 2 + if (cdir == 0) { + h = dx[0]; + x_left= true; + } + else if (cdir == 2) { + h = dx[0]; + x_right= true; + } + else if (cdir == 1) { + h = dx[1]; + y_left= true; + } + else if (cdir == 3) { + h = dx[1]; + y_right= true; + } +#else + if (cdir == 0) { + h = dx[0]; + x_left= true; + } + else if (cdir == 3) { + h = dx[0]; + x_right= true; + } + else if (cdir == 1) { + h = dx[1]; + y_left = true; + } + else if (cdir == 4) { + h = dx[1]; + y_right = true; + } + else if (cdir == 2) { + h = dx[2]; + z_left = true; + } + else if (cdir == 5) { + h = dx[2]; + z_right = true; + } +#endif + + Real bfv, bfm, bfm2; + + if (bct == LO_DIRICHLET) { + if (bho >= 1) { + Real h2 = 0.5e0_rt * h; + Real th2 = 3.e0_rt * h2; + bfv = 2.e0_rt * beta * h / ((bcl + h2) * (bcl + th2)); + bfm = (beta / h) * (th2 - bcl) / (bcl + h2); + bfm2 = (beta / h) * (bcl - h2) / (bcl + th2); + } + else { + bfv = beta / (0.5e0_rt * h + bcl); + bfm = bfv; + } + } + else { + amrex::Error("hbflx: unsupported boundary type"); + } + + if (inhom == 0) { + bfv = 0.e0_rt; + } + + int reg_ilo = reg.loVect3d()[0]; + int reg_ihi = reg.hiVect3d()[0]; + int reg_jlo = reg.loVect3d()[1]; + int reg_jhi = reg.hiVect3d()[1]; + int reg_klo = reg.loVect3d()[2]; + int reg_khi = reg.hiVect3d()[2]; + + if (x_left) { + int i = reg_ilo; + for (int k = reg_klo; k <= reg_khi; ++k) { + for (int j = reg_jlo; j <= reg_jhi; ++j) { + if (mask(i-1,j,k) > 0) { + flux(i,j,k) = b(i,j,k) * (bfv * bcval(i-1,j,k) - bfm * er(i,j,k)); + if (bho >= 1) { + flux(i,j,k) = flux(i,j,k) - b(i,j,k) * bfm2 * er(i+1,j,k); + } + } + } + } + } + else if (x_right) { + int i = reg_ihi; + for (int k = reg_klo; k <= reg_khi; ++k) { + for (int j = reg_jlo; j <= reg_jhi; ++j) { + if (mask(i+1,j,k) > 0) { + flux(i+1,j,k) = -b(i+1,j,k) * (bfv * bcval(i+1,j,k) - bfm * er(i,j,k)); + if (bho >= 1) { + flux(i+1,j,k) = flux(i+1,j,k) + b(i+1,j,k) * bfm2 * er(i-1,j,k); + } + } + } + } + } + else if (y_left) { + int j = reg_jlo; + for (int k = reg_klo; k <= reg_khi; ++k) { + for (int i = reg_ilo; i <= reg_ihi; ++i) { + if (mask(i,j-1,k) > 0) { + flux(i,j,k) = b(i,j,k) * (bfv * bcval(i,j-1,k) - bfm * er(i,j,k)); + if (bho >= 1) { + flux(i,j,k) = flux(i,j,k) - b(i,j,k) * bfm2 * er(i,j+1,k); + } + } + } + } + } + else if (y_right) { + int j = reg_jhi; + for (int k = reg_klo; k <= reg_khi; ++k) { + for (int i = reg_ilo; i <= reg_ihi; ++i) { + if (mask(i,j+1,k) > 0) { + flux(i,j+1,k) = -b(i,j+1,k) * (bfv * bcval(i,j+1,k) - bfm * er(i,j,k)); + if (bho >= 1) { + flux(i,j+1,k) = flux(i,j+1,k) + b(i,j+1,k) * bfm2 * er(i,j-1,k); + } + } + } + } + } + else if (z_left) { + int k = reg_klo; + for (int j = reg_jlo; j <= reg_jhi; ++j) { + for (int i = reg_ilo; i <= reg_ihi; ++i) { + if (mask(i,j,k-1) > 0) { + flux(i,j,k) = b(i,j,k) * (bfv * bcval(i,j,k-1) - bfm * er(i,j,k)); + if (bho >= 1) { + flux(i,j,k) = flux(i,j,k) - b(i,j,k) * bfm2 * er(i,j,k+1); + } + } + } + } + } + else if (z_right) { + int k = reg_khi; + for (int j = reg_jlo; j <= reg_jhi; ++j) { + for (int i = reg_ilo; i <= reg_ihi; ++i) { + if (mask(i,j,k+1) > 0) { + flux(i,j,k+1) = -b(i,j,k+1) * (bfv * bcval(i,j,k+1) - bfm * er(i,j,k)); + if (bho >= 1) { + flux(i,j,k+1) = flux(i,j,k+1) + b(i,j,k+1) * bfm2 * er(i,j,k-1); + } + } + } + } + } + else { + std::cout << "hbflx: impossible face orientation" << std::endl; + } + } + +} // namespace HABEC + +#endif diff --git a/Source/radiation/HABEC_1D.F90 b/Source/radiation/HABEC_1D.F90 index a8d2f446b4..3f2aafc52b 100644 --- a/Source/radiation/HABEC_1D.F90 +++ b/Source/radiation/HABEC_1D.F90 @@ -13,75 +13,6 @@ module habec_module contains -subroutine hbflx(flux, & - DIMS(fbox), & - er, DIMS(ebox), & - DIMS(reg), & - cdir, bct, bho, bcl, & - bcval, DIMS(bcv), & - mask, DIMS(msk), & - b, DIMS(bbox), & - beta, dx, inhom) bind(C, name="hbflx") - - use amrex_fort_module, only : rt => amrex_real - integer :: DIMDEC(fbox) - integer :: DIMDEC(ebox) - integer :: DIMDEC(reg) - integer :: DIMDEC(bcv) - integer :: DIMDEC(msk) - integer :: DIMDEC(bbox) - integer :: cdir, bct, bho, inhom - real(rt) :: bcl, beta, dx(1) - real(rt) :: flux(DIMV(fbox)) - real(rt) :: er(DIMV(ebox)) - real(rt) :: bcval(DIMV(bcv)) - integer :: mask(DIMV(msk)) - real(rt) :: b(DIMV(bbox)) - real(rt) :: h, bfm, bfv - real(rt) :: bfm2, h2, th2 - integer :: i - h = dx(1) - if (bct == LO_DIRICHLET) then - if (bho >= 1) then - h2 = 0.5e0_rt * h - th2 = 3.e0_rt * h2 - bfv = 2.e0_rt * beta * h / ((bcl + h2) * (bcl + th2)) - bfm = (beta / h) * (th2 - bcl) / (bcl + h2) - bfm2 = (beta / h) * (bcl - h2) / (bcl + th2) - else - bfv = beta / (0.5e0_rt * h + bcl) - bfm = bfv - endif - else - print *, "hbflx: unsupported boundary type" - stop - endif - if (inhom == 0) then - bfv = 0.e0_rt - endif - if (cdir == 0) then - ! Left face of grid - i = reg_l1 - if (mask(i-1) > 0) then - flux(i) = b(i) * (bfv * bcval(i-1) - bfm * er(i)) - if (bho >= 1) then - flux(i) = flux(i) - b(i) * bfm2 * er(i+1) - endif - endif - else if (cdir == 1) then - ! Right face of grid - i = reg_h1 - if (mask(i+1) > 0) then - flux(i+1) = -b(i+1) * (bfv * bcval(i+1) - bfm * er(i)) - if (bho >= 1) then - flux(i+1) = flux(i+1) + b(i+1) * bfm2 * er(i-1) - endif - endif - else - print *, "hbflx: impossible face orientation" - endif -end subroutine hbflx - subroutine hbflx3(flux, & DIMS(fbox), & er, DIMS(ebox), & diff --git a/Source/radiation/HABEC_2D.F90 b/Source/radiation/HABEC_2D.F90 index c1f37450b8..2119c4150c 100644 --- a/Source/radiation/HABEC_2D.F90 +++ b/Source/radiation/HABEC_2D.F90 @@ -14,105 +14,6 @@ module habec_module contains -subroutine hbflx(flux, & - DIMS(fbox), & - er, DIMS(ebox), & - DIMS(reg), & - cdir, bct, bho, bcl, & - bcval, DIMS(bcv), & - mask, DIMS(msk), & - b, DIMS(bbox), & - beta, dx, inhom) bind(C, name="hbflx") - - use amrex_fort_module, only : rt => amrex_real - integer :: DIMDEC(fbox) - integer :: DIMDEC(ebox) - integer :: DIMDEC(reg) - integer :: DIMDEC(bcv) - integer :: DIMDEC(msk) - integer :: DIMDEC(bbox) - integer :: cdir, bct, bho, inhom - real(rt) :: bcl, beta, dx(2) - real(rt) :: flux(DIMV(fbox)) - real(rt) :: er(DIMV(ebox)) - real(rt) :: bcval(DIMV(bcv)) - integer :: mask(DIMV(msk)) - real(rt) :: b(DIMV(bbox)) - real(rt) :: h, bfm, bfv - real(rt) :: bfm2, h2, th2 - integer :: i, j - if (cdir == 0 .OR. cdir == 2) then - h = dx(1) - else - h = dx(2) - endif - if (bct == LO_DIRICHLET) then - if (bho >= 1) then - h2 = 0.5e0_rt * h - th2 = 3.e0_rt * h2 - bfv = 2.e0_rt * beta * h / ((bcl + h2) * (bcl + th2)) - bfm = (beta / h) * (th2 - bcl) / (bcl + h2) - bfm2 = (beta / h) * (bcl - h2) / (bcl + th2) - else - bfv = beta / (0.5e0_rt * h + bcl) - bfm = bfv - endif - else - print *, "hbflx: unsupported boundary type" - stop - endif - if (inhom == 0) then - bfv = 0.e0_rt - endif - if (cdir == 0) then - ! Left face of grid - i = reg_l1 - do j = reg_l2, reg_h2 - if (mask(i-1,j) > 0) then - flux(i,j) = b(i,j) * (bfv * bcval(i-1,j) - bfm * er(i,j)) - if (bho >= 1) then - flux(i,j) = flux(i,j) - b(i,j) * bfm2 * er(i+1,j) - endif - endif - enddo - else if (cdir == 2) then - ! Right face of grid - i = reg_h1 - do j = reg_l2, reg_h2 - if (mask(i+1,j) > 0) then - flux(i+1,j) = -b(i+1,j) * (bfv * bcval(i+1,j) - bfm * er(i,j)) - if (bho >= 1) then - flux(i+1,j) = flux(i+1,j) + b(i+1,j) * bfm2 * er(i-1,j) - endif - endif - enddo - else if (cdir == 1) then - ! Bottom face of grid - j = reg_l2 - do i = reg_l1, reg_h1 - if (mask(i,j-1) > 0) then - flux(i,j) = b(i,j) * (bfv * bcval(i,j-1) - bfm * er(i,j)) - if (bho >= 1) then - flux(i,j) = flux(i,j) - b(i,j) * bfm2 * er(i,j+1) - endif - endif - enddo - else if (cdir == 3) then - ! Top face of grid - j = reg_h2 - do i = reg_l1, reg_h1 - if (mask(i,j+1) > 0) then - flux(i,j+1) = -b(i,j+1) * (bfv * bcval(i,j+1) - bfm * er(i,j)) - if (bho >= 1) then - flux(i,j+1) = flux(i,j+1) + b(i,j+1) * bfm2 * er(i,j-1) - endif - endif - enddo - else - print *, "hbflx: impossible face orientation" - endif -end subroutine hbflx - subroutine hbflx3(flux, & DIMS(fbox), & er, DIMS(ebox), & diff --git a/Source/radiation/HABEC_3D.F90 b/Source/radiation/HABEC_3D.F90 index 17aa922c66..dcd02ebf88 100644 --- a/Source/radiation/HABEC_3D.F90 +++ b/Source/radiation/HABEC_3D.F90 @@ -14,147 +14,6 @@ module habec_module contains -subroutine hbflx(flux, & - DIMS(fbox), & - er, DIMS(ebox), & - DIMS(reg), & - cdir, bct, bho, bcl, & - bcval, DIMS(bcv), & - mask, DIMS(msk), & - b, DIMS(bbox), & - beta, dx, inhom) bind(C, name="hbflx") - - use amrex_fort_module, only : rt => amrex_real - integer :: DIMDEC(fbox) - integer :: DIMDEC(ebox) - integer :: DIMDEC(reg) - integer :: DIMDEC(bcv) - integer :: DIMDEC(msk) - integer :: DIMDEC(bbox) - integer :: cdir, bct, bho, inhom - real(rt) :: bcl, beta, dx(3) - real(rt) :: flux(DIMV(fbox)) - real(rt) :: er(DIMV(ebox)) - real(rt) :: bcval(DIMV(bcv)) - integer :: mask(DIMV(msk)) - real(rt) :: b(DIMV(bbox)) - real(rt) :: h, bfm, bfv - real(rt) :: bfm2, h2, th2 - integer :: i, j, k - if (cdir == 0 .OR. cdir == 3) then - h = dx(1) - elseif (cdir == 1 .OR. cdir == 4) then - h = dx(2) - else - h = dx(3) - endif - if (bct == LO_DIRICHLET) then - if (bho >= 1) then - h2 = 0.5e0_rt * h - th2 = 3.e0_rt * h2 - bfv = 2.e0_rt * beta * h / ((bcl + h2) * (bcl + th2)) - bfm = (beta / h) * (th2 - bcl) / (bcl + h2) - bfm2 = (beta / h) * (bcl - h2) / (bcl + th2) - else - bfv = beta / (0.5e0_rt * h + bcl) - bfm = bfv - endif - else - print *, "hbflx: unsupported boundary type" - stop - endif - if (inhom == 0) then - bfv = 0.e0_rt - endif - if (cdir == 0) then - i = reg_l1 - do k = reg_l3, reg_h3 - do j = reg_l2, reg_h2 - if (mask(i-1,j,k) > 0) then - flux(i,j,k) = b(i,j,k) * & - (bfv * bcval(i-1,j,k) - bfm * er(i,j,k)) - if (bho >= 1) then - flux(i,j,k) = flux(i,j,k) - & - b(i,j,k) * bfm2 * er(i+1,j,k) - endif - endif - enddo - enddo - else if (cdir == 3) then - i = reg_h1 - do k = reg_l3, reg_h3 - do j = reg_l2, reg_h2 - if (mask(i+1,j,k) > 0) then - flux(i+1,j,k) = -b(i+1,j,k) * & - (bfv * bcval(i+1,j,k) - bfm * er(i,j,k)) - if (bho >= 1) then - flux(i+1,j,k) = flux(i+1,j,k) + & - b(i+1,j,k) * bfm2 * er(i-1,j,k) - endif - endif - enddo - enddo - else if (cdir == 1) then - j = reg_l2 - do k = reg_l3, reg_h3 - do i = reg_l1, reg_h1 - if (mask(i,j-1,k) > 0) then - flux(i,j,k) = b(i,j,k) * & - (bfv * bcval(i,j-1,k) - bfm * er(i,j,k)) - if (bho >= 1) then - flux(i,j,k) = flux(i,j,k) - & - b(i,j,k) * bfm2 * er(i,j+1,k) - endif - endif - enddo - enddo - else if (cdir == 4) then - j = reg_h2 - do k = reg_l3, reg_h3 - do i = reg_l1, reg_h1 - if (mask(i,j+1,k) > 0) then - flux(i,j+1,k) = -b(i,j+1,k) * & - (bfv * bcval(i,j+1,k) - bfm * er(i,j,k)) - if (bho >= 1) then - flux(i,j+1,k) = flux(i,j+1,k) + & - b(i,j+1,k) * bfm2 * er(i,j-1,k) - endif - endif - enddo - enddo - else if (cdir == 2) then - k = reg_l3 - do j = reg_l2, reg_h2 - do i = reg_l1, reg_h1 - if (mask(i,j,k-1) > 0) then - flux(i,j,k) = b(i,j,k) * & - (bfv * bcval(i,j,k-1) - bfm * er(i,j,k)) - if (bho >= 1) then - flux(i,j,k) = flux(i,j,k) - & - b(i,j,k) * bfm2 * er(i,j,k+1) - endif - endif - enddo - enddo - else if (cdir == 5) then - k = reg_h3 - do j = reg_l2, reg_h2 - do i = reg_l1, reg_h1 - if (mask(i,j,k+1) > 0) then - flux(i,j,k+1) = -b(i,j,k+1) * & - (bfv * bcval(i,j,k+1) - bfm * er(i,j,k)) - if (bho >= 1) then - flux(i,j,k+1) = flux(i,j,k+1) + & - b(i,j,k+1) * bfm2 * er(i,j,k-1) - endif - endif - enddo - enddo - else - print *, "hbflx: impossible face orientation" - endif -end subroutine hbflx - subroutine hbflx3(flux, & DIMS(fbox), & er, DIMS(ebox), & diff --git a/Source/radiation/HABEC_F.H b/Source/radiation/HABEC_F.H index 4df2a1318c..1ad5995275 100644 --- a/Source/radiation/HABEC_F.H +++ b/Source/radiation/HABEC_F.H @@ -10,16 +10,6 @@ extern "C" { #define RadBoundCond int #endif - void hbflx(BL_FORT_FAB_ARG(flux), - BL_FORT_FAB_ARG(soln), - ARLIM_P(reglo), ARLIM_P(reghi), - const int& cdir, const RadBoundCond& bct, - const int& bho, const amrex::Real& bcl, - const amrex::Real* bcval, ARLIM_P(fslo), ARLIM_P(fshi), - const BL_FORT_IFAB_ARG(mask), - BL_FORT_FAB_ARG(bcoefs), - const amrex::Real& beta, const amrex::Real* dx, const int& inhom); - void hbflx3(BL_FORT_FAB_ARG(flux), BL_FORT_FAB_ARG(soln), ARLIM_P(reglo), ARLIM_P(reghi), diff --git a/Source/radiation/HypreABec.cpp b/Source/radiation/HypreABec.cpp index 9d24aef815..f1a8213986 100644 --- a/Source/radiation/HypreABec.cpp +++ b/Source/radiation/HypreABec.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -307,14 +308,14 @@ void HypreABec::boundaryFlux(MultiFab* Flux, MultiFab& Soln, int icomp, pSPa, ARLIM(SPabox.loVect()), ARLIM(SPabox.hiVect())); } else { - hbflx(BL_TO_FORTRAN(Flux[idim][si]), - BL_TO_FORTRAN_N(Soln[si], icomp), - ARLIM(reg.loVect()), ARLIM(reg.hiVect()), - cdir, bct, bho, bcl, - BL_TO_FORTRAN_N(fs, bdcomp), - BL_TO_FORTRAN(msk), - BL_TO_FORTRAN((*bcoefs[idim])[si]), - beta, dx, inhom); + HABEC::hbflx(Flux[idim][si].array(), + Soln[si].array(icomp), + reg, + cdir, bct, bho, bcl, + fs.array(bdcomp), + msk.array(), + (*bcoefs[idim])[si].array(), + beta, dx, inhom); } } } diff --git a/Source/radiation/HypreMultiABec.cpp b/Source/radiation/HypreMultiABec.cpp index a151205ce7..bc98e86bbd 100644 --- a/Source/radiation/HypreMultiABec.cpp +++ b/Source/radiation/HypreMultiABec.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -3960,14 +3961,14 @@ void HypreMultiABec::boundaryFlux(int level, pSPa, ARLIM(SPabox.loVect()), ARLIM(SPabox.hiVect())); } else { - hbflx(BL_TO_FORTRAN(Flux[idim][mfi]), - BL_TO_FORTRAN_N(Soln[mfi], icomp), - ARLIM(reg.loVect()), ARLIM(reg.hiVect()), - cdir, bct, bho, bcl, - BL_TO_FORTRAN_N(fs, bdcomp), - BL_TO_FORTRAN(msk), - BL_TO_FORTRAN((*bcoefs[level])[idim][mfi]), - beta, geom[level].CellSize(), inhom); + HABEC::hbflx(Flux[idim][mfi].array(), + Soln[mfi].array(icomp), + reg, + cdir, bct, bho, bcl, + fs.array(bdcomp), + msk.array(), + (*bcoefs[level])[idim][mfi].array(), + beta, geom[level].CellSize(), inhom); } } } diff --git a/Source/radiation/Make.package b/Source/radiation/Make.package index 4b0479540b..f564af29cf 100644 --- a/Source/radiation/Make.package +++ b/Source/radiation/Make.package @@ -25,6 +25,7 @@ CEXE_headers += RadSolve.H CEXE_headers += RadBndry.H CEXE_headers += RadTypes.H CEXE_headers += MGRadBndry.H +CEXE_headers += HABEC.H CEXE_headers += filter.H CEXE_headers += filt_prim.H diff --git a/Source/sdc/sdc_newton_solve.H b/Source/sdc/sdc_newton_solve.H index 12c83a26e1..312837cc68 100644 --- a/Source/sdc/sdc_newton_solve.H +++ b/Source/sdc/sdc_newton_solve.H @@ -29,8 +29,6 @@ f_sdc_jac(const Real dt_m, GpuArray U_full; GpuArray R_full; - Array1D R_react; - // we are not solving the momentum equations // create a full state -- we need this for some interfaces @@ -85,19 +83,13 @@ f_sdc_jac(const Real dt_m, single_zone_react_source(U_full, R_full, burn_state); - // store the subset of R used in the Jacobian - - for (int n = 0; n < NumSpec; ++n) { - R_react(n+1) = R_full[UFS+n]; - } - R_react(NumSpec+1) = R_full[UEINT]; - // we are solving J dU = -f // where f is Eq. 36 evaluated with the current guess for U - for (int n = 1; n < NumSpec+1; ++n) { - f(n) = U(n) - dt_m * R_react(n) - f_source(n); + for (int n = 1; n <= NumSpec; ++n) { + f(n) = U(n) - dt_m * R_full[UFS-1+n] - f_source(n); } + f(NumSpec+1) = U(NumSpec+1) - dt_m * R_full[UEINT] - f_source(NumSpec+1); // get the Jacobian. @@ -218,13 +210,12 @@ sdc_newton_solve(const Real dt_m, int info = 0; f_sdc_jac(dt_m, U_react, f, Jac, f_source, rho_new, mom_source, T_old, E_var); - IArray1D ipvt; - // solve the linear system: Jac dU_react = -f #ifdef NEW_NETWORK_IMPLEMENTATION RHS::dgefa(Jac); info = 0; #else + IArray1D ipvt; dgefa(Jac, ipvt, info); #endif if (info != 0) { @@ -242,13 +233,13 @@ sdc_newton_solve(const Real dt_m, dgesl(Jac, ipvt, f_rhs); #endif - for (int n = 1; n < NumSpec+1; ++n) { + for (int n = 1; n <= NumSpec+1; ++n) { dU_react(n) = f_rhs(n); } // how much of dU_react should we apply? Real eta = 1.0_rt; - for (int n = 1; n < NumSpec+1; ++n) { + for (int n = 1; n <= NumSpec+1; ++n) { U_react(n) += eta * dU_react(n); } diff --git a/Source/sdc/sdc_react_util.H b/Source/sdc/sdc_react_util.H index 9d29c24271..5c06d58908 100644 --- a/Source/sdc/sdc_react_util.H +++ b/Source/sdc/sdc_react_util.H @@ -1,10 +1,6 @@ #ifndef SDC_REACT_UTIL_H #define SDC_REACT_UTIL_H -constexpr int iwfs = 1; -constexpr int iwe = NumSpec+1; - - AMREX_GPU_HOST_DEVICE AMREX_INLINE void single_zone_react_source(GpuArray const& state, @@ -68,7 +64,6 @@ single_zone_react_source(const int i, const int j, const int k, for (int n = 0; n < NUM_STATE; ++n) { state_arr[n] = state(i,j,k,n); - R_arr[n] = R(i,j,k,n); } single_zone_react_source(state_arr, R_arr, burn_state); @@ -90,8 +85,6 @@ single_zone_jac(GpuArray const& state, #endif #else - const auto eps = 1.e-8_rt; - // Jac has the derivatives with respect to the native // network variables, X, e. Note: the e derivative