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

Problem with 3D geometry

+1 vote

Hi, I've met a problem with 3D geometry. I followed the example in documentation and run into an error. My code is following:

from dolfin import *
from mshr import *

diam    = 5.0
mainBox = Box(Point(0,0,0),Point(diam,diam,diam))

mainStrip = Box(Point(0.55,0.8,0),Point(4.45,0.5,0.0635))
def strip(i):
    b = Box(Point(0.85+i*0.4,4.5,0),Point(0.95+i*0.4,0.8,0.0635))
    return b

geo = mainBox - mainStrip - strip(0) - strip(1) - strip(2) - strip(3) - strip(4) - strip(5) - strip(6) - strip(7) - strip(8)

info("\nCompact output of 3D geometry:")
info(geo)
info("\nVerbose output of 3D geometry:")
info(geo, True)

plot(geo, "3D geometry (surface)")

# Generate and plot mesh
mesh3d = Mesh(geo, 32)
info(mesh3d)
plot(mesh3d, "3D mesh")

interactive()

This produces the following error

Not an UFL type: <class 'mshr.CSGDifference'>

which is triggered inside the plot function. If I remove the plot function, similar error is triggered inside Mesh function.

Also, if I define just

geo = mainBox

I get the error

Not an UFL type: <class 'mshr.Box'>

What am I doing wrong? I have updated everything.

asked Jun 15, 2015 by Ianx86 FEniCS User (1,050 points)

1 Answer

+2 votes
 
Best answer

mshr has been spun out of dolfin to a large extent, so much of the syntax has changed.
If you replace Mesh with generate_mesh and delete the plot lines, I think it will work.

answered Jun 15, 2015 by chris_richardson FEniCS Expert (31,740 points)
selected Jun 15, 2015 by Ianx86

Awesome. Thank You very much :)

...