Setting up a sequence for meshing a .step file

More
4 years 9 months ago #2386 by jleman
Hello, I am very new to Netgen/NGSolve and am curious if the following is possible: I have a 3D .step geometry with a void inside (a solid sphere with a small cube cut out of the middle of it - see attached). So far I can import this geometry into netgen with a python script and mesh the volume. I would like to first mesh the surface of the cube with a very refined mesh and let that surface mesh seed the volume mesh (with elements growing in size away from the cube). Is it possible to sequence a meshing process like this using a python script? If so, can you point me to where I could find the syntax? Thanks.
More
4 years 9 months ago #2387 by jleman
From other threads I found some basic information in help queries within Python 3.7. I'm using Jupyter so in my case I ran:
Code:
help()

in the output window a box comes up in which you can enter the help search term. I found some basic documenation with the following searches:

  • netgen.occ.OCCGeometry
  • netgen.libngpy._meshing

  • Based on these sources I came up with the following code:
    Code:
    from netgen.occ import * geo = OCCGeometry('C:/00_Temp/SphereMinusCube.step') for x in range(1,7): geo.SetFaceMeshsize(x,10) geo.SetFaceMeshsize(0,50) mesh = geo.GenerateMesh(maxh = 50,grading = 0.5) #mesh.Save('C:/00_Temp/SphereMinusCube.vol')from netgen.occ import *
    More
    4 years 9 months ago - 4 years 9 months ago #2388 by jleman
    A couple of follow-up questions:

    1. How do I assign faces 1 through 7 of the .step file to a boundary condition (for example, bc1) and assign face 0 of the .step file to a second boundary condition (bc2)?

    2. Is there a command that will return the number of faces in a .step model?

    3. Is there a command that will return the surface mesh information for a specific surface (i.e. number of triangle elements etc.)?
    Last edit: 4 years 9 months ago by jleman.
    Time to create page: 0.107 seconds