Skip to content

Commit 12edf88

Browse files
committed
Fix Cylinder and Sphere Smooth function
1 parent 51f56f0 commit 12edf88

File tree

18 files changed

+332
-311
lines changed

18 files changed

+332
-311
lines changed

src/pre_process/m_initial_condition.fpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ contains
208208
call s_sphere(i, ib_markers%sf, q_prim_vf, ib)
209209
call s_sphere_levelset(levelset, levelset_norm, i)
210210
! Cylindrical patch
211+
elseif (patch_ib(i)%geometry == 9) then
212+
call s_cuboid(i, ib_markers%sf, q_prim_vf, ib)
213+
call s_cuboid_levelset(levelset, levelset_norm, i)
211214
elseif (patch_ib(i)%geometry == 10) then
212215
call s_cylinder(i, ib_markers%sf, q_prim_vf, ib)
213216
call s_cylinder_levelset(levelset, levelset_norm, i)

src/pre_process/m_patches.fpp

Lines changed: 60 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,24 +1613,24 @@ contains
16131613
- radius))*(-0.5_wp) + 0.5_wp
16141614
end if
16151615

1616-
if (((x_cc(i) - x_centroid)**2 &
1617-
+ (cart_y - y_centroid)**2 &
1618-
+ (cart_z - z_centroid)**2 <= radius**2) .or. &
1619-
patch_id_fp(i, j, k) == smooth_patch_id) &
1620-
then
1621-
1622-
if (present(ib)) then
1623-
! Updating the patch identities bookkeeping variable
1616+
if (present(ib)) then
1617+
! Updating the patch identities bookkeeping variable
1618+
if (((x_cc(i) - x_centroid)**2 &
1619+
+ (cart_y - y_centroid)**2 &
1620+
+ (cart_z - z_centroid)**2 <= radius**2)) then
16241621
patch_id_fp(i, j, k) = patch_id
1625-
else
1626-
if (patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k)) .or. &
1627-
patch_id_fp(i, j, k) == smooth_patch_id) then
1622+
end if
1623+
else
1624+
if ((((x_cc(i) - x_centroid)**2 &
1625+
+ (cart_y - y_centroid)**2 &
1626+
+ (cart_z - z_centroid)**2 <= radius**2) .and. &
1627+
patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. &
1628+
patch_id_fp(i, j, k) == smooth_patch_id) then
16281629

1629-
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
1630-
eta, q_prim_vf, patch_id_fp)
1630+
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
1631+
eta, q_prim_vf, patch_id_fp)
16311632

1632-
@:analytical()
1633-
end if
1633+
@:analytical()
16341634
end if
16351635
end if
16361636
end do
@@ -1829,39 +1829,57 @@ contains
18291829
end if
18301830
end if
18311831

1832-
if (((.not. f_is_default(length_x) .and. &
1833-
(cart_y - y_centroid)**2 &
1834-
+ (cart_z - z_centroid)**2 <= radius**2 .and. &
1835-
x_boundary%beg <= x_cc(i) .and. &
1836-
x_boundary%end >= x_cc(i)) &
1837-
.or. &
1838-
(.not. f_is_default(length_y) .and. &
1839-
(x_cc(i) - x_centroid)**2 &
1840-
+ (cart_z - z_centroid)**2 <= radius**2 .and. &
1841-
y_boundary%beg <= cart_y .and. &
1842-
y_boundary%end >= cart_y) &
1843-
.or. &
1844-
(.not. f_is_default(length_z) .and. &
1845-
(x_cc(i) - x_centroid)**2 &
1846-
+ (cart_y - y_centroid)**2 <= radius**2 .and. &
1847-
z_boundary%beg <= cart_z .and. &
1848-
z_boundary%end >= cart_z)) .or. patch_id_fp(i, j, k) == smooth_patch_id) then
1832+
if (present(ib)) then
1833+
if (((.not. f_is_default(length_x) .and. &
1834+
(cart_y - y_centroid)**2 &
1835+
+ (cart_z - z_centroid)**2 <= radius**2 .and. &
1836+
x_boundary%beg <= x_cc(i) .and. &
1837+
x_boundary%end >= x_cc(i)) &
1838+
.or. &
1839+
(.not. f_is_default(length_y) .and. &
1840+
(x_cc(i) - x_centroid)**2 &
1841+
+ (cart_z - z_centroid)**2 <= radius**2 .and. &
1842+
y_boundary%beg <= cart_y .and. &
1843+
y_boundary%end >= cart_y) &
1844+
.or. &
1845+
(.not. f_is_default(length_z) .and. &
1846+
(x_cc(i) - x_centroid)**2 &
1847+
+ (cart_y - y_centroid)**2 <= radius**2 .and. &
1848+
z_boundary%beg <= cart_z .and. &
1849+
z_boundary%end >= cart_z))) then
18491850

1850-
if (present(ib)) then
18511851
! Updating the patch identities bookkeeping variable
18521852
patch_id_fp(i, j, k) = patch_id
1853-
else
1854-
if (patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k)) &
1855-
.or. patch_id_fp(i, j, k) == smooth_patch_id) then
1853+
end if
18561854

1857-
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
1858-
eta, q_prim_vf, patch_id_fp)
1855+
else
1856+
if (((.not. f_is_default(length_x) .and. &
1857+
(cart_y - y_centroid)**2 &
1858+
+ (cart_z - z_centroid)**2 <= radius**2 .and. &
1859+
x_boundary%beg <= x_cc(i) .and. &
1860+
x_boundary%end >= x_cc(i)) &
1861+
.or. &
1862+
(.not. f_is_default(length_y) .and. &
1863+
(x_cc(i) - x_centroid)**2 &
1864+
+ (cart_z - z_centroid)**2 <= radius**2 .and. &
1865+
y_boundary%beg <= cart_y .and. &
1866+
y_boundary%end >= cart_y) &
1867+
.or. &
1868+
(.not. f_is_default(length_z) .and. &
1869+
(x_cc(i) - x_centroid)**2 &
1870+
+ (cart_y - y_centroid)**2 <= radius**2 .and. &
1871+
z_boundary%beg <= cart_z .and. &
1872+
z_boundary%end >= cart_z) .and. &
1873+
patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. &
1874+
patch_id_fp(i, j, k) == smooth_patch_id) then
18591875

1860-
@:analytical()
1876+
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
1877+
eta, q_prim_vf, patch_id_fp)
18611878

1862-
! Updating the patch identities bookkeeping variable
1863-
if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id
1864-
end if
1879+
@:analytical()
1880+
1881+
! Updating the patch identities bookkeeping variable
1882+
if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id
18651883
end if
18661884
end if
18671885
end do

tests/07D9EBD1/golden-metadata.txt

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/07D9EBD1/golden.txt

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)