I want to generate a cylindrical shape in FEniCS, but have been unable to find documentation or example codes that would allow me to make this. Previous code does not work in the newer versions of FEniCS. I am running FEniCS through docker. I don’t have any code to show because I am a complete newbie and don’t really know where else to ask for help.
from dolfin import *
from mshr import *
#Making a cylindrical geometry
cylinder = Cylinder(Point(0, 0, -1), Point(0, 0, 1), 0.5, 0.5)
geometry = cylinder
# Making Mesh (40 corresponds to the mesh density)
mesh = generate_mesh(geometry, 40)
# Save the mesh
File("cylinder.pvd") << mesh
Here is the mesh:
Hi Leo! Thank you! This worked on my computer! Any idea on how to make shapes contract on FEniCS? I want to compress and stretch the cylinder. Any help would be greatly appreciated!
You can adjust the dimensions like:
cylinder = Cylinder('coordinate of center of the top circle', 'coordinate of center of the bottom circle', 'radius of the circle at the top', 'radius of the circle at the bottom')
Then you can compress and stretch it. For more information please have a look at this
What is the way to obey the image or to see it. When I type plot mesh, an error occurs. Is there a way to see the image?
If you dont:
- post the code you are running
- post the error message you are receiving
(Both with proper markdown encapsulation),
It is very hard for anyone to give you any guidance.
This has been Fixed in later versions of dolfin: 3D plot using native FEniCS - #2 by dokken