Skip to content
Snippets Groups Projects
Commit a22f9a3f authored by jonathan.froehlich's avatar jonathan.froehlich
Browse files

Adjusted boundary conditions in cuboids

parent 6b55e945
No related branches found
No related tags found
3 merge requests!153Local add output info,!144Debug cardmech,!117Resolve "Fix volumetric derivatives"
......@@ -246,12 +246,12 @@ class CuboidGenerator:
# Faces
for j in range(y * D):
for k in range(z * D):
if self.bnd.left > 0:
if self.bnd.left >= 0:
for face in tt.square_to_triangles(*tt.cube_face_x(points, 0, j, k)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.left)
if self.bnd.right > 0:
if self.bnd.right >= 0:
for face in tt.square_to_triangles(*tt.cube_face_x(points, x * D, j, k)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.right)
......@@ -259,24 +259,24 @@ class CuboidGenerator:
'''Insert Pressure Boundary on Top and Bottom'''
for i in range(x * D):
for j in range(y * D):
if self.bnd.upper > 0:
if self.bnd.upper >= 0:
for face in tt.square_to_triangles(*tt.cube_face_z(points, i, j, z * D)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.upper)
if self.bnd.lower > 0:
if self.bnd.lower >= 0:
for face in tt.square_to_triangles(*tt.cube_face_z(points, i, j, 0)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.lower)
for i in range(x * D):
for k in range(z * D):
if self.bnd.front > 0:
if self.bnd.front >= 0:
for face in tt.square_to_triangles(*tt.cube_face_y(points, i, 0, k)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.front)
if self.bnd.back > 0:
if self.bnd.back >= 0:
for face in tt.square_to_triangles(*tt.cube_face_y(points, i, y * D, k)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.back)
......@@ -323,12 +323,12 @@ class CuboidGenerator:
# Faces
for j in range(y * D):
for k in range(z * D):
if self.bnd.left > 0:
if self.bnd.left >= 0:
for face in tt.square_to_triangles(*tt.cube_face_x(points, 0, j, k)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.left)
if self.bnd.right > 0:
if self.bnd.right >= 0:
for face in tt.square_to_triangles(*tt.cube_face_x(points, x * D, j, k)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.right)
......@@ -336,24 +336,24 @@ class CuboidGenerator:
'''Insert Pressure Boundary on Top and Bottom'''
for i in range(x * D):
for j in range(y * D):
if self.bnd.upper > 0:
if self.bnd.upper >= 0:
for face in tt.square_to_triangles(*tt.cube_face_z(points, i, j, z * D)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.upper)
if self.bnd.lower > 0:
if self.bnd.lower >= 0:
for face in tt.square_to_triangles(*tt.cube_face_z(points, i, j, 0)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.lower)
for i in range(x * D):
for k in range(z * D):
if self.bnd.front > 0:
if self.bnd.front >= 0:
for face in tt.square_to_triangles(*tt.cube_face_y(points, i, 0, k)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.front)
if self.bnd.back > 0:
if self.bnd.back >= 0:
for face in tt.square_to_triangles(*tt.cube_face_y(points, i, y * D, k)):
face_id = geometry.add_face(face)
geometry.add_bnd_condition(face_id, self.bnd.back)
......@@ -391,24 +391,24 @@ class CuboidGenerator:
''' Insert Dirichlet Boundary'''
for j in range(y * D):
for k in range(z * D):
if self.bnd.left > 0:
if self.bnd.left >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_x(points, 0, j, k)), self.bnd.left)
if self.bnd.right > 0:
if self.bnd.right >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_x(points, x * D, j, k)), self.bnd.right)
'''Insert Pressure Boundary on Top and Bottom'''
for i in range(x * D):
for j in range(y * D):
if self.bnd.lower > 0:
if self.bnd.lower >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_z(points, i, j, 0)), self.bnd.lower)
if self.bnd.upper > 0:
if self.bnd.upper >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_z(points, i, j, z * D)), self.bnd.upper)
for i in range(x * D):
for k in range(z * D):
if self.bnd.front > 0:
if self.bnd.front >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_y(points, i, 0, k)), self.bnd.front)
if self.bnd.back > 0:
if self.bnd.back >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_y(points, i, y * D, k)), self.bnd.back)
geometry.init_data()
......@@ -454,24 +454,24 @@ class CuboidGenerator:
''' Insert Dirichlet Boundary'''
for j in range(y * D):
for k in range(z * D):
if self.bnd.left > 0:
if self.bnd.left >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_x(points, 0, j, k)), self.bnd.left)
if self.bnd.right > 0:
if self.bnd.right >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_x(points, x * D, j, k)), self.bnd.right)
'''Insert Pressure Boundary on Top and Bottom'''
for i in range(x * D):
for j in range(y * D):
if self.bnd.lower > 0:
if self.bnd.lower >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_z(points, i, j, 0)), self.bnd.lower)
if self.bnd.upper > 0:
if self.bnd.upper >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_z(points, i, j, z * D)), self.bnd.upper)
for i in range(x * D):
for k in range(z * D):
if self.bnd.front > 0:
if self.bnd.front >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_y(points, i, 0, k)), self.bnd.front)
if self.bnd.back > 0:
if self.bnd.back >= 0:
geometry.add_bnd_condition(geometry.add_face(tt.cube_face_y(points, i, y * D, k)), self.bnd.back)
geometry.init_data()
......
......@@ -64,13 +64,13 @@ def write_properties_oriented(orientations, activation, transform=None):
class Geometry:
def __init__(self, name, path="", withdata=False):
self.name = name
self.path = path
self.points = {}
self.subdomains = {}
self.cells = {}
self.bnd = {}
self.faces = {}
self.vdata = {}
self.cdata = {}
......@@ -108,7 +108,6 @@ class Geometry:
def remove_face(self, face_index):
del self.faces[face_index]
del self.bnd[face_index]
def init_data(self):
self.vdata = {i: [] for i in self.points.keys()}
......
......@@ -134,7 +134,7 @@ def full_ellipsoid_bnd(points):
def convert_quarter_ellipsoid():
print("Start conversion of QuarterEllipsoid")
geo = VtuMesh("vtk/QuarterEllipsoid", "QuarterEllipsoid", True)
geo = VtuMesh("vtk/QuarterEllipsoid", "QuarterEllipsoid", 0.001)
geo.set_boundary_data(quarter_ellipsoid_bnd)
geo.read_celldata([1, 2, 3])
geo.save()
......@@ -143,7 +143,7 @@ def convert_quarter_ellipsoid():
def convert_full_ellipsoid():
print("Start converion of FullEllipsoid")
geo = VtuMesh("vtk/ellipsoid2Fibers", "FullEllipsoid", True)
geo = VtuMesh("vtk/ellipsoid2Fibers", "FullEllipsoid", 0.001)
geo.set_boundary_data(full_ellipsoid_bnd)
geo.read_celldata([1, 2, 3])
geo.save()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment