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

Method create_source_corrector

Source/driver/Castro.cpp:4167–4233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4165
4166
4167void
4168Castro::create_source_corrector()
4169{
4170
4171 BL_PROFILE("Castro::create_source_corrector()");
4172
4173 if (time_integration_method == CornerTransportUpwind && source_term_predictor == 1) {
4174
4175 // Optionally predict the source terms to t + dt/2,
4176 // which is the time-level n+1/2 value, To do this we use a
4177 // lagged predictor estimate: dS/dt_n = (S_n - S_{n-1}) / dt, so
4178 // S_{n+1/2} = S_n + (dt / 2) * dS/dt_n. We'll add the S_n
4179 // terms later; now we add the second term. We defer the
4180 // multiplication by dt / 2 until the actual advance, since
4181 // we may be subcycling and thus not know yet what the
4182 // advance timestep is.
4183
4184 // Note that since for dS/dt we want (S^{n+1} - S^{n}) / dt,
4185 // we only need to take twice the new-time source term from the
4186 // last timestep, since in the predictor-corrector approach,
4187 // the new-time source term is 1/2 * S^{n+1} - 1/2 * S^{n}.
4188 // This is untrue in general for the non-momentum sources,
4189 // so for safety we'll only apply it to the momentum sources.
4190
4191 // Even though we're calculating this predictor from the last
4192 // timestep, we've already done the swap, so the "new" data
4193 // from the last timestep is currently residing in the "old"
4194 // StateData. (As a corollary, this operation must be done
4195 // prior to updating any of the source StateData.) Since the
4196 // dt comes from the last timestep, which is no longer equal
4197 // to the difference between prevTime and curTime, we rely
4198 // on our recording of the last dt from the previous advance.
4199
4200 const Real time = get_state_data(Source_Type).prevTime();
4201
4202 AmrLevel::FillPatch(*this, source_corrector, NUM_GROW_SRC, time, Source_Type, UMX, 3, UMX);
4203
4204 source_corrector.mult(2.0 / lastDt, NUM_GROW_SRC);
4205
4206 }
4207 else if (time_integration_method == SimplifiedSpectralDeferredCorrections && source_term_predictor == 1) {
4208
4209 // If we're doing simplified SDC, our approach depends on
4210 // iteration. For the first iteration, we use the corrector
4211 // from the previous timestep, which when combined with the
4212 // old source, will give us a prediction of the time-centered
4213 // source term. For later iterations, we use the previous
4214 // iteration's corrector. Note that we swap time-levels
4215 // before the start of the step, so for iteration 0 we access
4216 // the previous step's corrector as the old data. But there
4217 // is no swap between iterations, so for later iterations, we
4218 // use the new timelevel.
4219
4220 if (sdc_iteration == 0) {
4221 const Real time = get_state_data(Source_Type).prevTime();
4222
4223 AmrLevel::FillPatch(*this, source_corrector, NUM_GROW_SRC, time, Source_Type, 0, NSRC);
4224

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected