nschloe / pygmsh

:spider_web: Gmsh for Python
GNU General Public License v3.0
844 stars 161 forks source link

use pygmsh for mesh #14

Closed berndhahnebach closed 5 years ago

berndhahnebach commented 8 years ago

Does pygmsh support creation of geometry only or does it support mesh commands of gmsh as well? I'm looking for something like the attached geo file.

Merge "tetra-02.brep";

///////////////////////////////////////////////////////
//Geometry Options, "= 0"  is False!
Geometry.OCCFixDegenerated = 0;
// Fix degenerated edges/faces in STEP, IGES and BRep models

Geometry.OCCFixSmallEdges = 0;
// Fix small edges in STEP, IGES and BRep models

Geometry.OCCFixSmallFaces = 0;
// Fix small faces in STEP, IGES and BRep models

Geometry.OCCSewFaces = 0;
// connect edges --> for shells 

Geometry.OCCConnectFaces = 0;
// connect faces --> for solids

///////////////////////////////////////////////////////
// elementsize (watch your units!)
//Mesh.CharacteristicLengthMax = 0.5;
Mesh.CharacteristicLengthMax = 1e+22;
//Default value: 1e+22

Mesh.CharacteristicLengthMin = 20;
// Minimum mesh element size

// optimization
//Mesh.Optimize = 0;
// Optimize the mesh to improve the quality of tetrahedral elements
//Mesh.OptimizeNetgen = 0;
// Optimize the mesh using Netgen to improve the quality of tetrahedral elements

//Mesh.HighOrderOptimize = 0;
// Optimize high order meshes?

///////////////////////////////////////////////////////
Mesh.ElementOrder = 2;
// Element order (1=linear elements, N (<6) = elements of higher order)
// Default value: 1

Mesh.Algorithm3D = 5;
// 3D mesh algorithm: 1=Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree
// default = 1

///////////////////////////////////////////////////////
// meshen immediately after loading the file into GUI --> not needed in konsole
//Mesh  2;  // surface
//Mesh  3;  // volume

///////////////////////////////////////////////////////
Mesh.Format = 33;
// 1=msh, 2=unv, 10=automatic, 19=vrml, 27=stl, 30=mesh, 31=bdf, 32=cgns, 33=med, 40=ply2
// default = 10

Mesh.SaveAll = 1;
// Ignore Physical definitions and save all elements

//Save "tetra-03.unv";
//Save "tetra-03.msh";
Save "tetra-03.med";
nschloe commented 8 years ago

Not at the moment; PyGmsh aims at constructing the geometry. I could imagine a module that supports Gmsh Meshes too, but really your code above doesn't look too scary to write in Gmsh's own language. :) (The geometry language is horrible, on the other hand.)

berndhahnebach commented 8 years ago

Hi Nico, Thanks for your fast answer!

but really your code above doesn't look too scary to write in Gmsh's own language. :)

Yes but ...

I do not want to write it myself. I'm thinking of writing a workbench for FreeCAD to work with GMSH. If I could have used pygmsh I only needed to write the gui and call pygmsh functions. Workbench scripting woul be a mix of own methods and pygmsh methods. Since pygmsh does not support them I need to write them myself since I would like to have the GMSH workbench in FreeCAD sciptable.

You got my idea hopefully. Cheers Bernd

TsingQAQ commented 7 years ago

It'll be a fantastic tool if PyGmsh could integrate Gmsh's meshing module, I‘m working on CFD and need some meshing tool to do the meshworkd for geometry. For me using PythonOCC to do the geometry construction is quite well cause it has already wrapped OpenCASCADE and is relatively more friendly and powerful, so a python wrap of gmsh's meshing module is quite lovely tool :)

berndhahnebach commented 7 years ago

Yeah it would be cool, but it does not seams to happen in near future. I started to implement GMSH meshing algorithm in FreeCAD. Works quite well already. Has grouping and different mesh element size for different regions ... This is all scriptable by python with and without GUI.

bernd

BTW There are some guys who have started a CFD workbench for FreeCAD.

TsingQAQ commented 7 years ago

@berndhahnebach Thanks for your information which really helps me, I'm a beginner at geometric parameterization and CFD, seems that there are already some work done on this area using FreeCAD, I'll take a look at that, Many thanks !

nschloe commented 5 years ago

Three years in, this suggestion hasn't created much interest. Considering how hard it would be to implement, too, I'll close this. If anyone is interested in this in the future, pygmsh is still open for pull requests regarding mesh handling.