Fix: fillet
This commit is contained in:
parent
ede45cd925
commit
cc3e03ab27
21
run.py
21
run.py
@ -23,9 +23,9 @@ def createTasks():
|
|||||||
"faceCenteredCubic"
|
"faceCenteredCubic"
|
||||||
]
|
]
|
||||||
directions = [
|
directions = [
|
||||||
[1, 0, 0],
|
#[1, 0, 0],
|
||||||
[0, 0, 1],
|
#[0, 0, 1],
|
||||||
#[1, 1, 1]
|
[1, 1, 1]
|
||||||
]
|
]
|
||||||
|
|
||||||
Task = namedtuple("Task", ["structure", "coeff", "direction", "saveto"])
|
Task = namedtuple("Task", ["structure", "coeff", "direction", "saveto"])
|
||||||
@ -33,13 +33,13 @@ def createTasks():
|
|||||||
|
|
||||||
for structure in structures:
|
for structure in structures:
|
||||||
if structure == "simpleCubic":
|
if structure == "simpleCubic":
|
||||||
theta = [c * 0.01 for c in range(1, 29 + 1)]
|
theta = [0.01, 0.29] #[c * 0.01 for c in range(1, 29 + 1)]
|
||||||
|
|
||||||
elif structure == "faceCenteredCubic":
|
elif structure == "faceCenteredCubic":
|
||||||
theta = []
|
theta = [0.01, 0.13] #[c * 0.01 for c in range(1, 13 + 1)]
|
||||||
|
|
||||||
elif structure == "bodyCenteredCubic":
|
elif structure == "bodyCenteredCubic":
|
||||||
theta = []
|
theta = [0.01, 0.13, 0.14, 0.18] #[c * 0.01 for c in range(1, 18 + 1)]
|
||||||
|
|
||||||
for coeff in theta:
|
for coeff in theta:
|
||||||
for direction in directions:
|
for direction in directions:
|
||||||
@ -60,10 +60,15 @@ def createMesh(tasks):
|
|||||||
port = 2810
|
port = 2810
|
||||||
|
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
|
logging.info("-" * 80)
|
||||||
|
logging.info("""createMesh:
|
||||||
|
task:\t{} / {}""".format(tasks.index(task) + 1, len(tasks)))
|
||||||
|
|
||||||
returncode = salome_utils.runExecute(port, scriptpath, task.structure, task.coeff, "".join([str(coord) for coord in task.direction]), os.path.join(task.saveto, "mesh.unv"))
|
returncode = salome_utils.runExecute(port, scriptpath, task.structure, task.coeff, "".join([str(coord) for coord in task.direction]), os.path.join(task.saveto, "mesh.unv"))
|
||||||
|
|
||||||
logging.info("Return code: {}".format(returncode))
|
logging.info("Return code:\t{}".format(returncode))
|
||||||
|
logging.info("-" * 80)
|
||||||
|
|
||||||
if returncode == 1:
|
if returncode == 1:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ from collections import namedtuple
|
|||||||
import os, sys
|
import os, sys
|
||||||
import logging
|
import logging
|
||||||
from pyquaternion import Quaternion
|
from pyquaternion import Quaternion
|
||||||
|
import math
|
||||||
|
|
||||||
ROOT = "/home/nafaryus/projects/anisotrope-cube"
|
ROOT = "/home/nafaryus/projects/anisotrope-cube"
|
||||||
sys.path.append(ROOT)
|
sys.path.append(ROOT)
|
||||||
@ -97,8 +98,8 @@ if __name__ == "__main__":
|
|||||||
logging.FileHandler("{}/cubic.log".format(LOG))
|
logging.FileHandler("{}/cubic.log".format(LOG))
|
||||||
])
|
])
|
||||||
|
|
||||||
fancyline = "--------------------------------------------------------------------------------"
|
#fancyline = "--------------------------------------------------------------------------------"
|
||||||
logging.info(fancyline)
|
#logging.info(fancyline)
|
||||||
|
|
||||||
stype = str(sys.argv[1])
|
stype = str(sys.argv[1])
|
||||||
theta = float(sys.argv[2])
|
theta = float(sys.argv[2])
|
||||||
@ -112,7 +113,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
saveto = str(sys.argv[4])
|
saveto = str(sys.argv[4])
|
||||||
|
|
||||||
logging.info("""Args:
|
logging.info("""genMesh:
|
||||||
structure type:\t{}
|
structure type:\t{}
|
||||||
coefficient:\t{}
|
coefficient:\t{}
|
||||||
flow direction:\t{}
|
flow direction:\t{}
|
||||||
@ -122,4 +123,4 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
genMesh(stype, theta, flowdirection, saveto)
|
genMesh(stype, theta, flowdirection, saveto)
|
||||||
|
|
||||||
logging.info(fancyline)
|
#logging.info(fancyline)
|
||||||
|
@ -159,8 +159,25 @@ def bodyCenteredCubic(alpha):
|
|||||||
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
|
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
|
||||||
R_fillet = Cf * (r0 * math.sqrt(2) - R)
|
R_fillet = Cf * (r0 * math.sqrt(2) - R)
|
||||||
|
|
||||||
grains = geompy.MakeFilletAll(grains, R_fillet)
|
#grains = geompy.MakeFilletAll(grains, R_fillet)
|
||||||
geometry1 = geompy.MakeCutList(Pore_1a, [grains], True)
|
#geometry1 = geompy.MakeCutList(Pore_1a, [grains], True)
|
||||||
geometry2 = geompy.MakeCutList(Pore_3c, [grains], True)
|
#geometry2 = geompy.MakeCutList(Pore_3c, [grains], True)
|
||||||
|
|
||||||
|
# Scaling up
|
||||||
|
scale = 100
|
||||||
|
grains = geompy.MakeScaleTransform(grains, O, scale)
|
||||||
|
geometry1 = geompy.MakeScaleTransform(Pore_1a, O, scale)
|
||||||
|
geometry2 = geompy.MakeScaleTransform(Pore_3c, O, scale)
|
||||||
|
|
||||||
|
#
|
||||||
|
grains = geompy.MakeFilletAll(grains, R_fillet * scale)
|
||||||
|
geometry1 = geompy.MakeCutList(geometry1, [grains], True)
|
||||||
|
geometry2 = geompy.MakeCutList(geometry2, [grains], True)
|
||||||
|
|
||||||
|
# Scaling down
|
||||||
|
grains = geompy.MakeScaleTransform(grains, O, 1 / scale)
|
||||||
|
geometry1 = geompy.MakeScaleTransform(geometry1, O, 1 / scale)
|
||||||
|
geometry2 = geompy.MakeScaleTransform(geometry2, O, 1 / scale)
|
||||||
|
|
||||||
|
|
||||||
return grains, Pore_1a, Pore_3c
|
return grains, Pore_1a, Pore_3c
|
||||||
|
@ -154,8 +154,24 @@ def faceCenteredCubic(alpha):
|
|||||||
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
|
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
|
||||||
R_fillet = Cf * (r0 * math.sqrt(2) - R)
|
R_fillet = Cf * (r0 * math.sqrt(2) - R)
|
||||||
|
|
||||||
grains = geompy.MakeFilletAll(grains, R_fillet)
|
#grains = geompy.MakeFilletAll(grains, R_fillet)
|
||||||
geometry1 = geompy.MakeCutList(Common, [grains], True)
|
#geometry1 = geompy.MakeCutList(Common, [grains], True)
|
||||||
geometry2 = geompy.MakeCutList(Cut_8, [grains], True)
|
#geometry2 = geompy.MakeCutList(Cut_8, [grains], True)
|
||||||
|
|
||||||
|
# Scaling up
|
||||||
|
scale = 100
|
||||||
|
grains = geompy.MakeScaleTransform(grains, O, scale)
|
||||||
|
geometry1 = geompy.MakeScaleTransform(Common, O, scale)
|
||||||
|
geometry2 = geompy.MakeScaleTransform(Cut_8, O, scale)
|
||||||
|
|
||||||
|
#
|
||||||
|
grains = geompy.MakeFilletAll(grains, R_fillet * scale)
|
||||||
|
geometry1 = geompy.MakeCutList(geometry1, [grains], True)
|
||||||
|
geometry2 = geompy.MakeCutList(geometry2, [grains], True)
|
||||||
|
|
||||||
|
# Scaling down
|
||||||
|
grains = geompy.MakeScaleTransform(grains, O, 1 / scale)
|
||||||
|
geometry1 = geompy.MakeScaleTransform(geometry1, O, 1 / scale)
|
||||||
|
geometry2 = geompy.MakeScaleTransform(geometry2, O, 1 / scale)
|
||||||
|
|
||||||
return grains, geometry1, geometry2
|
return grains, geometry1, geometry2
|
||||||
|
@ -123,8 +123,20 @@ def simpleCubic(alpha):
|
|||||||
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
|
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
|
||||||
R_fillet = Cf * (r0 * math.sqrt(2) - R)
|
R_fillet = Cf * (r0 * math.sqrt(2) - R)
|
||||||
|
|
||||||
grains = geompy.MakeFilletAll(grains, R_fillet)
|
# Scaling up
|
||||||
geometry1 = geompy.MakeCutList(Cut_1, [grains], True)
|
scale = 100
|
||||||
geometry2 = geompy.MakeCutList(Cut_4, [grains], True)
|
grains = geompy.MakeScaleTransform(grains, O, scale)
|
||||||
|
geometry1 = geompy.MakeScaleTransform(Cut_1, O, scale)
|
||||||
|
geometry2 = geompy.MakeScaleTransform(Cut_4, O, scale)
|
||||||
|
|
||||||
|
#
|
||||||
|
grains = geompy.MakeFilletAll(grains, R_fillet * scale)
|
||||||
|
geometry1 = geompy.MakeCutList(geometry1, [grains], True)
|
||||||
|
geometry2 = geompy.MakeCutList(geometry2, [grains], True)
|
||||||
|
|
||||||
|
# Scaling down
|
||||||
|
grains = geompy.MakeScaleTransform(grains, O, 1 / scale)
|
||||||
|
geometry1 = geompy.MakeScaleTransform(geometry1, O, 1 / scale)
|
||||||
|
geometry2 = geompy.MakeScaleTransform(geometry2, O, 1 / scale)
|
||||||
|
|
||||||
return grains, geometry1, geometry2
|
return grains, geometry1, geometry2
|
||||||
|
@ -89,7 +89,7 @@ def createBoundary(gobj, bcount, dvec, norm, grains):
|
|||||||
nvec = geompy.GetNormal(plane)
|
nvec = geompy.GetNormal(plane)
|
||||||
|
|
||||||
fwang = round(geompy.GetAngle(nvec, flowvec), 0)
|
fwang = round(geompy.GetAngle(nvec, flowvec), 0)
|
||||||
#print("fwang = ", fwang)
|
print("fwang = ", fwang)
|
||||||
|
|
||||||
if fwang == 0:
|
if fwang == 0:
|
||||||
inletplanes.append(plane)
|
inletplanes.append(plane)
|
||||||
@ -99,7 +99,7 @@ def createBoundary(gobj, bcount, dvec, norm, grains):
|
|||||||
|
|
||||||
for n in range(len(symvec)):
|
for n in range(len(symvec)):
|
||||||
sang = round(geompy.GetAngle(nvec, symvec[n]), 0)
|
sang = round(geompy.GetAngle(nvec, symvec[n]), 0)
|
||||||
#print("sang = ", sang, "\n")
|
print("sang = ", sang)
|
||||||
|
|
||||||
if sang == 0:
|
if sang == 0:
|
||||||
if symetryplanes[n][0] == None:
|
if symetryplanes[n][0] == None:
|
||||||
@ -112,6 +112,7 @@ def createBoundary(gobj, bcount, dvec, norm, grains):
|
|||||||
symetryplanes[n][1] = []
|
symetryplanes[n][1] = []
|
||||||
|
|
||||||
symetryplanes[n][1].append(plane)
|
symetryplanes[n][1].append(plane)
|
||||||
|
print("\n")
|
||||||
|
|
||||||
logging.info("""createBoundary:
|
logging.info("""createBoundary:
|
||||||
planes:\t{}
|
planes:\t{}
|
||||||
|
Loading…
Reference in New Issue
Block a user