Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/post processing consistency properties #778

Merged
merged 4 commits into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 33 additions & 47 deletions ansys/mapdl/core/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,6 @@ def _edof_rst(self, item, it1num=""):
"""Element degree of freedom result"""
return self._mapdl.get_array("ELEM", item1=item, it1num=it1num)

@property
def nodal_temperature(self) -> np.ndarray:
"""The nodal temperature of the current result.

Expand All @@ -1265,7 +1264,7 @@ def nodal_temperature(self) -> np.ndarray:

Examples
--------
>>> mapdl.post_processing.temperature
>>> mapdl.post_processing.temperature()
array([0., 0., 0., ..., 0., 0., 0.])

"""
Expand Down Expand Up @@ -1310,10 +1309,9 @@ def plot_nodal_temperature(self, show_node_numbering=False, **kwargs):
"""
kwargs.setdefault("scalar_bar_args", {'title': "Nodal\nTemperature"})
return self._plot_point_scalars(
self.nodal_temperature, show_node_numbering=show_node_numbering, **kwargs
self.nodal_temperature(), show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_pressure(self) -> np.ndarray:
"""The nodal pressure of the current result.

Expand All @@ -1332,7 +1330,7 @@ def nodal_pressure(self) -> np.ndarray:

Examples
--------
>>> mapdl.post_processing.pressure
>>> mapdl.post_processing.pressure()
array([0., 0., 0., ..., 0., 0., 0.])

