diff --git a/ansys/mapdl/reader/rst.py b/ansys/mapdl/reader/rst.py index 2a9c6fe9..31687435 100644 --- a/ansys/mapdl/reader/rst.py +++ b/ansys/mapdl/reader/rst.py @@ -759,11 +759,11 @@ def animate_nodal_solution(self, rnum, comp='norm', node_components=None, element_components=None, sel_type_all=True, add_text=True, - displacement_factor=0.1, nangles=100, + displacement_factor=0.1, n_frames=100, loop=True, movie_filename=None, **kwargs): """Animate nodal solution. Assumes nodal solution is a - displacement array from a modal solution. + displacement array from a modal or static solution. rnum : int or list Cumulative result number with zero based indexing, or a @@ -793,7 +793,7 @@ def animate_nodal_solution(self, rnum, comp='norm', displacement_factor : float, optional Increases or decreases displacement by a factor. - nangles : int, optional + n_frames : int, optional Number of "frames" between each full cycle. loop : bool, optional @@ -824,6 +824,11 @@ def animate_nodal_solution(self, rnum, comp='norm', >>> rst.animate_nodal_solution(0, movie_filename='disp.mp4') """ + if 'nangles' in kwargs: + n_frames = kwargs.pop('nangles') + warnings.warn('The ``nangles`` kwarg is depreciated and ``n_frames`` ' + 'should be used instead.') + scalars = None if comp: _, disp = self.nodal_solution(rnum) @@ -861,7 +866,7 @@ def animate_nodal_solution(self, rnum, comp='norm', node_components=node_components, element_components=element_components, sel_type_all=sel_type_all, - nangles=nangles, + n_frames=n_frames, displacement_factor=displacement_factor, movie_filename=movie_filename, loop=loop, **kwargs) @@ -2407,7 +2412,7 @@ def cs_4x4(self, cs_cord, as_vtk_matrix=False): def _plot_point_scalars(self, scalars, rnum=None, grid=None, show_displacement=False, displacement_factor=1, - add_text=True, animate=False, nangles=100, + add_text=True, animate=False, n_frames=100, overlay_wireframe=False, node_components=None, element_components=None, sel_type_all=True, movie_filename=None, @@ -2587,10 +2592,10 @@ def q_callback(): plotter.add_key_event("q", q_callback) first_loop = True - cached_normals = [None for _ in range(nangles)] + cached_normals = [None for _ in range(n_frames)] while self._animating: - for j, angle in enumerate(np.linspace(0, np.pi*2, nangles + 1)[:-1]): + for j, angle in enumerate(np.linspace(0, np.pi*2, n_frames + 1)[:-1]): mag_adj = np.sin(angle) if scalars is not None: copied_mesh.active_scalars[:] = scalars*mag_adj diff --git a/tests/conftest.py b/tests/conftest.py index 5211f222..09bc938d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -26,7 +26,8 @@ def mapdl(request): EXEC_FILE = get_ansys_bin(rver) break - return launch_mapdl(EXEC_FILE, override=True, cleanup_on_exit=cleanup) + return launch_mapdl(EXEC_FILE, override=True, cleanup_on_exit=cleanup, + additional_switches='-smp') @pytest.fixture(scope='function') diff --git a/tests/test_binary_reader.py b/tests/test_binary_reader.py index 2fa882de..8d0bd210 100644 --- a/tests/test_binary_reader.py +++ b/tests/test_binary_reader.py @@ -403,6 +403,7 @@ def test_file_close(tmpdir): shutil.copy(examples.rstfile, tmpfile) rst = pymapdl_reader.read_binary(tmpfile) nnum, stress = rst.nodal_stress(0) + del rst os.remove(tmpfile) # tests file has been correctly closed diff --git a/tests/test_dist_rst.py b/tests/test_dist_rst.py index 83c59994..ba6289d0 100644 --- a/tests/test_dist_rst.py +++ b/tests/test_dist_rst.py @@ -83,8 +83,9 @@ def test_not_a_dis_rst(tmpdir): @skip_no_ansys def test_not_all_found(thermal_solution, mapdl, tmpdir): + if not mapdl._distributed: + return filename = os.path.join(mapdl.directory, 'file0.rth') - tmp_file = os.path.join(mapdl.directory, 'tmp0.rth') shutil.copy(filename, tmp_file) with pytest.raises(FileNotFoundError): @@ -93,6 +94,9 @@ def test_not_all_found(thermal_solution, mapdl, tmpdir): @skip_no_ansys def test_temperature(thermal_solution, mapdl, tmpdir): + if not mapdl._distributed: + return + ans_temp = mapdl.post_processing.nodal_temperature dist_rst = pymapdl_reader.read_binary(os.path.join(mapdl.directory, 'file0.rth')) @@ -109,6 +113,9 @@ def test_temperature(thermal_solution, mapdl, tmpdir): @skip_no_ansys def test_plot_temperature(thermal_solution, mapdl): + if not mapdl._distributed: + return + dist_rst = pymapdl_reader.read_binary(os.path.join(mapdl.directory, 'file0.rth')) cpos = dist_rst.plot_nodal_temperature(0) assert isinstance(cpos, CameraPosition)