Skip to content

Commit 02ad051

Browse files
committed
Fix sphere smoothing
1 parent 131b41e commit 02ad051

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

src/pre_process/m_patches.fpp

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,34 +1605,32 @@ contains
16051605
cart_z = z_cc(k)
16061606
end if
16071607

1608-
if ((x_cc(i) - x_centroid)**2 &
1609-
+ (cart_y - y_centroid)**2 &
1610-
+ (cart_z - z_centroid)**2 <= radius**2) &
1611-
then
1612-
1613-
if (present(ib)) then
1614-
! Updating the patch identities bookkeeping variable
1615-
patch_id_fp(i, j, k) = patch_id
1616-
else
1617-
if (patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k)) .or. &
1618-
patch_id_fp(i, j, k) == smooth_patch_id) then
1608+
if (.not. present(ib) .and. patch_icpp(patch_id)%smoothen) then
1609+
eta = tanh(smooth_coeff/min(dx, dy)* &
1610+
(sqrt((x_cc(i) - x_centroid)**2 &
1611+
+ (cart_y - y_centroid)**2 &
1612+
+ (cart_z - z_centroid)**2) &
1613+
- radius))*(-0.5_wp) + 0.5_wp
1614+
end if
16191615

1620-
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
1621-
eta, q_prim_vf, patch_id_fp)
1616+
if (present(ib) .and. ((x_cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 &
1617+
+ (cart_z - z_centroid)**2 <= radius**2)) then
1618+
patch_id_fp(i, j, 0) = patch_id
1619+
else
1620+
if (((x_cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 &
1621+
+ (cart_z - z_centroid)**2 <= radius**2 &
1622+
.and. &
1623+
patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) &
1624+
.or. &
1625+
(.not. present(ib) .and. patch_id_fp(i, j, k) == smooth_patch_id)) &
1626+
then
16221627

1623-
@:analytical()
1624-
end if
1628+
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
1629+
eta, q_prim_vf, patch_id_fp)
16251630

1626-
if (patch_icpp(patch_id)%smoothen) then
1627-
eta = tanh(smooth_coeff/min(dx, dy, dz)* &
1628-
(sqrt((x_cc(i) - x_centroid)**2 &
1629-
+ (cart_y - y_centroid)**2 &
1630-
+ (cart_z - z_centroid)**2) &
1631-
- radius))*(-0.5_wp) + 0.5_wp
1632-
end if
1631+
@:analytical()
16331632
end if
16341633
end if
1635-
16361634
end do
16371635
end do
16381636
end do

0 commit comments

Comments
 (0)