Skip to content

Fixes the mesh deformation for mode shape animation #1696

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

Merged
merged 7 commits into from
Jun 5, 2025
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
4 changes: 3 additions & 1 deletion examples/02-modal_analyses/01-plot_and_animate_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 2 additions & 0 deletions src/ansys/dpf/core/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def animate_mode(

wf.set_input_name("weights", scaling_op.inputs.weights)
wf.set_output_name("field", scaling_op.outputs.field)
wf.set_output_name("deform_by", scaling_op.outputs.field)

anim = Animator(workflow=wf, **kwargs)

Expand All @@ -130,5 +131,6 @@ def animate_mode(
save_as=save_as,
mode_number=mode_number,
clim=[0, max_data],
scale_factor=deform_scale_factor,
**kwargs,
)
3 changes: 2 additions & 1 deletion src/ansys/dpf/core/animator.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,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]:
Expand Down Expand Up @@ -121,6 +121,7 @@ def render_frame(frame):
self.add_field(
field,
deform_by=deform,
scale_factor=scale_factor[frame],
scale_factor_legend=scale_factor[frame],
shell_layer=shell_layer,
**kwargs,
Expand Down