| 59 | |
| 60 | |
| 61 | void |
| 62 | fill_temp_diff_coeff(const Box& bx, |
| 63 | Array4<Real const> const& U_arr, |
| 64 | Array4<Real> const& coeff_arr) { |
| 65 | |
| 66 | amrex::ParallelFor(bx, |
| 67 | [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept |
| 68 | { |
| 69 | |
| 70 | eos_t eos_state; |
| 71 | eos_state.rho = U_arr(i,j,k,URHO); |
| 72 | Real rhoinv = 1.0_rt/eos_state.rho; |
| 73 | |
| 74 | eos_state.T = U_arr(i,j,k,UTEMP); // needed as an initial guess |
| 75 | eos_state.e = U_arr(i,j,k,UEINT) * rhoinv; |
| 76 | for (int n = 0; n < NumSpec; n++) { |
| 77 | eos_state.xn[n] = U_arr(i,j,k,UFS+n) * rhoinv; |
| 78 | } |
| 79 | #if NAUX_NET > 0 |
| 80 | for (int n = 0; n < NumAux; n++) { |
| 81 | eos_state.aux[n] = U_arr(i,j,k,UFX+n) * rhoinv; |
| 82 | } |
| 83 | #endif |
| 84 | |
| 85 | if (eos_state.e < 0.0_rt) { |
| 86 | eos_state.T = castro::small_temp; |
| 87 | eos(eos_input_rt, eos_state); |
| 88 | } else { |
| 89 | eos(eos_input_re, eos_state); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | if (eos_state.rho > castro::diffuse_cutoff_density) { |
| 94 | conductivity(eos_state); |
| 95 | |
| 96 | if (eos_state.rho < castro::diffuse_cutoff_density_hi) { |
| 97 | Real multiplier = (eos_state.rho - castro::diffuse_cutoff_density) / |
| 98 | (castro::diffuse_cutoff_density_hi - castro::diffuse_cutoff_density); |
| 99 | eos_state.conductivity = eos_state.conductivity * multiplier; |
| 100 | } |
| 101 | } else { |
| 102 | eos_state.conductivity = 0.0_rt; |
| 103 | } |
| 104 | coeff_arr(i,j,k) = castro::diffuse_cond_scale_fac * eos_state.conductivity * |
| 105 | rhoinv / eos_state.cv; |
| 106 | |
| 107 | }); |
| 108 | } |
| 109 | |