Skip to content

Commit de3e7a1

Browse files
authored
IB-DB Treatment (#407)
1 parent f23fceb commit de3e7a1

File tree

6 files changed

+100
-4
lines changed

6 files changed

+100
-4
lines changed

src/common/m_derived_types.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ module m_derived_types
276276
real(kind(0d0)), dimension(2, 2, 2) :: interp_coeffs !< Interpolation Coefficients of image point
277277
integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of
278278
logical :: slip
279+
integer, dimension(3) :: DB
279280
280281
end type ghost_point
281282

src/simulation/m_global_parameters.fpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ module m_global_parameters
160160
!> @{
161161
type(int_bounds_info) :: bc_x, bc_y, bc_z
162162
!> @}
163+
type(bounds_info) :: x_domain, y_domain, z_domain
163164

164165
logical :: parallel_io !< Format of the data files
165166
logical :: file_per_process !< shared file or not when using parallel io
@@ -500,9 +501,9 @@ contains
500501
#:endfor
501502
#:endfor
502503

503-
! x_domain%beg = dflt_int; x_domain%end = dflt_int;
504-
! y_domain%beg = dflt_int; y_domain%end = dflt_int;
505-
! z_domain%beg = dflt_int; z_domain%end = dflt_int;
504+
x_domain%beg = dflt_int; x_domain%end = dflt_int
505+
y_domain%beg = dflt_int; y_domain%end = dflt_int
506+
z_domain%beg = dflt_int; z_domain%end = dflt_int
506507

507508
! Fluids physical parameters
508509
do i = 1, num_fluids_max

src/simulation/m_ibm.fpp

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,11 @@ contains
409409
index = index + dir
410410
end do
411411
ghost_points(q)%ip_grid(dim) = index
412+
if (ghost_points(q)%DB(dim) == -1) then
413+
ghost_points(q)%ip_grid(dim) = ghost_points(q)%loc(dim) + 1
414+
else if (ghost_points(q)%DB(dim) == 1) then
415+
ghost_points(q)%ip_grid(dim) = ghost_points(q)%loc(dim) - 1
416+
end if
412417
end if
413418
end do
414419

@@ -508,14 +513,47 @@ contains
508513
ghost_points(count)%ib_patch_id = &
509514
patch_id
510515
ghost_points(count)%slip = patch_ib(patch_id)%slip
516+
517+
if ((x_cc(i) - dx(i)) < x_domain%beg) then
518+
ghost_points(count)%DB(1) = -1
519+
else if ((x_cc(i) + dx(i)) > x_domain%end) then
520+
ghost_points(count)%DB(1) = 1
521+
else
522+
ghost_points(count)%DB(1) = 0
523+
end if
524+
525+
if ((y_cc(j) - dy(j)) < y_domain%beg) then
526+
ghost_points(count)%DB(2) = -1
527+
else if ((y_cc(j) + dy(j)) > y_domain%end) then
528+
ghost_points(count)%DB(2) = 1
529+
else
530+
ghost_points(count)%DB(2) = 0
531+
end if
532+
511533
count = count + 1
534+
512535
else
513536
inner_points(count_i)%loc = [i, j, 0]
514537
patch_id = ib_markers%sf(i, j, 0)
515538
inner_points(count_i)%ib_patch_id = &
516539
patch_id
517540
inner_points(count_i)%slip = patch_ib(patch_id)%slip
541+
if ((x_cc(i) - dx(i)) < x_domain%beg .or. &
542+
(x_cc(i) + dx(i)) > x_domain%end) then
543+
ghost_points(count)%DB(1) = 1
544+
else
545+
ghost_points(count)%DB(1) = 0
546+
end if
547+
548+
if ((y_cc(j) - dy(j)) < y_domain%beg .or. &
549+
(y_cc(j) + dy(j)) > y_domain%end) then
550+
ghost_points(count)%DB(2) = 1
551+
else
552+
ghost_points(count)%DB(2) = 0
553+
end if
554+
518555
count_i = count_i + 1
556+
519557
end if
520558
end if
521559
else
@@ -531,13 +569,63 @@ contains
531569
ghost_points(count)%ib_patch_id = &
532570
ib_markers%sf(i, j, k)
533571
ghost_points(count)%slip = patch_ib(patch_id)%slip
572+
573+
if ((x_cc(i) - dx(i)) < x_domain%beg) then
574+
ghost_points(count)%DB(1) = -1
575+
else if ((x_cc(i) + dx(i)) > x_domain%end) then
576+
ghost_points(count)%DB(1) = 1
577+
else
578+
ghost_points(count)%DB(1) = 0
579+
end if
580+
581+
if ((y_cc(j) - dy(j)) < y_domain%beg) then
582+
ghost_points(count)%DB(2) = -1
583+
else if ((y_cc(j) + dy(j)) > y_domain%end) then
584+
ghost_points(count)%DB(2) = 1
585+
else
586+
ghost_points(count)%DB(2) = 0
587+
end if
588+
589+
if ((z_cc(k) - dz(k)) < z_domain%beg) then
590+
ghost_points(count)%DB(3) = -1
591+
else if ((z_cc(k) + dz(k)) > z_domain%end) then
592+
ghost_points(count)%DB(3) = 1
593+
else
594+
ghost_points(count)%DB(3) = 0
595+
end if
596+
534597
count = count + 1
535598
else
536599
inner_points(count_i)%loc = [i, j, k]
537600
patch_id = ib_markers%sf(i, j, k)
538601
inner_points(count_i)%ib_patch_id = &
539602
ib_markers%sf(i, j, k)
540603
inner_points(count_i)%slip = patch_ib(patch_id)%slip
604+
605+
if ((x_cc(i) - dx(i)) < x_domain%beg) then
606+
ghost_points(count)%DB(1) = -1
607+
else if ((x_cc(i) + dx(i)) > x_domain%end) then
608+
ghost_points(count)%DB(1) = 1
609+
else
610+
ghost_points(count)%DB(1) = 0
611+
end if
612+
613+
if ((y_cc(j) - dy(j)) < y_domain%beg) then
614+
ghost_points(count)%DB(2) = -1
615+
else if ((y_cc(j) + dy(j)) > y_domain%end) then
616+
ghost_points(count)%DB(2) = 1
617+
else
618+
ghost_points(count)%DB(2) = 0
619+
end if
620+
621+
if ((z_cc(k) - dz(k)) < z_domain%beg) then
622+
ghost_points(count)%DB(3) = -1
623+
else if ((z_cc(k) + dz(k)) > z_domain%end) then
624+
ghost_points(count)%DB(3) = 1
625+
else
626+
ghost_points(count)%DB(3) = 0
627+
end if
628+
541629
count_i = count_i + 1
542630
end if
543631
end if
@@ -591,6 +679,7 @@ contains
591679
(y_cc(j2) - gp%ip_loc(2))**2)
592680

