This email from TIM48@pitt.edu originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders list to disable email stamping for this address.

 

Hi,

I would recommend using the script method in Gmsh to add in the physical groups for 1d elements. A lot of time they are in incremental numbers, so it is easy to iterate through them. Below I'll provide the python code I wrote for my own use. I will emphasize here that you should double check the curves are set up in incremental numbers before applying the codes below.

##### Below this section is setting parameters for NekMesh #####
## Note that this could be done in Gmsh, but it's faster to automate it
## Note that Curve loop will need to be defined after all physical groups like
#  inlet, outlet, top, and bottom boundary. If this is not done in order,
#  mesh verticies will exhibit a no-slip boundary condition onto the interior
#  flow. The order is paramount!
loopRange = range(1,result.shape[0])
botRange = range(0,rows.shape[0]-1)
outRange = range(rows.shape[0]-1, (rows.shape[0]+inlet.shape[0]))
topRange = range((rows.shape[0]+inlet.shape[0]), (rows.shape[0]+inlet.shape[0]+top.shape[0])-1)
inRange = range((rows.shape[0]+inlet.shape[0]+top.shape[0])-1, result.shape[0])
idx = loopRange[-1]+2 # define physical groups for rest of the assignment

## Bottom Boundary
print("//+")
print('Physical Curve("Bottom", %d) = {' % (int(idx)), end= '')
for i in botRange:
    if i == botRange[-1]:
      print("%d" % (int(i)+1), end = '};\n')
      print("//+")
    else:
      print("%d," % (int(i)+1), end = '')

## Outlet
print('Physical Curve("Outlet", %d) = {' % (int(idx+1)), end= '')
for i in outRange:
    if i == outRange[-1]:
      print("%d" % (int(i)+1), end = '};\n')
      print("//+")
    else:
      print("%d," % (int(i)+1), end = '')

## Top Boundary
print('Physical Curve("Top", %d) = {' % (int(idx+2)), end= '')
for i in topRange:
    if i == topRange[-1]:
      print("%d" % (int(i)+1), end = '};\n')
      print("//+")
    else:
      print("%d," % (int(i)+1), end = '')
     
## Inlet
print('Physical Curve("Inlet", %d) = {' % (int(idx+3)), end= '')
for i in inRange:
    if i == inRange[-1]:
      print("%d" % (int(i)+1), end = '};\n')
      print("//+")
    else:
      print("%d," % (int(i)+1), end = '')
     
# Physical Groups
print("Curve Loop(1) = {", end="")
for i in loopRange:
    print("%d," % (int(i)), end="")
    if i == loopRange[-1]:
      print("%d" % (int(i)+1), end="};\n")
      print("//+")

print("Plane Surface(1) = {1};")
print("//+")
print('Physical Surface("Fluid", %d) = {1};' % (int(idx+4)) )