I am doing a simulation on a heterogeneous material. The material properties are defined in a function and stored together with mesh in a hdf5 file. The file was created using a single processor.
I am trying to implement parallel, by:
MPI_Comm comm( MPI_COMM_WORLD );
HDF5File g(comm, "mesh_and_material.h5", "r" );
Mesh mesh0(comm );
g.read( mesh0, "mesh", use_partition_from_file );
Poisson::FunctionSpace V_0(mesh0);
Function u_1(V_0);
Function materials_in(V_0); // the material property function, scalar labels.
g.read( materials_in, "materials" );
// output, check mesh and material, see if read correctly.
File file( comm, "solution.pvd", "compressed");
File file2( comm, "materials_in.pvd", "compressed");
file << u_1;
file2 << materials_in;
and I ran the code:
mpirun -np 4 ./main
Unfortunately the result was disappointing with mesh distorted. I guess it is due to the fact that the file was created using a single core. I can run the code with
mpirun -np 1 ./main
which gives the correct answer. But I need to run in parallel.
Any suggestions? Thanks!