Skip to content

Commit 105f30a

Browse files
committed
Fix Cylinder and Sphere
1 parent 587638e commit 105f30a

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

src/pre_process/m_patches.fpp

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,29 +1606,30 @@ contains
16061606
end if
16071607

16081608
if (.not. present(ib) .and. patch_icpp(patch_id)%smoothen) then
1609-
eta = tanh(smooth_coeff/min(dx, dy)* &
1609+
eta = tanh(smooth_coeff/min(dx, dy, dz)* &
16101610
(sqrt((x_cc(i) - x_centroid)**2 &
16111611
+ (cart_y - y_centroid)**2 &
16121612
+ (cart_z - z_centroid)**2) &
16131613
- radius))*(-0.5_wp) + 0.5_wp
16141614
end if
16151615

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
1616+
if ((x_cc(i) - x_centroid)**2 &
1617+
+ (cart_y - y_centroid)**2 &
1618+
+ (cart_z - z_centroid)**2 <= radius**2) &
1619+
then
16271620

1628-
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
1629-
eta, q_prim_vf, patch_id_fp)
1621+
if (present(ib)) then
1622+
! Updating the patch identities bookkeeping variable
1623+
patch_id_fp(i, j, k) = patch_id
1624+
else
1625+
if (patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k)) .or. &
1626+
patch_id_fp(i, j, k) == smooth_patch_id) then
16301627

1631-
@:analytical()
1628+
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
1629+
eta, q_prim_vf, patch_id_fp)
1630+
1631+
@:analytical()
1632+
end if
16321633
end if
16331634
end if
16341635
end do
@@ -1808,6 +1809,25 @@ contains
18081809
cart_z = z_cc(k)
18091810
end if
18101811

1812+
if (.not. present(ib) .and. patch_icpp(patch_id)%smoothen) then
1813+
if (.not. f_is_default(length_x)) then
1814+
eta = tanh(smooth_coeff/min(dy, dz)* &
1815+
(sqrt((cart_y - y_centroid)**2 &
1816+
+ (cart_z - z_centroid)**2) &
1817+
- radius))*(-0.5_wp) + 0.5_wp
1818+
elseif (.not. f_is_default(length_y)) then
1819+
eta = tanh(smooth_coeff/min(dx, dz)* &
1820+
(sqrt((x_cc(i) - x_centroid)**2 &
1821+
+ (cart_z - z_centroid)**2) &
1822+
- radius))*(-0.5_wp) + 0.5_wp
1823+
else
1824+
eta = tanh(smooth_coeff/min(dx, dy)* &
1825+
(sqrt((x_cc(i) - x_centroid)**2 &
1826+
+ (cart_y - y_centroid)**2) &
1827+
- radius))*(-0.5_wp) + 0.5_wp
1828+
end if
1829+
end if
1830+
18111831
if ((.not. f_is_default(length_x) .and. &
18121832
(cart_y - y_centroid)**2 &
18131833
+ (cart_z - z_centroid)**2 <= radius**2 .and. &
@@ -1841,25 +1861,6 @@ contains
18411861
! Updating the patch identities bookkeeping variable
18421862
if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id
18431863
end if
1844-
1845-
if (patch_icpp(patch_id)%smoothen) then
1846-
if (.not. f_is_default(length_x)) then
1847-
eta = tanh(smooth_coeff/min(dy, dz)* &
1848-
(sqrt((cart_y - y_centroid)**2 &
1849-
+ (cart_z - z_centroid)**2) &
1850-
- radius))*(-0.5_wp) + 0.5_wp
1851-
elseif (.not. f_is_default(length_y)) then
1852-
eta = tanh(smooth_coeff/min(dx, dz)* &
1853-
(sqrt((x_cc(i) - x_centroid)**2 &
1854-
+ (cart_z - z_centroid)**2) &
1855-
- radius))*(-0.5_wp) + 0.5_wp
1856-
else
1857-
eta = tanh(smooth_coeff/min(dx, dy)* &
1858-
(sqrt((x_cc(i) - x_centroid)**2 &
1859-
+ (cart_y - y_centroid)**2) &
1860-
- radius))*(-0.5_wp) + 0.5_wp
1861-
end if
1862-
end if
18631864
end if
18641865
end if
18651866
end do

0 commit comments

Comments
 (0)