Hello,
I would like to solve my problem in MPI parallelization. There are several independent mesh in my problem, so I'm tring to use the same method as "solve independent equation on different cores" in this Q and A. But I stucked at setting Function
value.
The following is the simplified program in C++.
Mesh mesh;
HDF5File fpH5(MPI_COMM_SELF,"./mymesh.h5","r");
fpH5.read(mesh,"mesh",false);
Constant u0(0.0);
Poisson::FunctionSpace V(mesh);
Function u(V);
u=u0;
Executing this program by "mpirun -n 2 ./myprogram
", it result in following error. There is no error when executing this program by "mpirun -n 1 ./myprogram
". Also there is no error when using "UnitSquareMesh
" or "HDF5File fpH5m(MPI_COMM_WORLD, ...
".
How can I avoid this error and access the Function.
terminate called after throwing an instance of 'std::runtime_error'
what():
*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** fenics@fenicsproject.org
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to access vector of degrees of freedom.
*** Reason: Cannot access a non-const vector from a subfunction.
*** Where: This error was encountered inside Function.cpp.
*** Process: unknown
***
*** DOLFIN version: 1.4.0
*** Git changeset: unknown
*** -------------------------------------------------------------------------