MCPcopy Create free account
hub / github.com/AMReX-Astro/Castro / getTempDiffusionTerm

Method getTempDiffusionTerm

Source/diffusion/Castro_diffusion.cpp:100–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99
100void
101Castro::getTempDiffusionTerm (Real time, MultiFab& state_in, MultiFab& TempDiffTerm)
102{
103 BL_PROFILE("Castro::getTempDiffusionTerm()");
104
105 // Fill coefficients at this level.
106 Vector<std::unique_ptr<MultiFab> > coeffs(AMREX_SPACEDIM);
107 for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
108 coeffs[dir] = std::make_unique<MultiFab>(getEdgeBoxArray(dir), dmap, 1, 0);
109 }
110
111 // Fill temperature at this level.
112 MultiFab Temperature(grids, dmap, 1, 1);
113
114 {
115 FillPatchIterator fpi(*this, state_in, 1, time, State_Type, 0, NUM_STATE);
116 MultiFab& grown_state = fpi.get_mf();
117
118 MultiFab::Copy(Temperature, grown_state, UTEMP, 0, 1, 1);
119
120#ifdef _OPENMP
121#pragma omp parallel
122#endif
123 {
124 FArrayBox coeff_cc(The_Async_Arena());;
125
126 for (MFIter mfi(grown_state, TilingIfNotGPU()); mfi.isValid(); ++mfi)
127 {
128
129 const Box& bx = mfi.tilebox();
130
131 // Create an array for storing cell-centered conductivity data.
132 // It needs to have a ghost zone for the next step.
133
134 const Box& obx = amrex::grow(bx, 1);
135 coeff_cc.resize(obx, 1);
136
137 Array4<Real> const coeff_arr = coeff_cc.array();
138 Array4<Real const> const U_arr = grown_state.array(mfi);
139
140 fill_temp_cond(obx, U_arr, coeff_arr);
141
142 for (int idir = 0; idir < AMREX_SPACEDIM; ++idir) {
143
144 const Box& nbx = amrex::surroundingNodes(bx, idir);
145
146 Array4<Real> const edge_coeff_arr = (*coeffs[idir]).array(mfi);
147
148 amrex::ParallelFor(nbx,
149 [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
150 {
151 if (idir == 0) {
152 edge_coeff_arr(i,j,k) = 0.5_rt * (coeff_arr(i,j,k) + coeff_arr(i-1,j,k));
153 } else if (idir == 1) {
154 edge_coeff_arr(i,j,k) = 0.5_rt * (coeff_arr(i,j,k) + coeff_arr(i,j-1,k));
155 } else {
156 edge_coeff_arr(i,j,k) = 0.5_rt * (coeff_arr(i,j,k) + coeff_arr(i,j,k-1));
157 }

Callers

nothing calls this directly

Calls 4

fill_temp_condFunction · 0.85
isValidMethod · 0.80
defineMethod · 0.80
applyopMethod · 0.80

Tested by

no test coverage detected