Skip to content

Kratos rotating frame#14279

Open
SADPR wants to merge 4 commits intomasterfrom
Kratos_RotatingFrame
Open

Kratos rotating frame#14279
SADPR wants to merge 4 commits intomasterfrom
Kratos_RotatingFrame

Conversation

@SADPR
Copy link
Copy Markdown
Contributor

@SADPR SADPR commented Mar 11, 2026

Overview

This PR introduces a RotatingFrameProcess in the MeshMovingApplication to apply rigid-body rotational kinematics to model parts in ALE-type simulations, e.g., Sliding Mesh.

The process performs two operations:

  • rotates a model part (rotating frame) and assigns the corresponding MESH_DISPLACEMENT
  • assigns the corresponding rigid-body rotational VELOCITY to another model part (rotating object/skin)

Overview

This PR introduces a RotatingFrameProcess in the MeshMovingApplication to apply rigid-body rotational kinematics to model parts in ALE-type simulations.

The process performs two operations:

  • rotates a model part and assigns the corresponding MESH_DISPLACEMENT
  • assigns the corresponding rigid-body rotational VELOCITY to another model part

The rigid-body velocity is computed as

$$ \mathbf{v} = \boldsymbol{\omega} \times (\mathbf{x} - \mathbf{x}_c) $$

where

  • $\boldsymbol{\omega}$ is the angular velocity
  • $\mathbf{x}_c$ is the center of rotation.

The mesh rotation is applied as

$$ \mathbf{x} = \mathbf{R}(\theta)(\mathbf{x}_0 - \mathbf{x}_c) + \mathbf{x}_c $$

with the corresponding mesh displacement

$$ \mathbf{u}_{mesh} = \mathbf{x} - \mathbf{x}_0 $$

Angular acceleration

If an acceleration_time is specified, the angular velocity is ramped linearly until the target value is reached.

Let $\omega_t$ be the target angular velocity and $T_a$ the acceleration time.
The angular acceleration is

$$ \alpha = \frac{\omega_t}{T_a} $$

For $t \le T_a$:

$$ \omega(t) = \alpha t $$

$$ \theta(t) = \frac{1}{2}\alpha t^2 $$

For $t \text{greater than} T_a$:

$$ \omega(t) = \omega_t $$

$$ \theta(t) = \frac{1}{2}\alpha T_a^2 + \omega_t (t - T_a) $$

This allows smoothly ramping the rotational motion before reaching the final constant angular velocity.


Process Settings

The process requires two model parts:

  • rotating_frame_model_part_name
    Model part whose nodes are rotated and assigned MESH_DISPLACEMENT.

  • rotating_object_model_part_name
    Model part where the rigid-body rotational VELOCITY is imposed.

Example:

{
    "rotating_frame_model_part_name": "FluidModelPart.ALE",
    "rotating_object_model_part_name": "FluidModelPart.Slave",
    "center_of_rotation": [0.0, 0.0, 0.0],
    "axis_of_rotation": [0.0, 0.0, 1.0],
    "target_angular_velocity_radians": 5.0,
    "acceleration_time": 0.5
}

Example

@SADPR SADPR requested a review from a team as a code owner March 11, 2026 12:10
@loumalouomega
Copy link
Copy Markdown
Member

I love the animation

for comp in components_map[variable]:
vu.ApplyFixity(comp, True, model_part.Nodes)

def _ApplyRotationAndMeshDisplacementPython(self, theta):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These operation in C++ (can be implemented in some utilities) may gain some important performance.

Copy link
Copy Markdown
Member

@loumalouomega loumalouomega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only comment is that some operations may be interesting to implement in some utilities and expose to python to avoid performance penalty

@SADPR
Copy link
Copy Markdown
Contributor Author

SADPR commented Mar 11, 2026

@loumalouomega Those functions were in C++ at the beginning (slightly faster). But @RiccardoRossi convinced me to make everything in Python. See -> 102d1fb

@loumalouomega
Copy link
Copy Markdown
Member

@loumalouomega Those functions were in C++ at the beginning (slightly faster). But @RiccardoRossi convinced me to make everything in Python. See -> 102d1fb

¯_(ツ)_/¯

@rubenzorrilla
Copy link
Copy Markdown
Member

Can't we use the standard f(x,y,z,t) functions I/O we have for all the processes to define the angular velocity here? Besides being more similar to the rest of processes, it would allow to define any ramp up function.

Commit body

Replace legacy target_angular_velocity_radians + acceleration_time input with a single angular_velocity_radians (constant or f(x,y,z,t) string).
Add standard interval support to align with Kratos process conventions.
Change rotation update to incremental step integration (delta_theta) over the overlap:
[t-Δt, t] ∩ [interval_begin, interval_end]
Apply incremental rotation on current coordinates and recompute MESH_DISPLACEMENT from initial coordinates.
Keep rotational VELOCITY assignment active only when process interval is active.
Manage fixity activation/deactivation consistently when entering/leaving interval.
Enable equivalent behavior between:
one process with piecewise angular velocity function, and
two process instances split by interval.
Update/add tests for:
constant numeric vs constant string input equivalence,
no-op outside interval,
split-interval vs single piecewise-function equivalence.
Migration note

Update project parameters from:
target_angular_velocity_radians, acceleration_time
To:
angular_velocity_radians (+ optional interval).
@SADPR
Copy link
Copy Markdown
Contributor Author

SADPR commented Mar 19, 2026

@rubenzorrilla done. RotatingFrameProcess now uses standard function input for angular velocity (angular_velocity_radians as constant or f(x,y,z,t)), with interval support. I removed target_angular_velocity_radians and acceleration_time to avoid duplicated APIs. Ramp-up can be defined directly in the function (e.g. -25.0*t if t<1.0 else -25.0). I also added regression tests for function input and interval behavior.

@SADPR
Copy link
Copy Markdown
Contributor Author

SADPR commented Apr 9, 2026

@RiccardoRossi @rubenzorrilla any news here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants