Boundary conditions
-
Hi everyone, I am trying to use Salome to generate grids for CFD analysis. I came to the point where I can write a script which defines a simple geometry. However, I do not have a clue how to define boundary conditions. I know there are some groups (for geometry and mesh), but however I try to define them, I get some error message. Below is a simple script to define a hexahedra (from 6 faces f[0] to f[5]) which are defined from 12 edges (e[0] to e[11]) which are defined by 8 vertices (v[0] to v[7]). Can anyone tell me how to define a gruop for boundary condtion for face 0 (f[0]) for example? Sincerely, Bojan Niceno #---------------------------------------- # # 7----6----6 # /| /| # 7 | 5 | # / | / | # 4----4----5 | # | | | | # | 11 | 10 # | | | | # | | | | # | | | | # 8 | 9 | # | | | | # | 3----2|---2 # | / | / # | 3 | 1 # |/ |/ # 0----0----1 # #---------------------------------------- import geompy import smesh #-------------------- # Define coordinates #-------------------- # helping variables to define geometry x0 = -1.0 x1 = 1.0 y0 = -1.0 y1 = 1.0 z0 = 0.0 z1 = 4.0 x = [ x0, x1, x1, x0, x0, x1, x1, x0] y = [ y0, y0, y1, y1, y0, y0, y1, y1] z = [ z0, z0, z0, z0, z1, z1, z1, z1] # helping string numbs = [] numbs.append('_00') numbs.append('_01') numbs.append('_02') numbs.append('_03') numbs.append('_04') numbs.append('_05') numbs.append('_06') numbs.append('_07') numbs.append('_08') numbs.append('_09') numbs.append('_10') numbs.append('_11') numbs.append('_12') numbs.append('_13') #----------------- # Define vertices #----------------- v = [] # for storing vertices for i in range(8): v.append(geompy.MakeVertex(x[i],y[i],z[i])) geompy.addToStudy(geompy.MakeVertex(x[i],y[i],z[i]), 'Vertex' + numbs[i]) #-------------- # Define edges #-------------- e = [] # for storing edges # edges on the bottom e.append(geompy.MakeEdge(v[0], v[1])) e.append(geompy.MakeEdge(v[1], v[2])) e.append(geompy.MakeEdge(v[2], v[3])) e.append(geompy.MakeEdge(v[3], v[0])) # edges on the top e.append(geompy.MakeEdge(v[4], v[5])) e.append(geompy.MakeEdge(v[5], v[6])) e.append(geompy.MakeEdge(v[6], v[7])) e.append(geompy.MakeEdge(v[7], v[4])) # edges in-between e.append(geompy.MakeEdge(v[0], v[4])) e.append(geompy.MakeEdge(v[1], v[5])) e.append(geompy.MakeEdge(v[2], v[6])) e.append(geompy.MakeEdge(v[3], v[7])) for i in range(len(e)): geompy.addToStudy(e[i], 'Edge' + numbs[i]) #------------- # Define face #------------- f = [] # for storing faces # faces on bottom (min z) and top (max z) f.append(geompy.MakeQuad(e[0], e[1], e[2], e[3] )) f.append(geompy.MakeQuad(e[4], e[5], e[6], e[7] )) # faces left (min y) and right (max y) f.append(geompy.MakeQuad(e[3], e[7], e[8], e[11])) f.append(geompy.MakeQuad(e[2], e[6], e[10], e[11])) # faces front (min x) and back (max x) f.append(geompy.MakeQuad(e[0], e[4], e[8], e[9] )) f.append(geompy.MakeQuad(e[1], e[5], e[9], e[10])) for i in range(len(f)): geompy.addToStudy(f[i], 'Face' + numbs[i]) #---------------- # Define a solid #---------------- s = geompy.MakeHexa(f[0], f[1], f[2], f[3], f[4], f[5]) geompy.addToStudy(s, 'Solid') #=============== # # DEFINE A MESH # #=============== hexa = smesh.Mesh(s, "Mesh") algo_s = hexa.Segment() algo_s.NumberOfSegments(2) # add algorithms hexa.Quadrangle() hexa.Hexahedron() #------------------------- # Create local hypothesis #------------------------- # in x direction algo_x = hexa.Segment(e[0]) algo_x.NumberOfSegments(10) algo_x.Propagation() # in y direction algo_y = hexa.Segment(e[1]) algo_y.NumberOfSegments(10) algo_y.Propagation() # in z direction algo_z = hexa.Segment(e[8]) algo_z.NumberOfSegments(20) algo_z.Propagation() hexa.Compute()
-
Hi,
I don't know how it works with the scripts, but if you do it interactively with the GUI it is rather easy. Check the documentation on this site and the piston tutorial under caelinux.com
Under the GUI I usually explode the geometry and select the "sub-geometry" I need. For example edges, faces and vertex.
Massimo
-
Powered by
Ploneboard