Mod: minor changes
This commit is contained in:
parent
c2ef046f74
commit
7d0fe5a4a9
@ -42,15 +42,11 @@ class UltimateRunner(object):
|
||||
params = self.config.cases[0]
|
||||
filename = "shape.step"
|
||||
|
||||
match params["label"]:
|
||||
case "simple":
|
||||
self.shape = Simple(params["direction"])
|
||||
|
||||
case "bodyCentered":
|
||||
self.shape = BodyCentered(params["direction"])
|
||||
|
||||
case "faceCentered":
|
||||
self.shape = FaceCentered(params["direction"])
|
||||
self.shape = {
|
||||
"simple": Simple,
|
||||
"bodyCentered": BodyCentered,
|
||||
"faceCentered": FaceCentered
|
||||
}[params["label"]](params["direction"])
|
||||
|
||||
self.shape.build()
|
||||
|
||||
@ -90,20 +86,19 @@ class UltimateRunner(object):
|
||||
patches[name] = [ f"patch{ n }" ]
|
||||
|
||||
for name in patches.keys():
|
||||
match name:
|
||||
case "inlet":
|
||||
if name == "inlet":
|
||||
patchGroup = "inlet"
|
||||
patchType = "patch"
|
||||
|
||||
case "outlet":
|
||||
elif name == "outlet":
|
||||
patchGroup = "outlet"
|
||||
patchType = "patch"
|
||||
|
||||
case "wall":
|
||||
elif name == "wall":
|
||||
patchGroup = "wall"
|
||||
patchType = "wall"
|
||||
|
||||
case _:
|
||||
else:
|
||||
patchGroup = "symetry"
|
||||
patchType = "symetryPlane"
|
||||
|
||||
@ -118,34 +113,33 @@ class UltimateRunner(object):
|
||||
})
|
||||
|
||||
flow.append(createPatchDict)
|
||||
|
||||
flow.write()
|
||||
# Build a flow
|
||||
flow.build()
|
||||
#flow.build()
|
||||
|
||||
|
||||
def pipeline(self, stage: str = None):
|
||||
stage = stage or self.config["stage"]
|
||||
|
||||
match stage:
|
||||
case "shape" | "all":
|
||||
if stage in ["shape", "all"]:
|
||||
with self.database.atomic():
|
||||
Shape.create(self._exec_id, **self.config.cases[0])
|
||||
|
||||
self.computeShape()
|
||||
|
||||
case "mesh" | "all":
|
||||
elif stage in ["mesh", "all"]:
|
||||
with self.database.atomic():
|
||||
Mesh.create(self._exec_id)
|
||||
|
||||
self.computeMesh()
|
||||
|
||||
case "flow" | "all":
|
||||
elif stage in ["flow", "all"]:
|
||||
with self.database.atomic():
|
||||
Flow.create(self._exec_id)
|
||||
|
||||
self.computeFlow()
|
||||
|
||||
case "postProcess" | "all":
|
||||
elif stage in ["postProcess", "all"]:
|
||||
self.postProcess()
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ class FoamFile(object):
|
||||
"| \\\\ / O peration |",
|
||||
"| \\\\ / A nd | |",
|
||||
"| \\\\/ M anipulation | |",
|
||||
"\*---------------------------------------------------------------------------*/"
|
||||
"\\*---------------------------------------------------------------------------*/"
|
||||
]
|
||||
desc[3] += " Version: {}".format(version() or "missed")
|
||||
desc[3] += " " * (limit - len(desc[3])) + "|"
|
||||
|
@ -28,7 +28,7 @@ def checkMesh(case: str = None) -> str:
|
||||
with open("checkMesh.log", "r") as io:
|
||||
warnings = []
|
||||
for line in io:
|
||||
if re.search("\*\*\*", line):
|
||||
if re.search(r"***", line):
|
||||
warnings.append(line.replace("***", "").strip())
|
||||
|
||||
if warnings:
|
||||
|
@ -136,8 +136,8 @@ class BodyCentered(Periodic):
|
||||
inletface.name = "inlet"
|
||||
|
||||
vecFlow = self.normal(inletface)
|
||||
self.cell = inletface.Extrude(extr)
|
||||
self.cell = reconstruct(self.cell)
|
||||
# ISSUE: don't use face.Extrude(length), only face.Extrude(length, vector)
|
||||
self.cell = inletface.Extrude(extr, Vec(*vecFlow))
|
||||
|
||||
# Boundaries
|
||||
symetryId = 0
|
||||
|
@ -143,8 +143,8 @@ class FaceCentered(Periodic):
|
||||
inletface.name = "inlet"
|
||||
|
||||
vecFlow = self.normal(inletface)
|
||||
self.cell = inletface.Extrude(extr)
|
||||
self.cell = reconstruct(self.cell)
|
||||
# ISSUE: don't use face.Extrude(length), only face.Extrude(length, vector)
|
||||
self.cell = inletface.Extrude(extr, Vec(*vecFlow))
|
||||
|
||||
# Boundaries
|
||||
symetryId = 0
|
||||
|
@ -27,15 +27,15 @@ def pos(self) -> numpy.array:
|
||||
|
||||
|
||||
# ISSUE: netgen.occ.Face.Extrude: the opposite face has the same name and normal vector as an initial face.
|
||||
def reconstruct(shape):
|
||||
"""Reconstruct shape with new objects.
|
||||
"""
|
||||
faces = []
|
||||
|
||||
for face in shape.faces:
|
||||
faceNew = occ.Face(face.wires[0])
|
||||
faceNew.name = face.name
|
||||
faces.append(faceNew)
|
||||
|
||||
return occ.Solid(faces)
|
||||
#def reconstruct(shape):
|
||||
# """Reconstruct shape with new objects.
|
||||
# """
|
||||
# faces = []
|
||||
#
|
||||
# for face in shape.faces:
|
||||
# faceNew = occ.Face(face.wires[0])
|
||||
# faceNew.name = face.name
|
||||
# faces.append(faceNew)
|
||||
#
|
||||
# return occ.Solid(faces)
|
||||
|
||||
|
@ -131,8 +131,8 @@ class Simple(Periodic):
|
||||
inletface.name = "inlet"
|
||||
|
||||
vecFlow = self.normal(inletface)
|
||||
self.cell = inletface.Extrude(extr * Vec(*vecFlow))
|
||||
self.cell = reconstruct(self.cell)
|
||||
# ISSUE: don't use face.Extrude(length), only face.Extrude(length, vector)
|
||||
self.cell = inletface.Extrude(extr, Vec(*vecFlow))
|
||||
|
||||
# Boundaries
|
||||
symetryId = 0
|
||||
@ -152,6 +152,7 @@ class Simple(Periodic):
|
||||
face.name = f"symetry{ symetryId }"
|
||||
symetryId += 1
|
||||
|
||||
|
||||
# Main shape
|
||||
self.shape = self.cell - self.lattice
|
||||
|
||||
|
@ -74,8 +74,7 @@ class OnePhaseFlow(FoamCase):
|
||||
|
||||
# ISSUE: add proxy from geometry direction to outlet boundaryField.
|
||||
for boundary in boundaries:
|
||||
match boundary:
|
||||
case "inlet":
|
||||
if boundary == "inlet":
|
||||
p["boundaryField"][boundary] = dict(
|
||||
type = "fixedValue",
|
||||
value = "uniform 1e-3"
|
||||
@ -85,7 +84,7 @@ class OnePhaseFlow(FoamCase):
|
||||
value = "uniform (0 0 -6e-5)" # * direction
|
||||
)
|
||||
|
||||
case "outlet":
|
||||
elif boundary == "outlet":
|
||||
p["boundaryField"][boundary] = dict(
|
||||
type = "fixedValue",
|
||||
value = "uniform 0"
|
||||
@ -94,7 +93,7 @@ class OnePhaseFlow(FoamCase):
|
||||
type = "zeroGradient",
|
||||
)
|
||||
|
||||
case _:
|
||||
else:
|
||||
p["boundaryField"][boundary] = dict(
|
||||
type = "zeroGradient"
|
||||
)
|
||||
|
@ -1,7 +1,10 @@
|
||||
name: anisotropy
|
||||
channels:
|
||||
- local
|
||||
- conda-forge
|
||||
dependencies:
|
||||
- python>=3.9
|
||||
- poetry
|
||||
- sqlite
|
||||
- occt
|
||||
- netgen
|
||||
|
Loading…
Reference in New Issue
Block a user