*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit aedc853f authored by Hanser, Valentin's avatar Hanser, Valentin
Browse files

added fullProblemZ in miniHEXMeshGenerator

parent c2983dea
Branches
No related tags found
No related merge requests found
Pipeline #285898 passed
......@@ -63,7 +63,7 @@ def addZElements(macroX, macroY, macroZ, element_list, ind_z_start, domainNumber
class mini3DSheetsHexMesh:
def __init__(self, x_i=[1], y_i=[1], z_Fe=[1, 1, 1], z_0=[0.1], numSheets=1, fullProblemY=False, fullProblemX=True, MS =False, z_MS = [1], origin = (0, 0, 0), extend_Left_Right=None):
def __init__(self, x_i=[1], y_i=[1], z_Fe=[1, 1, 1], z_0=[0.1], numSheets=1, fullProblemX=True, fullProblemY=False, fullProblemZ=True, MS =False, z_MS = [1], origin = (0, 0, 0), extend_Left_Right=None):
bnd_dict = selfFillingList()
domain_dict = selfFillingList()
......@@ -94,6 +94,14 @@ class mini3DSheetsHexMesh:
if not fullProblemX:
x_i = halfArray(x_i)
if not fullProblemZ:
isOdd = (numSheets % 2 == 1)
numSheets = int(numSheets/2)
if MS :
numSheets = 1
if fullProblemX and type(extend_Left_Right) != type(None):
addElements(macroX, np.flipud(extend_Left_Right))
......@@ -105,32 +113,49 @@ class mini3DSheetsHexMesh:
#start with halfAir
ind_z_start = 1
sym = "" if fullProblemX else "sym_"
sym_x = "" if fullProblemX else "sym_"
ind_z_start = 1
if not MS:
ind_z_start = addZElements(macroX, macroY, macroZ, z_0_first_half, ind_z_start, domain_dict["air"], bnd_dict["bottom_outer"], bnd_dict["front_outer"], bnd_dict["right_outer"], bnd_dict["back_outer"],bnd_dict[sym+"left_outer"],bnd_dict["ibot"], domains, boundaries)
if fullProblemZ or not isOdd:
ind_z_start = addZElements(macroX, macroY, macroZ, z_0_second_half, ind_z_start, domain_dict["air"], bnd_dict["bottom_outer"], bnd_dict["front_outer"], bnd_dict["right_outer"], bnd_dict["back_outer"],bnd_dict[sym_x+"left_outer"],bnd_dict["ibot"], domains, boundaries)
else:
z_Fe_tmp = halfArray(z_Fe, True)
tmp =ind_z_start
ind_z_start = addZElements(macroX, macroY, macroZ, z_Fe_tmp, ind_z_start, domain_dict["iron"], bnd_dict["sym_bottom"], bnd_dict["front_inner"], bnd_dict["right_inner"], bnd_dict["back_inner"],bnd_dict[sym_x+"left_inner"],bnd_dict["sym_bottom"], domains, boundaries)
itop = "top_outer" if MS else "itop"
if fullProblemX and type(extend_Left_Right) != type(None):
addDomBnd(1, len(extend_Left_Right), 1, len(y_i), tmp, tmp + len(z_Fe_tmp)-1, domain_dict["iron_left"], bnd_dict["sym_bottom"], bnd_dict["front_inner"], bnd_dict["iinner"], bnd_dict["back_inner"],bnd_dict[sym_x+"left_inner"],bnd_dict[itop], domains, boundaries)
if type(extend_Left_Right) != type(None):
addDomBnd(len(macroX)- len(extend_Left_Right) + 1, len(macroX), 1, len(y_i), tmp, tmp + len(z_Fe_tmp)-1, domain_dict["iron_right"], bnd_dict["sym_bottom"], bnd_dict["front_inner"], bnd_dict["right_inner"], bnd_dict["back_inner"], bnd_dict["iinner"],bnd_dict[itop], domains, boundaries)
#start with halfAir
ibot = "bottom_outer" if MS else "ibot"
if not fullProblemZ:
ibot = "sym_bottom"
itop = "top_outer" if MS else "itop"
for n in range(numSheets):
ibot = "bottom_outer" if MS and n == 0 else "ibot"
itop = "top_outer" if MS and n == 0 else "itop"
# iron
tmp =ind_z_start
ind_z_start = addZElements(macroX, macroY, macroZ, z_Fe, ind_z_start, domain_dict["iron"], bnd_dict[ibot], bnd_dict["front_inner"], bnd_dict["right_inner"], bnd_dict["back_inner"],bnd_dict[sym+"left_inner"],bnd_dict[itop], domains, boundaries)
ind_z_start = addZElements(macroX, macroY, macroZ, z_Fe, ind_z_start, domain_dict["iron"], bnd_dict[ibot], bnd_dict["front_inner"], bnd_dict["right_inner"], bnd_dict["back_inner"],bnd_dict[sym_x+"left_inner"],bnd_dict[itop], domains, boundaries)
if fullProblemX and type(extend_Left_Right) != type(None):
addDomBnd(1, len(extend_Left_Right), 1, 1, tmp, tmp + len(z_Fe)-1, domain_dict["iron_left"], bnd_dict[ibot], bnd_dict["front_inner"], bnd_dict["iinner"], bnd_dict["back_inner"],bnd_dict[sym+"left_inner"],bnd_dict[itop], domains, boundaries)
addDomBnd(1, len(extend_Left_Right), 1, len(y_i), tmp, tmp + len(z_Fe)-1, domain_dict["iron_left"], bnd_dict[ibot], bnd_dict["front_inner"], bnd_dict["iinner"], bnd_dict["back_inner"],bnd_dict[sym_x+"left_inner"],bnd_dict[itop], domains, boundaries)
if type(extend_Left_Right) != type(None):
addDomBnd(len(macroX)- len(extend_Left_Right) + 1, len(macroX), 1, 1, tmp, tmp + len(z_Fe)-1, domain_dict["iron_right"], bnd_dict[ibot], bnd_dict["front_inner"], bnd_dict["right_inner"], bnd_dict["back_inner"], bnd_dict["iinner"],bnd_dict[itop], domains, boundaries)
addDomBnd(len(macroX)- len(extend_Left_Right) + 1, len(macroX), 1, len(y_i), tmp, tmp + len(z_Fe)-1, domain_dict["iron_right"], bnd_dict[ibot], bnd_dict["front_inner"], bnd_dict["right_inner"], bnd_dict["back_inner"], bnd_dict["iinner"],bnd_dict[itop], domains, boundaries)
# air
if n != numSheets - 1:
ind_z_start = addZElements(macroX, macroY, macroZ, z_0, ind_z_start, domain_dict["air"], bnd_dict[itop], bnd_dict["front_outer"], bnd_dict["right_outer"], bnd_dict["back_outer"],bnd_dict[sym+"left_outer"],bnd_dict[ibot], domains, boundaries)
ind_z_start = addZElements(macroX, macroY, macroZ, z_0, ind_z_start, domain_dict["air"], bnd_dict[itop], bnd_dict["front_outer"], bnd_dict["right_outer"], bnd_dict["back_outer"],bnd_dict[sym_x+"left_outer"],bnd_dict[ibot], domains, boundaries)
#end with halfAir
ind_z_start = addZElements(macroX, macroY, macroZ, z_0_first_half, ind_z_start, domain_dict["air"], bnd_dict["itop"], bnd_dict["front_outer"], bnd_dict["right_outer"], bnd_dict["back_outer"],bnd_dict[sym+"left_outer"],bnd_dict["top_outer"], domains, boundaries)
ind_z_start = addZElements(macroX, macroY, macroZ, z_0_first_half, ind_z_start, domain_dict["air"], bnd_dict["itop"], bnd_dict["front_outer"], bnd_dict["right_outer"], bnd_dict["back_outer"],bnd_dict[sym_x+"left_outer"],bnd_dict["top_outer"], domains, boundaries)
......@@ -162,6 +187,8 @@ class mini3DSheetsHexMesh:
self.domains = domains
self.domain_dict = domain_dict
self.fullProblemX = fullProblemX
self.fullProblemY = fullProblemY
self.fullProblemZ = fullProblemZ
def get2DMesh(self):
......@@ -239,7 +266,7 @@ if __name__ == "__main__":
for i in range(len(phii)):
sol.Set(cos(phii[i]) * x + sin(phii[i]) * y, BND)
BVP(bf=ah, lf=f, gf=sol, pre=c).Do()
solvers.BVP(bf=ah, lf=f, gf=sol, pre=c)
Redraw()
myBreak(locals(), globals(), file=__file__.split('/')[-1])
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment