faceCenteredCubic geometry ready

This commit is contained in:
L-Nafaryus 2021-03-08 14:54:41 +05:00
parent 15aed6ff8c
commit 3c1d45ff10
No known key found for this signature in database
GPG Key ID: C76D8DCD2727DBB7
2 changed files with 40 additions and 35 deletions

View File

@ -5,7 +5,7 @@
- [x] boundary type (wall or symetryPlane) - [x] boundary type (wall or symetryPlane)
- [x] restruct for ways - [x] restruct for ways
- [x] build alpha = 0.01 .. 0.13 - [x] build alpha = 0.01 .. 0.13
- [ ] ! symetryPlane -> cyclicAMI - [x] ! symetryPlane -> cyclicAMI
## 3.03.21 ## 3.03.21
- [x] configure salome server, ports, etc. - [x] configure salome server, ports, etc.
@ -16,9 +16,9 @@
- [x] createPatch(Dict) - [x] createPatch(Dict)
- [ ] views (mesh, ..) - [ ] views (mesh, ..)
- [x] alpha for simpleCubic [0.01 .. 0.28] - [x] alpha for simpleCubic [0.01 .. 0.28]
- [ ] translation vector (cyclicAMI) - [x] translation vector (cyclicAMI)
- [ ] BUG: angle between the direction vector and the normal to inlet is ~1.4e-14 - [ ] BUG: angle between the direction vector and the normal to inlet is ~1.4e-14
- [x] Temporary solution - [x] Another solution
- [ ] BUG: ideasUnvToFoam not working with param '-case PATH' - [ ] BUG: ideasUnvToFoam not working with param '-case PATH'
- [x] Temporary sulution via os.chdir(PATH) - [x] Temporary sulution via os.chdir(PATH)
@ -26,4 +26,4 @@
- [ ] ERROR: MakeFuseList with alpha > 0.2 - [ ] ERROR: MakeFuseList with alpha > 0.2
## 7.03.21 ## 7.03.21
- [ ] Split the symetryPlane to 4 faces - [x] Split the symetryPlane to 4 faces

View File

