Implement the APDL *GET shortcuts in PyMAPDL
See original GitHub issueIs your feature request related to a problem? Please describe. Implement pymapdl versions of APDL *GET shortcuts.
See the APDL *GET documentation to see the exact values N
can take in the examples below.
Inverse Get Functions:
- N=NODE(X,Y,Z) - get number of node nearest to coordinate X,Y,Z
- K=KP(X,Y,Z) - same but for keypoints
Alternative Get Functions:
- element_number = NELEM(n, npos)
- centroid_x = CENTRX(N) - plus CENTRY and CENTRZ
- adjacent_element_number = ELADJ(N, face)
- mat_ID_to_be_used_for_contact = SECTOMAT(Sect1, Sect2)
- real_constant_ID_to_be_used_for_contact = SECTOREAL(Sect1, Sect2)
- x_coord = KX(N) - and equivalent for KY and KZ
- select_status_kp_N = KSEL(N)
- element_N_select_status = ESEL(N)
- select_status_line_N = LSEL(N)
- select_status_node_N = NSEL(N)
- select_status_volume_N = VSEL(N)
- select_status_area_N = ASEL(N)
- x_coord = NX(N) - and equivalent for NY and NZ
- x_cosine = NORMNX(N) - and equivalent for Y and Z
- x_cosine = NORMKX(N) - and equivalent for Y and Z
- next_higher_area_in_selection = ARNEXT(N)
- next_higher_element_in_selection = ELNEXT(N)
- next_higher_kp_in_selection = KPNEXT(N)
- next_higher_line_in_selection = LSNEXT(N)
- next_higher_node_in_selection = NDNEXT(N)
- next_higher_volume_in_selection = VLNEXT(N)
- x_struct_displacement = UX(N) - and equivalent for UY and UZ
- x_struct_rot = ROTX(N) - and equivalent ROTY and ROTZ
- temp_at_node = TEMP(N) (also weird things happen with SHELL131 and SHELL132, whcih use TBOT, TE1, TE2,… etc)
- pressure_at_node = PRES(N)
- voltage_at_node = VOLT(N)
- x_magnetic_vector_potential = AX(N) - and equivalent AY and AZ
- x_fluid_velocity = VX(N) - and equivalent VY and VZ
- x_coordinate_fraction_way_along_a_line = LX(L, LFRAC) - and LY and LZ
- x_component_slope_fraction_way_along_a_line = LSX(L, LFRAC) - and LY and LZ
- distance_between_n1_n2 = DISTND(N1, N2)
- distance_between_keypoints_k1_k2 = DISTKP(K1, K2)
- distance_between_element_centroid_and_node_e1_n = DISTEN(E, N)
- angle_between_3_nodes = ANGLEN(N1, N2, N3)
- angle_between_3_nodes = ANGLEK(K1, K2, K3)
- node_nearest_node_n = NNEAR(N)
- keypoint_nearest_keypoint_k = KNEAR(K)
- element_nearest_node_n = ENEARN(N)
- area_triangle_from_nodes = AREAND(N1, N2, N3)
- area_triangle_from_keypoints = AREAKP(N1, N2, N3)
- ARNODE(N) - I am not sure what this does from the description
- element_conected_to_node_n = ENEXTN(N, LOC)
- dofs_active_at_node = NODEDOF(N)
- node_in_position_X_on_face_Y = NDFACE(E, FACE, LOC)
- face_of_element_containing_selected_nodes = NMFACE(E)
- area_of_face_of_element = ARFACE(E)
- attribute_number_assigned_to_element = EATT(E, VAL)
- RCON(R, LOC) - ?
- magnetic_scalar_potential_at_n = MAG(N)
Describe the solution you’d like
all of these (or most of them at least) are spin-offs, or alternatives to the *GET
methods, like shorthand ways to call it. Additionally a number of them are named in tricky ways that class with existing functions (like ESEL
and NSEL
), or are very similar (like NODE
vs NODES
). I think it would make sense to make functions that explain what they are without ambiguity.
Here is my proposed list:
- NODE(X, Y, Z) -
mapdl.get_node_at(x, y, z)
- KP(X, Y, Z) -
mapdl.get_keypoint_at(x, y, z)
- NELEM(N) - ?
- CENTRX(N) -
mapdl.get_centroid(n, x_coord=True, y_coord=False, z_coord=True)
- ELADJ(N) -
mapdl.get_adjacent_element(n, face)
- ESEL(N) -
mapdl.get_element_select_status(n)
- ELNEXT(N) - ?
- SECTOMAT(Sect1, Sect2) - ?
- SECTOREAL(Sect1, Sect2) - ?
- KX(N) -
mapdl.get_keypoint_coords(n, x_coord=True, y_coord=False, z_coord=True)
- KSEL(N) -
mapdl.get_keypoint_select_status(n)
- KPNEXT(N) - ?
- LSEL(N) -
mapdl.get_line_select_status(n)
- LSNEXT(N) - ?
- NX(N) -
mapdl.get_node_coords(n, x_coord=True, y_coord=False, z_coord=True)
- NSEL(N) -
mapdl.get_node_select_status(n)
- NDNEXT(N) - ?
- VSEL(N) -
mapdl.get_volume_select_status(n)
- VLNEXT(N) - ?
- UX(N) -
mapdl.get_node_structural_displacement(n, x_coord=True, y_coord=False, z_coord=True)
- ROTX(N) -
mapdl.get_node_structural_rotation(n, x_coord=True, y_coord=False, z_coord=True)
- TEMP(N) -
mapdl.get_node_temperature(n)
(not sure what to do for the other options - PRES(N) -
mapdl.get_node_pressure(n)
- VOLT(N) -
mapdl.get_node_voltage(n)
- AX(N) -
mapdl.get_node_magnetic_potential_vector(n, x_coord=True, y_coord=False, z_coord=True)
- VX(N) -
mapdl.get_nodal_fluid_velocity(n, x_coord=True, y_coord=False, z_coord=True)
Describe alternatives you’ve considered
we could just use the commands as they are but I think this will be more trouble than it’s worth as the commands are not easy to read and clash with a number of existing commands. Some of these commands may already exist, but I couldn’t find them at first. Additionally I am not sure what the commands should be for some of these because I didn’t fully understand the explanations in the docs.
#353 Suggests one way of implementing features like this, with a class containing the functions themselves
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (14 by maintainers)
Nice work, thanks. I tried several of the *GET inline functions and they work well. One suggestion: it would be helpful to document all that have been implemented. For instance, the docs do not state that enextn(node,loc) has been implemented, but it appears to be working just fine.
So I’ve been thinking about this and I think I’ve changed my mind and I agree with you both. I’ll come up with a draft implementation and see how it goes.