def CreateSegment(self, x, sangle, eangle): cen1 = self.center cen1[0] = x ring1_ptr = geometry_factory.CreateSmallRing(cen1, self.axis, self.rin, self.rout, sangle, eangle) ring1 = ring1_ptr.GetReference() cen2 = self.center cen2[0] = x + self.x_thick ring2_ptr = geometry_factory.CreateSmallRing(cen2, self.axis, self.rin, self.rout, sangle, eangle) ring2 = ring2_ptr.GetReference() ## create segment patch by connect the two rings segment_patch_ptr = self.bsplines_patch_util.CreateConnectedPatch( ring1, ring2) return segment_patch_ptr
def CreatePatch(): ## generate trajectory curve cpoints = [] cpoints.append([0.0, 0.0, 0.0]) cpoints.append([0.0, 0.0, 1.0]) cpoints.append([1.0, 1.0, 2.0]) order = 2 curve_ptr = geometry_factory.CreateCurve(cpoints, order) curve = curve_ptr.GetReference() curve.Prefix = "curve" mpatch_export3.Export(curve, "curve.m") ## generate the local Frenet frame along the trajectory npoints = 10 trans_list = geometry_factory.GenerateLocalFrenetFrame(curve, npoints) for trans in trans_list: print(trans) geometry_factory.ExportLocalFrenetFrameToMatlab(trans_list, "frame.m", 2e-1) ## generate a list of cut section rin = 0.5 rout = 1.0 start_angle = 45 end_angle = 90 axis = "z" ring_patches = [] for i in range(0, npoints): ring_ptr = geometry_factory.CreateSmallRing([0.0, 0.0, 0.0], axis, rin, rout, start_angle, end_angle) ring = ring_ptr.GetReference() ring.Id = i + 1 ring.Prefix = "ring" ring.ApplyTransformation(trans_list[i]) # mpatch_export3.Export(ring, ring.Name() + "_def.m") ring_patches.append(ring_ptr) ## create the sweep volume order_w = 2 vol_ptr = bsplines_patch_util.CreateConnectedPatch(ring_patches, order_w) return vol_ptr
from KratosMultiphysics import * from KratosMultiphysics.IsogeometricApplication import * kernel = Kernel() #defining kernel nurbs_fespace_library = BSplinesFESpaceLibrary() grid_lib = ControlGridLibrary() multipatch_util = MultiPatchUtility() bsplines_patch_util = BSplinesPatchUtility() mpatch_export = MultiNURBSPatchMatlabExporter() import geometry_factory ## create rings rin = 4.8 rout = 5.0 leng = 15.0 sangle = 75.0 eangle = 105.0 ring1_ptr = geometry_factory.CreateSmallRing([0.0, 0.0, 0.0], 'x', rin, rout, sangle, eangle) ring1 = ring1_ptr.GetReference() ring2_ptr = geometry_factory.CreateSmallRing([leng, 0.0, 0.0], 'x', rin, rout, sangle, eangle) ring2 = ring2_ptr.GetReference() ## create segment patch by connect the two rings segment_patch_ptr = bsplines_patch_util.CreateConnectedPatch(ring1, ring2) segment_patch = segment_patch_ptr.GetReference() print(segment_patch) mpatch_export.Export(segment_patch, "segment.m")