This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Solve independent PDE using mesh generated by mshr in FEniCS 2016.1.0

+1 vote

Hi, everyone!

I am writing a code to solve independent PDEs on different cores in a similar fashion as
https://fenicsproject.org/qa/2682/solve-independent-equations-on-different-cores

The only difference is that, instead of "UnitSquareMesh(mpi_comm_self(),...)", I want to use a mesh generated by mshr.

I believe in an earlier version of FEniCS, it can be done like this:
https://fenicsproject.org/qa/8450/mpi4py-how-to-disable-automatic-distribution-of-mesh

But in the current version of mshr 2016.1.0, there is no mshr._generate. (The code below will say "False" with mshr 2016.1.0). Probably it is moved somewhere else.

import mshr
print 'mshr has "_generate":',hasattr(mshr,'_generate')

Question 1) can anyone tell me where this function is located in the mshr 2016.1.0?

Without 'mshr._generate', I was doing a work-around: build a mesh by mshr in one separate serial code and read from the mesh file in the parallel code. However, from
https://bitbucket.org/fenics-project/dolfin/issues/614/add-member-function-to-mesh-to-read-from
I found that mesh file can only be read in the Dolfin.Mesh constructor.
To solve independent PDE in different cores, I need to supply 'mpi_comm_self()' to the Dolfin.Mesh constructor too.
However, I don't know how to supply both of the mesh file and 'mpi_comm_self()' to the constructor at the same time.

Question 2) how can I pass both 'mpi_comm_self()' and a mesh file to Dolfin.Mesh?

If I am unclear, please let me know.

Thanks!

asked Oct 27, 2016 by barnwellguy FEniCS Novice (130 points)
edited Oct 28, 2016 by barnwellguy
...