This commit is contained in:
L-Nafaryus 2021-05-17 12:03:00 +05:00
commit 962837ae67
8 changed files with 5812 additions and 37 deletions

View File

@ -14,17 +14,8 @@ $ git clone git@github.com:L-Nafaryus/anisotrope-cube.git
$ cd anisotrope-cube
```
* Generate all structures with configured parameters:
* Run all:
```bash
$ python run.py mesh
$ python run.py
```
* Run calculations:
```bash
$ python run.py calc
```
* All:
```bash
$ python run.py all
```

View File

@ -58,10 +58,11 @@ class ViscousLayers(Parameters):
# Project variables
##
structures = [
"simple",
"bodyCentered",
#"simple",
#"bodyCentered",
"faceCentered"
]
class simple:
theta = [c * 0.01 for c in range(1, 28 + 1)]
directions = [
@ -72,8 +73,8 @@ class simple:
fillet = False
fineness = 1
parameters = Parameters(
minSize = 0.005,
maxSize = 0.1,
minSize = 0.01,
maxSize = 0.5,
growthRate = 0.5,
nbSegPerEdge = 0.5,
nbSegPerRadius = 0.5,
@ -107,7 +108,7 @@ class bodyCentered:
fineness = 1
parameters = Parameters(
minSize = 0.005,
maxSize = 0.05,
maxSize = 0.1,
growthRate = 0.5,
nbSegPerEdge = 0.5,
nbSegPerRadius = 0.5,
@ -121,7 +122,7 @@ class bodyCentered:
checkChartBoundary = False
)
viscousLayers = ViscousLayers(
thickness = 0.01,
thickness = 0.005,
numberOfLayers = 2,
stretchFactor = 1.2,
isFacesToIgnore = True,

70
extra/fillet-radius.py Normal file
View File

@ -0,0 +1,70 @@
import matplotlib.pyplot as plt
from math import sqrt
import sys
if __name__ == "__main__":
try:
stype = sys.argv[1]
except IndexError:
print("python fillet-radius.py [simple|bodyCentered|faceCentered]")
exit(1)
if stype == "simple":
r0 = 1.0
C1, C2 = 0.8, 0.5
theta1, theta2 = 0.01, 0.28
delta = 0.2
elif stype == "bodyCentered":
L = 1.0
r0 = L * sqrt(3) / 4
C1, C2 = 0.3, 0.2
theta1, theta2 = 0.01, 0.18
delta = 0.02
elif stype == "faceCentered":
L = 1.0
r0 = L * sqrt(2) / 4
C1, C2 = 0.3, 0.2
theta1, theta2 = 0.01, 0.13
delta = 0.012
else:
print("python fillet-radius.py [simple|bodyCentered|faceCentered]")
exit(1)
Cf = lambda theta: C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1)
fillet = lambda theta: delta - Cf(theta) * (r0 / (1 - theta) - r0)
tocount = lambda num: int(num * 100)
theta = [ 0.01 * n for n in range(tocount(theta1), tocount(theta2) + 1) ]
coeffs = [ Cf(n) for n in theta ]
radiuses = [ fillet(n) for n in theta ]
plt.figure(1)
plt.subplot(211)
plt.plot(theta, coeffs, "o")
plt.grid(True)
plt.ylabel("Cf")
plt.subplot(212)
plt.plot(theta, radiuses, "o")
plt.grid(True)
plt.ylabel("Radius")
plt.xlabel("Theta")
plt.show()

View File

@ -28,10 +28,11 @@ def bodyCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]):
yw = xl
zh = height
C1, C2 = 0.8, 0.05
C1, C2 = 0.3, 0.2
theta1, theta2 = 0.01, 0.18
Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1)
filletradius = Cf * (radius - r0)
delta = 0.02
filletradius = delta - Cf * (radius - r0)
scale = 100
oo = geompy.MakeVertex(0, 0, 0)
@ -178,10 +179,11 @@ def bodyCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1,
point.append((0 + xl, L + yw, L + zh))
point.append((L / 3 + xl, L / 3 + yw, 4 * L / 3 + zh))
C1, C2 = 0.8, 0.05
C1, C2 = 0.3, 0.2
theta1, theta2 = 0.01, 0.18
Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1)
filletradius = Cf * (radius - r0)
delta = 0.02
filletradius = delta - Cf * (radius - r0)
scale = 100
oo = geompy.MakeVertex(0, 0, 0)

View File

@ -28,10 +28,11 @@ def faceCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]):
yw = xl
zh = width
C1, C2 = 0.8, 0.05
C1, C2 = 0.3, 0.2
theta1, theta2 = 0.01, 0.13
Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1)
filletradius = Cf * (radius - r0)
delta = 0.012
filletradius = delta - Cf * (radius - r0)
scale = 100
oo = geompy.MakeVertex(0, 0, 0)
@ -176,10 +177,11 @@ def faceCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1,
point.append((-width + xl, 0 + yw, 0 + zh))
point.append((-2 * width / 3 + xl, -2 * width / 3 + yw, width / 3 + zh))
C1, C2 = 0.8, 0.05
C1, C2 = 0.3, 0.2
theta1, theta2 = 0.01, 0.13
Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1)
filletradius = Cf * (radius - r0)
delta = 0.012
filletradius = delta - Cf * (radius - r0)
scale = 100
oo = geompy.MakeVertex(0, 0, 0)

View File

@ -26,10 +26,10 @@ def simpleCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]):
yw = xl
zh = height
C1, C2 = 0.8, 0.05
C1, C2 = 0.8, 0.5 #0.8, 0.05
theta1, theta2 = 0.01, 0.28
Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1)
filletradius = Cf * (radius - r0)
filletradius = 0.2 - Cf * (radius - r0)
scale = 100
oo = geompy.MakeVertex(0, 0, 0)
@ -165,10 +165,10 @@ def simpleHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, 1]):
point.append((2 * L / 3 + xl, 5 * L / 3 + yw, 2 * L / 3 + zh))
point.append((L + xl, L + yw, L + zh))
C1, C2 = 0.8, 0.05
C1, C2 = 0.8, 0.5 # 0.8, 0.05
theta1, theta2 = 0.01, 0.28
Cf = C1 + (C2 - C1) / (theta2 - theta1) * (theta - theta1)
filletradius = Cf * (radius - r0)
filletradius = 0.2 - Cf * (radius - r0)
scale = 100
oo = geompy.MakeVertex(0, 0, 0)

View File

@ -1,7 +1,7 @@
#import salome
import subprocess
import logging
import sys
import sys, os
import config
from config import logger
@ -28,7 +28,7 @@ def runExecute(port: int, scriptpath: str, *args) -> int:
scriptpath, "args:{}".format(", ".join([str(arg) for arg in args]))]
logger.info("salome: {}".format(cmd[1 : 6]))
#logpath = os.path.join()
logpath = os.path.join("/".join(args[4].split("/")[:-1]), "salome.log")
#p = subprocess.Popen(["salome", "start", "--shutdown-servers=1", "--port", str(port), "-t", scriptpath, "args:{}".format(", ".join([str(arg) for arg in args]))],
# stderr = subprocess.STDOUT)
@ -36,17 +36,18 @@ def runExecute(port: int, scriptpath: str, *args) -> int:
with subprocess.Popen(cmd,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE) as p:
stderr = subprocess.PIPE) as p, \
open(logpath, "wb") as logfile:
#for line in p.stdout:
for line in p.stdout:
# sys.stdout.buffer.write(line)
# logfile.write(line)
logfile.write(line)
out, err = p.communicate()
print(str(err, "utf-8"))
#logfile.write(err)
#print(str(err, "utf-8"))
logfile.write(err)
if err and p.returncode == 1:
if err:
logger.error("salome:\n\t{}".format(str(err, "utf-8")))
#if err:
# if p.returncode == 1:

5708
temp/bodyCenteredCubic.step Normal file

File diff suppressed because it is too large Load Diff