You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The conversion to data frame fails in the following example. Maybe because of low number of nodes?
To Reproduce
importmatplotlib.pyplotaspltimportnumpyasnpfromansys.mapdl.coreimportlaunch_mapdlmapdl=launch_mapdl()
mapdl.prep7()
mapdl.units("SI") # SI - International system (m, kg, s, K).# define a PLANE183 element type with thicknessmapdl.et(1, "PLANE183", kop3=3)
mapdl.r(1, 0.001) # thickness of 0.001 meters)# Define a material (nominal steel in SI)mapdl.mp("EX", 1, 210e9) # Elastic moduli in Pa (kg/(m*s**2))mapdl.mp("DENS", 1, 7800) # Density in kg/m3mapdl.mp("NUXY", 1, 0.3) # Poisson's Ratio# list currently defined material propertiesprint(mapdl.mplist())
length=0.4width=0.1ratio=0.3# diameter/widthdiameter=width*ratioradius=diameter*0.5# create the rectanglerect_anum=mapdl.blc4(width=length, height=width)
# create a circle in the middle of the rectanglecirc_anum=mapdl.cyl4(length/2, width/2, radius)
# Note how pymapdl parses the output and returns the area numbers# created by each command. This can be used to execute a boolean# operation on these areas to cut the circle out of the rectangle.plate_with_hole_anum=mapdl.asba(rect_anum, circ_anum)
# ensure there are at 50 elements around the holehole_esize=np.pi*diameter/50# 0.0002plate_esize=0.01# increased the density of the mesh at the centermapdl.lsel("S", "LINE", vmin=5, vmax=8)
mapdl.lesize("ALL", hole_esize, kforc=1)
mapdl.lsel("ALL")
# Decrease the area mesh expansion. This ensures that the mesh# remains fine nearby the holemapdl.mopt("EXPND", 0.7) # default 1mapdl.esize(plate_esize)
mapdl.amesh(plate_with_hole_anum)
# Fix the left-hand side.mapdl.nsel("S", "LOC", "X", 0)
mapdl.d("ALL", "UX")
# Fix a single node on the left-hand side of the plate in the Y# direction. Otherwise, the mesh would be allowed to move in the y# direction and would be an improperly constrained mesh.mapdl.nsel("R", "LOC", "Y", width/2)
assertmapdl.mesh.n_node==1mapdl.d("ALL", "UY")
# Apply a force on the right-hand side of the plate. For this# example, we select the nodes at the right-most side of the plate.mapdl.nsel("S", "LOC", "X", length)
# Verify that only the nodes at length have been selected:assertnp.allclose(mapdl.mesh.nodes[:, 0], length)
# Next, couple the DOF for these nodes. This lets us provide a force# to one node that will be spread throughout all nodes in this coupled# set.mapdl.cp(5, "UX", "ALL")
f=open('Node_disp_xy45.txt', 'a')
foriiinrange(0, 1):
# Select a single node in this set and apply a force to it# We use "R" to re-select from the current node groupmapdl.nsel("R", "LOC", "Y", width/2)
mapdl.f("ALL", "FY", 10+10*ii)
# finally, be sure to select all nodes again to solve the entire solution_=mapdl.allsel()
mapdl.run("/SOLU")
mapdl.antype("STATIC")
output=mapdl.solve()
print(output)
# grab the result from the ``mapdl`` instanceresult=mapdl.result# result.plot_principal_nodal_stress(# 0, "SEQV", lighting=False, cpos="xy", background="w", text_color="k",# add_text=False)np.savetxt(f, result.nodal_displacement(0)[1])
f.close()
The text was updated successfully, but these errors were encountered:
Describe the bug
The conversion to data frame fails in the following example. Maybe because of low number of nodes?
To Reproduce
The text was updated successfully, but these errors were encountered: