@@ -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
0 commit comments