FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
778 stars 181 forks source link

[BUG]: MR #2651 broke ADIOS2 output in C++ #2702

Closed massimiliano-leoni closed 1 year ago

massimiliano-leoni commented 1 year ago

How to reproduce the bug

Before commit https://github.com/FEniCS/dolfinx/commit/547e645bbafb1b3e1965b9e8cb042e17ae6fa59f the following MWE worked fine

#include <basix/e-lagrange.h>

#include <dolfinx.h>
#include <dolfinx/io/ADIOS2Writers.h>
#include <dolfinx/mesh/generation.h>

using namespace dolfinx;

int main(int argc, char *argv[]) {
  init_logging(argc, argv);

  auto part = mesh::create_cell_partitioner(mesh::GhostMode::none);
  auto meshL = std::make_shared<mesh::Mesh<double>>(
      mesh::create_box(MPI_COMM_WORLD, {{{0, 0, 0}, {1, 1, 1}}}, {15, 15, 15},
                       mesh::CellType::tetrahedron, part));

  basix::FiniteElement eL = basix::element::create_lagrange<double>(
      mesh::cell_type_to_basix_type(meshL->topology()->cell_types()[0]), 1,
      basix::element::lagrange_variant::equispaced, false);
  auto VL = std::make_shared<fem::FunctionSpace<double>>(
      fem::create_functionspace(meshL, eL, 3));

  auto uL = std::make_shared<fem::Function<PetscScalar>>(VL);

  uL->x()->set(1);

  io::FidesWriter<double> writeruL(meshL->comm(), "uL.bp",
                                   io::adios2_writer::U<double>{uL}, "BPFile",
                                   io::FidesMeshPolicy::reuse);
  //    io::VTXWriter<double> writeruL(meshL->comm(), "uL.bp", {uL});    // Doesn't work either
  writeruL.write(0.0);
}

Afterwards, the produced output file, when opened in Paraview, shows no functions, only the mesh. Looking into the bp folder with bpls shows that the data is there, so perhaps Paraview is partly to be blamed for this bug, but still...

Minimal Example (Python)

No response

Output (Python)

No response

Version

main branch

DOLFINx git commit

No response

Installation

No response

Additional information

No response

garth-wells commented 1 year ago

Try setting the ADIOS2 engine to "bp4".

massimiliano-leoni commented 1 year ago

@garth-wells I passed "BP4" instead of "BPFile" in the example above but I got the same result :frowning_face:

garth-wells commented 1 year ago

@massimiliano-leoni can you test with https://github.com/FEniCS/dolfinx/pull/2708?