From 31e56beb962f99344b7496be744e51b7dd943556 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Mon, 10 Jan 2022 22:28:34 +0100 Subject: [PATCH 01/39] VM8 almost finishe code, idea how to modify NDIST --- doc/source/_static/vm8_setup.png | Bin 0 -> 7688 bytes ...calculation_of_point_to_point_distances.py | 104 ++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 doc/source/_static/vm8_setup.png create mode 100644 examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py diff --git a/doc/source/_static/vm8_setup.png b/doc/source/_static/vm8_setup.png new file mode 100644 index 0000000000000000000000000000000000000000..d3087b477b4e50af37ff9594f151b847099c7bea GIT binary patch literal 7688 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 b9WLU>Fpra&FG9etw~+a18{=X_eB}QEXkPo9 literal 0 HcmV?d00001 diff --git a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py new file mode 100644 index 00000000000..ba338ee4968 --- /dev/null +++ b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py @@ -0,0 +1,104 @@ +############################################################################### +# Import and start MAPDL. Import math library. +# import math +import math + +from ansys.mapdl.core import launch_mapdl + +mapdl = launch_mapdl() +mapdl.finish() +mapdl.run("/CLEAR,all") +mapdl.prep7() + + +############################################################################### + + +class Create: + def __init__(self, x1, y1, z1, x2, y2, z2): + # Attributes + print("Define Distance") + self.x1 = x1 + self.y1 = y1 + self.z1 = z1 + self.x2 = x2 + self.y2 = y2 + self.z2 = z2 + + def create_kp_method(self): + kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) + kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) + kp_x, kp_y, kp_z = mapdl.kdist(kp1, kp2) + dist_kp = math.sqrt(kp_x ** 2 + kp_y ** 2 + kp_z ** 2) + mapdl.kplot(show_keypoint_numbering=True, + background="black", + show_bounds=True, + font_size=26) + return dist_kp + + def create_node_method(self): + node1 = mapdl.n(x=self.x1, y=self.y1, z=self.z1) + node2 = mapdl.n(x=self.x2, y=self.y2, z=self.z2) + dist_xyz_n = mapdl.ndist(node1, node2) + return dist_xyz_n + # dist_n = math.sqrt(dist_xyz_n[0] ** 2 + dist_xyz_n[1] ** 2 + dist_xyz_n[2] ** 2) + # print(dist_n) + + +kp = Create(1, 2, 3, 10, 20, 30) +kp_dist = kp.create_kp_method() +print(f"Distance between keypoints is: {kp_dist}") +print(f"========================================") +node = Create(1, 2, 3, 10, 20, 30) +print(node.create_node_method()) +node_dist = node.create_node_method() +print(node_dist) +# print(f"Distance between nodes is: {node_dist}") + + + + + + + + +############################################################################### +# CHANGES FOR NDIST + +string_out =""" +Distance between node is: 33.67491648096547 +======================================== +Define Distance +The distance between nodes 1 and 2 in coordinate system 0 is: + DIST DX (ND2-ND1) DY (ND2-ND1) DZ (ND2-ND1) + 33.67491648 9.000000000 18.00000000 27.00000000 +""" +################################# +print(string_out.split()) +################################# + + +################################# +ndsit_x = string_out.split()[-1] +ndsit_y = string_out.split()[-2] +ndsit_z = string_out.split()[-3] +ndsit_DIST = string_out.split()[-4] +print(f"DX: {ndsit_x}\n" + f"DY: {ndsit_y}\n" + f"DZ: {ndsit_z}\n" + f"DIST: {ndsit_DIST}") +################################# +print("\n\n\n") + +################################# +dist_str = string_out.split()[-4] +dist = float(string_out.split()[-4]) +print(f"type of the splited string: {type(dist_str)},\n" + f"where the full automatically calculated distance between is: {dist_str},\n" + f"convertation str to flot: {type(dist)},\n" + f"where the distance is: {dist}") + +################################# + + + From 205d4bc8139bca1f41dc5de1dffd4b28e9655af7 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Thu, 13 Jan 2022 17:21:56 +0100 Subject: [PATCH 02/39] check kp distances and use updates of kdist --- ...calculation_of_point_to_point_distances.py | 63 ------------------- 1 file changed, 63 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py index ba338ee4968..3509b1f9ee9 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py @@ -36,69 +36,6 @@ def create_kp_method(self): font_size=26) return dist_kp - def create_node_method(self): - node1 = mapdl.n(x=self.x1, y=self.y1, z=self.z1) - node2 = mapdl.n(x=self.x2, y=self.y2, z=self.z2) - dist_xyz_n = mapdl.ndist(node1, node2) - return dist_xyz_n - # dist_n = math.sqrt(dist_xyz_n[0] ** 2 + dist_xyz_n[1] ** 2 + dist_xyz_n[2] ** 2) - # print(dist_n) - - kp = Create(1, 2, 3, 10, 20, 30) kp_dist = kp.create_kp_method() print(f"Distance between keypoints is: {kp_dist}") -print(f"========================================") -node = Create(1, 2, 3, 10, 20, 30) -print(node.create_node_method()) -node_dist = node.create_node_method() -print(node_dist) -# print(f"Distance between nodes is: {node_dist}") - - - - - - - - -############################################################################### -# CHANGES FOR NDIST - -string_out =""" -Distance between node is: 33.67491648096547 -======================================== -Define Distance -The distance between nodes 1 and 2 in coordinate system 0 is: - DIST DX (ND2-ND1) DY (ND2-ND1) DZ (ND2-ND1) - 33.67491648 9.000000000 18.00000000 27.00000000 -""" -################################# -print(string_out.split()) -################################# - - -################################# -ndsit_x = string_out.split()[-1] -ndsit_y = string_out.split()[-2] -ndsit_z = string_out.split()[-3] -ndsit_DIST = string_out.split()[-4] -print(f"DX: {ndsit_x}\n" - f"DY: {ndsit_y}\n" - f"DZ: {ndsit_z}\n" - f"DIST: {ndsit_DIST}") -################################# -print("\n\n\n") - -################################# -dist_str = string_out.split()[-4] -dist = float(string_out.split()[-4]) -print(f"type of the splited string: {type(dist_str)},\n" - f"where the full automatically calculated distance between is: {dist_str},\n" - f"convertation str to flot: {type(dist)},\n" - f"where the distance is: {dist}") - -################################# - - - From fe3d08a9831466096bc0236b5feb0ce6c7f0988f Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Thu, 13 Jan 2022 17:59:34 +0100 Subject: [PATCH 03/39] vm8 check --- ..._calculation_of_point_to_point_distances.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py index 3509b1f9ee9..1319a9f68e7 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py @@ -12,7 +12,7 @@ ############################################################################### - +# Main Code class Create: def __init__(self, x1, y1, z1, x2, y2, z2): @@ -28,14 +28,12 @@ def __init__(self, x1, y1, z1, x2, y2, z2): def create_kp_method(self): kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) - kp_x, kp_y, kp_z = mapdl.kdist(kp1, kp2) - dist_kp = math.sqrt(kp_x ** 2 + kp_y ** 2 + kp_z ** 2) - mapdl.kplot(show_keypoint_numbering=True, - background="black", - show_bounds=True, - font_size=26) - return dist_kp + kpdist = mapdl.kdist(kp1, kp2) + # mapdl.kplot(show_keypoint_numbering=True, + # background="black", + # show_bounds=True, + # font_size=26) + return kpdist kp = Create(1, 2, 3, 10, 20, 30) -kp_dist = kp.create_kp_method() -print(f"Distance between keypoints is: {kp_dist}") +print(f"Distance between keypoints is: {kp.create_kp_method()}") From 70b259ea184f7dc882dcb06e9d56438b2ca06e24 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Thu, 13 Jan 2022 18:07:15 +0100 Subject: [PATCH 04/39] almost all code without comments --- examples/06-verif-manual/trywithAlex.py | 39 +++++++++++++++++++ ...calculation_of_point_to_point_distances.py | 35 +++++++++++++---- 2 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 examples/06-verif-manual/trywithAlex.py diff --git a/examples/06-verif-manual/trywithAlex.py b/examples/06-verif-manual/trywithAlex.py new file mode 100644 index 00000000000..1319a9f68e7 --- /dev/null +++ b/examples/06-verif-manual/trywithAlex.py @@ -0,0 +1,39 @@ +############################################################################### +# Import and start MAPDL. Import math library. +# import math +import math + +from ansys.mapdl.core import launch_mapdl + +mapdl = launch_mapdl() +mapdl.finish() +mapdl.run("/CLEAR,all") +mapdl.prep7() + + +############################################################################### +# Main Code + +class Create: + def __init__(self, x1, y1, z1, x2, y2, z2): + # Attributes + print("Define Distance") + self.x1 = x1 + self.y1 = y1 + self.z1 = z1 + self.x2 = x2 + self.y2 = y2 + self.z2 = z2 + + def create_kp_method(self): + kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) + kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) + kpdist = mapdl.kdist(kp1, kp2) + # mapdl.kplot(show_keypoint_numbering=True, + # background="black", + # show_bounds=True, + # font_size=26) + return kpdist + +kp = Create(1, 2, 3, 10, 20, 30) +print(f"Distance between keypoints is: {kp.create_kp_method()}") diff --git a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py index 1319a9f68e7..5cc0654a24b 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py @@ -12,7 +12,7 @@ ############################################################################### -# Main Code + class Create: def __init__(self, x1, y1, z1, x2, y2, z2): @@ -28,12 +28,31 @@ def __init__(self, x1, y1, z1, x2, y2, z2): def create_kp_method(self): kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) - kpdist = mapdl.kdist(kp1, kp2) - # mapdl.kplot(show_keypoint_numbering=True, - # background="black", - # show_bounds=True, - # font_size=26) - return kpdist + kp_x, kp_y, kp_z = mapdl.kdist(kp1, kp2) + dist_kp = math.sqrt(kp_x ** 2 + kp_y ** 2 + kp_z ** 2) + mapdl.kplot(show_keypoint_numbering=True, + background="black", + show_bounds=True, + font_size=26) + return dist_kp + + def create_node_method(self): + node1 = mapdl.n(x=self.x1, y=self.y1, z=self.z1) + node2 = mapdl.n(x=self.x2, y=self.y2, z=self.z2) + dist_xyz_n = mapdl.ndist(node1, node2) + return dist_xyz_n + # dist_n = math.sqrt(dist_xyz_n[0] ** 2 + dist_xyz_n[1] ** 2 + dist_xyz_n[2] ** 2) + # print(dist_n) + kp = Create(1, 2, 3, 10, 20, 30) -print(f"Distance between keypoints is: {kp.create_kp_method()}") +kp_dist = kp.create_kp_method() +print(f"Distance between keypoints is: {kp_dist}") +print(f"========================================") +node = Create(1, 2, 3, 10, 20, 30) +node_dist = node.create_node_method() +print(node_dist) +print(f"Distance between nodes is: {node_dist}") + + + From 111be7d4c2fc8da4fe6d7694c411b89d8301e109 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Mon, 17 Jan 2022 11:01:45 +0100 Subject: [PATCH 05/39] deleted unnecessary files --- examples/06-verif-manual/trywithAlex.py | 39 ------------------------- 1 file changed, 39 deletions(-) delete mode 100644 examples/06-verif-manual/trywithAlex.py diff --git a/examples/06-verif-manual/trywithAlex.py b/examples/06-verif-manual/trywithAlex.py deleted file mode 100644 index 1319a9f68e7..00000000000 --- a/examples/06-verif-manual/trywithAlex.py +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################### -# Import and start MAPDL. Import math library. -# import math -import math - -from ansys.mapdl.core import launch_mapdl - -mapdl = launch_mapdl() -mapdl.finish() -mapdl.run("/CLEAR,all") -mapdl.prep7() - - -############################################################################### -# Main Code - -class Create: - def __init__(self, x1, y1, z1, x2, y2, z2): - # Attributes - print("Define Distance") - self.x1 = x1 - self.y1 = y1 - self.z1 = z1 - self.x2 = x2 - self.y2 = y2 - self.z2 = z2 - - def create_kp_method(self): - kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) - kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) - kpdist = mapdl.kdist(kp1, kp2) - # mapdl.kplot(show_keypoint_numbering=True, - # background="black", - # show_bounds=True, - # font_size=26) - return kpdist - -kp = Create(1, 2, 3, 10, 20, 30) -print(f"Distance between keypoints is: {kp.create_kp_method()}") From e073346d46344cc53e18bc567d28d5d9c102b169 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Mon, 17 Jan 2022 11:11:37 +0100 Subject: [PATCH 06/39] deleted old file without ndist and kdist functionality --- ...calculation_of_point_to_point_distances.py | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py diff --git a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py b/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py deleted file mode 100644 index 5cc0654a24b..00000000000 --- a/examples/06-verif-manual/vm-008-parametric_calculation_of_point_to_point_distances.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################### -# Import and start MAPDL. Import math library. -# import math -import math - -from ansys.mapdl.core import launch_mapdl - -mapdl = launch_mapdl() -mapdl.finish() -mapdl.run("/CLEAR,all") -mapdl.prep7() - - -############################################################################### - - -class Create: - def __init__(self, x1, y1, z1, x2, y2, z2): - # Attributes - print("Define Distance") - self.x1 = x1 - self.y1 = y1 - self.z1 = z1 - self.x2 = x2 - self.y2 = y2 - self.z2 = z2 - - def create_kp_method(self): - kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) - kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) - kp_x, kp_y, kp_z = mapdl.kdist(kp1, kp2) - dist_kp = math.sqrt(kp_x ** 2 + kp_y ** 2 + kp_z ** 2) - mapdl.kplot(show_keypoint_numbering=True, - background="black", - show_bounds=True, - font_size=26) - return dist_kp - - def create_node_method(self): - node1 = mapdl.n(x=self.x1, y=self.y1, z=self.z1) - node2 = mapdl.n(x=self.x2, y=self.y2, z=self.z2) - dist_xyz_n = mapdl.ndist(node1, node2) - return dist_xyz_n - # dist_n = math.sqrt(dist_xyz_n[0] ** 2 + dist_xyz_n[1] ** 2 + dist_xyz_n[2] ** 2) - # print(dist_n) - - -kp = Create(1, 2, 3, 10, 20, 30) -kp_dist = kp.create_kp_method() -print(f"Distance between keypoints is: {kp_dist}") -print(f"========================================") -node = Create(1, 2, 3, 10, 20, 30) -node_dist = node.create_node_method() -print(node_dist) -print(f"Distance between nodes is: {node_dist}") - - - From d4b8eba07a8ff8b93092c18213b8cb5e4c10b231 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Mon, 17 Jan 2022 11:45:11 +0100 Subject: [PATCH 07/39] removed old file and created new one to check kdist functionality --- .../vm-008-parametric_calculation.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 examples/06-verif-manual/vm-008-parametric_calculation.py diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py new file mode 100644 index 00000000000..3815ce43005 --- /dev/null +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -0,0 +1,44 @@ +############################################################################### +# Import and start MAPDL. Import math library. +# import math +import math + +from ansys.mapdl.core import launch_mapdl + +mapdl = launch_mapdl() +mapdl.finish() +mapdl.run("/CLEAR,all") +mapdl.prep7() + + +############################################################################### + + +class Create: + def __init__(self, x1, y1, z1, x2, y2, z2): + # Attributes + print("Define Distance") + self.x1 = x1 + self.y1 = y1 + self.z1 = z1 + self.x2 = x2 + self.y2 = y2 + self.z2 = z2 + + def create_kp_method(self): + kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) + kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) + dist_kp = mapdl.kdist(kp1, kp2) + mapdl.kplot(show_keypoint_numbering=True, + background="black", + show_bounds=True, + font_size=26) + return dist_kp + + +kp = Create(1, 2, 3, 10, 20, 30) +kp_dist = kp.create_kp_method() +print(kp_dist) + + + From a65b146dd523be12ff006b4240406d7b251b07fe Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Mon, 17 Jan 2022 12:20:06 +0100 Subject: [PATCH 08/39] Full script without comments --- .../vm-008-parametric_calculation.py | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 3815ce43005..fdc88035538 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -17,7 +17,6 @@ class Create: def __init__(self, x1, y1, z1, x2, y2, z2): # Attributes - print("Define Distance") self.x1 = x1 self.y1 = y1 self.z1 = z1 @@ -28,17 +27,29 @@ def __init__(self, x1, y1, z1, x2, y2, z2): def create_kp_method(self): kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) - dist_kp = mapdl.kdist(kp1, kp2) + dist_kp, kx, ky, kz = mapdl.kdist(kp1, kp2) mapdl.kplot(show_keypoint_numbering=True, - background="black", + background="grey", show_bounds=True, font_size=26) - return dist_kp - - -kp = Create(1, 2, 3, 10, 20, 30) -kp_dist = kp.create_kp_method() -print(kp_dist) + return dist_kp, mapdl.klist() + def create_node_method(self): + node1 = mapdl.n(x=self.x1, y=self.y1, z=self.z1) + node2 = mapdl.n(x=self.x2, y=self.y2, z=self.z2) + dist_node, node_x, node_y, node_z = mapdl.ndist(node1, node2) + mapdl.nplot(background="green", + show_bounds=True, + font_size=26) + return dist_node, mapdl.nlist() +kp = Create(1, 2, 3, 10, 20, 30) +kp_dist, keypoint_list = kp.create_kp_method() +print(f"Distance between keypoint is: {kp_dist},\n\n\n" + f"{keypoint_list}") + +nodes = Create(1, 200, 3, 10, 20, 300) +node_dist, node_list = nodes.create_node_method() +print(f"Distance between nodes is: {node_dist},\n\n\n" + f"{node_list}") From ed1e24f04157d16564d9680938a623d0dece0c98 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Mon, 17 Jan 2022 14:25:38 +0100 Subject: [PATCH 09/39] extra modifications --- .idea/misc.xml | 3 + .../vm-008-parametric_calculation.py | 167 +++++++++++++++++- 2 files changed, 162 insertions(+), 8 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 1d209eafc7f..d734b5efd52 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ + + \ No newline at end of file diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index fdc88035538..fc718dd30dd 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -1,18 +1,75 @@ +r""" +.. _ref_vm8_example: + +Parametric Calculation +---------------------- +Problem Description: + - Write a user file macro to calculate the distance d between either nodes + or keypoints in ``PREP7``. Define abbreviations for calling the macro and + verify the parametric expressions by using the macro to calculate + the distance between nodes :math:`N_1` and :math:`N_2` and + between keypoints :math:`K_3` and :math:`K_4`. + +Reference: + - None. + +Analysis Type(s): + - Parametric Arithmetic + +Element Type: + - None. + +Geometric Properties(Coordinates): + - :math:`N_{\mathrm{1(x,y,z)}} = 1.5, 2.5, 3.5` + - :math:`N_{\mathrm{2(x,y,z)}} = -3.7, 4.6, -3` + - :math:`K_{\mathrm{3(x,y,z)}} = 100, 0, 30` + - :math:`K_{\mathrm{4(x,y,z)}} = -200,25,80` + +.. image:: ../../_static/vm8_setup.png + :width: 300 + :alt: VM8 Problem Sketch + +Analysis Assumptions and Modeling Notes: + - The user file is created by the *CREATE command within the run. + In normal use, this file would most likely already exist locally. + Colons are used in the user file to create non-echoing comments (the colon + character specifies a branching label in Mechanical APDL). + The active coordinate system is saved and restored within the macro to ensure + Cartesian coordinates in the distance calculations and to re-establish + the active coordinate system after the macro is used. Lowercase input + is used throughout. Input case is preserved by Mechanical APDL where + appropriate (system-dependent). + + +""" +# sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' + ############################################################################### -# Import and start MAPDL. Import math library. -# import math -import math +# Start MAPDL +# ~~~~~~~~~~~ + +import numpy as np +import pandas as pd from ansys.mapdl.core import launch_mapdl +# Start MAPDL. mapdl = launch_mapdl() -mapdl.finish() -mapdl.run("/CLEAR,all") -mapdl.prep7() ############################################################################### +# Pre-Processing +# ~~~~~~~~~~~~~~ +# Enter verification example mode and the pre-processing routine. +mapdl.clear() +mapdl.verify() +_ = mapdl.prep7() + + +############################################################################### +# Pre-Processing +# ~~~~~~~~~~~~~~ class Create: def __init__(self, x1, y1, z1, x2, y2, z2): @@ -43,13 +100,107 @@ def create_node_method(self): font_size=26) return dist_node, mapdl.nlist() +############################################################################### +# Distance between keypoints. + kp = Create(1, 2, 3, 10, 20, 30) kp_dist, keypoint_list = kp.create_kp_method() -print(f"Distance between keypoint is: {kp_dist},\n\n\n" +print(f"Distance between keypoint is: {kp_dist},\n" f"{keypoint_list}") + +############################################################################### +# Distance between nodes. + nodes = Create(1, 200, 3, 10, 20, 300) node_dist, node_list = nodes.create_node_method() -print(f"Distance between nodes is: {node_dist},\n\n\n" +print(f"Distance between nodes is: {node_dist},\n" f"{node_list}") + + +# ############################################################################### +# # Check Results +# # ~~~~~~~~~~~~~ +# # Finally we have the results of the loads for the simplified axisymmetric model, +# # which can be compared with expected target values for models with ``PIPE288``, +# # ``SOLID185``, and ``SHELL181`` elements. Loads expected for each load step are: +# # +# # - 1st Load Step with deflection :math:`\delta = 0.032 (in)` has :math:`load_1 = 1024400\,(lb)`. +# # - 2nd Load Step with deflection :math:`\delta = 0.05 (in)` has :math:`load_2 = 1262000\,(lb)`. +# # - 3rd Load Step with deflection :math:`\delta = 0.1 (in)` has :math:`load_3 = 1262000\,(lb)`. +# +# target_res = np.asarray([1024400, 1262000, 1262000, +# 1024400, 1262000, 1262000, +# 1024400, 1262000, 1262000]) +# +# simulation_res = np.asarray([pipe288_ls1, pipe288_ls2, pipe288_ls2, +# solid185_ls1, solid185_ls2, solid185_ls3, +# shell181_ls1, shell181_ls2, shell181_ls3]) +# +# main_columns = { +# "Target": target_res, +# "Mechanical APDL": simulation_res, +# "Ratio": list(np.divide(simulation_res, target_res)) +# } +# +# row_tuple = [("PIPE288", "Load, lb for Deflection = 0.032 in"), +# ("PIPE288", "Load, lb for Deflection = 0.05 in"), +# ("PIPE288", "Load, lb for Deflection = 0.1 in"), +# +# ("SOLID185", "Load, lb for Deflection = 0.032 in"), +# ("SOLID185", "Load, lb for Deflection = 0.05 in"), +# ("SOLID185", "Load, lb for Deflection = 0.1 in"), +# +# ("SHELL181", "Load, lb for Deflection = 0.032 in"), +# ("SHELL181", "Load, lb for Deflection = 0.05 in"), +# ("SHELL181", "Load, lb for Deflection = 0.1 in")] +# +# index_names = ["Element Type", "Load Step"] +# row_indexing = pd.MultiIndex.from_tuples(row_tuple) +# df = pd.DataFrame(main_columns, index=row_indexing) +# +# df.style.set_caption('Results Comparison', +# ).set_table_styles([ +# { +# "selector": "th.col_heading", +# "props": [("background-color", "#FFEFD5"), +# ("color", "black"), +# ("border", "0.5px solid black"), +# ("font-style", "italic"), +# ("text-align", "center")] +# }, +# { +# "selector": "th.row_heading", +# "props": [("background-color", "#FFEFD5"), +# ("color", "black"), +# ("border", "0.5px solid black"), +# ("font-style", "italic"), +# ("text-align", "center")] +# }, +# { +# "selector": "td:hover", +# "props": [("background-color", "#FFF8DC")] +# }, +# { +# "selector": "th", +# "props": [("max-width", '120px')] +# }, +# { +# "selector": "", +# "props": [('border', '0.5px solid black')] +# }, +# { +# 'selector': 'caption', +# 'props': [('color', 'black'), +# ("font-style", "italic"), +# ('font-size', '24px'), +# ("text-align", "center")] +# }], +# ).set_properties(**{ +# "background-color": "#FFFAFA", +# "color": "black", +# "border-color": "black", +# "border-width": "0.5px", +# "border-style": "solid", +# "text-align": "center"}).format("{:.3f}") From b02a745ba1c0af03b445f18ef6e5b7ee64f7849e Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Mon, 17 Jan 2022 14:52:40 +0100 Subject: [PATCH 10/39] check vm8 --- .idea/pymapdl.iml | 1 + examples/06-verif-manual/vm-008-parametric_calculation.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.idea/pymapdl.iml b/.idea/pymapdl.iml index 5195124935e..490ac2ef3e6 100644 --- a/.idea/pymapdl.iml +++ b/.idea/pymapdl.iml @@ -2,6 +2,7 @@ + diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index fc718dd30dd..65b56f99e31 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -48,8 +48,8 @@ # Start MAPDL # ~~~~~~~~~~~ -import numpy as np -import pandas as pd +# import numpy as np +# import pandas as pd from ansys.mapdl.core import launch_mapdl From 8816dd3f6e5de57c5ca53052d70b34ee65f60af1 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 13:07:25 +0100 Subject: [PATCH 11/39] updated and simplified pandas dataframe with output results --- .../vm-008-parametric_calculation.py | 152 ++++++++---------- 1 file changed, 63 insertions(+), 89 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 65b56f99e31..d8a0ecae231 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -73,7 +73,7 @@ class Create: def __init__(self, x1, y1, z1, x2, y2, z2): - # Attributes + # Coordinate Attributes self.x1 = x1 self.y1 = y1 self.z1 = z1 @@ -81,6 +81,7 @@ def __init__(self, x1, y1, z1, x2, y2, z2): self.y2 = y2 self.z2 = z2 + # Method def create_kp_method(self): kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) @@ -101,10 +102,10 @@ def create_node_method(self): return dist_node, mapdl.nlist() ############################################################################### -# Distance between keypoints. +# Distance between keypoints +# ~~~~~~~~~~~~~~~~~~~~~~~~~~ - -kp = Create(1, 2, 3, 10, 20, 30) +kp = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) kp_dist, keypoint_list = kp.create_kp_method() print(f"Distance between keypoint is: {kp_dist},\n" f"{keypoint_list}") @@ -112,95 +113,68 @@ def create_node_method(self): ############################################################################### # Distance between nodes. +# ~~~~~~~~~~~~~~~~~~~~~~~~~~ -nodes = Create(1, 200, 3, 10, 20, 300) +nodes = Create(100, 0, 30, -200, 25, 80) node_dist, node_list = nodes.create_node_method() print(f"Distance between nodes is: {node_dist},\n" f"{node_list}") -# ############################################################################### -# # Check Results -# # ~~~~~~~~~~~~~ -# # Finally we have the results of the loads for the simplified axisymmetric model, -# # which can be compared with expected target values for models with ``PIPE288``, -# # ``SOLID185``, and ``SHELL181`` elements. Loads expected for each load step are: -# # -# # - 1st Load Step with deflection :math:`\delta = 0.032 (in)` has :math:`load_1 = 1024400\,(lb)`. -# # - 2nd Load Step with deflection :math:`\delta = 0.05 (in)` has :math:`load_2 = 1262000\,(lb)`. -# # - 3rd Load Step with deflection :math:`\delta = 0.1 (in)` has :math:`load_3 = 1262000\,(lb)`. -# -# target_res = np.asarray([1024400, 1262000, 1262000, -# 1024400, 1262000, 1262000, -# 1024400, 1262000, 1262000]) -# -# simulation_res = np.asarray([pipe288_ls1, pipe288_ls2, pipe288_ls2, -# solid185_ls1, solid185_ls2, solid185_ls3, -# shell181_ls1, shell181_ls2, shell181_ls3]) -# -# main_columns = { -# "Target": target_res, -# "Mechanical APDL": simulation_res, -# "Ratio": list(np.divide(simulation_res, target_res)) -# } -# -# row_tuple = [("PIPE288", "Load, lb for Deflection = 0.032 in"), -# ("PIPE288", "Load, lb for Deflection = 0.05 in"), -# ("PIPE288", "Load, lb for Deflection = 0.1 in"), -# -# ("SOLID185", "Load, lb for Deflection = 0.032 in"), -# ("SOLID185", "Load, lb for Deflection = 0.05 in"), -# ("SOLID185", "Load, lb for Deflection = 0.1 in"), -# -# ("SHELL181", "Load, lb for Deflection = 0.032 in"), -# ("SHELL181", "Load, lb for Deflection = 0.05 in"), -# ("SHELL181", "Load, lb for Deflection = 0.1 in")] -# -# index_names = ["Element Type", "Load Step"] -# row_indexing = pd.MultiIndex.from_tuples(row_tuple) -# df = pd.DataFrame(main_columns, index=row_indexing) +############################################################################### +# Check Results +# ~~~~~~~~~~~~~ + +# Finally we have the results of the loads for the simplified axisymmetric model, +# which can be compared with expected target values for models with ``PIPE288``, +# ``SOLID185``, and ``SHELL181`` elements. Loads expected for each load step are: # -# df.style.set_caption('Results Comparison', -# ).set_table_styles([ -# { -# "selector": "th.col_heading", -# "props": [("background-color", "#FFEFD5"), -# ("color", "black"), -# ("border", "0.5px solid black"), -# ("font-style", "italic"), -# ("text-align", "center")] -# }, -# { -# "selector": "th.row_heading", -# "props": [("background-color", "#FFEFD5"), -# ("color", "black"), -# ("border", "0.5px solid black"), -# ("font-style", "italic"), -# ("text-align", "center")] -# }, -# { -# "selector": "td:hover", -# "props": [("background-color", "#FFF8DC")] -# }, -# { -# "selector": "th", -# "props": [("max-width", '120px')] -# }, -# { -# "selector": "", -# "props": [('border', '0.5px solid black')] -# }, -# { -# 'selector': 'caption', -# 'props': [('color', 'black'), -# ("font-style", "italic"), -# ('font-size', '24px'), -# ("text-align", "center")] -# }], -# ).set_properties(**{ -# "background-color": "#FFFAFA", -# "color": "black", -# "border-color": "black", -# "border-width": "0.5px", -# "border-style": "solid", -# "text-align": "center"}).format("{:.3f}") +# - 1st Load Step with deflection :math:`\delta = 0.032 (in)` has :math:`load_1 = 1024400\,(lb)`. +# - 2nd Load Step with deflection :math:`\delta = 0.05 (in)` has :math:`load_2 = 1262000\,(lb)`. +# - 3rd Load Step with deflection :math:`\delta = 0.1 (in)` has :math:`load_3 = 1262000\,(lb)`. + +import numpy as np +import pandas as pd + + +row_names = ["N1 - N2 distance (LEN2)", + "K3 - K4 distance (LEN1)"] + +col_names = ['Target', + 'Mechanical APDL', + 'RATIO'] + + +target_res = np.asarray([8.5849, + 305.16]) + +simulation_res = np.asarray([kp_dist, node_dist]) + +main_columns = { + "Target": target_res, + "Mechanical APDL": simulation_res, + "Ratio": list(np.divide(simulation_res, target_res)) +} + +df2 = pd.DataFrame(main_columns, index=row_names) + + +df2.style.set_table_styles([ + { + "selector": "th", + "props": [('font-size', '16px')] + }, + { + "selector": "td", + "props": [('font-size', '16px')] + }, + { + "selector": "td:hover", + "props": [("background-color", "#FFF8DC")] + }], +).set_properties(** + { + "color": "black", + "text-align": "center" + }, +).format("{:.2f}") From a6855d730a2146d712fe4a496dd89078beebbdf3 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 14:27:04 +0100 Subject: [PATCH 12/39] Modified Output dataframe and added comments --- .../vm-008-parametric_calculation.py | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index d8a0ecae231..c9d39a1c8a4 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -48,8 +48,8 @@ # Start MAPDL # ~~~~~~~~~~~ -# import numpy as np -# import pandas as pd +import numpy as np +import pandas as pd from ansys.mapdl.core import launch_mapdl @@ -73,7 +73,7 @@ class Create: def __init__(self, x1, y1, z1, x2, y2, z2): - # Coordinate Attributes + # Coordinate Attributes. self.x1 = x1 self.y1 = y1 self.z1 = z1 @@ -81,11 +81,16 @@ def __init__(self, x1, y1, z1, x2, y2, z2): self.y2 = y2 self.z2 = z2 - # Method def create_kp_method(self): + + # Define keypoints by coordinates. kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) + + # Get the distance between keypoints. dist_kp, kx, ky, kz = mapdl.kdist(kp1, kp2) + + # Plot keypoints. mapdl.kplot(show_keypoint_numbering=True, background="grey", show_bounds=True, @@ -93,10 +98,16 @@ def create_kp_method(self): return dist_kp, mapdl.klist() def create_node_method(self): + + # Define nodes by coordinates. node1 = mapdl.n(x=self.x1, y=self.y1, z=self.z1) node2 = mapdl.n(x=self.x2, y=self.y2, z=self.z2) + + # Get the distance between nodes. dist_node, node_x, node_y, node_z = mapdl.ndist(node1, node2) - mapdl.nplot(background="green", + + # Plot nodes. + mapdl.nplot(background="grey", show_bounds=True, font_size=26) return dist_node, mapdl.nlist() @@ -104,16 +115,18 @@ def create_node_method(self): ############################################################################### # Distance between keypoints # ~~~~~~~~~~~~~~~~~~~~~~~~~~ +# kp = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) kp_dist, keypoint_list = kp.create_kp_method() -print(f"Distance between keypoint is: {kp_dist},\n" +print(f"Distance between keypoint is: {kp_dist}\n\n" f"{keypoint_list}") ############################################################################### # Distance between nodes. # ~~~~~~~~~~~~~~~~~~~~~~~~~~ +# nodes = Create(100, 0, 30, -200, 25, 80) node_dist, node_list = nodes.create_node_method() @@ -124,41 +137,38 @@ def create_node_method(self): ############################################################################### # Check Results # ~~~~~~~~~~~~~ - -# Finally we have the results of the loads for the simplified axisymmetric model, -# which can be compared with expected target values for models with ``PIPE288``, -# ``SOLID185``, and ``SHELL181`` elements. Loads expected for each load step are: +# Finally we have the results of the distances for both simulations, +# which can be compared with expected target values: # -# - 1st Load Step with deflection :math:`\delta = 0.032 (in)` has :math:`load_1 = 1024400\,(lb)`. -# - 2nd Load Step with deflection :math:`\delta = 0.05 (in)` has :math:`load_2 = 1262000\,(lb)`. -# - 3rd Load Step with deflection :math:`\delta = 0.1 (in)` has :math:`load_3 = 1262000\,(lb)`. - -import numpy as np -import pandas as pd - +# - 1st simulation to get the distance between keypoints `K_3` and `K_4`, where `LEN_1 = 8.58\,(in)`. +# - 2nd simulation to get the distance between nodes `N_1` and `N_2`, where `LEN_2 = 305.16\,(in)`. +# Define the names of the rows. row_names = ["N1 - N2 distance (LEN2)", "K3 - K4 distance (LEN1)"] +# Define the names of the columns. col_names = ['Target', 'Mechanical APDL', 'RATIO'] +# Define the values of the target results. +target_res = np.asarray([8.5849, 305.16]) -target_res = np.asarray([8.5849, - 305.16]) - +# Create an array with outputs of the simulations. simulation_res = np.asarray([kp_dist, node_dist]) +# Identifying and filling corresponding columns. main_columns = { "Target": target_res, "Mechanical APDL": simulation_res, "Ratio": list(np.divide(simulation_res, target_res)) } +# Create and fill the output dataframe with pandas. df2 = pd.DataFrame(main_columns, index=row_names) - +# Apply style settings for the dataframe. df2.style.set_table_styles([ { "selector": "th", From e9a440dd5301c09bb0d38ca62bb52544588dee23 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 14:32:18 +0100 Subject: [PATCH 13/39] Modified LaTex style at the Check Output --- examples/06-verif-manual/vm-008-parametric_calculation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index c9d39a1c8a4..79469ac52a8 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -130,7 +130,7 @@ def create_node_method(self): nodes = Create(100, 0, 30, -200, 25, 80) node_dist, node_list = nodes.create_node_method() -print(f"Distance between nodes is: {node_dist},\n" +print(f"Distance between nodes is: {node_dist}\n\n" f"{node_list}") @@ -140,8 +140,8 @@ def create_node_method(self): # Finally we have the results of the distances for both simulations, # which can be compared with expected target values: # -# - 1st simulation to get the distance between keypoints `K_3` and `K_4`, where `LEN_1 = 8.58\,(in)`. -# - 2nd simulation to get the distance between nodes `N_1` and `N_2`, where `LEN_2 = 305.16\,(in)`. +# - 1st simulation to get the distance between keypoints :math:`K_3` and :math:`K_4`, where :math:`LEN_1 = 8.58\,(in)`. +# - 2nd simulation to get the distance between nodes :math:`N_1` and :math:`N_2`, where :math:`LEN_2 = 305.16\,(in)`. # Define the names of the rows. row_names = ["N1 - N2 distance (LEN2)", From 763a85872594c4b5da02eb6821428b27828456c9 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 14:35:43 +0100 Subject: [PATCH 14/39] add numbers of the kps and nodes --- examples/06-verif-manual/vm-008-parametric_calculation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 79469ac52a8..6a11e89a601 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -84,8 +84,8 @@ def __init__(self, x1, y1, z1, x2, y2, z2): def create_kp_method(self): # Define keypoints by coordinates. - kp1 = mapdl.k(x=self.x1, y=self.y1, z=self.z1) - kp2 = mapdl.k(x=self.x2, y=self.y2, z=self.z2) + kp1 = mapdl.k(npt=3, x=self.x1, y=self.y1, z=self.z1) + kp2 = mapdl.k(npt=4, x=self.x2, y=self.y2, z=self.z2) # Get the distance between keypoints. dist_kp, kx, ky, kz = mapdl.kdist(kp1, kp2) @@ -100,8 +100,8 @@ def create_kp_method(self): def create_node_method(self): # Define nodes by coordinates. - node1 = mapdl.n(x=self.x1, y=self.y1, z=self.z1) - node2 = mapdl.n(x=self.x2, y=self.y2, z=self.z2) + node1 = mapdl.n(node=1, x=self.x1, y=self.y1, z=self.z1) + node2 = mapdl.n(node=2, x=self.x2, y=self.y2, z=self.z2) # Get the distance between nodes. dist_node, node_x, node_y, node_z = mapdl.ndist(node1, node2) From a1594a20eee258a2defa01c3aa78d2af5f65f9f5 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 14:38:35 +0100 Subject: [PATCH 15/39] Added f-string properties to the print outputs --- examples/06-verif-manual/vm-008-parametric_calculation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 6a11e89a601..be71504566c 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -119,7 +119,7 @@ def create_node_method(self): kp = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) kp_dist, keypoint_list = kp.create_kp_method() -print(f"Distance between keypoint is: {kp_dist}\n\n" +print(f"Distance between keypoint is: {kp_dist:.2f}\n\n" f"{keypoint_list}") @@ -130,7 +130,7 @@ def create_node_method(self): nodes = Create(100, 0, 30, -200, 25, 80) node_dist, node_list = nodes.create_node_method() -print(f"Distance between nodes is: {node_dist}\n\n" +print(f"Distance between nodes is: {node_dist:.2f}\n\n" f"{node_list}") From 7ab16d1741629bf9e2d8cd3e404346ef3633f093 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 14:42:31 +0100 Subject: [PATCH 16/39] Added vtk and numbering to the kps and nodes plotting --- examples/06-verif-manual/vm-008-parametric_calculation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index be71504566c..1a0a097acc1 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -92,6 +92,7 @@ def create_kp_method(self): # Plot keypoints. mapdl.kplot(show_keypoint_numbering=True, + vtk=True, background="grey", show_bounds=True, font_size=26) @@ -107,7 +108,9 @@ def create_node_method(self): dist_node, node_x, node_y, node_z = mapdl.ndist(node1, node2) # Plot nodes. - mapdl.nplot(background="grey", + mapdl.nplot(nnum=True, + vtk=True, + color="grey", show_bounds=True, font_size=26) return dist_node, mapdl.nlist() From c1ad6556c5c6cd51ae21284e1494b850f8b32853 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 14:55:02 +0100 Subject: [PATCH 17/39] adding description --- .../06-verif-manual/vm-008-parametric_calculation.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 1a0a097acc1..332e3ecfb30 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -70,6 +70,9 @@ ############################################################################### # Pre-Processing # ~~~~~~~~~~~~~~ +# Identifying the class ```create`` with methods ``create_kp_method`` and +# ``create_node_method`` to calculate and plot the distances between keypoints +# and nodes. class Create: def __init__(self, x1, y1, z1, x2, y2, z2): @@ -115,10 +118,15 @@ def create_node_method(self): font_size=26) return dist_node, mapdl.nlist() + ############################################################################### # Distance between keypoints # ~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Using already created method for keypoints to get the distance between them +# and print out an output. The keypoints have got next coordinates: # +# - :math:`K_{\mathrm{3(x,y,z)}} = 100, 0, 30` +# - :math:`K_{\mathrm{4(x,y,z)}} = -200,25,80` kp = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) kp_dist, keypoint_list = kp.create_kp_method() @@ -129,7 +137,11 @@ def create_node_method(self): ############################################################################### # Distance between nodes. # ~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Using already created method for nodes to get the distance between them and +# print out an output. The nodes have got next coordinates: # +# - :math:`N_{\mathrm{1(x,y,z)}} = 1.5, 2.5, 3.5` +# - :math:`N_{\mathrm{2(x,y,z)}} = -3.7, 4.6, -3` nodes = Create(100, 0, 30, -200, 25, 80) node_dist, node_list = nodes.create_node_method() From 36985e5b1eeb11f1df6952069114f9d7d015a1c3 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 14:59:03 +0100 Subject: [PATCH 18/39] chaged a style inside of the keypoint and node topic --- .../06-verif-manual/vm-008-parametric_calculation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 332e3ecfb30..8ff3c31c80d 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -70,7 +70,7 @@ ############################################################################### # Pre-Processing # ~~~~~~~~~~~~~~ -# Identifying the class ```create`` with methods ``create_kp_method`` and +# Identifying the class ``create`` with methods ``create_kp_method`` and # ``create_node_method`` to calculate and plot the distances between keypoints # and nodes. @@ -125,8 +125,8 @@ def create_node_method(self): # Using already created method for keypoints to get the distance between them # and print out an output. The keypoints have got next coordinates: # -# - :math:`K_{\mathrm{3(x,y,z)}} = 100, 0, 30` -# - :math:`K_{\mathrm{4(x,y,z)}} = -200,25,80` +# * :math:`K_{\mathrm{3(x,y,z)}} = 100, 0, 30` +# * :math:`K_{\mathrm{4(x,y,z)}} = -200,25,80` kp = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) kp_dist, keypoint_list = kp.create_kp_method() @@ -140,8 +140,8 @@ def create_node_method(self): # Using already created method for nodes to get the distance between them and # print out an output. The nodes have got next coordinates: # -# - :math:`N_{\mathrm{1(x,y,z)}} = 1.5, 2.5, 3.5` -# - :math:`N_{\mathrm{2(x,y,z)}} = -3.7, 4.6, -3` +# * :math:`N_{\mathrm{1(x,y,z)}} = 1.5, 2.5, 3.5` +# * :math:`N_{\mathrm{2(x,y,z)}} = -3.7, 4.6, -3` nodes = Create(100, 0, 30, -200, 25, 80) node_dist, node_list = nodes.create_node_method() From c1c4ca503f45e79defb16c3f85b96de0d2bbedd4 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 15:39:01 +0100 Subject: [PATCH 19/39] fixed some mistakes of the description --- .../vm-008-parametric_calculation.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 8ff3c31c80d..a9dce61b4b1 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -14,7 +14,7 @@ - None. Analysis Type(s): - - Parametric Arithmetic + - Parametric Arithmetic. Element Type: - None. @@ -128,7 +128,7 @@ def create_node_method(self): # * :math:`K_{\mathrm{3(x,y,z)}} = 100, 0, 30` # * :math:`K_{\mathrm{4(x,y,z)}} = -200,25,80` -kp = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) +kp = Create(100, 0, 30, -200, 25, 80) kp_dist, keypoint_list = kp.create_kp_method() print(f"Distance between keypoint is: {kp_dist:.2f}\n\n" f"{keypoint_list}") @@ -143,7 +143,7 @@ def create_node_method(self): # * :math:`N_{\mathrm{1(x,y,z)}} = 1.5, 2.5, 3.5` # * :math:`N_{\mathrm{2(x,y,z)}} = -3.7, 4.6, -3` -nodes = Create(100, 0, 30, -200, 25, 80) +nodes = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) node_dist, node_list = nodes.create_node_method() print(f"Distance between nodes is: {node_dist:.2f}\n\n" f"{node_list}") @@ -155,8 +155,11 @@ def create_node_method(self): # Finally we have the results of the distances for both simulations, # which can be compared with expected target values: # -# - 1st simulation to get the distance between keypoints :math:`K_3` and :math:`K_4`, where :math:`LEN_1 = 8.58\,(in)`. -# - 2nd simulation to get the distance between nodes :math:`N_1` and :math:`N_2`, where :math:`LEN_2 = 305.16\,(in)`. +# - 1st simulation to get the distance between keypoints :math:`K_3` and :math:`K_4`, where :math:`LEN_1 = 305.16\,(in)`. +# - 2nd simulation to get the distance between nodes :math:`N_1` and :math:`N_2`, where :math:`LEN_2 = 8.58\,(in)`. +# +# For better representation of the results we can use ``pandas`` dataframe +# with following settings below: # Define the names of the rows. row_names = ["N1 - N2 distance (LEN2)", @@ -171,7 +174,7 @@ def create_node_method(self): target_res = np.asarray([8.5849, 305.16]) # Create an array with outputs of the simulations. -simulation_res = np.asarray([kp_dist, node_dist]) +simulation_res = np.asarray([node_dist, kp_dist]) # Identifying and filling corresponding columns. main_columns = { From 4f861a03ed4c48b0a8ca5727ce6027c35cd21645 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 15:53:22 +0100 Subject: [PATCH 20/39] fixing style of script for pandas data frame settings --- .../vm-008-parametric_calculation.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index a9dce61b4b1..c493cb00b88 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -155,8 +155,8 @@ def create_node_method(self): # Finally we have the results of the distances for both simulations, # which can be compared with expected target values: # -# - 1st simulation to get the distance between keypoints :math:`K_3` and :math:`K_4`, where :math:`LEN_1 = 305.16\,(in)`. -# - 2nd simulation to get the distance between nodes :math:`N_1` and :math:`N_2`, where :math:`LEN_2 = 8.58\,(in)`. +# - 1st simulation to get the distance between keypoints :math:`K_3` and :math:`K_4`, where :math:`LEN_1 = 305.16\,(in)` +# - 2nd simulation to get the distance between nodes :math:`N_1` and :math:`N_2`, where :math:`LEN_2 = 8.58\,(in)` # # For better representation of the results we can use ``pandas`` dataframe # with following settings below: @@ -199,10 +199,8 @@ def create_node_method(self): { "selector": "td:hover", "props": [("background-color", "#FFF8DC")] - }], -).set_properties(** - { - "color": "black", - "text-align": "center" - }, -).format("{:.2f}") + }]).set_properties(** + { + "color": "black", + "text-align": "center" + }).format("{:.2f}") From 60c6dd421b5ebafdb73b4c06403fe91e2b0dde28 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 16:15:16 +0100 Subject: [PATCH 21/39] check unit testing --- examples/06-verif-manual/vm-008-parametric_calculation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index c493cb00b88..e58adc8364a 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -39,7 +39,7 @@ the active coordinate system after the macro is used. Lowercase input is used throughout. Input case is preserved by Mechanical APDL where appropriate (system-dependent). - + CHECK UNIT TESTING ISSUE """ # sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' From ceaf5161057af46bfa9789822f61e186407ecb51 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 17:34:55 +0100 Subject: [PATCH 22/39] added Analysis Assumptions description --- .../vm-008-parametric_calculation.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index e58adc8364a..1e193d02e79 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -30,16 +30,21 @@ :alt: VM8 Problem Sketch Analysis Assumptions and Modeling Notes: - - The user file is created by the *CREATE command within the run. - In normal use, this file would most likely already exist locally. - Colons are used in the user file to create non-echoing comments (the colon - character specifies a branching label in Mechanical APDL). - The active coordinate system is saved and restored within the macro to ensure - Cartesian coordinates in the distance calculations and to re-establish - the active coordinate system after the macro is used. Lowercase input - is used throughout. Input case is preserved by Mechanical APDL where - appropriate (system-dependent). - CHECK UNIT TESTING ISSUE + - Instead of ``*create``, ``*use``, etc., we have created a class + `` Create`` with methods that correspond to each type of simulation. + In normal use, this class would most likely already exist, so + it is possible to change coordinates and reuse it. The simulation + can be checked not just by target values, but also with the simple + distances' formula between keypoints as: + + * To calculate the distance in cartesian coordinate system: + :math:`DIST = \sqrt[2]{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}` + + * Python representation of the distance formula: + + .. doctest:: + import math + DIST = math.sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2) """ # sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' From 0fd42890d0552a121e27c56a2c0b2f97de4c94c7 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 17:56:16 +0100 Subject: [PATCH 23/39] VM is ready to review --- .../vm-008-parametric_calculation.py | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 1e193d02e79..898b160f285 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -37,21 +37,26 @@ can be checked not just by target values, but also with the simple distances' formula between keypoints as: - * To calculate the distance in cartesian coordinate system: - :math:`DIST = \sqrt[2]{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}` - - * Python representation of the distance formula: - - .. doctest:: - import math - DIST = math.sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2) + * Calculate distance between two keypoints in the Cartesian coordinate system: + :math:`D = \sqrt[2]{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}` + * Python representation of the distance formula: + .. doctest:: + + import math + # Define coordinates for keypoints K3 and K4. + x1, y1, z1 = 100, 0, 30 + x2, y2, z2 = -200, 25, 80 + dist_kp = math.sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2) + print(dist_kp) """ -# sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' ############################################################################### # Start MAPDL # ~~~~~~~~~~~ +# Start MAPDL and import Numpy and Pandas libraries. + +# sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' import numpy as np import pandas as pd From ab7b7c7a26efc0d50a22554f8c13e2384c3feefc Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 18:20:57 +0100 Subject: [PATCH 24/39] VM is ready to review --- examples/06-verif-manual/vm-008-parametric_calculation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 898b160f285..cf3080a123c 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -31,7 +31,7 @@ Analysis Assumptions and Modeling Notes: - Instead of ``*create``, ``*use``, etc., we have created a class - `` Create`` with methods that correspond to each type of simulation. + ``Create`` with methods that correspond to each type of simulation. In normal use, this class would most likely already exist, so it is possible to change coordinates and reuse it. The simulation can be checked not just by target values, but also with the simple From a9807cfab1d52ba5b3893ed8cb199fac5a5f00b7 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 18:28:48 +0100 Subject: [PATCH 25/39] VM is ready to review1 --- examples/06-verif-manual/vm-008-parametric_calculation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index cf3080a123c..30edb2d1d27 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -78,8 +78,8 @@ ############################################################################### -# Pre-Processing -# ~~~~~~~~~~~~~~ +# Define main Class +# ~~~~~~~~~~~~~~~~~ # Identifying the class ``create`` with methods ``create_kp_method`` and # ``create_node_method`` to calculate and plot the distances between keypoints # and nodes. From c1ddc1513ac56e08da12bbb784bb117f86318c39 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 18 Jan 2022 18:44:04 +0100 Subject: [PATCH 26/39] VM8 is ready to review --- examples/06-verif-manual/vm-008-parametric_calculation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 30edb2d1d27..7217f427d8b 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -78,7 +78,7 @@ ############################################################################### -# Define main Class +# Define Main Class # ~~~~~~~~~~~~~~~~~ # Identifying the class ``create`` with methods ``create_kp_method`` and # ``create_node_method`` to calculate and plot the distances between keypoints From 1838af210847fcf3f9ca8bac902168240c595a68 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Thu, 20 Jan 2022 16:23:48 +0100 Subject: [PATCH 27/39] VM8 changed name of the class block --- examples/06-verif-manual/vm-008-parametric_calculation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 7217f427d8b..2f905f91281 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -78,8 +78,8 @@ ############################################################################### -# Define Main Class -# ~~~~~~~~~~~~~~~~~ +# Define Class +# ~~~~~~~~~~~~ # Identifying the class ``create`` with methods ``create_kp_method`` and # ``create_node_method`` to calculate and plot the distances between keypoints # and nodes. From 795697b836dfc5790e4cc1d4450082be65ffb092 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Fri, 21 Jan 2022 09:54:07 +0100 Subject: [PATCH 28/39] Delete misc.xml --- .idea/misc.xml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .idea/misc.xml diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d734b5efd52..00000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file From 3c7425d9208a2debbd0e488264d18fe51eee0ac6 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Fri, 21 Jan 2022 09:54:18 +0100 Subject: [PATCH 29/39] Delete pymapdl.iml --- .idea/pymapdl.iml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .idea/pymapdl.iml diff --git a/.idea/pymapdl.iml b/.idea/pymapdl.iml deleted file mode 100644 index 490ac2ef3e6..00000000000 --- a/.idea/pymapdl.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file From 0597f27dd49ee0af72ed9a526acbd53621531d19 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Sat, 22 Jan 2022 01:38:23 +0100 Subject: [PATCH 30/39] removed idea files --- .idea/.gitignore | 3 --- .idea/inspectionProfiles/profiles_settings.xml | 6 ------ .idea/misc.xml | 7 ------- .idea/modules.xml | 8 -------- .idea/pymapdl.iml | 18 ------------------ .idea/vcs.xml | 6 ------ 6 files changed, 48 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/pymapdl.iml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d33521af1..00000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da2d6..00000000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d734b5efd52..00000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 62f867e6293..00000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/pymapdl.iml b/.idea/pymapdl.iml deleted file mode 100644 index 490ac2ef3e6..00000000000 --- a/.idea/pymapdl.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4cb..00000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From d688df759cb4df632fc9288574d121aee7430a57 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Sat, 22 Jan 2022 02:02:33 +0100 Subject: [PATCH 31/39] changed names of the methods --- .../vm-008-parametric_calculation.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 2f905f91281..6c83a55d2da 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -4,7 +4,7 @@ Parametric Calculation ---------------------- Problem Description: - - Write a user file macro to calculate the distance d between either nodes + - Write a user file macro to calculate the distance ``d`` between either nodes or keypoints in ``PREP7``. Define abbreviations for calling the macro and verify the parametric expressions by using the macro to calculate the distance between nodes :math:`N_1` and :math:`N_2` and @@ -30,12 +30,11 @@ :alt: VM8 Problem Sketch Analysis Assumptions and Modeling Notes: - - Instead of ``*create``, ``*use``, etc., we have created a class + - Instead of ``*CREATE``, ``*USE``, etc., we have created a class ``Create`` with methods that correspond to each type of simulation. - In normal use, this class would most likely already exist, so - it is possible to change coordinates and reuse it. The simulation - can be checked not just by target values, but also with the simple - distances' formula between keypoints as: + This class gives a possibility to change coordinates and reuse it. + The simulation can be checked not just by target values, but also + with the simple distances' formula between keypoints as: * Calculate distance between two keypoints in the Cartesian coordinate system: :math:`D = \sqrt[2]{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}` @@ -94,7 +93,7 @@ def __init__(self, x1, y1, z1, x2, y2, z2): self.y2 = y2 self.z2 = z2 - def create_kp_method(self): + def kp_distances(self): # Define keypoints by coordinates. kp1 = mapdl.k(npt=3, x=self.x1, y=self.y1, z=self.z1) @@ -111,7 +110,7 @@ def create_kp_method(self): font_size=26) return dist_kp, mapdl.klist() - def create_node_method(self): + def node_distances(self): # Define nodes by coordinates. node1 = mapdl.n(node=1, x=self.x1, y=self.y1, z=self.z1) @@ -139,7 +138,7 @@ def create_node_method(self): # * :math:`K_{\mathrm{4(x,y,z)}} = -200,25,80` kp = Create(100, 0, 30, -200, 25, 80) -kp_dist, keypoint_list = kp.create_kp_method() +kp_dist, keypoint_list = kp.kp_distances() print(f"Distance between keypoint is: {kp_dist:.2f}\n\n" f"{keypoint_list}") @@ -154,7 +153,7 @@ def create_node_method(self): # * :math:`N_{\mathrm{2(x,y,z)}} = -3.7, 4.6, -3` nodes = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) -node_dist, node_list = nodes.create_node_method() +node_dist, node_list = nodes.node_distances() print(f"Distance between nodes is: {node_dist:.2f}\n\n" f"{node_list}") From aa75db06e40baac08e71fb423a18e757b721ac39 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Sat, 22 Jan 2022 02:27:21 +0100 Subject: [PATCH 32/39] VM8 is ready to be merged, almost all suggestions were added --- .../vm-008-parametric_calculation.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 6c83a55d2da..6ef32a658ea 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -108,7 +108,7 @@ def kp_distances(self): background="grey", show_bounds=True, font_size=26) - return dist_kp, mapdl.klist() + return dist_kp def node_distances(self): @@ -125,7 +125,7 @@ def node_distances(self): color="grey", show_bounds=True, font_size=26) - return dist_node, mapdl.nlist() + return dist_node ############################################################################### @@ -138,9 +138,11 @@ def node_distances(self): # * :math:`K_{\mathrm{4(x,y,z)}} = -200,25,80` kp = Create(100, 0, 30, -200, 25, 80) -kp_dist, keypoint_list = kp.kp_distances() -print(f"Distance between keypoint is: {kp_dist:.2f}\n\n" - f"{keypoint_list}") +kp_dist = kp.kp_distances() +print(f"Distance between keypoint is: {kp_dist:.2f}\n\n") + +# Print the list of keypoints. +print(mapdl.klist()) ############################################################################### @@ -153,9 +155,11 @@ def node_distances(self): # * :math:`N_{\mathrm{2(x,y,z)}} = -3.7, 4.6, -3` nodes = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) -node_dist, node_list = nodes.node_distances() -print(f"Distance between nodes is: {node_dist:.2f}\n\n" - f"{node_list}") +node_dist = nodes.node_distances() +print(f"Distance between nodes is: {node_dist:.2f}\n\n") + +# Print the list of nodes. +print(mapdl.nlist()) ############################################################################### From ae776ba13164bc997660e57f356f93b6f8f19576 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Mon, 24 Jan 2022 23:45:55 +0100 Subject: [PATCH 33/39] VM8 is rebuilt with decorator property and ready to review --- .../vm-008-parametric_calculation.py | 61 ++++++++++++++----- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 6ef32a658ea..939090ffc07 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -73,7 +73,7 @@ mapdl.clear() mapdl.verify() -_ = mapdl.prep7() +mapdl.prep7(mute=True) ############################################################################### @@ -84,20 +84,16 @@ # and nodes. class Create: - def __init__(self, x1, y1, z1, x2, y2, z2): - # Coordinate Attributes. - self.x1 = x1 - self.y1 = y1 - self.z1 = z1 - self.x2 = x2 - self.y2 = y2 - self.z2 = z2 + def __init__(self, p1, p2): + # Points Attributes. + self.p1 = p1 + self.p2 = p2 def kp_distances(self): # Define keypoints by coordinates. - kp1 = mapdl.k(npt=3, x=self.x1, y=self.y1, z=self.z1) - kp2 = mapdl.k(npt=4, x=self.x2, y=self.y2, z=self.z2) + kp1 = mapdl.k(npt=3, x=self.p1[0], y=self.p1[1], z=self.p1[2]) + kp2 = mapdl.k(npt=4, x=self.p2[0], y=self.p2[1], z=self.p2[2]) # Get the distance between keypoints. dist_kp, kx, ky, kz = mapdl.kdist(kp1, kp2) @@ -113,8 +109,8 @@ def kp_distances(self): def node_distances(self): # Define nodes by coordinates. - node1 = mapdl.n(node=1, x=self.x1, y=self.y1, z=self.z1) - node2 = mapdl.n(node=2, x=self.x2, y=self.y2, z=self.z2) + node1 = mapdl.n(node=1, x=self.p1[0], y=self.p1[1], z=self.p1[2]) + node2 = mapdl.n(node=2, x=self.p2[0], y=self.p2[1], z=self.p2[2]) # Get the distance between nodes. dist_node, node_x, node_y, node_z = mapdl.ndist(node1, node2) @@ -127,6 +123,35 @@ def node_distances(self): font_size=26) return dist_node + @property + def p1(self): + # Getting value + return self._p1 + + @p1.setter + def p1(self, new_value): + # Check the data type: + if not isinstance(new_value, list): + raise ValueError("The coordinates should be implemented by the list!") + # Check the quantity of items: + if len(new_value) != 3: + raise ValueError("The coordinates should have three items in the list as [X, Y, Z]") + self._p1 = new_value + + @property + def p2(self): + return self._p2 + + @p2.setter + def p2(self, new_value): + # Check the data type: + if not isinstance(new_value, list): + raise ValueError("The coordinates should be implemented by the list!") + # Check the quantity of items: + if len(new_value) != 3: + raise ValueError("The coordinates should have three items in the list as [X, Y, Z]") + self._p2 = new_value + ############################################################################### # Distance between keypoints @@ -135,9 +160,11 @@ def node_distances(self): # and print out an output. The keypoints have got next coordinates: # # * :math:`K_{\mathrm{3(x,y,z)}} = 100, 0, 30` -# * :math:`K_{\mathrm{4(x,y,z)}} = -200,25,80` +# * :math:`K_{\mathrm{4(x,y,z)}} = -200, 25,80` -kp = Create(100, 0, 30, -200, 25, 80) +kp1 = [100, 0, 30] +kp2 = [-200, 25, 80] +kp = Create(kp1, kp2) kp_dist = kp.kp_distances() print(f"Distance between keypoint is: {kp_dist:.2f}\n\n") @@ -154,7 +181,9 @@ def node_distances(self): # * :math:`N_{\mathrm{1(x,y,z)}} = 1.5, 2.5, 3.5` # * :math:`N_{\mathrm{2(x,y,z)}} = -3.7, 4.6, -3` -nodes = Create(1.5, 2.5, 3.5, -3.7, 4.6, -3) +node1 = [1.5, 2.5, 3.5] +node2 = [-3.7, 4.6, -3] +nodes = Create(node1, node2) node_dist = nodes.node_distances() print(f"Distance between nodes is: {node_dist:.2f}\n\n") From a8842c6c45f0d13c1c1e556f5cadc8cc6652cadd Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 25 Jan 2022 20:36:11 +0100 Subject: [PATCH 34/39] Removed styling setting, left just format style for decimals --- .../vm-008-parametric_calculation.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 939090ffc07..0ca57dfd80c 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -229,20 +229,4 @@ def p2(self, new_value): df2 = pd.DataFrame(main_columns, index=row_names) # Apply style settings for the dataframe. -df2.style.set_table_styles([ - { - "selector": "th", - "props": [('font-size', '16px')] - }, - { - "selector": "td", - "props": [('font-size', '16px')] - }, - { - "selector": "td:hover", - "props": [("background-color", "#FFF8DC")] - }]).set_properties(** - { - "color": "black", - "text-align": "center" - }).format("{:.2f}") +df2.style.format("{:.2f}") From dd79c00c9b69fcdd6bd544f1bd9b3ecd8c62f95b Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 25 Jan 2022 20:50:43 +0100 Subject: [PATCH 35/39] Unit test check --- examples/06-verif-manual/vm-008-parametric_calculation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 0ca57dfd80c..6efaa8a0e6f 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -230,3 +230,4 @@ def p2(self, new_value): # Apply style settings for the dataframe. df2.style.format("{:.2f}") + From bd05834efc8f8d07c7efc959645b68115b2ea690 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Tue, 25 Jan 2022 20:52:25 +0100 Subject: [PATCH 36/39] Unit test check2 --- examples/06-verif-manual/vm-008-parametric_calculation.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 6efaa8a0e6f..0ca57dfd80c 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -230,4 +230,3 @@ def p2(self, new_value): # Apply style settings for the dataframe. df2.style.format("{:.2f}") - From 7f03c6555a3592734f13f88cdc7a3ef8cad99534 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Wed, 26 Jan 2022 16:15:14 +0100 Subject: [PATCH 37/39] VM8 Last update, ready to be merged --- examples/06-verif-manual/vm-008-parametric_calculation.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 0ca57dfd80c..fba50270992 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -47,7 +47,7 @@ x2, y2, z2 = -200, 25, 80 dist_kp = math.sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2) print(dist_kp) - +# sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' """ ############################################################################### @@ -55,8 +55,6 @@ # ~~~~~~~~~~~ # Start MAPDL and import Numpy and Pandas libraries. -# sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' - import numpy as np import pandas as pd From 78f85554477fc959145f421fdbfeb76b974bbd33 Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Wed, 26 Jan 2022 17:09:32 +0100 Subject: [PATCH 38/39] VM8 check --- .../06-verif-manual/vm-008-parametric_calculation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index fba50270992..37b3fd86c42 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -47,7 +47,6 @@ x2, y2, z2 = -200, 25, 80 dist_kp = math.sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2) print(dist_kp) -# sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' """ ############################################################################### @@ -55,6 +54,8 @@ # ~~~~~~~~~~~ # Start MAPDL and import Numpy and Pandas libraries. +# sphinx_gallery_thumbnail_path = '_static/vm8_setup.png' + import numpy as np import pandas as pd @@ -224,7 +225,7 @@ def p2(self, new_value): } # Create and fill the output dataframe with pandas. -df2 = pd.DataFrame(main_columns, index=row_names) +df2 = pd.DataFrame(main_columns, index=row_names).round(2) -# Apply style settings for the dataframe. -df2.style.format("{:.2f}") +# Apply settings for the dataframe. +df2.head() From 50f0053c05add65a12ce5fd9884427431a17a85b Mon Sep 17 00:00:00 2001 From: Roman Ilchenko Date: Wed, 26 Jan 2022 18:25:41 +0100 Subject: [PATCH 39/39] VM10 check test --- examples/06-verif-manual/vm-008-parametric_calculation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/06-verif-manual/vm-008-parametric_calculation.py b/examples/06-verif-manual/vm-008-parametric_calculation.py index 37b3fd86c42..f83219551aa 100644 --- a/examples/06-verif-manual/vm-008-parametric_calculation.py +++ b/examples/06-verif-manual/vm-008-parametric_calculation.py @@ -47,6 +47,7 @@ x2, y2, z2 = -200, 25, 80 dist_kp = math.sqrt((x2 - x1)**2 + (y2 - y1)**2 + (z2 - z1)**2) print(dist_kp) + """ ###############################################################################