Skip to content

Commit

Permalink
add cuboid smoothing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Wilfong committed Apr 11, 2024
1 parent 5a8debb commit 91acd10
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 156 deletions.
18 changes: 18 additions & 0 deletions src/pre_process/m_check_patches.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ contains
patch_icpp(i)%geometry == 4 .or. &
patch_icpp(i)%geometry == 5 .or. &
patch_icpp(i)%geometry == 8 .or. &
patch_icpp(i)%geometry == 9 .or. &
patch_icpp(i)%geometry == 10 .or. &
patch_icpp(i)%geometry == 11 .or. &
patch_icpp(i)%geometry == 12)) then
Expand Down Expand Up @@ -210,6 +211,12 @@ contains

end if

if (patch_icpp(patch_id)%smoothen .and. &
(patch_icpp(patch_id)%length_x .ne. patch_icpp(patch_id)%length_y)) then
call s_mpi_abort('Patch smoothing of retangle patch '//trim(iStr)// &

Check warning on line 216 in src/pre_process/m_check_patches.fpp

View workflow job for this annotation

GitHub Actions / Spell Check

"retangle" should be "rectangle".
'requires the patch to be a square. Exiting ...')
end if

end subroutine s_check_rectangle_patch_geometry ! ----------------------

!> This subroutine verifies that the geometric parameters of
Expand Down Expand Up @@ -475,6 +482,17 @@ contains

end if

if (patch_icpp(patch_id)%smoothen .and. &
((patch_icpp(patch_id)%length_x .ne. patch_icpp(patch_id)%length_y) &
.or. &
(patch_icpp(patch_id)%length_x .ne. patch_icpp(patch_id)%length_y) &
.or. &
(patch_icpp(patch_id)%length_y .ne. patch_icpp(patch_id)%length_z))) &
then
call s_mpi_abort('Patch smoothing of cuboid patch '//trim(iStr)// &
'requires the patch to be a cube. Exiting ...')
end if

end subroutine s_check_cuboid_patch_geometry ! -------------------------

!> This subroutine verifies that the geometric parameters of
Expand Down
17 changes: 15 additions & 2 deletions src/pre_process/m_patches.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,12 @@ contains
length_x = patch_icpp(patch_id)%length_x
length_y = patch_icpp(patch_id)%length_y
length_z = patch_icpp(patch_id)%length_z
if (.not. ib) then
smooth_coeff = patch_icpp(patch_id)%smooth_coeff
smooth_patch_id = patch_icpp(patch_id)%smooth_patch_id
end if
! Computing the beginning and the end x-, y- and z-coordinates of
! the cuboid based on its centroid and lengths
x_boundary%beg = x_centroid - 0.5d0*length_x
Expand Down Expand Up @@ -1645,9 +1650,17 @@ contains
z_boundary%beg <= cart_z .and. &
z_boundary%end >= cart_z &
.and. &
patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) &
patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k)) &
.or. &
patch_id_fp(i, j, k) == smooth_patch_id) &
then
if (.not. ib .and. patch_icpp(patch_id)%smoothen) then
eta = tanh(smooth_coeff/min(dx, dy, dz)* &
(max(abs(x_cc(i) - x_centroid), abs(y_cc(j) - y_centroid), abs(z_cc(k) - z_centroid)) &
- length_x/2d0))*(-0.5d0) + 0.5d0
end if
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
eta, q_prim_vf, patch_id_fp)
Expand Down
Loading

0 comments on commit 91acd10

Please sign in to comment.