Skip to content

Commit

Permalink
Fix Cylinder and Sphere
Browse files Browse the repository at this point in the history
  • Loading branch information
haochey committed Feb 5, 2025
1 parent 587638e commit 105f30a
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions src/pre_process/m_patches.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,29 +1606,30 @@ contains
end if

if (.not. present(ib) .and. patch_icpp(patch_id)%smoothen) then
eta = tanh(smooth_coeff/min(dx, dy)* &
eta = tanh(smooth_coeff/min(dx, dy, dz)* &
(sqrt((x_cc(i) - x_centroid)**2 &

Check warning on line 1610 in src/pre_process/m_patches.fpp

View check run for this annotation

Codecov / codecov/patch

src/pre_process/m_patches.fpp#L1610

Added line #L1610 was not covered by tests
+ (cart_y - y_centroid)**2 &
+ (cart_z - z_centroid)**2) &
- radius))*(-0.5_wp) + 0.5_wp

Check warning on line 1613 in src/pre_process/m_patches.fpp

View check run for this annotation

Codecov / codecov/patch

src/pre_process/m_patches.fpp#L1613

Added line #L1613 was not covered by tests
end if

if (present(ib) .and. ((x_cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 &
+ (cart_z - z_centroid)**2 <= radius**2)) then
patch_id_fp(i, j, 0) = patch_id
else
if (((x_cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 &
+ (cart_z - z_centroid)**2 <= radius**2 &
.and. &
patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) &
.or. &
(.not. present(ib) .and. patch_id_fp(i, j, k) == smooth_patch_id)) &
then
if ((x_cc(i) - x_centroid)**2 &
+ (cart_y - y_centroid)**2 &
+ (cart_z - z_centroid)**2 <= radius**2) &
then

call s_assign_patch_primitive_variables(patch_id, i, j, k, &
eta, q_prim_vf, patch_id_fp)
if (present(ib)) then
! Updating the patch identities bookkeeping variable
patch_id_fp(i, j, k) = patch_id
else
if (patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k)) .or. &
patch_id_fp(i, j, k) == smooth_patch_id) then

@:analytical()
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
eta, q_prim_vf, patch_id_fp)

@:analytical()
end if
end if
end if
end do
Expand Down Expand Up @@ -1808,6 +1809,25 @@ contains
cart_z = z_cc(k)
end if

if (.not. present(ib) .and. patch_icpp(patch_id)%smoothen) then
if (.not. f_is_default(length_x)) then
eta = tanh(smooth_coeff/min(dy, dz)* &
(sqrt((cart_y - y_centroid)**2 &
+ (cart_z - z_centroid)**2) &
- radius))*(-0.5_wp) + 0.5_wp
elseif (.not. f_is_default(length_y)) then

Check warning on line 1818 in src/pre_process/m_patches.fpp

View check run for this annotation

Codecov / codecov/patch

src/pre_process/m_patches.fpp#L1817-L1818

Added lines #L1817 - L1818 were not covered by tests
eta = tanh(smooth_coeff/min(dx, dz)* &
(sqrt((x_cc(i) - x_centroid)**2 &

Check warning on line 1820 in src/pre_process/m_patches.fpp

View check run for this annotation

Codecov / codecov/patch

src/pre_process/m_patches.fpp#L1820

Added line #L1820 was not covered by tests
+ (cart_z - z_centroid)**2) &
- radius))*(-0.5_wp) + 0.5_wp

Check warning on line 1822 in src/pre_process/m_patches.fpp

View check run for this annotation

Codecov / codecov/patch

src/pre_process/m_patches.fpp#L1822

Added line #L1822 was not covered by tests
else
eta = tanh(smooth_coeff/min(dx, dy)* &
(sqrt((x_cc(i) - x_centroid)**2 &

Check warning on line 1825 in src/pre_process/m_patches.fpp

View check run for this annotation

Codecov / codecov/patch

src/pre_process/m_patches.fpp#L1825

Added line #L1825 was not covered by tests
+ (cart_y - y_centroid)**2) &
- radius))*(-0.5_wp) + 0.5_wp

Check warning on line 1827 in src/pre_process/m_patches.fpp

View check run for this annotation

Codecov / codecov/patch

src/pre_process/m_patches.fpp#L1827

Added line #L1827 was not covered by tests
end if
end if

if ((.not. f_is_default(length_x) .and. &
(cart_y - y_centroid)**2 &
+ (cart_z - z_centroid)**2 <= radius**2 .and. &
Expand Down Expand Up @@ -1841,25 +1861,6 @@ contains
! Updating the patch identities bookkeeping variable
if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id
end if

if (patch_icpp(patch_id)%smoothen) then
if (.not. f_is_default(length_x)) then
eta = tanh(smooth_coeff/min(dy, dz)* &
(sqrt((cart_y - y_centroid)**2 &
+ (cart_z - z_centroid)**2) &
- radius))*(-0.5_wp) + 0.5_wp
elseif (.not. f_is_default(length_y)) then
eta = tanh(smooth_coeff/min(dx, dz)* &
(sqrt((x_cc(i) - x_centroid)**2 &
+ (cart_z - z_centroid)**2) &
- radius))*(-0.5_wp) + 0.5_wp
else
eta = tanh(smooth_coeff/min(dx, dy)* &
(sqrt((x_cc(i) - x_centroid)**2 &
+ (cart_y - y_centroid)**2) &
- radius))*(-0.5_wp) + 0.5_wp
end if
end if
end if
end if
end do
Expand Down

0 comments on commit 105f30a

Please sign in to comment.