| 140 | } |
| 141 | |
| 142 | void |
| 143 | Castro::construct_new_gravity (Real time) |
| 144 | { |
| 145 | BL_PROFILE("Castro::construct_new_gravity()"); |
| 146 | |
| 147 | const Real strt_time = ParallelDescriptor::second(); |
| 148 | |
| 149 | MultiFab& grav_new = get_new_data(Gravity_Type); |
| 150 | MultiFab& phi_new = get_new_data(PhiGrav_Type); |
| 151 | |
| 152 | // Always set phi to zero initially since some gravity modes |
| 153 | // don't use it and we want to have valid data. |
| 154 | |
| 155 | if (gravity->get_gravity_type() != "PoissonGrav") { |
| 156 | phi_new.setVal(0.0); |
| 157 | } |
| 158 | |
| 159 | if (!do_grav) { |
| 160 | |
| 161 | grav_new.setVal(0.0); |
| 162 | |
| 163 | return; |
| 164 | |
| 165 | } |
| 166 | |
| 167 | // If we're doing Poisson gravity, do the new-time level or composite solve here. |
| 168 | |
| 169 | if (gravity->get_gravity_type() == "PoissonGrav") |
| 170 | { |
| 171 | if (level == 0 && parent->subcyclingMode() == "None") { |
| 172 | if (castro::verbose > 0) { |
| 173 | amrex::Print() << "\n... new-time composite Poisson gravity solve from level " << level << " to level " << parent->finestLevel() << std::endl << std::endl; |
| 174 | } |
| 175 | |
| 176 | // Use the "old" phi from the current time step as a guess for this solve. |
| 177 | |
| 178 | for (int lev = level; lev <= parent->finestLevel(); ++lev) { |
| 179 | MultiFab& lev_phi_old = getLevel(lev).get_old_data(PhiGrav_Type); |
| 180 | MultiFab& lev_phi_new = getLevel(lev).get_new_data(PhiGrav_Type); |
| 181 | |
| 182 | MultiFab::Copy(lev_phi_new, lev_phi_old, 0, 0, 1, lev_phi_new.nGrow()); |
| 183 | } |
| 184 | |
| 185 | gravity->multilevel_solve_for_new_phi(level, parent->finestLevel()); |
| 186 | } |
| 187 | else if (parent->subcyclingMode() != "None") { |
| 188 | // Use the "old" phi from the current time step as a guess for this solve. |
| 189 | |
| 190 | MultiFab& phi_old = get_old_data(PhiGrav_Type); |
| 191 | |
| 192 | MultiFab::Copy(phi_new, phi_old, 0, 0, 1, phi_new.nGrow()); |
| 193 | |
| 194 | // Subtract off the (composite - level) contribution for the purposes |
| 195 | // of the level solve. We'll add it back later. |
| 196 | |
| 197 | if (gravity->DoCompositeCorrection() && level < parent->finestLevel() && level <= gravity->get_max_solve_level()) { |
| 198 | phi_new.minus(comp_minus_level_phi, 0, 1, 0); |
| 199 | } |
nothing calls this directly
no test coverage detected