Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Working with external (step) meshes

More
4 years 3 months ago - 4 years 3 months ago #2312 by gcdiwan
Dear NGSolve developers,

I am interested in knowing if it's possible to perform boolean operations on external meshes in step formats. I have a solid geometry (say volume1 and given in a step file) which needs to be embedded inside another volume, ideally a sphere (say volume2 and created with CSGeometry() ) and i then need to mesh the region (volume2 - volume1) and define dirichlet boundary conditions on the surface of volume1. I tried performing the boolean operation in gmsh but as i understand from mailing list there, a boolean between step and geometric entities in gmsh is not possible (also i get incorrect results so not sure if the boolean operation is being performed correctly).

I started looking at the merge.py given here and this actually merges my step file with a sphere without trouble (attached the adapted script). However it's not clear to me how to obtain the volume mesh for the region in between and define a boundary condition on interior surface. The line mesh.GenerateVolumeMesh() in the merge.py ends up in error in my case, i receive an error: Stop meshing since too many attempts. I am not sure why this happens as i could get a volume mesh with gmsh and i also added a line geo1.Heal() that fixes the errors in my step file if any.

Provided i am able to generate a volume mesh, would the following syntax make sense in order to apply the dirichlet condition on the surface of volume1:
Code:
mesh.SetMaterial(1,'inner') # set the volume1 material as inner uVal = x+2.0 mesh.SetMaterial(2,'outer') # set the volume2 material as outer and then fes = H1(mesh, order=2, dirichlet="inner") ubar = GridFunction (fes) ubar.Set (uVal, definedon=mesh.Boundaries("inner"))

Thanks in advance for your help!

File Attachment:

File Name: merge_adpa...-21-2.py
File Size:2 KB
Last edit: 4 years 3 months ago by gcdiwan.
More
4 years 2 months ago - 4 years 2 months ago #2327 by gcdiwan
I could get the boolean operation working with the merge.py given in my message above. I am now trying to get this code working on the hpc cluster. We have a mpi build for ngsolve on the cluster and the python version 3.8. While the script above works on my desktop with python version 3.6, ngsolve complains for the line below when tried on the hpc cluster:
Code:
from netgen.NgOCC import *
and produces following error:
Code:
This module is deprecated and just a wrapper for netgen.occ, import netgen.occ instead --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-a49208ac6baf> in <module> ----> 1 from netgen.NgOCC import * /opt/apps/alces/ngsolve_mpi/lib/python3.8/site-packages/netgen/NgOCC.py in <module> 5 logger.warning("This module is deprecated and just a wrapper for netgen.occ, import netgen.occ instead") 6 ----> 7 from .occ import * /opt/apps/alces/ngsolve_mpi/lib/python3.8/site-packages/netgen/occ.py in <module> ----> 1 from .libngpy._NgOCC import * 2 from .meshing import meshsize ModuleNotFoundError: No module named 'netgen.libngpy._NgOCC'; 'netgen.libngpy' is not a package

Any clues why netgen complains? (btw, import netgen.occ also produces same error)
Thanks!
Last edit: 4 years 2 months ago by gcdiwan. Reason: additional comment
More
4 years 2 months ago #2329 by christopher
This is most likely because the version on the cluster is built without OCC support. Make sure that -DUSE_OCC=ON is set and occ is installed on the cluster.

Best
Christopher
Time to create page: 0.159 seconds