593681
interp_coeffs = 0d0
682+
594683
if (dist(1, 1, 1) <= 1d-16) then
595684
interp_coeffs(1, 1, 1) = 1d0
596685
else if (dist(2, 1, 1) <= 1d-16) then

src/simulation/m_mpi_proxy.fpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ contains
165165
& 'Re_inv', 'poly_sigma', 'palpha_eps', 'ptgalpha_eps', 'pi_fac', &
166166
& 'bc_x%vb1','bc_x%vb2','bc_x%vb3','bc_x%ve1','bc_x%ve2','bc_x%ve2', &
167167
& 'bc_y%vb1','bc_y%vb2','bc_y%vb3','bc_y%ve1','bc_y%ve2','bc_y%ve3', &
168-
& 'bc_z%vb1','bc_z%vb2','bc_z%vb3','bc_z%ve1','bc_z%ve2','bc_z%ve3' ]
168+
& 'bc_z%vb1','bc_z%vb2','bc_z%vb3','bc_z%ve1','bc_z%ve2','bc_z%ve3', &
169+
& 'x_domain%beg', 'x_domain%end', 'y_domain%beg', 'y_domain%end', &
170+
& 'z_domain%beg', 'z_domain%end']
169171
call MPI_BCAST(${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
170172
#:endfor
171173

src/simulation/m_start_up.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ contains
132132
mapped_weno, mp_weno, weno_avg, &
133133
riemann_solver, wave_speeds, avg_state, &
134134
bc_x, bc_y, bc_z, &
135+
x_domain, y_domain, z_domain, &
135136
hypoelasticity, &
136137
ib, num_ibs, patch_ib, &
137138
fluid_pp, probe_wrt, prim_vars_wrt, &

toolchain/mfc/run/case_dicts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@
123123
SIMULATION.append(f'bc_{cmp}%ve1')
124124
SIMULATION.append(f'bc_{cmp}%ve2')
125125
SIMULATION.append(f'bc_{cmp}%ve3')
126+
for prepend in ["domain%beg", "domain%end", "a", "b"]:
127+
SIMULATION.append(f"{cmp}_{prepend}")
126128

127129
for wrt_id in range(1,10+1):
128130
for cmp in ["x", "y", "z"]:

0 commit comments

Comments
 (0)