beam_wy = 0.012 beam_wz = 0.025 msection.SetAsRectangularSection(beam_wy, beam_wz) msection.SetYoungModulus(0.01e9) msection.SetGshearModulus(0.01e9 * 0.3) msection.SetBeamRaleyghDamping(0.000) #msection.SetCentroid(0,0.02) #msection.SetShearCenter(0,0.1) #msection.SetSectionRotation(45*chrono.CH_C_RAD_TO_DEG) # Add some EULER-BERNOULLI BEAMS: beam_L = 0.1 hnode1 = fea.ChNodeFEAxyzrot(chrono.ChFrameD(chrono.ChVectorD(0, 0, 0))) hnode2 = fea.ChNodeFEAxyzrot(chrono.ChFrameD(chrono.ChVectorD(beam_L, 0, 0))) hnode3 = fea.ChNodeFEAxyzrot(chrono.ChFrameD(chrono.ChVectorD(beam_L * 2, 0, 0))) my_mesh.AddNode(hnode1) my_mesh.AddNode(hnode2) my_mesh.AddNode(hnode3) belement1 = fea.ChElementBeamEuler() belement1.SetNodes(hnode1, hnode2) belement1.SetSection(msection) my_mesh.AddElement(belement1) belement2 = fea.ChElementBeamEuler()
na = 8 nl = 8 nodes, edges = reconstruct_shape(na, nl, UNIT_FACTOR, ring_gap=RING_GAP, shift_z=-RING_GAP * nl / 2.0) # mesh mesh = fea.ChMesh() # nodes noderot = chrono.ChQuaternionD(chrono.QUNIT) fea_nodes = [] for n in nodes: fn = fea.ChNodeFEAxyzrot( chrono.ChFrameD(chrono.ChVectorD(n[0], n[1], n[2]), noderot)) fn.SetMass(0.1) fn.SetFixed(False) mesh.AddNode(fn) fea_nodes.append(fn) # material of each element rho = 152.2 # 152.2 material density E = 8e20 # Young's modulus 8e4 nu = 0.5 # 0.5 # Poisson ratio alpha = 1.0 # 0.3 # shear factor beta = 0.2 # torque factor material = fea.ChMaterialShellReissnerIsothropic(rho, E, nu, alpha, beta) alphadamp = 0.1 # elements elements = []
import pychrono as chrono import pychrono.fea as fea import copy print("Copyright (c) 2017 projectchrono.org ") # Create the physical system my_system = chrono.ChSystemSMC() # Create a mesh: my_mesh = fea.ChMesh() my_system.Add(my_mesh) # Create some nodes. mnodeA = fea.ChNodeFEAxyzrot(chrono.ChFrameD(chrono.ChVectorD(0, 0, 0))) mnodeB = fea.ChNodeFEAxyzrot(chrono.ChFrameD(chrono.ChVectorD(2, 0, 0))) # Default mass for FEM nodes is zero mnodeA.SetMass(0.0) mnodeB.SetMass(0.0) my_mesh.AddNode(mnodeA) my_mesh.AddNode(mnodeB) # Create beam section & material msection = fea.ChBeamSectionEulerAdvanced() beam_wy = 0.1 beam_wz = 0.2 msection.SetAsRectangularSection(beam_wy, beam_wz) msection.SetYoungModulus(0.01e9)
# i.e. each node has coordinates of type: position, rotation, # where X axis of rotated system is the direction of the beam, # Y and Z are the section plane. beam_nodes = [] length = 1.2 # beam length, in meters N_nodes = 16 for i_n in range(N_nodes): # i-th node position position = chrono.ChVectorD(length * (i_n / (N_nodes - 1)), # node position, x 0.5, # node position, y 0) # node position, z # create the node node = fea.ChNodeFEAxyzrot( chrono.ChFrameD(position) ) # add it to mesh mesh.AddNode(node) # add it to the auxiliary beam_nodes beam_nodes.append(node) # 5. Create the elements for ie in range(N_nodes - 1): # create the element element = fea.ChElementBeamEuler()
application.AddTypicalLogo() application.AddTypicalSky() application.AddTypicalLights() application.AddTypicalCamera(chronoirr.vector3df(0, 6.0, -10)) # Create a mesh, that is a container for groups # of elements and their referenced nodes. my_mesh = fea.ChMesh() # Remember to add the mesh to the system! my_system.Add(my_mesh) # my_system.Set_G_acc(VNULL) or my_mesh.SetAutomaticGravity(False) nodePlotA = fea.ChNodeFEAxyzrot() nodePlotB = fea.ChNodeFEAxyzrot() nodesLoad = [] ref_X = chrono.ChFunction_Recorder() ref_Y = chrono.ChFunction_Recorder() load_torque = chrono.ChVectorD() load_force = chrono.ChVectorD() bench1 = False bench2 = True bench3 = False # # BENCHMARK n.1 #
right = bb_dz / 2. target_nodes, target_edges, target_na, target_nl = sleeve.cut_extremities( left, right) # Downsample the mesh to match the number of sensors target_nodes, target_edges = downsample(target_nodes, target_edges, target_na, target_nl, NSENSORS_ANGLE, NSENSORS_LENGTH) # Visualize the target nodes (bigger nodes) fea_nodes = [] noderot = chrono.ChQuaternionD(chrono.QUNIT) for tn in target_nodes: fea_node = fea.ChNodeFEAxyzrot( chrono.ChFrameD(chrono.ChVectorD(tn[0], tn[1], tn[2]), noderot)) fea_nodes.append(fea_node) target_mesh.AddNode(fea_node) # Generate the optimised shape (cloth) cloth_nodes, cloth_edges = gen_cylinder(bb_dx, bb_dz, NSENSORS_ANGLE, NSENSORS_LENGTH, NEIGHBOURS, shift_z=-bb_dz / 2.) current_cloth_nodes_pos = cloth_nodes.copy() # Initial position of the nodes to optimize for i, cn in enumerate(cloth_nodes):
def __init__(self, length, radius, neighbours, na=MIN_NA, nl=MIN_NL, material=None, node_mass=10., sleeve_thickness=0.002, alphadamp=0.1, shift_x=0, shift_y=0, shift_z=0): """ Initialize a 3D cylinder mesh made of na x nl nodes. This forms the skeleton of the sleeve. :param length: the length of the sleeve :param radius: the radius of the sleeve :param neighbours: Number of neighbours :param na: number of nodes in the circumference :param nl: number of nodes in the length :param material: a fea.ChMaterialShellReissner material property of the mesh :param node_mass: mass of the node :param sleeve_thickness: Thickness of the sleeve :param alphadamp This is the Rayleigh "alpha" for the stiffness-proportional damping. This assumes damping forces as F=alpha*[Km]*v where [Km] is the stiffness matrix (material part, i.e.excluding geometric stiffness) and v is a vector of node speeds. Usually, alpha in the range 0.0 - 0.1 Note that the mass-proportional term of classical Rayleigh damping is not supported. :param shift_x: the sleeve displacement from the origin on x axis :param shift_y: the sleeve displacement from the origin on y axis :param shift_z: the sleeve displacement from the origin on z axis """ # Handle unrealistic values if na < 3: raise ValueError(f"Number of nodes in the circumference" f" must be >= {self.MIN_NA}.") if nl < 2: raise ValueError( f"Number of nodes in the length must be >= {self.MIN_NL}.") self.na = na self.nl = nl self.length = length self.radius = radius self.shift_x = shift_x self.shift_y = shift_y # Create the nodes and edges self.nodes, self.edges = gen_cylinder.gen_cylinder( radius, length, na, nl, neighbours, shift_x, shift_y, shift_z) # Create the mesh made of nodes and elements self.mesh = fea.ChMesh() # Create FEA nodes self.fea_nodes = [] for n in self.nodes: nodepos = tool.make_ChVectorD(n) noderot = chrono.ChQuaternionD(chrono.QUNIT) node = fea.ChNodeFEAxyzrot(chrono.ChFrameD(nodepos, noderot)) node.SetMass(node_mass) self.fea_nodes.append(node) self.mesh.AddNode(node) # Create FEA elements self.elements = [] for i in range(nl - 1): for j in range(na): # Make elements elem = fea.ChElementShellReissner4() if j == na - 1: # Connect last nodes to the first ones elem.SetNodes( self.fea_nodes[(i + 1) * na], # top right self.fea_nodes[i * na], # top left self.fea_nodes[j + i * na], # bottom left self.fea_nodes[j + (i + 1) * na] # bottom right ) else: elem.SetNodes( self.fea_nodes[j + 1 + (i + 1) * na], # top right self.fea_nodes[j + 1 + i * na], # top left self.fea_nodes[j + i * na], # bottom left self.fea_nodes[j + (i + 1) * na] # bottom right ) if material: elem.AddLayer(sleeve_thickness, 0 * chrono.CH_C_DEG_TO_RAD, material) elem.SetAlphaDamp(alphadamp) elem.SetAsNeutral() self.mesh.AddElement(elem) self.elements.append(elem)