From c7678a2f0d666f8a377a4d0a96f195e04da459dc Mon Sep 17 00:00:00 2001 From: L-Nafaryus Date: Sun, 20 Jun 2021 17:26:11 +0500 Subject: [PATCH] Fix: strips works now --- conf/config.toml | 6 +- .../template/system/createPatchDict.symetry | 15 +++++ salomepl/bodyCentered.py | 56 +++++-------------- salomepl/faceCentered.py | 54 +++++------------- salomepl/simple.py | 48 ++++------------ 5 files changed, 59 insertions(+), 120 deletions(-) diff --git a/conf/config.toml b/conf/config.toml index d3046e7..94f1599 100644 --- a/conf/config.toml +++ b/conf/config.toml @@ -27,7 +27,7 @@ directions = [ [0, 0, 1], [1, 1, 1] ] -fillet = false +fillet = true [simple.mesh] fineness = 3 @@ -66,7 +66,7 @@ directions = [ [0, 0, 1], [1, 1, 1] ] -fillet = false +fillet = true [bodyCentered.mesh] fineness = 3 @@ -104,7 +104,7 @@ directions = [ [0, 0, 1], [1, 1, 1] ] -fillet = false +fillet = true [faceCentered.mesh] fineness = 3 diff --git a/openfoam/template/system/createPatchDict.symetry b/openfoam/template/system/createPatchDict.symetry index be8a224..2965fb0 100644 --- a/openfoam/template/system/createPatchDict.symetry +++ b/openfoam/template/system/createPatchDict.symetry @@ -148,6 +148,21 @@ patches constructFrom patches; patches (symetry5_); } + + { + name strips; + + patchInfo + { + type wall; + inGroups (wall); + } + + constructFrom patches; + patches (strips_); + } + + ); // ************************************************************************* // diff --git a/salomepl/bodyCentered.py b/salomepl/bodyCentered.py index c00929d..973e535 100644 --- a/salomepl/bodyCentered.py +++ b/salomepl/bodyCentered.py @@ -109,7 +109,7 @@ def bodyCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): grainsOrigin = None if fillet: - grainsOrigin = grains + grainsOrigin = geompy.MakeScaleTransform(grains, oo, 1 / scale) grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -117,28 +117,11 @@ def bodyCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): ## shape = geompy.MakeCutList(cubic, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "bodyCenteredCubic") - stripsShape = None - - if fillet: - shapeOrigin = geompy.MakeCutList(cubic, [grainsOrigin]) - shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) - - shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) - shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) - - stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) - sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) - strips = None - if fillet: - strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") - geompy.UnionList(strips, geompy.SubShapeAll( - geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) - inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -166,8 +149,13 @@ def bodyCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): groups.extend(symetry) if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + stripsShape = geompy.MakeCutList(shapeShell[0], groups + [grainsOrigin]) + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) groups.append(strips) - + wall = geompy.CutListOfGroups([sall], groups, theName = "wall") groups.append(wall) @@ -265,7 +253,7 @@ def bodyCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, grainsOrigin = None if fillet: - grainsOrigin = grains + grainsOrigin = geompy.MakeScaleTransform(grains, oo, 1 / scale) grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -273,29 +261,11 @@ def bodyCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, ## shape = geompy.MakeCutList(hexagonPrism, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "bodyCenteredCubic") - stripsShape = None - - if fillet: - shapeOrigin = geompy.MakeCutList(hexagonPrism, [grainsOrigin]) - shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) - - shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) - shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) - - stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) - - + sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) - strips = None - if fillet: - strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") - geompy.UnionList(strips, geompy.SubShapeAll( - geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) - - inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -323,9 +293,13 @@ def bodyCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, groups.extend(symetry) if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + stripsShape = geompy.MakeCutList(shapeShell[0], groups + [grainsOrigin]) + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) groups.append(strips) - - + wall = geompy.CutListOfGroups([sall], groups, theName = "wall") groups.append(wall) diff --git a/salomepl/faceCentered.py b/salomepl/faceCentered.py index 41ec235..6952ce0 100644 --- a/salomepl/faceCentered.py +++ b/salomepl/faceCentered.py @@ -108,7 +108,7 @@ def faceCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): grainsOrigin = None if fillet: - grainsOrigin = grains + grainsOrigin = geompy.MakeScaleTransform(grains, oo, 1 / scale) grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -116,29 +116,11 @@ def faceCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): ## shape = geompy.MakeCutList(cubic, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "faceCenteredCubic") - stripsShape = None - - if fillet: - shapeOrigin = geompy.MakeCutList(cubic, [grainsOrigin]) - shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) - - shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) - shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) - - stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) - - + sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) - strips = None - if fillet: - strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") - geompy.UnionList(strips, geompy.SubShapeAll( - geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) - - inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -166,6 +148,11 @@ def faceCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): groups.extend(symetry) if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + stripsShape = geompy.MakeCutList(shapeShell[0], groups + [grainsOrigin]) + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) groups.append(strips) wall = geompy.CutListOfGroups([sall], groups, theName = "wall") @@ -263,7 +250,7 @@ def faceCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, grainsOrigin = None if fillet: - grainsOrigin = grains + grainsOrigin = geompy.MakeScaleTransform(grains, oo, 1 / scale) grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -271,29 +258,11 @@ def faceCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, ## shape = geompy.MakeCutList(hexagonPrism, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "faceCenteredCubic") - stripsShape = None - - if fillet: - shapeOrigin = geompy.MakeCutList(hexagonPrism, [grainsOrigin]) - shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) - - shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) - shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) - - stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) - - + sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) - strips = None - if fillet: - strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") - geompy.UnionList(strips, geompy.SubShapeAll( - geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) - - inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -321,6 +290,11 @@ def faceCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, groups.extend(symetry) if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + stripsShape = geompy.MakeCutList(shapeShell[0], groups + [grainsOrigin]) + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) groups.append(strips) wall = geompy.CutListOfGroups([sall], groups, theName = "wall") diff --git a/salomepl/simple.py b/salomepl/simple.py index 0a13516..dc1f244 100644 --- a/salomepl/simple.py +++ b/salomepl/simple.py @@ -97,7 +97,7 @@ def simpleCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): grainsOrigin = None if fillet: - grainsOrigin = grains + grainsOrigin = geompy.MakeScaleTransform(grains, oo, 1 / scale) grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -105,28 +105,11 @@ def simpleCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): ## shape = geompy.MakeCutList(cubic, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "simpleCubic") - stripsShape = None - - if fillet: - shapeOrigin = geompy.MakeCutList(cubic, [grainsOrigin]) - shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) - - shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) - shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) - - stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) - sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) - strips = None - if fillet: - strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") - geompy.UnionList(strips, geompy.SubShapeAll( - geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) - inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -154,6 +137,11 @@ def simpleCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): groups.extend(symetry) if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + stripsShape = geompy.MakeCutList(shapeShell[0], groups + [grainsOrigin]) + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) groups.append(strips) wall = geompy.CutListOfGroups([sall], groups, theName = "wall") @@ -242,7 +230,7 @@ def simpleHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, 1]): grainsOrigin = None if fillet: - grainsOrigin = grains + grainsOrigin = geompy.MakeScaleTransform(grains, oo, 1 / scale) grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -250,28 +238,11 @@ def simpleHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, 1]): ## shape = geompy.MakeCutList(hexagonPrism, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "simpleCubic") - stripsShape = None - - if fillet: - shapeOrigin = geompy.MakeCutList(hexagonPrism, [grainsOrigin]) - shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) - - shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) - shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) - - stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) - sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) - strips = None - if fillet: - strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") - geompy.UnionList(strips, geompy.SubShapeAll( - geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) - inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -299,6 +270,11 @@ def simpleHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, 1]): groups.extend(symetry) if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + stripsShape = geompy.MakeCutList(shapeShell[0], groups + [grainsOrigin]) + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) groups.append(strips) wall = geompy.CutListOfGroups([sall], groups, theName = "wall")