-
Notifications
You must be signed in to change notification settings - Fork 128
Analytic mibm velocities and airfoil centroid #1111
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
Changes from all commits
89a0ac5
ef446f5
2f9b1be
d54bc5b
697b5a0
6ed8350
7bd28cd
f40422a
541e727
cb7b845
54c9421
37f2730
8b00a82
6817228
f6c961e
a815445
e94637d
675d974
8363059
cbdb29f
aa68ade
928ccd0
7707c26
fb09485
801d504
0747715
a2f49c4
de62c66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,8 @@ | |
| #:def analytical() | ||
|
|
||
| #:enddef | ||
|
|
||
| ! For moving immersed boundaries in simulation | ||
| #:def mib_analytical() | ||
|
|
||
| #:enddef | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -279,6 +279,7 @@ contains | |||||
| do i = 0, m | ||||||
| xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] ! get coordinate frame centered on IB | ||||||
| xy_local = matmul(inverse_rotation, xy_local) ! rotate the frame into the IB's coordinates | ||||||
| xy_local = xy_local - patch_ib(patch_id)%centroid_offset ! airfoils are a patch that require a centroid offset | ||||||
danieljvickers marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| if (xy_local(1) >= 0._wp .and. xy_local(1) <= ca_in) then | ||||||
| xa = xy_local(1)/ca_in | ||||||
|
|
@@ -433,6 +434,7 @@ contains | |||||
| do i = 0, m | ||||||
| xyz_local = [x_cc(i) - center(1), y_cc(j) - center(2), z_cc(l) - center(3)] ! get coordinate frame centered on IB | ||||||
| xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates | ||||||
| xyz_local = xyz_local - patch_ib(patch_id)%centroid_offset ! airfoils are a patch that require a centroid offset | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The 3D airfoil routine subtracts Severity Level: Critical 🚨- ❌ 3D airfoil marker placement incorrect in s_ib_3D_airfoil.
- ⚠️ 3D pitching/rotating airfoil simulations show wrong geometry.
Suggested change
Steps of Reproduction ✅1. Prepare a 3D case with an airfoil patch (patch_ib(... )%geometry == 11) so
s_apply_ib_patches calls s_ib_3D_airfoil during marker generation.
2. Set patch_ib(patch_id)%centroid_offset to a non-zero vector and set non-zero rotation
angles so rotation_matrix_inverse is non-trivial; run to the IB marker generation step.
3. In s_ib_3D_airfoil the code computes xyz_local and applies inverse_rotation at
src/common/m_ib_patches.fpp:435-436, then subtracts patch_ib(patch_id)%centroid_offset at
line 437 without rotating that offset into the local frame.
4. As a result the z/y/x cell-inclusion tests (for example the z_min/z_max check at the
surrounding block) and the later assignments to ib_markers_sf(i,j,l) are done with an
inconsistent offset and the 3D airfoil appears shifted. Reproduces when centroid_offset ≠
0 and rotation ≠ identity.Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** src/common/m_ib_patches.fpp
**Line:** 437:437
**Comment:**
*Logic Error: The 3D airfoil routine subtracts `patch_ib(patch_id)%centroid_offset` from `xyz_local` after applying `inverse_rotation`; if `centroid_offset` is expressed in the global/model frame this subtraction is done in the wrong basis. Rotate the centroid offset into the IB/local frame with the same `inverse_rotation` before subtracting to ensure the offset is applied consistently in the same coordinate system.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||
|
|
||||||
| if (xyz_local(3) >= z_min .and. xyz_local(3) <= z_max) then | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -95,13 +95,15 @@ contains | |||||||||||||||||||||||||||||||||||||
| integer :: i, j, k | ||||||||||||||||||||||||||||||||||||||
| integer :: max_num_gps, max_num_inner_gps | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! do all set up for moving immersed boundaries | ||||||||||||||||||||||||||||||||||||||
| moving_immersed_boundary_flag = .false. | ||||||||||||||||||||||||||||||||||||||
| do i = 1, num_ibs | ||||||||||||||||||||||||||||||||||||||
| if (patch_ib(i)%moving_ibm /= 0) then | ||||||||||||||||||||||||||||||||||||||
| call s_compute_moment_of_inertia(i, patch_ib(i)%angular_vel) | ||||||||||||||||||||||||||||||||||||||
| moving_immersed_boundary_flag = .true. | ||||||||||||||||||||||||||||||||||||||
| end if | ||||||||||||||||||||||||||||||||||||||
| call s_update_ib_rotation_matrix(i) | ||||||||||||||||||||||||||||||||||||||
| call s_compute_centroid_offset(i) | ||||||||||||||||||||||||||||||||||||||
danieljvickers marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||
| end do | ||||||||||||||||||||||||||||||||||||||
| $:GPU_ENTER_DATA(copyin='[patch_ib]') | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -1012,24 +1014,35 @@ contains | |||||||||||||||||||||||||||||||||||||
| ! compute the surface integrals of the IB via a volume integraion method described in | ||||||||||||||||||||||||||||||||||||||
| ! "A coupled IBM/Euler-Lagrange framework for simulating shock-induced particle size segregation" | ||||||||||||||||||||||||||||||||||||||
| ! by Archana Sridhar and Jesse Capecelatro | ||||||||||||||||||||||||||||||||||||||
| subroutine s_compute_ib_forces(q_prim_vf, dynamic_viscosity) | ||||||||||||||||||||||||||||||||||||||
| subroutine s_compute_ib_forces(q_prim_vf, fluid_pp) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! real(wp), dimension(idwbuff(1)%beg:idwbuff(1)%end, & | ||||||||||||||||||||||||||||||||||||||
| ! idwbuff(2)%beg:idwbuff(2)%end, & | ||||||||||||||||||||||||||||||||||||||
| ! idwbuff(3)%beg:idwbuff(3)%end), intent(in) :: pressure | ||||||||||||||||||||||||||||||||||||||
| type(scalar_field), dimension(1:sys_size), intent(in) :: q_prim_vf | ||||||||||||||||||||||||||||||||||||||
| real(wp), intent(in) :: dynamic_viscosity | ||||||||||||||||||||||||||||||||||||||
| type(physical_parameters), dimension(1:num_fluids), intent(in) :: fluid_pp | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| integer :: gp_id, i, j, k, l, q, ib_idx | ||||||||||||||||||||||||||||||||||||||
| integer :: gp_id, i, j, k, l, q, ib_idx, fluid_idx | ||||||||||||||||||||||||||||||||||||||
| real(wp), dimension(num_ibs, 3) :: forces, torques | ||||||||||||||||||||||||||||||||||||||
| real(wp), dimension(1:3, 1:3) :: viscous_stress_div, viscous_stress_div_1, viscous_stress_div_2, viscous_cross_1, viscous_cross_2 ! viscous stress tensor with temp vectors to hold divergence calculations | ||||||||||||||||||||||||||||||||||||||
| real(wp), dimension(1:3) :: local_force_contribution, radial_vector, local_torque_contribution, vel | ||||||||||||||||||||||||||||||||||||||
| real(wp) :: cell_volume, dx, dy, dz | ||||||||||||||||||||||||||||||||||||||
| real(wp) :: cell_volume, dx, dy, dz, dynamic_viscosity | ||||||||||||||||||||||||||||||||||||||
| real(wp), dimension(1:num_fluids) :: dynamic_viscosities | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| forces = 0._wp | ||||||||||||||||||||||||||||||||||||||
| torques = 0._wp | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| $:GPU_PARALLEL_LOOP(private='[ib_idx,radial_vector,local_force_contribution,cell_volume,local_torque_contribution, viscous_stress_div, viscous_stress_div_1, viscous_stress_div_2, viscous_cross_1, viscous_cross_2, dx, dy, dz]', copy='[forces,torques]', copyin='[ib_markers,patch_ib,dynamic_viscosity]', collapse=3) | ||||||||||||||||||||||||||||||||||||||
| if (viscous) then | ||||||||||||||||||||||||||||||||||||||
| do fluid_idx = 1, num_fluids | ||||||||||||||||||||||||||||||||||||||
| if (fluid_pp(fluid_idx)%Re(1) /= 0._wp) then | ||||||||||||||||||||||||||||||||||||||
| dynamic_viscosities(fluid_idx) = 1._wp/fluid_pp(fluid_idx)%Re(1) | ||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||
| dynamic_viscosities(fluid_idx) = 0._wp | ||||||||||||||||||||||||||||||||||||||
| end if | ||||||||||||||||||||||||||||||||||||||
| end do | ||||||||||||||||||||||||||||||||||||||
| end if | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| $:GPU_PARALLEL_LOOP(private='[ib_idx,fluid_idx, radial_vector,local_force_contribution,cell_volume,local_torque_contribution, dynamic_viscosity, viscous_stress_div, viscous_stress_div_1, viscous_stress_div_2, viscous_cross_1, viscous_cross_2, dx, dy, dz]', copy='[forces,torques]', copyin='[ib_markers,patch_ib,dynamic_viscosities]', collapse=3) | ||||||||||||||||||||||||||||||||||||||
| do i = 0, m | ||||||||||||||||||||||||||||||||||||||
| do j = 0, n | ||||||||||||||||||||||||||||||||||||||
| do k = 0, p | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -1044,26 +1057,33 @@ contains | |||||||||||||||||||||||||||||||||||||
| dx = x_cc(i + 1) - x_cc(i) | ||||||||||||||||||||||||||||||||||||||
| dy = y_cc(j + 1) - y_cc(j) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! Get the pressure contribution to force via a finite difference to compute the 2D components of the gradient of the pressure and cell volume | ||||||||||||||||||||||||||||||||||||||
| local_force_contribution(1) = -1._wp*(q_prim_vf(E_idx)%sf(i + 1, j, k) - q_prim_vf(E_idx)%sf(i - 1, j, k))/(2._wp*dx) ! force is the negative pressure gradient | ||||||||||||||||||||||||||||||||||||||
| local_force_contribution(2) = -1._wp*(q_prim_vf(E_idx)%sf(i, j + 1, k) - q_prim_vf(E_idx)%sf(i, j - 1, k))/(2._wp*dy) | ||||||||||||||||||||||||||||||||||||||
| cell_volume = abs(dx*dy) | ||||||||||||||||||||||||||||||||||||||
| ! add the 3D component of the pressure gradient, if we are working in 3 dimensions | ||||||||||||||||||||||||||||||||||||||
| if (num_dims == 3) then | ||||||||||||||||||||||||||||||||||||||
| dz = z_cc(k + 1) - z_cc(k) | ||||||||||||||||||||||||||||||||||||||
| local_force_contribution(3) = -1._wp*(q_prim_vf(E_idx)%sf(i, j, k + 1) - q_prim_vf(E_idx)%sf(i, j, k - 1))/(2._wp*dz) | ||||||||||||||||||||||||||||||||||||||
| cell_volume = abs(cell_volume*dz) | ||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||
| local_force_contribution(3) = 0._wp | ||||||||||||||||||||||||||||||||||||||
| end if | ||||||||||||||||||||||||||||||||||||||
| local_force_contribution(:) = 0._wp | ||||||||||||||||||||||||||||||||||||||
| do fluid_idx = 0, num_fluids - 1 | ||||||||||||||||||||||||||||||||||||||
| ! Get the pressure contribution to force via a finite difference to compute the 2D components of the gradient of the pressure and cell volume | ||||||||||||||||||||||||||||||||||||||
| local_force_contribution(1) = local_force_contribution(1) - (q_prim_vf(E_idx + fluid_idx)%sf(i + 1, j, k) - q_prim_vf(E_idx + fluid_idx)%sf(i - 1, j, k))/(2._wp*dx) ! force is the negative pressure gradient | ||||||||||||||||||||||||||||||||||||||
| local_force_contribution(2) = local_force_contribution(2) - (q_prim_vf(E_idx + fluid_idx)%sf(i, j + 1, k) - q_prim_vf(E_idx + fluid_idx)%sf(i, j - 1, k))/(2._wp*dy) | ||||||||||||||||||||||||||||||||||||||
| cell_volume = abs(dx*dy) | ||||||||||||||||||||||||||||||||||||||
| ! add the 3D component of the pressure gradient, if we are working in 3 dimensions | ||||||||||||||||||||||||||||||||||||||
| if (num_dims == 3) then | ||||||||||||||||||||||||||||||||||||||
| dz = z_cc(k + 1) - z_cc(k) | ||||||||||||||||||||||||||||||||||||||
| local_force_contribution(3) = local_force_contribution(3) - (q_prim_vf(E_idx + fluid_idx)%sf(i, j, k + 1) - q_prim_vf(E_idx + fluid_idx)%sf(i, j, k - 1))/(2._wp*dz) | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1061
to
+1069
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Off-by-one indexing: the pressure-gradient loop uses Severity Level: Critical 🚨- ❌ IB force computation for multi-fluid flows incorrect.
- ⚠️ Multi-fluid pressure-gradient selection inconsistent.
- ⚠️ Affects s_compute_ib_forces force aggregation path.
Suggested change
Steps of Reproduction ✅1. Run a multi-fluid case (num_fluids >= 2) that exercises immersed boundary force
accumulation; s_compute_ib_forces is defined in src/simulation/m_ibm.fpp (subroutine
s_compute_ib_forces, start around line 1017).
2. When the triple loop over grid points hits an IB cell (ib_idx /= 0) the code executes
the pressure-gradient accumulation loop at src/simulation/m_ibm.fpp lines ~1060-1072 (the
shown local_force_contribution block).
3. The loop uses do fluid_idx = 0, num_fluids-1 and indexes q_prim_vf(E_idx + fluid_idx) —
the rest of the codebase consistently uses 1..num_fluids indexing for per-fluid fields
(see multiple occurrences of loops using 1..num_fluids, e.g., s_ibm_correct_state and
earlier sections).
4. On a multi-fluid run this off-by-one selection will pick the wrong q_prim_vf field for
at least one fluid component, producing incorrect pressure gradients and therefore
incorrect IB force contributions; this is observable in differing IB forces/torques vs.
expected values when comparing single- vs multi-fluid runs.Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** src/simulation/m_ibm.fpp
**Line:** 1061:1069
**Comment:**
*Off By One: Off-by-one indexing: the pressure-gradient loop uses `do fluid_idx = 0, num_fluids - 1` but other code uses 1..num_fluids; this mixes 0-based and 1-based offsets when indexing `q_prim_vf` and is likely wrong or will index the wrong fields; change the loop to `do fluid_idx = 1, num_fluids` and index `q_prim_vf(E_idx + fluid_idx - 1)` so indexing is consistent with the rest of the code.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||||||||||||||||||||||||||||||||||
| cell_volume = abs(cell_volume*dz) | ||||||||||||||||||||||||||||||||||||||
| end if | ||||||||||||||||||||||||||||||||||||||
| end do | ||||||||||||||||||||||||||||||||||||||
danieljvickers marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! Update the force values atomically to prevent race conditions | ||||||||||||||||||||||||||||||||||||||
| call s_cross_product(radial_vector, local_force_contribution, local_torque_contribution) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! get the viscous stress and add its contribution if that is considered | ||||||||||||||||||||||||||||||||||||||
| ! TODO :: This is really bad code | ||||||||||||||||||||||||||||||||||||||
| ! if (.false.) then | ||||||||||||||||||||||||||||||||||||||
| if (viscous) then | ||||||||||||||||||||||||||||||||||||||
| ! compute the volume-weighted local dynamic viscosity | ||||||||||||||||||||||||||||||||||||||
| dynamic_viscosity = 0._wp | ||||||||||||||||||||||||||||||||||||||
| do fluid_idx = 1, num_fluids | ||||||||||||||||||||||||||||||||||||||
| ! local dynamic viscosity is the dynamic viscosity of the fluid times alpha of the fluid | ||||||||||||||||||||||||||||||||||||||
| dynamic_viscosity = dynamic_viscosity + (q_prim_vf(fluid_idx + advxb - 1)%sf(i, j, k)*dynamic_viscosities(fluid_idx)) | ||||||||||||||||||||||||||||||||||||||
| end do | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! get the linear force component first | ||||||||||||||||||||||||||||||||||||||
| call s_compute_viscous_stress_tensor(viscous_stress_div_1, q_prim_vf, dynamic_viscosity, i - 1, j, k) | ||||||||||||||||||||||||||||||||||||||
| call s_compute_viscous_stress_tensor(viscous_stress_div_2, q_prim_vf, dynamic_viscosity, i + 1, j, k) | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -1150,6 +1170,64 @@ contains | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| end subroutine s_finalize_ibm_module | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| !> Computes the center of mass for IB patch types where we are unable to determine their center of mass analytically. | ||||||||||||||||||||||||||||||||||||||
| !> These patches include things like NACA airfoils and STL models | ||||||||||||||||||||||||||||||||||||||
| subroutine s_compute_centroid_offset(ib_marker) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| integer, intent(in) :: ib_marker | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| integer :: i, j, k, num_cells, num_cells_local | ||||||||||||||||||||||||||||||||||||||
| real(wp), dimension(1:3) :: center_of_mass, center_of_mass_local | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! Offset only needs to be computes for specific geometries | ||||||||||||||||||||||||||||||||||||||
| if (patch_ib(ib_marker)%geometry == 4 .or. & | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%geometry == 5 .or. & | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%geometry == 11 .or. & | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%geometry == 12) then | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| center_of_mass_local = [0._wp, 0._wp, 0._wp] | ||||||||||||||||||||||||||||||||||||||
| num_cells_local = 0 | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! get the summed mass distribution and number of cells to divide by | ||||||||||||||||||||||||||||||||||||||
| do i = 0, m | ||||||||||||||||||||||||||||||||||||||
| do j = 0, n | ||||||||||||||||||||||||||||||||||||||
| do k = 0, p | ||||||||||||||||||||||||||||||||||||||
| if (ib_markers%sf(i, j, k) == ib_marker) then | ||||||||||||||||||||||||||||||||||||||
| num_cells_local = num_cells_local + 1 | ||||||||||||||||||||||||||||||||||||||
| center_of_mass_local = center_of_mass_local + [x_cc(i), y_cc(j), 0._wp] | ||||||||||||||||||||||||||||||||||||||
| if (num_dims == 3) center_of_mass_local(3) = center_of_mass_local(3) + z_cc(k) | ||||||||||||||||||||||||||||||||||||||
| end if | ||||||||||||||||||||||||||||||||||||||
| end do | ||||||||||||||||||||||||||||||||||||||
| end do | ||||||||||||||||||||||||||||||||||||||
| end do | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! reduce the mass contribution over all MPI ranks and compute COM | ||||||||||||||||||||||||||||||||||||||
| call s_mpi_allreduce_integer_sum(num_cells_local, num_cells) | ||||||||||||||||||||||||||||||||||||||
| if (num_cells /= 0) then | ||||||||||||||||||||||||||||||||||||||
| call s_mpi_allreduce_sum(center_of_mass_local(1), center_of_mass(1)) | ||||||||||||||||||||||||||||||||||||||
| call s_mpi_allreduce_sum(center_of_mass_local(2), center_of_mass(2)) | ||||||||||||||||||||||||||||||||||||||
| call s_mpi_allreduce_sum(center_of_mass_local(3), center_of_mass(3)) | ||||||||||||||||||||||||||||||||||||||
| center_of_mass = center_of_mass/real(num_cells, wp) | ||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%centroid_offset = [0._wp, 0._wp, 0._wp] | ||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||
| end if | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
danieljvickers marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||
| ! assign the centroid offset as a vector pointing from the true COM to the "centroid" in the input file and replace the current centroid | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%centroid_offset = [patch_ib(ib_marker)%x_centroid, patch_ib(ib_marker)%y_centroid, patch_ib(ib_marker)%z_centroid] & | ||||||||||||||||||||||||||||||||||||||
| - center_of_mass | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%x_centroid = center_of_mass(1) | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%y_centroid = center_of_mass(2) | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%z_centroid = center_of_mass(3) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| ! rotate the centroid offset back into the local coords of the IB | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%centroid_offset = matmul(patch_ib(ib_marker)%rotation_matrix_inverse, patch_ib(ib_marker)%centroid_offset) | ||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||
| patch_ib(ib_marker)%centroid_offset(:) = [0._wp, 0._wp, 0._wp] | ||||||||||||||||||||||||||||||||||||||
| end if | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| end subroutine s_compute_centroid_offset | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| subroutine s_compute_moment_of_inertia(ib_marker, axis) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| real(wp), dimension(3), intent(in) :: axis !< the axis about which we compute the moment. Only required in 3D. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.