@@ -60,6 +60,7 @@ Castro::trans_single(const Box& bx,
6060 vol,
6161#endif
6262 hdt, cdtdx);
63+
6364}
6465
6566
@@ -107,7 +108,37 @@ Castro::actual_trans_single(const Box& bx, // NOLINT(readability-convert-member
107108
108109 bool reset_density = transverse_reset_density;
109110 bool reset_rhoe = transverse_reset_rhoe;
111+ bool use_eos = transverse_use_eos;
110112 Real small_p = small_pres;
113+ Real temp_guess = T_guess;
114+ Real abundance_tol = abundance_failure_tolerance;
115+
116+ int ilo = 0 ;
117+ int jlo = 0 ;
118+ int klo = 0 ;
119+
120+ int ihi = 0 ;
121+ int jhi = 0 ;
122+ int khi = 0 ;
123+
124+ if (idir_t == 0 ) {
125+ ihi = 1 ;
126+ } else if (idir_t == 1 ) {
127+ jhi = 1 ;
128+ } else {
129+ khi = 1 ;
130+ }
131+
132+ if (idir_n == 0 ) {
133+ ilo += d;
134+ ihi += d;
135+ } else if (idir_n == 1 ) {
136+ jlo += d;
137+ jhi += d;
138+ } else {
139+ klo += d;
140+ khi += d;
141+ }
111142
112143 amrex::ParallelFor (bx,
113144 [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
@@ -117,48 +148,13 @@ Castro::actual_trans_single(const Box& bx, // NOLINT(readability-convert-member
117148 // (i, i+1) in the x-direction, and similarly for
118149 // the y- and z- directions.
119150
120- int il = i;
121- int jl = j; // NOLINT(misc-confusable-identifiers)
122- int kl = k;
123-
124- int ir = i;
125- int jr = j;
126- int kr = k;
151+ const int il = i + ilo;
152+ const int jl = j + jlo; // NOLINT(misc-confusable-identifiers)
153+ const int kl = k + klo;
127154
128- // set the face indices in the transverse direction
129-
130- if (idir_t == 0 ) {
131- ir = i+1 ;
132- jr = j;
133- kr = k;
134-
135- } else if (idir_t == 1 ) {
136- ir = i;
137- jr = j+1 ;
138- kr = k;
139-
140- } else {
141- ir = i;
142- jr = j;
143- kr = k+1 ;
144- }
145-
146- // We're handling both the plus and minus states;
147- // for the minus state we're shifting one zone to
148- // the left in our chosen direction.
149-
150- if (idir_n == 0 ) {
151- il += d;
152- ir += d;
153-
154- } else if (idir_n == 1 ) {
155- jl += d;
156- jr += d;
157-
158- } else {
159- kl += d;
160- kr += d;
161- }
155+ const int ir = i + ihi;
156+ const int jr = j + jhi;
157+ const int kr = k + khi;
162158
163159 // Update all of the passively-advected quantities with the
164160 // transverse term and convert back to the primitive quantity.
@@ -384,8 +380,8 @@ Castro::actual_trans_single(const Box& bx, // NOLINT(readability-convert-member
384380 // Reset to original value if adding transverse terms made any mass fraction invalid.
385381
386382 for (int n = 0 ; n < NumSpec; ++n) {
387- if (qo_arr (i,j,k,n+QFS ) > 1 .0_rt + castro::abundance_failure_tolerance ||
388- qo_arr (i,j,k,n+QFS ) < -castro::abundance_failure_tolerance ) {
383+ if (qo_arr (i,j,k,n+QFS ) > 1 .0_rt + abundance_tol ||
384+ qo_arr (i,j,k,n+QFS ) < -abundance_tol ) {
389385 rrnewn = rrn;
390386 runewn = run;
391387 rvnewn = rvn;
@@ -443,13 +439,13 @@ Castro::actual_trans_single(const Box& bx, // NOLINT(readability-convert-member
443439 // Pretend QREINT has been fixed
444440 // We can get pressure update via eos or using p-evolution equation
445441
446- if (transverse_use_eos ) {
442+ if (use_eos ) {
447443
448444 // With the EOS route:
449445 eos_rep_t eos_state;
450446 eos_state.rho = rrnewn;
451447 eos_state.e = qo_arr (i,j,k,QREINT ) * rhoinv;
452- eos_state.T = T_guess ;
448+ eos_state.T = temp_guess ;
453449
454450 for (int n = 0 ; n < NumSpec; n++) {
455451 eos_state.xn [n] = qo_arr (i,j,k,QFS +n);
@@ -581,7 +577,10 @@ Castro::actual_trans_final(const Box& bx, // NOLINT(readability-convert-member-
581577
582578 bool reset_density = transverse_reset_density;
583579 bool reset_rhoe = transverse_reset_rhoe;
580+ bool use_eos = transverse_use_eos;
584581 Real small_p = small_pres;
582+ Real temp_guess = T_guess;
583+ Real abundance_tol = abundance_failure_tolerance;
585584
586585 amrex::ParallelFor (bx,
587586 [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
@@ -860,8 +859,8 @@ Castro::actual_trans_final(const Box& bx, // NOLINT(readability-convert-member-
860859 // Reset to original value if adding transverse terms made any mass fraction invalid.
861860
862861 for (int n = 0 ; n < NumSpec; ++n) {
863- if (qo_arr (i,j,k,n+QFS ) > 1 .0_rt + castro::abundance_failure_tolerance ||
864- qo_arr (i,j,k,n+QFS ) < -castro::abundance_failure_tolerance ) {
862+ if (qo_arr (i,j,k,n+QFS ) > 1 .0_rt + abundance_tol ||
863+ qo_arr (i,j,k,n+QFS ) < -abundance_tol ) {
865864 rrnewn = rrn;
866865 runewn = run;
867866 rvnewn = rvn;
@@ -914,13 +913,13 @@ Castro::actual_trans_final(const Box& bx, // NOLINT(readability-convert-member-
914913 // Pretend QREINT has been fixed
915914 // We can get pressure update via eos or using p-evolution equation
916915
917- if (transverse_use_eos ) {
916+ if (use_eos ) {
918917
919918 // With the EOS route:
920919 eos_rep_t eos_state;
921920 eos_state.rho = rrnewn;
922921 eos_state.e = qo_arr (i,j,k,QREINT ) / rrnewn;
923- eos_state.T = T_guess ;
922+ eos_state.T = temp_guess ;
924923
925924 for (int n = 0 ; n < NumSpec; n++) {
926925 eos_state.xn [n] = qo_arr (i,j,k,QFS +n);
0 commit comments