Skip to content

IB moment of inertia from the cell sum has an extra 1/cell_volume factor #1994

Open

Description

@sbryngelson

s_compute_moment_of_inertia (src/simulation/m_ibm.fpp) computes the moment numerically for geometries without an analytic formula (everything except circle, rectangle, ellipse, sphere):

moment = moment + distance_to_axis          ! sum of r^2 over the body's cells
...
moment = moment*patch%mass/(count*cell_volume)

patch%mass is the body's total mass (it is used as force/mass in m_time_steppers.fpp:908 and accel_bf*mass in m_ibm.fpp:1426). For count uniform-density cells each carries mass/count, so the moment is mass * sum(r^2) / count, with units of mass*length^2. Dividing additionally by cell_volume makes it mass/length, so the result scales with grid resolution (e.g. refining by 2x in 3D multiplies the moment by 8) and the angular response of two-way-coupled bodies (STL/airfoil/other non-analytic shapes) depends on the mesh.

Expected: moment = moment*patch%mass/count, which is consistent with the analytic branches (e.g. 0.4*mass*r^2 for the sphere). The line dates from #1075.

Separately, the sum runs over the local rank's cells only, with no reduction across ranks (the routine is a GPU_ROUTINE(seq) called from device loops, so an MPI reduction cannot simply be added there); a body split across ranks gets a different moment on each rank. #1992 fixes the periodic-marker decoding and the 0/0 on ranks holding none of the body, but not this.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions