Fix: fillet

This commit is contained in:
L-Nafaryus 2021-04-01 15:48:20 +05:00
parent ede45cd925
commit cc3e03ab27
6 changed files with 75 additions and 23 deletions

19
run.py
View File

@ -23,9 +23,9 @@ def createTasks():
"faceCenteredCubic"
]
directions = [
[1, 0, 0],
[0, 0, 1],
#[1, 1, 1]
#[1, 0, 0],
#[0, 0, 1],
[1, 1, 1]
]
Task = namedtuple("Task", ["structure", "coeff", "direction", "saveto"])
@ -33,13 +33,13 @@ def createTasks():
for structure in structures:
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":
theta = []
theta = [0.01, 0.13] #[c * 0.01 for c in range(1, 13 + 1)]
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 direction in directions:
@ -60,9 +60,14 @@ def createMesh(tasks):
port = 2810
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"))
logging.info("Return code: {}".format(returncode))
logging.info("Return code:\t{}".format(returncode))
logging.info("-" * 80)
if returncode == 1:
break

View File

@ -2,6 +2,7 @@ from collections import namedtuple
import os, sys
import logging
from pyquaternion import Quaternion
import math
ROOT = "/home/nafaryus/projects/anisotrope-cube"
sys.path.append(ROOT)
@ -97,8 +98,8 @@ if __name__ == "__main__":
logging.FileHandler("{}/cubic.log".format(LOG))
])
fancyline = "--------------------------------------------------------------------------------"
logging.info(fancyline)
#fancyline = "--------------------------------------------------------------------------------"
#logging.info(fancyline)
stype = str(sys.argv[1])
theta = float(sys.argv[2])
@ -112,7 +113,7 @@ if __name__ == "__main__":
saveto = str(sys.argv[4])
logging.info("""Args:
logging.info("""genMesh:
structure type:\t{}
coefficient:\t{}
flow direction:\t{}
@ -122,4 +123,4 @@ if __name__ == "__main__":
genMesh(stype, theta, flowdirection, saveto)
logging.info(fancyline)
#logging.info(fancyline)

View File

@ -159,8 +159,25 @@ def bodyCenteredCubic(alpha):
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
R_fillet = Cf * (r0 * math.sqrt(2) - R)
grains = geompy.MakeFilletAll(grains, R_fillet)
geometry1 = geompy.MakeCutList(Pore_1a, [grains], True)
geometry2 = geompy.MakeCutList(Pore_3c, [grains], True)
#grains = geompy.MakeFilletAll(grains, R_fillet)
#geometry1 = geompy.MakeCutList(Pore_1a, [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

View File

@ -154,8 +154,24 @@ def faceCenteredCubic(alpha):
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
R_fillet = Cf * (r0 * math.sqrt(2) - R)
grains = geompy.MakeFilletAll(grains, R_fillet)
geometry1 = geompy.MakeCutList(Common, [grains], True)
geometry2 = geompy.MakeCutList(Cut_8, [grains], True)
#grains = geompy.MakeFilletAll(grains, R_fillet)
#geometry1 = geompy.MakeCutList(Common, [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

View File

@ -123,8 +123,20 @@ def simpleCubic(alpha):
Cf = C1 + (C2 - C1) / (alpha2 - alpha1) * (alpha - alpha1)
R_fillet = Cf * (r0 * math.sqrt(2) - R)
grains = geompy.MakeFilletAll(grains, R_fillet)
geometry1 = geompy.MakeCutList(Cut_1, [grains], True)
geometry2 = geompy.MakeCutList(Cut_4, [grains], True)
# Scaling up
scale = 100
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

View File

@ -89,7 +89,7 @@ def createBoundary(gobj, bcount, dvec, norm, grains):
nvec = geompy.GetNormal(plane)
fwang = round(geompy.GetAngle(nvec, flowvec), 0)
#print("fwang = ", fwang)
print("fwang = ", fwang)
if fwang == 0:
inletplanes.append(plane)
@ -99,7 +99,7 @@ def createBoundary(gobj, bcount, dvec, norm, grains):
for n in range(len(symvec)):
sang = round(geompy.GetAngle(nvec, symvec[n]), 0)
#print("sang = ", sang, "\n")
print("sang = ", sang)
if sang == 0:
if symetryplanes[n][0] == None:
@ -112,6 +112,7 @@ def createBoundary(gobj, bcount, dvec, norm, grains):
symetryplanes[n][1] = []
symetryplanes[n][1].append(plane)
print("\n")
logging.info("""createBoundary:
planes:\t{}