Solve STEP Geometry

Hi,

When I use ‘[color=orange]from netgen.geom2d import unit_square[/color]’ and set the boundary conditions with the flag ‘[color=red]dirichlet=’ left|right’[/color]’ (figure 1), then the Poisson equation on the unit square with homogeneous Dirichlet boundary conditions is solved (figure 2).

If I import the geometry in the format *.step using ‘[color=orange]geo=LoadOCCGeometry (‘unit_square.step’)[/color] ’ (the unit-square) and set the boundary conditions with ‘[color=red]dirichlet=’ left|right’[/color]’ flag (figure 3), then the Poisson equation on the unit square with homogeneous Dirichlet boundary conditions is not solved (figure 4).

How to set boundary conditions for files of type *.step? Is it possible to determine several boundary conditions on the walls of a square?

Hi,

I’m not sure which boundary conditions are loaded from a *.step.
If the boundary conditions are set to strings, you can use the following to print them:

from netgen.geom2d import unit_square

ngmesh = unit_square.GenerateMesh()

from ngsolve import *
mesh = Mesh(ngmesh)
print(mesh.GetBoundaries())

If you have integers as boundary conditon, you can set names using:

mesh.ngmesh.SetBCName(0,"somename")

Could you please attach your *.step file? Then I can check what is loaded from the *.step file?

Best,
Christoph

Thanks for your quick response, STEP file

Using print(mesh.GetBoundaries()) I determined: [ul]
[li]The number of integers as a boundary condition is equal to the number of planes in the file *.step. There are exactly six of them in 3D for a cube.[/li]
[li]And what about the 2D case where the number of integers is equal to one, since one plane? You can set the name of the boundary conditions at a node?[/li]
[/ul]

As it looks like, importing *.step files just makes sense for 3D meshes and 2D surface meshes in 3D.
But for a 2D mesh, some information is not set correctly.

Do you really need to import a 2D *.step file? Generating 2D geometries in Netgen is not very difficult.

Best,
Christoph

The priority is to import the finished 2D model in the format *.step. In Netgen, when writing a 2D object (line) to a file, the ‘[color=red]-bc=[/color]’ flag is specified with the individual number to be referenced when setting the boundary condition. That is, the boundary condition is set on the line. With the format *.step so can be done? Set a boundary condition on a line, point, node, or finite element rather than a surface?