Meshing various parts with various level of refinement

Hello,

I have a script to generate a 2D mesh from a 3D geometry, making a vertical cut of it.
I managed to create this geometry, but I’d like that in the mesh that on the domain AqueousHumor, the refinement of the mesh is smaller than in the other regions.

So far, I can set the size of the mesh using SetMaxSize, but it sets it globally.
Here is the part of the code I have done to make the mesh :

import  SMESH, SALOMEDS
from salome.smesh import smeshBuilder

smesh = smeshBuilder.New()
Eye_Mesh = smesh.Mesh(EyePlan)
NETGEN_2D_1 = Eye_Mesh.Triangle(algo=smeshBuilder.NETGEN_1D2D)

smesh.SetName(Eye_Mesh.GetMesh(), 'Eye_Mesh')

# Set markers
Vitreous_humor_1 = Eye_Mesh.GroupOnGeom(VitreousHumor, 'VitreousHumor', SMESH.FACE)
Retina_1 = Eye_Mesh.GroupOnGeom(Retina, 'Retina', SMESH.FACE)
Choroid_1 = Eye_Mesh.GroupOnGeom(Group_Choroid, 'Choroid', SMESH.FACE)
Lens_1 = Eye_Mesh.GroupOnGeom(Lens, 'Lens', SMESH.FACE)
Iris_1 = Eye_Mesh.GroupOnGeom(Group_Iris, 'Iris', SMESH.FACE)
AqueousHumor_1 = Eye_Mesh.GroupOnGeom(AqueousHumor, 'AqueousHumor', SMESH.FACE)
Lamina_1 = Eye_Mesh.GroupOnGeom(Group_Lamina, 'Lamina', SMESH.FACE)
OpticNerve_1 = Eye_Mesh.GroupOnGeom(OpticNerve, 'OpticNerve', SMESH.FACE)
Cornea_1 = Eye_Mesh.GroupOnGeom(Cornea, 'Cornea', SMESH.FACE)
Sclera_1 = Eye_Mesh.GroupOnGeom(Group_Sclera, 'Sclera', SMESH.FACE)

NETGEN_2D_Parameters = NETGEN_2D_1.Parameters()
NETGEN_2D_Parameters.SetMaxSize( 1 )
# NETGEN_2D_Parameters.SetLocalSizeOnShape(AqueousHumor_1, 0.1)

The full script is accessible here.

I tried to use SetLocalSizeOnShape, but it results in an error : omniORB.CORBA._omni_sys_exc: CORBA.INV_OBJREF(omniORB.INV_OBJREF_InterfaceMisMatch, CORBA.COMPLETED_NO).

NB: I use here the NETGEN algorithm, if another algorithm permits to do it easily, I can gladly change !

Thanks !

hello,
you need to use submeshes.
the steps are:

  1. create a mesh of your compound 1d-2d-3d
  2. create a submeshes for each solid or group of solids you want different refinements.
    the submeshes what they do is ‘overwrite’ the elements that the mesh will generate and that way you can give a submesh of netgen with different parameters. keep in mind to use this only for 3D! if you do for 1D or 2D you will highly risk of creating non conformal mesh.
    exampleSubmesh.py (3,3 KB)