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

Method gwstrain

Source/driver/sum_utils.cpp:317–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315
316#ifdef GRAVITY
317void
318Castro::gwstrain (Real time,
319 Real& h_plus_1, Real& h_cross_1,
320 Real& h_plus_2, Real& h_cross_2,
321 Real& h_plus_3, Real& h_cross_3,
322 bool local) {
323
324 amrex::ignore_unused(time);
325
326 BL_PROFILE("Castro::gwstrain()");
327
328 // We have nothing to do if the user did not request the gravitational wave
329 // strain (inferred from whether the observation distance is positive).
330 if (castro::gw_dist <= 0.0_rt) {
331 return;
332 }
333
334 constexpr amrex::Real c_light_4 = amrex::Math::powi<4>(C::c_light);
335
336 GeometryData geomdata = geom.data();
337
338 MultiFab& S_new = get_new_data(State_Type);
339 MultiFab& grav_new = get_new_data(Gravity_Type);
340
341 bool mask_available = level < parent->finestLevel();
342
343 MultiFab tmp_mf;
344 const MultiFab& mask_mf = mask_available ? getLevel(level+1).build_fine_mask() : tmp_mf;
345
346 // Qtt stores the second time derivative of the quadrupole moment.
347 // We calculate it directly rather than computing the quadrupole moment
348 // and differentiating it in time, because the latter method is less accurate
349 // and requires the state at other timesteps. See, e.g., Equation 5 of
350 // Loren-Aguilar et al. 2005.
351
352 ReduceOps<ReduceOpSum, ReduceOpSum, ReduceOpSum,
353 ReduceOpSum, ReduceOpSum, ReduceOpSum,
354 ReduceOpSum, ReduceOpSum, ReduceOpSum> reduce_op;
355 ReduceData<Real, Real, Real,
356 Real, Real, Real,
357 Real, Real, Real> reduce_data(reduce_op);
358 using ReduceTuple = typename decltype(reduce_data)::Type;
359
360#ifdef AMREX_USE_OMP
361#pragma omp parallel
362#endif
363 for (MFIter mfi(S_new, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
364
365 const Box& box = mfi.tilebox();
366
367 auto rho = S_new[mfi].array(URHO);
368 auto vol = volume.array(mfi);
369 auto xmom = S_new[mfi].array(UMX);
370 auto ymom = S_new[mfi].array(UMY);
371 auto zmom = S_new[mfi].array(UMZ);
372 auto gravx = grav_new[mfi].array(0);
373 auto gravy = grav_new[mfi].array(1);
374 auto gravz = grav_new[mfi].array(2);

Callers 1

Calls 4

positionFunction · 0.85
isValidMethod · 0.80
valueMethod · 0.80

Tested by

no test coverage detected