Calculates the distance between cell and neighbor center along face normal.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(bc_set_t), | intent(in) | :: | bc | |||
| integer, | intent(in) | :: | face_id | |||
| integer, | intent(in) | :: | cell_id | |||
| integer, | intent(in) | :: | nb |
function face_normal_distance(mesh, bc, face_id, cell_id, nb) result(dist) type(mesh_t), intent(in) :: mesh type(bc_set_t), intent(in) :: bc integer, intent(in) :: face_id integer, intent(in) :: cell_id integer, intent(in) :: nb real(rk) :: dist integer :: pair_face integer :: btype real(rk) :: nvec(3) nvec = outward_normal(mesh, face_id, cell_id) if (nb > 0) then if (mesh%faces(face_id)%neighbor == 0) then btype = patch_type_for_face(mesh, bc, face_id) if (btype == bc_periodic) then pair_face = mesh%faces(face_id)%periodic_face if (pair_face <= 0) then call fatal_error('numerics', 'periodic face has no paired face') end if dist = abs(dot_product(mesh%faces(face_id)%center - & mesh%cells(cell_id)%center, nvec)) + & abs(dot_product(mesh%cells(nb)%center - & mesh%faces(pair_face)%center, nvec)) dist = max(dist, tiny_safe) return end if end if dist = abs(dot_product(mesh%cells(nb)%center - & mesh%cells(cell_id)%center, nvec)) else dist = abs(dot_product(mesh%faces(face_id)%center - & mesh%cells(cell_id)%center, nvec)) end if dist = max(dist, tiny_safe) end function face_normal_distance