433 {
435 return;
436 const size_t nstep =
data.currentStep();
438 return;
439 double max_u = 0.;
440 for (
const auto &u :
data.d_u)
441 max_u = std::
max(max_u, u.length());
443 MPI_Allreduce(MPI_IN_PLACE, &max_u, 1, MPI_DOUBLE, MPI_MAX,
445 double com0x = 0., com0y = 0.;
446 if (!
data.d_particlesListTypeParticle.empty()) {
447 const auto c =
data.d_particlesListTypeParticle[0]->getXCenter();
448 com0x = c.d_x;
449 com0y = c.d_y;
450 }
452 d_metricOs << std::format(
"{},{:.12e},{:.12e},{:.12e},{:.12e}\n", nstep,
453 data.d_time, max_u, com0x, com0y);
455 }
456 const size_t n =
data.d_u.size();
457 std::vector<double> buf(6 * n, 0.);
458 for (size_t i = 0; i < n; ++i) {
460 continue;
461 buf[6 * i + 0] =
data.d_u[i].d_x;
462 buf[6 * i + 1] =
data.d_u[i].d_y;
463 buf[6 * i + 2] =
data.d_u[i].d_z;
464 buf[6 * i + 3] =
data.d_v[i].d_x;
465 buf[6 * i + 4] =
data.d_v[i].d_y;
466 buf[6 * i + 5] =
data.d_v[i].d_z;
467 }
469 MPI_Allreduce(MPI_IN_PLACE, buf.data(), static_cast<int>(buf.size()),
472 return;
474 std::ofstream xr(
d_outDir /
"nodal" /
"x_ref.bin", std::ios::binary);
475 const uint32_t nn = static_cast<uint32_t>(n);
476 xr.write(reinterpret_cast<const char *>(&nn), sizeof(nn));
477 for (size_t i = 0; i < n; ++i) {
478 const double p[3] = {
data.d_xRef[i].d_x,
data.d_xRef[i].d_y,
480 xr.write(reinterpret_cast<const char *>(p), sizeof(p));
481 }
483 }
484 std::ofstream os(
d_outDir /
"nodal" / std::format(
"uv_{:06d}.bin", nstep),
485 std::ios::binary);
486 const char magic[4] = {'P', 'D', 'U', 'V'};
487 const uint32_t step32 = static_cast<uint32_t>(nstep);
488 const uint32_t nn = static_cast<uint32_t>(n);
489 os.write(magic, 4);
490 os.write(reinterpret_cast<const char *>(&step32), sizeof(step32));
491 os.write(reinterpret_cast<const char *>(&nn), sizeof(nn));
492 os.write(reinterpret_cast<const char *>(buf.data()),
493 static_cast<std::streamsize>(buf.size() * sizeof(double)));
494 }
static bool ownsNode(const data::ModelData &data, size_t i)
T max(const std::vector< T > &data)
Returns the maximum from list of data.
int mpiSize()
Get size (number) of processors.
MPI_Comm mpiComm()
Get MPI comm.