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

generation meshes of checkerboards type

0 votes

Hi!
I want to generate meshes of checkerboard`s structure.
I tried mshr:

from mshr import *
domain =   Rectangle(Point(0., 0.), Point(1., 1.))
n = 10
for k in range(n):
  for m in range(n):
     domain.set_subdomain(n*k + m + 1, Rectangle(Point(float(k)/n, float(m)/n),      Point(float(k+1)/n, float(m+1)/n)))

It works when n is small enough:
n=8

But there is some troubles when n>8

for example n = 10

Is it bug, or I chose not the right way?
Thanks a lot!

asked Apr 8, 2016 by ashoka FEniCS Novice (270 points)

1 Answer

+1 vote
 
Best answer

Hi,
these behaviour is a known bug of the latest release version of mshr library (see here). To fix your problem you need to install the development version of mshr (or dev version of fenics).

answered Apr 8, 2016 by hernan_mella FEniCS Expert (19,460 points)
selected Apr 18, 2016 by johannr

(Your code works fine using fenics 1.7dev version)

I have managed to install fencis 1.7.0dev!
Thanks!

glad to hear!

...