Function opensn::DistributeSurfaceAngularFluxes

Function Documentation

DistributedSurfaceData opensn::DistributeSurfaceAngularFluxes(const std::string &file_base, const std::vector<std::string> &surfaces, const mpi::Communicator &comm, std::uint64_t max_send_bytes = SURFACE_REDISTRIBUTION_BYTES)

Distribute the faces of a surface angular-flux file set written by DiscreteOrdinatesProblemIO::WriteSurfaceAngularFluxes across the ranks of comm.

Each file is read with DiscreteOrdinatesProblemIO::ReadSurfaceAngularFluxes, which does not check the data against a problem. The files <file_base>0.h5, …, <file_base>(N-1).h5 are found from the num_partitions attribute of the first file. N need not equal the size of comm, and the data need not match the partitioning of any current mesh. File k is read by rank k modulo the size of comm, one file per rank at a time, and its faces are sent to their owner ranks (see SurfaceFaceOwner) in exchanges in which each rank sends at most max_send_bytes packed bytes (at least one face), before the next file is read. The peak memory of a rank is therefore one file’s requested surfaces, as returned by the reader, plus its owned faces and one exchange. A rank receives from every rank in an exchange, so its receive buffer is bounded by the number of ranks times max_send_bytes; faces spread evenly over owners, so it is typically about max_send_bytes. Every file must contain every requested tag, possibly without faces. Any rank may read any file, so the files must be on a file system that every rank of comm can access; file_base is used only by the calling rank.

Collective over comm. Throws, on all ranks, std::invalid_argument for invalid arguments, including names that resolve to the same tag twice, and std::logic_error for missing, inconsistent, or malformed files, for a tag with no faces in any file, and for duplicate faces.

Parameters:
  • file_base – File name base.

  • surfaces – Surface names to read. Must be non-empty and unique. A boundary name reads that tag, and the name of an interior surface reads both of its tags, <name>_u and <name>_d. A single side’s tag is rejected unless its other side is also requested, because surface responses need both sides. Names are resolved against file 0, and every other file is read with the resolved tags.

  • comm – Communicator to distribute the faces over.

  • max_send_bytes – Per-rank send budget of one exchange.