smoothing=smoothing) #tank.setAbsorptionZones(x_p=True, # dragAlpha=dragAlpha, # ) ##################### Shape Geometry & Characteristics ############################### # --- Circle b = 2.0 * opts.radius h = 2.0 * opts.radius # --- Circle Setup circle = st.Circle(domain=domain, radius=opts.radius, coords=(0.5, opts.tank_dim[1] / 2), barycenter=(0.5, opts.tank_dim[1] / 2), nPoints=opts.nPoints) # --- Body properties setup circle2D = bd.RigidBody(shape=circle) circle2D.setMass(mass=opts.mass) I = (3.14 * (opts.radius**4) / 2.) * opts.mass circle2D.It = I / opts.mass / opts.width circle2D.setConstraints(free_x=opts.free_x, free_r=opts.free_r) circle2D.setNumericalScheme(scheme=opts.scheme) circle2D.inputMotion(InputMotion=opts.InputMotion, At=opts.At, Tt=opts.Tt) circle2D.setRecordValues(filename='circle2D', all_values=True)
'y+': 3, 'x-': 4, 'sponge': 5, 'circle':6, } ############################################################################################################################################################################################################## # circle2D ############################################################################################################################################################################################################ if opts.circle2D: width=opts.width # The 3rd dimension mass=opts.mass # kg I = (3.14*(radius**4)/2.)*mass # --- Shape properties setup circle = st.Circle(domain=domain, radius=opts.radius, coords=(xc1, yc1), barycenter=(xc1, yc1), nPoints=28) # --- Body properties setup circle2D = bd.RigidBody(shape=circle) free_x=(0.0, 0.0, 0.0) # Translational DOFs free_r=(0.0, 0.0, 0.0) # Rotational DOFs if opts.movingDomain==True: free_x=(1.0, 1.0, 0.0) # Translational DOFs free_r=(0.0, 0.0, 1.0) # Rotational DOFs circle2D.setMass(mass) circle2D.It= I/circle2D.mass/width circle2D.setConstraints(free_x=free_x, free_r=free_r) circle2D.setNumericalScheme(scheme=opts.scheme) circle2D.inputMotion(InputMotion=opts.InputMotion, At=opts.At, Tt=opts.Tt) circle2D.setRecordValues(filename='circle2D', all_values=True)
he = opts.he ############ TANK ################### tank_dim = (opts.tank_dim_x, opts.tank_dim_y) x1 = 0.2 ### CYLINDER ##### cylinder_pos = np.array([opts.cylinder_pos_x, opts.cylinder_pos_y, 0.]) cylinder_radius = opts.cylinder_radius if opts.circle2D: circle = st.Circle(domain=domain, radius=cylinder_radius, coords=(cylinder_pos[0], cylinder_pos[1]), barycenter=(cylinder_pos[0], cylinder_pos[1]), nPoints=28) circle2D = bd.RigidBody(shape=circle) free_x = (0.0, 0.0, 0.0) free_r = (0.0, 0.0, 0.0) circle2D.setConstraints(free_x=free_x, free_r=free_r) circle2D.setNumericalScheme(None) circle2D.setRecordValues(filename='circle2D', all_values=True) boundaryOrientations = { 'y-': np.array([0., -1., 0.]), 'x+': np.array([+1, 0., 0.]), 'y+': np.array([0., +1., 0.]), 'x-': np.array([-1., 0., 0.]),
# boundary tags dictionary bt = {'inflow': 1, 'reflecting': 99} my_vertexFlags = [bt['inflow'], bt['reflecting'], bt['reflecting'], bt['inflow']] my_segmentFlags = [bt['reflecting'], bt['reflecting'], bt['reflecting'], bt['inflow']] my_customShape = st.CustomShape(domain, boundaryTags=bt, vertices=my_vertices, vertexFlags=my_vertexFlags, segments=my_segments, segmentFlags=my_segmentFlags) # define cylindrical obstacle. boundaryTag value is set to 99-2 here because of # weird 'start_flag' issue in `_assembleGeometry` in SpatialTools.py center_x = 10.0 center_y = 5.0 my_circle = st.Circle(domain=domain, radius=1., barycenter=[center_x, center_y], coords=[center_x, center_y], nPoints=20, boundaryTag={'reflecting': 99-2}) # set obstacle to be hole and set boundary tag to reflecting my_circle.setHoles([[center_x, center_y]]) # assemble domain and set mesh triangle options st.assembleDomain(domain) domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2,) nnx = None nny = None # hack for using same mesh for tests, don't remove if opts.he==4.0: from shutil import copyfile