@ -95,7 +95,7 @@ class faceCenteredCubic:
sphere = geompy.MakeFilletAll(sphere, R_fillet) sphere = geompy.MakeFilletAll(sphere, R_fillet)
self.spheres = sphere self.spheres = sphere
geompy.addToStudy(sphere, "spheres") geompy.addToStudy(self.spheres, "spheres")
#else: #else:
# sphere = sphere + sphere2 + sphere3 #geompy.MakeCompound(sphere + sphere2 + sphere3) # sphere = sphere + sphere2 + sphere3 #geompy.MakeCompound(sphere + sphere2 + sphere3)
@ -103,7 +103,7 @@ class faceCenteredCubic:
self.geometry = geompy.MakeCutList(box, [sphere], True) self.geometry = geompy.MakeCutList(box, [sphere], True)
self.geometrybbox = box self.geometrybbox = box
geompy.addToStudy(self.geometry, self.name) #geompy.addToStudy(self.geometry, self.name)
# Rombus # Rombus
sk = geompy.Sketcher3D() sk = geompy.Sketcher3D()
@ -112,17 +112,29 @@ class faceCenteredCubic:
sk.addPointsAbsolute(size[2] / 2, size[2] / 2, 0) sk.addPointsAbsolute(size[2] / 2, size[2] / 2, 0)
sk.addPointsAbsolute(0, size[2] / 2, size[2] / 2) sk.addPointsAbsolute(0, size[2] / 2, size[2] / 2)
sk.addPointsAbsolute(0, 0, size[2]) sk.addPointsAbsolute(0, 0, size[2])
face = geompy.MakeFaceWires([sk.wire()], 1) face = geompy.MakeFaceWires([sk.wire()], 1)
rombusbbox = geompy.MakePrismVecH(face, geompy.MakeVectorDXDYDZ(1, 1, 0), size[2] / 2) rombusbbox = geompy.MakePrismVecH(face, geompy.MakeVectorDXDYDZ(1, 1, 0), size[0])
rombusbbox = geompy.MakeRotation(rombusbbox, axes[2], 45 * math.pi / 180.0)
rombusbbox = geompy.MakeTranslation(rombusbbox, size[0], 0, 0)
geompy.addToStudy(face, "rombus") self.rombus = geompy.MakeCutList(rombusbbox, [sphere], True)
self.rombusbbox = rombusbbox
# Change position
self.geometry = geompy.MakeRotation(self.geometry, axes[2], -45 * math.pi / 180.0)
self.geometry = geompy.MakeTranslation(self.geometry, 0, 0.5, 0)
self.geometrybbox = geompy.MakeRotation(self.geometrybbox, axes[2], -45 * math.pi / 180.0)
self.geometrybbox = geompy.MakeTranslation(self.geometrybbox, 0, 0.5, 0)
self.rombus = geompy.MakeRotation(self.rombus, axes[2], -45 * math.pi / 180.0)
self.rombus = geompy.MakeTranslation(self.rombus, 0, 0.5, 0)
self.rombusbbox = geompy.MakeRotation(self.rombusbbox, axes[2], -45 * math.pi / 180.0)
self.rombusbbox = geompy.MakeTranslation(self.rombusbbox, 0, 0.5, 0)
geompy.addToStudy(self.geometry, self.name)
geompy.addToStudy(self.rombus, "rombus")
geompy.addToStudy(rombusbbox, "rombusbbox") geompy.addToStudy(rombusbbox, "rombusbbox")
#self.rombus = geompy.MakeCutList(rombusbbox, [sphere], True)
#self.rombusbbox = rombusbbox
#geompy.addToStudy(self.rombus, "rombus")
return self.geometry return self.geometry
@ -152,7 +164,8 @@ class faceCenteredCubic:
buffergeometry = self.geometry buffergeometry = self.geometry
if direction == "001": if direction == "001":
center = geompy.MakeVertex(2, 2, 1) [x, y, z, _, _, _, _, _, _] = geompy.GetPosition(self.geometry)
center = geompy.MakeVertex(x, y, z)
norm = geompy.MakeVector(center, norm = geompy.MakeVector(center,
geompy.MakeVertexWithRef(center, 0, 0, 1)) geompy.MakeVertexWithRef(center, 0, 0, 1))
@ -167,11 +180,9 @@ class faceCenteredCubic:
-math.cos((0 + rot[2]) * math.pi / 180.0), -math.cos((0 + rot[2]) * math.pi / 180.0),
math.sin((0 + rot[2]) * math.pi / 180.0), 0)) math.sin((0 + rot[2]) * math.pi / 180.0), 0))
vstep = 1
hstep = math.sqrt(2)
elif direction == "100": elif direction == "100":
center = geompy.MakeVertex(2, 2, 1) [x, y, z, _, _, _, _, _, _] = geompy.GetPosition(self.geometry)
center = geompy.MakeVertex(x, y, z)
norm = geompy.MakeVector(center, norm = geompy.MakeVector(center,
geompy.MakeVertexWithRef(center, geompy.MakeVertexWithRef(center,
@ -186,12 +197,10 @@ class faceCenteredCubic:
-math.cos((0 + rot[2]) * math.pi / 180.0), -math.cos((0 + rot[2]) * math.pi / 180.0),
math.sin((0 + rot[2]) * math.pi / 180.0), 0)) math.sin((0 + rot[2]) * math.pi / 180.0), 0))
vstep = math.sqrt(2)
hstep = 1
elif direction == "111": elif direction == "111":
center = geompy.MakeVertex(2, 2, 2)
self.geometry = self.rombus self.geometry = self.rombus
[x, y, z, _, _, _, _, _, _] = geompy.GetPosition(self.geometry)
center = geompy.MakeVertex(x, y, z)
norm = geompy.MakeVector(center, norm = geompy.MakeVector(center,
geompy.MakeVertexWithRef(center, 1, 1, 1)) geompy.MakeVertexWithRef(center, 1, 1, 1))
@ -207,9 +216,6 @@ class faceCenteredCubic:
geompy.MakeVertexWithRef(center, -1, 1, 1)) geompy.MakeVertexWithRef(center, -1, 1, 1))
#-math.cos((0 + rot[2]) * math.pi / 180.0), #-math.cos((0 + rot[2]) * math.pi / 180.0),
#math.sin((0 + rot[2]) * math.pi / 180.0), 0)) #math.sin((0 + rot[2]) * math.pi / 180.0), 0))
vstep = math.sqrt(2)
hstep = 1
logging.info("boundaryCreate: direction = {}".format(direction)) logging.info("boundaryCreate: direction = {}".format(direction))
@ -313,16 +319,15 @@ class faceCenteredCubic:
# Main groups # Main groups
inlet = createGroup(inletplane, "inlet") inlet = createGroup(inletplane, "inlet")
outlet = createGroup(outletplane, "outlet") outlet = createGroup(outletplane, "outlet")
#symetryPlane = createGroup(hplanes, "symetryPlane") # Symetry planes
symetryPlaneFW = createGroup(fwplanes, "symetryPlaneFW") symetryPlaneFW = createGroup(fwplanes, "symetryPlaneFW")
symetryPlaneBW = createGroup(bwplanes, "symetryPlaneBW") symetryPlaneBW = createGroup(bwplanes, "symetryPlaneBW")
symetryPlaneL = createGroup(lplanes, "symetryPlaneL") symetryPlaneL = createGroup(lplanes, "symetryPlaneL")
symetryPlaneR = createGroup(rplanes, "symetryPlaneR") symetryPlaneR = createGroup(rplanes, "symetryPlaneR")
# wall # Wall
allgroup = geompy.CreateGroup(self.geometry, geompy.ShapeType["FACE"]) allgroup = geompy.CreateGroup(self.geometry, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllIDs(self.geometry, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllIDs(self.geometry, geompy.ShapeType["FACE"])
geompy.UnionIDs(allgroup, faces) geompy.UnionIDs(allgroup, faces)
@ -466,19 +471,19 @@ if __name__ == "__main__":
logging.info("Creating the geometry ...") logging.info("Creating the geometry ...")
fcc.geometryCreate(alpha) fcc.geometryCreate(alpha)
#logging.info("Extracting boundaries ...") logging.info("Extracting boundaries ...")
#fcc.boundaryCreate(direction) fcc.boundaryCreate(direction)
#logging.info("Creating the mesh ...") logging.info("Creating the mesh ...")
#fcc.meshCreate(2) #, { fcc.meshCreate(2) #, {
# "thickness": 0.001, # "thickness": 0.001,
# "number": 1, # "number": 1,
# "stretch": 1.1 # "stretch": 1.1
#}) #})
#fcc.meshCompute() #fcc.meshCompute()
#logging.info("Exporting the mesh ...") logging.info("Exporting the mesh ...")
#fcc.meshExport(buildpath) fcc.meshExport(buildpath)
end_time = time.monotonic() end_time = time.monotonic()
logging.info("Elapsed time: {}".format(timedelta(seconds=end_time - start_time))) logging.info("Elapsed time: {}".format(timedelta(seconds=end_time - start_time)))