Face centered cubic ready
This commit is contained in:
parent
3c1d45ff10
commit
2e4ce07d41
@ -24,7 +24,7 @@ class faceCenteredCubic:
|
|||||||
|
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
|
|
||||||
def geometryCreate(self, alpha):
|
def geometryCreate(self, alpha, fillet):
|
||||||
"""
|
"""
|
||||||
Create the simple cubic geometry.
|
Create the simple cubic geometry.
|
||||||
|
|
||||||
@ -34,6 +34,12 @@ class faceCenteredCubic:
|
|||||||
Radius = R0 / (1 - alpha)
|
Radius = R0 / (1 - alpha)
|
||||||
Should be from 0.01 to 0.28
|
Should be from 0.01 to 0.28
|
||||||
|
|
||||||
|
fillet (list): Fillet coefficient.
|
||||||
|
|
||||||
|
[fillet1, fillet2]
|
||||||
|
0 <= fillet <= 1
|
||||||
|
if fillet = [0, 0] then R_fillet = 0
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Configured geometry.
|
Configured geometry.
|
||||||
"""
|
"""
|
||||||
@ -44,13 +50,13 @@ class faceCenteredCubic:
|
|||||||
R0 = math.sqrt(2) / 4
|
R0 = math.sqrt(2) / 4
|
||||||
R = R0 / (1 - alpha)
|
R = R0 / (1 - alpha)
|
||||||
|
|
||||||
C1 = 0.8
|
C1 = fillet[0]
|
||||||
C2 = 0.4
|
C2 = fillet[1]
|
||||||
alpha1 = 0.01
|
alpha1 = 0.01
|
||||||
alpha2 = 0.28
|
alpha2 = 0.28
|
||||||
|
|
||||||
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
|
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
|
||||||
R_fillet = 0 #Cf * (R0 * math.sqrt(2) - R)
|
R_fillet = Cf * (R0 * math.sqrt(2) - R)
|
||||||
|
|
||||||
logging.info("geometryCreate: alpha = {}".format(alpha))
|
logging.info("geometryCreate: alpha = {}".format(alpha))
|
||||||
logging.info("geometryCreate: R = {}".format(R))
|
logging.info("geometryCreate: R = {}".format(R))
|
||||||
@ -95,17 +101,13 @@ class faceCenteredCubic:
|
|||||||
sphere = geompy.MakeFilletAll(sphere, R_fillet)
|
sphere = geompy.MakeFilletAll(sphere, R_fillet)
|
||||||
|
|
||||||
self.spheres = sphere
|
self.spheres = sphere
|
||||||
geompy.addToStudy(self.spheres, "spheres")
|
|
||||||
#else:
|
|
||||||
# sphere = sphere + sphere2 + sphere3 #geompy.MakeCompound(sphere + sphere2 + sphere3)
|
|
||||||
|
|
||||||
|
# Main geometry and bounding box
|
||||||
# geompy.RemoveExtraEdges(obj, True)
|
# geompy.RemoveExtraEdges(obj, True)
|
||||||
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)
|
# Rombus and bounding box
|
||||||
|
|
||||||
# Rombus
|
|
||||||
sk = geompy.Sketcher3D()
|
sk = geompy.Sketcher3D()
|
||||||
sk.addPointsAbsolute(0, 0, size[2])
|
sk.addPointsAbsolute(0, 0, size[2])
|
||||||
sk.addPointsAbsolute(size[2] / 2, 0, size[2] / 2)
|
sk.addPointsAbsolute(size[2] / 2, 0, size[2] / 2)
|
||||||
@ -122,6 +124,9 @@ class faceCenteredCubic:
|
|||||||
self.rombusbbox = rombusbbox
|
self.rombusbbox = rombusbbox
|
||||||
|
|
||||||
# Change position
|
# Change position
|
||||||
|
self.spheres = geompy.MakeRotation(self.spheres, axes[2], -45 * math.pi / 180.0)
|
||||||
|
self.spheres = geompy.MakeTranslation(self.spheres, 0, 0.5, 0)
|
||||||
|
|
||||||
self.geometry = geompy.MakeRotation(self.geometry, axes[2], -45 * math.pi / 180.0)
|
self.geometry = geompy.MakeRotation(self.geometry, axes[2], -45 * math.pi / 180.0)
|
||||||
self.geometry = geompy.MakeTranslation(self.geometry, 0, 0.5, 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.MakeRotation(self.geometrybbox, axes[2], -45 * math.pi / 180.0)
|
||||||
@ -132,6 +137,8 @@ class faceCenteredCubic:
|
|||||||
self.rombusbbox = geompy.MakeRotation(self.rombusbbox, axes[2], -45 * math.pi / 180.0)
|
self.rombusbbox = geompy.MakeRotation(self.rombusbbox, axes[2], -45 * math.pi / 180.0)
|
||||||
self.rombusbbox = geompy.MakeTranslation(self.rombusbbox, 0, 0.5, 0)
|
self.rombusbbox = geompy.MakeTranslation(self.rombusbbox, 0, 0.5, 0)
|
||||||
|
|
||||||
|
|
||||||
|
geompy.addToStudy(self.spheres, "spheres")
|
||||||
geompy.addToStudy(self.geometry, self.name)
|
geompy.addToStudy(self.geometry, self.name)
|
||||||
geompy.addToStudy(self.rombus, "rombus")
|
geompy.addToStudy(self.rombus, "rombus")
|
||||||
geompy.addToStudy(rombusbbox, "rombusbbox")
|
geompy.addToStudy(rombusbbox, "rombusbbox")
|
||||||
@ -145,8 +152,9 @@ class faceCenteredCubic:
|
|||||||
Parameters:
|
Parameters:
|
||||||
direction (str): Direction of the flow.
|
direction (str): Direction of the flow.
|
||||||
|
|
||||||
'001' for the flow with normal vector (0, 0, -1) to face.
|
'001' for the flow with normal vector (0, 0, 1) to face.
|
||||||
'100' for the flow with normal vector (-1, 0, 0) to face.
|
'100' for the flow with normal vector (1, 0, 0) to face.
|
||||||
|
'111' for (1, 1, 1)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
boundary (dict):
|
boundary (dict):
|
||||||
@ -394,7 +402,7 @@ class faceCenteredCubic:
|
|||||||
param.SetUseSurfaceCurvature( 1 )
|
param.SetUseSurfaceCurvature( 1 )
|
||||||
param.SetFuseEdges( 1 )
|
param.SetFuseEdges( 1 )
|
||||||
param.SetCheckChartBoundary( 0 )
|
param.SetCheckChartBoundary( 0 )
|
||||||
param.SetMinSize( 0.01 )
|
param.SetMinSize( 0.001 )
|
||||||
param.SetMaxSize( 0.1 )
|
param.SetMaxSize( 0.1 )
|
||||||
param.SetFineness(fineness)
|
param.SetFineness(fineness)
|
||||||
#param.SetGrowthRate( 0.1 )
|
#param.SetGrowthRate( 0.1 )
|
||||||
@ -406,11 +414,12 @@ class faceCenteredCubic:
|
|||||||
logging.info("meshCreate: viscous layers params - thickness = {}, number = {}, stretch factor = {}".format(
|
logging.info("meshCreate: viscous layers params - thickness = {}, number = {}, stretch factor = {}".format(
|
||||||
viscousLayers["thickness"], viscousLayers["number"], viscousLayers["stretch"]))
|
viscousLayers["thickness"], viscousLayers["number"], viscousLayers["stretch"]))
|
||||||
|
|
||||||
vlayer = netgen.ViscousLayers(viscousLayers["thickness"],
|
vlayer = netgen.ViscousLayers(
|
||||||
viscousLayers["number"],
|
viscousLayers["thickness"],
|
||||||
viscousLayers["stretch"],
|
viscousLayers["number"],
|
||||||
[self.boundary["inlet"], self.boundary["outlet"]],
|
viscousLayers["stretch"],
|
||||||
1, smeshBuilder.NODE_OFFSET)
|
[self.boundary["inlet"], self.boundary["outlet"]],
|
||||||
|
1, smeshBuilder.NODE_OFFSET)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.info("meshCreate: viscous layers are disabled")
|
logging.info("meshCreate: viscous layers are disabled")
|
||||||
@ -469,18 +478,18 @@ if __name__ == "__main__":
|
|||||||
fcc = faceCenteredCubic(name)
|
fcc = faceCenteredCubic(name)
|
||||||
|
|
||||||
logging.info("Creating the geometry ...")
|
logging.info("Creating the geometry ...")
|
||||||
fcc.geometryCreate(alpha)
|
fcc.geometryCreate(alpha, [0, 0])
|
||||||
|
|
||||||
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.01,
|
||||||
# "number": 1,
|
"number": 2,
|
||||||
# "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)
|
||||||
|
@ -59,7 +59,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Start in parallel
|
# Start in parallel
|
||||||
processes = []
|
processes = []
|
||||||
structures = ["simpleCubic"] #, "bc-cubic", "fc-cubic"]
|
structures = ["simpleCubic", "faceCenteredCubic"] #, "bodyCenteredCubic"]
|
||||||
directions = ["001"] #, "100", "111"]
|
directions = ["001"] #, "100", "111"]
|
||||||
coefficients = [0.1] #[ alpha * 0.01 for alpha in range(1, 13 + 1) ]
|
coefficients = [0.1] #[ alpha * 0.01 for alpha in range(1, 13 + 1) ]
|
||||||
port = 2810
|
port = 2810
|
||||||
|
@ -24,7 +24,7 @@ class simpleCubic:
|
|||||||
|
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
|
|
||||||
def geometryCreate(self, alpha):
|
def geometryCreate(self, alpha, fillet):
|
||||||
"""
|
"""
|
||||||
Create the simple cubic geometry.
|
Create the simple cubic geometry.
|
||||||
|
|
||||||
@ -34,6 +34,12 @@ class simpleCubic:
|
|||||||
Radius = R0 / (1 - alpha)
|
Radius = R0 / (1 - alpha)
|
||||||
Should be from 0.01 to 0.28
|
Should be from 0.01 to 0.28
|
||||||
|
|
||||||
|
fillet (list): Fillet coefficient.
|
||||||
|
|
||||||
|
[fillet1, fillet2]
|
||||||
|
0 <= fillet <= 1
|
||||||
|
if fillet = [0, 0] then R_fillet = 0
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Configured geometry.
|
Configured geometry.
|
||||||
"""
|
"""
|
||||||
@ -44,8 +50,8 @@ class simpleCubic:
|
|||||||
R0 = 1
|
R0 = 1
|
||||||
R = R0 / (1 - alpha)
|
R = R0 / (1 - alpha)
|
||||||
|
|
||||||
C1 = 0.8
|
C1 = fillet[0]
|
||||||
C2 = 0.4
|
C2 = fillet[1]
|
||||||
alpha1 = 0.01
|
alpha1 = 0.01
|
||||||
alpha2 = 0.28
|
alpha2 = 0.28
|
||||||
|
|
||||||
@ -147,8 +153,9 @@ class simpleCubic:
|
|||||||
Parameters:
|
Parameters:
|
||||||
direction (str): Direction of the flow.
|
direction (str): Direction of the flow.
|
||||||
|
|
||||||
'001' for the flow with normal vector (0, 0, -1) to face.
|
'001' for the flow with normal vector (0, 0, 1) to face.
|
||||||
'100' for the flow with normal vector (-1, 0, 0) to face.
|
'100' for the flow with normal vector (1, 0, 0) to face.
|
||||||
|
'111' for (1, 1, 1)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
boundary (dict):
|
boundary (dict):
|
||||||
@ -478,7 +485,7 @@ if __name__ == "__main__":
|
|||||||
sc = simpleCubic(name)
|
sc = simpleCubic(name)
|
||||||
|
|
||||||
logging.info("Creating the geometry ...")
|
logging.info("Creating the geometry ...")
|
||||||
sc.geometryCreate(alpha)
|
sc.geometryCreate(alpha, [0, 0])
|
||||||
|
|
||||||
logging.info("Extracting boundaries ...")
|
logging.info("Extracting boundaries ...")
|
||||||
sc.boundaryCreate(direction)
|
sc.boundaryCreate(direction)
|
||||||
|
Loading…
Reference in New Issue
Block a user