"""
Expand Down Expand Up @@ -1377,10 +1375,9 @@ def plot_nodal_pressure(self, show_node_numbering=False, **kwargs):
"""
kwargs.setdefault("scalar_bar_args", {'title': "Nodal\nPressure"})
return self._plot_point_scalars(
self.nodal_pressure, show_node_numbering=show_node_numbering, **kwargs
self.nodal_pressure(), show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_voltage(self) -> np.ndarray:
"""The nodal voltage of the current result.

Expand Down Expand Up @@ -1408,7 +1405,7 @@ def nodal_voltage(self) -> np.ndarray:
--------
Return the voltage of the current result.

>>> mapdl.post_processing.voltage
>>> mapdl.post_processing.voltage()
array([0., 0., 0., ..., 0., 0., 0.])
"""
return self._ndof_rst("VOLT")
Expand Down Expand Up @@ -1451,7 +1448,7 @@ def plot_nodal_voltage(self, show_node_numbering=False, **kwargs):
"""
kwargs.setdefault("scalar_bar_args", {'title': "Nodal\nVoltage"})
return self._plot_point_scalars(
self.nodal_voltage, show_node_numbering=show_node_numbering, **kwargs
self.nodal_voltage(), show_node_numbering=show_node_numbering, **kwargs
)

def nodal_component_stress(self, component) -> np.ndarray:
Expand Down Expand Up @@ -1621,7 +1618,6 @@ def plot_nodal_principal_stress(
disp, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_stress_intensity(self) -> np.ndarray:
"""The nodal stress intensity of the current result.

Expand All @@ -1643,7 +1639,7 @@ def nodal_stress_intensity(self) -> np.ndarray:

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_stress_intensity
>>> mapdl.post_processing.nodal_stress_intensity()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -1688,13 +1684,12 @@ def plot_nodal_stress_intensity(self, show_node_numbering=False, **kwargs):
>>> mapdl.post_processing.plot_nodal_stress_intensity(smooth_shading=True)

"""
scalars = self.nodal_stress_intensity
scalars = self.nodal_stress_intensity()
kwargs.setdefault("scalar_bar_args", {'title': "Nodal Stress\nIntensity"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_eqv_stress(self) -> np.ndarray:
"""The nodal equivalent stress of the current result.

Expand All @@ -1718,15 +1713,15 @@ def nodal_eqv_stress(self) -> np.ndarray:

Examples
--------
>>> mapdl.post_processing.nodal_eqv_stress
>>> mapdl.post_processing.nodal_eqv_stress()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Stress from result 2

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_eqv_stress
>>> mapdl.post_processing.nodal_eqv_stress()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -1771,7 +1766,7 @@ def plot_nodal_eqv_stress(self, show_node_numbering=False, **kwargs):
>>> mapdl.post_processing.plot_nodal_eqv_stress(smooth_shading=True)

"""
scalars = self.nodal_eqv_stress
scalars = self.nodal_eqv_stress()
kwargs.setdefault("scalar_bar_args", {'title': "Nodal Equivalent\nStress"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
Expand Down Expand Up @@ -1952,7 +1947,6 @@ def plot_nodal_total_principal_strain(
disp, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_total_strain_intensity(self) -> np.ndarray:
"""The total nodal strain intensity of the current result.

Expand All @@ -1976,7 +1970,7 @@ def nodal_total_strain_intensity(self) -> np.ndarray:

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_total_strain_intensity
>>> mapdl.post_processing.nodal_total_strain_intensity()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -2019,13 +2013,12 @@ def plot_nodal_total_strain_intensity(self, show_node_numbering=False, **kwargs)
>>> mapdl.post_processing.plot_nodal_total_strain_intensity()

"""
scalars = self.nodal_total_strain_intensity
scalars = self.nodal_total_strain_intensity()
kwargs.setdefault("scalar_bar_args", {'title': "Total Nodal\nStrain Intensity"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_total_eqv_strain(self) -> np.ndarray:
"""The total nodal equivalent strain of the current result.

Expand All @@ -2047,15 +2040,15 @@ def nodal_total_eqv_strain(self) -> np.ndarray:
--------
Total quivalent strain for the current result.

>>> mapdl.post_processing.nodal_total_eqv_strain
>>> mapdl.post_processing.nodal_total_eqv_strain()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Strain from result 2.

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_total_eqv_strain
>>> mapdl.post_processing.nodal_total_eqv_strain()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -2099,7 +2092,7 @@ def plot_nodal_total_eqv_strain(self, show_node_numbering=False, **kwargs):
>>> mapdl.post_processing.plot_nodal_total_eqv_strain(smooth_shading=True)

"""
scalars = self.nodal_total_eqv_strain
scalars = self.nodal_total_eqv_strain()
kwargs.setdefault("scalar_bar_args", {'title': "Total Nodal\nEquivalent Strain"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
Expand Down Expand Up @@ -2265,7 +2258,6 @@ def plot_nodal_elastic_principal_strain(
disp, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_elastic_strain_intensity(self) -> np.ndarray:
"""The elastic nodal strain intensity of the current result.

Expand Down Expand Up @@ -2294,7 +2286,7 @@ def nodal_elastic_strain_intensity(self) -> np.ndarray:

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_elastic_strain_intensity
>>> mapdl.post_processing.nodal_elastic_strain_intensity()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -2338,13 +2330,12 @@ def plot_nodal_elastic_strain_intensity(self, show_node_numbering=False, **kwarg
>>> mapdl.post_processing.plot_nodal_elastic_strain_intensity()

"""
scalars = self.nodal_elastic_strain_intensity
scalars = self.nodal_elastic_strain_intensity()
kwargs.setdefault("scalar_bar_args", {'title': "Elastic Nodal\nStrain Intensity"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_elastic_eqv_strain(self) -> np.ndarray:
"""The elastic nodal equivalent strain of the current result.

Expand All @@ -2365,15 +2356,15 @@ def nodal_elastic_eqv_strain(self) -> np.ndarray:
--------
Elastic quivalent strain for the current result.

>>> mapdl.post_processing.nodal_elastic_eqv_strain
>>> mapdl.post_processing.nodal_elastic_eqv_strain()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Strain from result 2.

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_elastic_eqv_strain
>>> mapdl.post_processing.nodal_elastic_eqv_strain()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -2417,7 +2408,7 @@ def plot_nodal_elastic_eqv_strain(self, show_node_numbering=False, **kwargs):
>>> mapdl.post_processing.plot_nodal_elastic_eqv_strain(smooth_shading=True)

"""
scalars = self.nodal_elastic_eqv_strain
scalars = self.nodal_elastic_eqv_strain()
kwargs.setdefault("scalar_bar_args", {'title': "Elastic Nodal\n Equivalent Strain"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
Expand Down Expand Up @@ -2582,7 +2573,6 @@ def plot_nodal_plastic_principal_strain(
disp, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_plastic_strain_intensity(self) -> np.ndarray:
"""The plastic nodal strain intensity of the current result.

Expand Down Expand Up @@ -2612,7 +2602,7 @@ def nodal_plastic_strain_intensity(self) -> np.ndarray:

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_plastic_strain_intensity
>>> mapdl.post_processing.nodal_plastic_strain_intensity()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -2656,13 +2646,12 @@ def plot_nodal_plastic_strain_intensity(self, show_node_numbering=False, **kwarg
>>> mapdl.post_processing.plot_nodal_plastic_strain_intensity()

"""
scalars = self.nodal_plastic_strain_intensity
scalars = self.nodal_plastic_strain_intensity()
kwargs.setdefault("scalar_bar_args", {'title': "Plastic Nodal\nStrain Intensity"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_plastic_eqv_strain(self) -> np.ndarray:
"""The plastic nodal equivalent strain of the current result.

Expand Down Expand Up @@ -2690,15 +2679,15 @@ def nodal_plastic_eqv_strain(self) -> np.ndarray:
--------
Plastic quivalent strain for the current result

>>> mapdl.post_processing.nodal_plastic_eqv_strain
>>> mapdl.post_processing.nodal_plastic_eqv_strain()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Strain from result 2

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_plastic_eqv_strain
>>> mapdl.post_processing.nodal_plastic_eqv_strain()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -2742,7 +2731,7 @@ def plot_nodal_plastic_eqv_strain(self, show_node_numbering=False, **kwargs):
>>> mapdl.post_processing.plot_nodal_plastic_eqv_strain(smooth_shading=True)

"""
scalars = self.nodal_plastic_eqv_strain
scalars = self.nodal_plastic_eqv_strain()
kwargs.setdefault("scalar_bar_args", {'title': "Plastic Nodal\n Equivalent Strain"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
Expand Down Expand Up @@ -2914,7 +2903,6 @@ def plot_nodal_thermal_principal_strain(
disp, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_thermal_strain_intensity(self) -> np.ndarray:
"""The thermal nodal strain intensity of the current result.

Expand Down Expand Up @@ -2944,7 +2932,7 @@ def nodal_thermal_strain_intensity(self) -> np.ndarray:

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_thermal_strain_intensity
>>> mapdl.post_processing.nodal_thermal_strain_intensity()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -2985,13 +2973,12 @@ def plot_nodal_thermal_strain_intensity(self, show_node_numbering=False, **kwarg
>>> mapdl.post_processing.plot_nodal_thermal_strain_intensity()

"""
scalars = self.nodal_thermal_strain_intensity
scalars = self.nodal_thermal_strain_intensity()
kwargs.setdefault("scalar_bar_args", {'title': "Thermal Nodal\nStrain Intensity"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_thermal_eqv_strain(self) -> np.ndarray:
"""The thermal nodal equivalent strain of the current result.

Expand Down Expand Up @@ -3019,15 +3006,15 @@ def nodal_thermal_eqv_strain(self) -> np.ndarray:
--------
Thermal quivalent strain for the current result.

>>> mapdl.post_processing.nodal_thermal_eqv_strain
>>> mapdl.post_processing.nodal_thermal_eqv_strain()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Strain from result 2.

>>> mapdl.post1()
>>> mapdl.set(1, 2)
>>> mapdl.post_processing.nodal_thermal_eqv_strain
>>> mapdl.post_processing.nodal_thermal_eqv_strain()
array([15488.84357602, 16434.95432337, 15683.2334295 , ...,
0. , 0. , 0. ])

Expand Down Expand Up @@ -3071,13 +3058,12 @@ def plot_nodal_thermal_eqv_strain(self, show_node_numbering=False, **kwargs):
>>> mapdl.post_processing.plot_nodal_thermal_eqv_strain(smooth_shading=True)

"""
scalars = self.nodal_thermal_eqv_strain
scalars = self.nodal_thermal_eqv_strain()
kwargs.setdefault("scalar_bar_args", {'title': "Thermal Nodal\n Equivalent Strain"})
return self._plot_point_scalars(
scalars, show_node_numbering=show_node_numbering, **kwargs
)

@property
def nodal_contact_friction_stress(self) -> np.ndarray:
"""Nodal contact friction stress of the current result.

Expand Down Expand Up @@ -3149,5 +3135,5 @@ def plot_nodal_contact_friction_stress(self, show_node_numbering=False, **kwargs
"""
kwargs.setdefault("scalar_bar_args", {'title': "Nodal Contact\n Friction Stress"})
return self._plot_point_scalars(
self.nodal_contact_friction_stress, show_node_numbering=show_node_numbering, **kwargs
)
self.nodal_contact_friction_stress(), show_node_numbering=show_node_numbering, **kwargs
)
2 changes: 1 addition & 1 deletion examples/00-mapdl-examples/pressure_vessel.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
# results directly from MAPDL's VGET command
# *VGET, __VAR__, NODE, , S, EQV
nnum = mapdl.mesh.nnum
von_mises_mapdl = mapdl.post_processing.nodal_eqv_stress
von_mises_mapdl = mapdl.post_processing.nodal_eqv_stress()

# we could print out the solution for each node with:

Expand Down
Loading