Export solution data and import geometries


475
views
1
7 months ago by
Hi everyone,

I am a new user to FEniCS (using it with the docker platform) and have 2 questions:

1. Can I import geometries from other applications into FEniCS (using a python code). I may want to import complicated geometries and want to know if it's possible.

2. Can I export the solution data into .txt files or .mat files to do more manipulations on it later on. I don have ParaView or Jupyter notebook.

Thanks for helping!
Community: FEniCS Project

3 Answers


1
7 months ago by
Hi,

you can import a geometry and a mesh from GMSH.

mesh = Mesh('Cube.xml')​

You can only import .xml files in FEniCS. The mesh from GMSH has .msh extension.So, after you save it as .msh, you convert it into .xml from your terminal with

dolfin-convert Cube.msh Cube.xml​


and then you pass it on Fenics.

I also needed clarity on this querry...
Minas , is dolfin-convert a command or a module that has to be added ?
written 7 months ago by Ovais  
mathaiakis@Yannisp-Linux:~/Fenics/Codes/FSI$ dolfin-convert Cube.msh Cube.xml


where the file /Fenics/Codes/FSI has inside the Cube.msh file. I converted it with this command from my terminal into an xml file.

written 7 months ago by Minas Mattheakis  
0
7 months ago by
Ovais  
File attached: outputexample.py (877 Bytes)

for saving array to text files you can read this post.

https://fenicsproject.org/qa/8199/error-while-printing-stiffness-matrix-saving-external-file

I tried the same on a simple poisson demo and was able to export the results by saving the array to a text file.

I have attached the example file , it saves the output (vertex values) to output.txt
0
7 months ago by
meshio might also be helpful?
Please login to add an answer/comment or follow this question.

Similar posts:
Search »