From 98fde684368809327ebc224c107f8542e87b46ad Mon Sep 17 00:00:00 2001 From: Rajesh Meena <60212378+rajesh1359@users.noreply.github.com> Date: Wed, 14 Aug 2024 01:35:03 +0530 Subject: [PATCH 1/5] Fixes the mesh deformation for mode shape animation This commit make deform_by default for mode animation. --- src/ansys/dpf/core/animation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/dpf/core/animation.py b/src/ansys/dpf/core/animation.py index 87073956d7..ed418e6e0f 100644 --- a/src/ansys/dpf/core/animation.py +++ b/src/ansys/dpf/core/animation.py @@ -96,6 +96,7 @@ def animate_mode( wf.set_input_name("ponderation", scaling_op.inputs.ponderation) wf.set_output_name("field", scaling_op.outputs.field) + wf.set_output_name("deform_by", scaling_op.outputs.field) anim = Animator(workflow=wf, **kwargs) From 7faf7848759832574daefba106c3758140adc5e8 Mon Sep 17 00:00:00 2001 From: Rajesh Meena <60212378+rajesh1359@users.noreply.github.com> Date: Wed, 14 Aug 2024 02:01:54 +0530 Subject: [PATCH 2/5] pass deformation scaling factor to animator This fix transfers deformation scale factor to animator --- src/ansys/dpf/core/animation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/dpf/core/animation.py b/src/ansys/dpf/core/animation.py index ed418e6e0f..b0b0ddf739 100644 --- a/src/ansys/dpf/core/animation.py +++ b/src/ansys/dpf/core/animation.py @@ -107,5 +107,6 @@ def animate_mode( save_as=save_as, mode_number=mode_number, clim=[0, max_data], + scale_factor=deform_scale_factor, **kwargs, ) From 27d47aabd14300ec8c5be79281ff4a1fdb8d5ff4 Mon Sep 17 00:00:00 2001 From: Rajesh Meena <60212378+rajesh1359@users.noreply.github.com> Date: Wed, 14 Aug 2024 02:03:03 +0530 Subject: [PATCH 3/5] making use of scale factor per frame This fix adds use of scale factor per frame --- src/ansys/dpf/core/animator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/dpf/core/animator.py b/src/ansys/dpf/core/animator.py index a799a8c5e2..31581b47af 100644 --- a/src/ansys/dpf/core/animator.py +++ b/src/ansys/dpf/core/animator.py @@ -98,6 +98,7 @@ def render_frame(frame): self.add_field( field, deform_by=deform, + scale_factor=scale_factor[frame], scale_factor_legend=scale_factor[frame], **kwargs, ) From 6b31ec6f2c81d8a90321c717a9a1dd6792bbc68b Mon Sep 17 00:00:00 2001 From: Rajesh Meena <60212378+rajesh1359@users.noreply.github.com> Date: Wed, 14 Aug 2024 02:38:05 +0530 Subject: [PATCH 4/5] Handling integer type scale factor This change handles integer type scale factor in animator. ideally integer type scale factor should be acceptable by scale operator. --- src/ansys/dpf/core/animator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/dpf/core/animator.py b/src/ansys/dpf/core/animator.py index 31581b47af..a8e67673c4 100644 --- a/src/ansys/dpf/core/animator.py +++ b/src/ansys/dpf/core/animator.py @@ -47,7 +47,7 @@ def animate_workflow( scale_factor = [False] * len(indices) type_scale = type(scale_factor) if type_scale in [int, float]: - scale_factor = [scale_factor] * len(indices) + scale_factor = [float(scale_factor)] * len(indices) elif type_scale == list: pass # elif type_scale in [core.field.Field, core.fields_container.FieldsContainer]: From d3cc20dfcba9dffa123cc173e95d41318084e878 Mon Sep 17 00:00:00 2001 From: PProfizi Date: Thu, 5 Jun 2025 15:11:52 +0200 Subject: [PATCH 5/5] Showcase the deform_scale_factor parameter of animate_mode in example --- examples/02-modal_analyses/01-plot_and_animate_modes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/02-modal_analyses/01-plot_and_animate_modes.py b/examples/02-modal_analyses/01-plot_and_animate_modes.py index d167150245..b6673eb347 100644 --- a/examples/02-modal_analyses/01-plot_and_animate_modes.py +++ b/examples/02-modal_analyses/01-plot_and_animate_modes.py @@ -72,4 +72,6 @@ # To suppress window pop-up, set the `off_screen` argument to True. # ~~~~~~~~~~~~~~~~~~~~ -animation.animate_mode(disp, mode_number=1, save_as="tmp.gif", off_screen=True) +animation.animate_mode( + disp, mode_number=1, save_as="tmp.gif", off_screen=True, deform_scale_factor=10.0 +)