Skip to content

Commit

Permalink
Merge pull request #13197 from marcosvanella/master
Browse files Browse the repository at this point in the history
FDS Source: Check matching boundary planes for adjacent meshes when c…
  • Loading branch information
marcosvanella authored Jul 19, 2024
2 parents 7a3a7c8 + e1b5fd8 commit f3dbf79
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
1 change: 1 addition & 0 deletions Manuals/FDS_User_Guide/FDS_User_Guide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13819,6 +13819,7 @@ \chapter{Error Codes}
731 \> {\ct GEOM ID=, Non manifold geometry in adjacent faces at edge \ldots\ } \> Section~\ref{triangulated_surfaces_quality} \\
732 \> {\ct GEOM ID=, Opposite normals on triangles sharing edge with \ldots\ } \> Section~\ref{triangulated_surfaces_quality} \\
733 \> {\ct GEOM ID=, Open geometry at edge with nodes \ldots\ } \> Section~\ref{triangulated_surfaces_quality} \\
734 \> {\ct Mismatched mesh boundary location between meshes \ldots\ } \> Section~\ref{info:GEOM_Basics} \\
\> \> \\
801 \> {\ct VENT \ldots\ cannot use MULT\_ID because it involves HVAC. } \> Section~\ref{info:HVAC} \\
802 \> {\ct VENT \ldots\ needs an explicit ID because it involves HVAC. } \> Section~\ref{info:HVAC} \\
Expand Down
63 changes: 61 additions & 2 deletions Source/geom.f90
Original file line number Diff line number Diff line change
Expand Up @@ -802,15 +802,17 @@ SUBROUTINE SET_CUTCELLS_3D

IF (FIRST_CALL) THEN

! Check Meshes Boundaries match, requirement to get consistent ghost and internal cut-cells.
CALL CHECK_WALL_CELL_PLANE_MATCH; IF (STOP_STATUS==SETUP_STOP) RETURN

! Get geometry triangle bins in Cartesian directions:
CALL GET_GEOM_TRIBIN

! Snap to grid planes node positions in the work volume of this process:
CALL SNAP_GEOM_NODES

! Initialize GEOMETRY fields used by CC_IBM:
CALL CC_INIT_GEOM
IF (STOP_STATUS==SETUP_STOP) RETURN
CALL CC_INIT_GEOM; IF (STOP_STATUS==SETUP_STOP) RETURN
FIRST_CALL = .FALSE.

ENDIF
Expand Down Expand Up @@ -4906,6 +4908,63 @@ END SUBROUTINE SNAP_GEOM_NODES

END SUBROUTINE SET_CUTCELLS_3D

! ----------------------- CHECK_WALL_CELL_PLANE_MATCH ----------------------------

SUBROUTINE CHECK_WALL_CELL_PLANE_MATCH

! Routine checks that external boundaries match among neighboring meshes. This is not strictly enforced
! by FDS but is required to compute same cut-cells on mesh ghost-cells and other mesh internal cells.

USE MPI_F08

! Local variables:
INTEGER :: NM,NOM,IW,IOR,IERR
REAL(EB):: XM,XOM
INTEGER, ALLOCATABLE, DIMENSION(:,:) :: BUFF
TYPE(WALL_TYPE), POINTER :: WC
TYPE(EXTERNAL_WALL_TYPE), POINTER :: EWC
TYPE(MESH_TYPE), POINTER :: M2

ALLOCATE(BUFF(2,NMESHES)); BUFF=0
MESH_LP : DO NM=LOWER_MESH_INDEX,UPPER_MESH_INDEX
CALL POINT_TO_MESH(NM)
EXT_WALL_LOOP_1 : DO IW=1,N_EXTERNAL_WALL_CELLS
WC=>WALL(IW)
EWC=>EXTERNAL_WALL(IW)
BC =>BOUNDARY_COORD(WC%BC_INDEX)
IOR = BC%IOR; NOM = EWC%NOM; IF(NOM<1 .OR. NOM==NM) CYCLE EXT_WALL_LOOP_1
M2 => MESHES(NOM)
SELECT CASE(IOR)
CASE( IAXIS); XM=X(0); XOM=M2%X(M2%IBAR) ! Low X for mesh NM, high X for mesh NOM
CASE(-IAXIS); XM=X(IBAR); XOM=M2%X(0) ! High X for mesh NM, low X for mesh NOM
CASE( JAXIS); XM=Y(0); XOM=M2%Y(M2%JBAR) ! Low Y for mesh NM, high Y for mesh NOM
CASE(-JAXIS); XM=Y(JBAR); XOM=M2%Y(0) ! High Y for mesh NM, low Y for mesh NOM
CASE( KAXIS); XM=Z(0); XOM=M2%Z(M2%KBAR) ! Low Z for mesh NM, high Z for mesh NOM
CASE(-KAXIS); XM=Z(KBAR); XOM=M2%Z(0) ! High Z for mesh NM, low Z for mesh NOM
END SELECT
IF(ABS(XM-XOM)>10._EB*GEOMEPS) THEN
BUFF(1:2,NM) = (/NM,NOM/)
CYCLE MESH_LP
ENDIF
ENDDO EXT_WALL_LOOP_1
ENDDO MESH_LP

! Now All-Reduce mismatch
CALL MPI_ALLREDUCE(MPI_IN_PLACE,BUFF(1,1),2*NMESHES,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,IERR)

DO NM=1,NMESHES
IF(BUFF(1,NM)>0) THEN ! First Mismatched meshes found.
IF (MY_RANK==0) THEN
WRITE(LU_ERR,'(A,I5,A,I5,A)') "ERROR(734): Mismatched mesh boundary location between meshes ",BUFF(1,NM),&
" and ",BUFF(2,NM),". Check your mesh MULT line. Mesh boundary locations must strictly match with &GEOM."
ENDIF
DEALLOCATE(BUFF)
CALL SHUTDOWN("") ; RETURN
ENDIF
ENDDO
DEALLOCATE(BUFF)
END SUBROUTINE CHECK_WALL_CELL_PLANE_MATCH

! ----------------------- EXCHANGE_CC_NOADVANCE_INFO ----------------------------

SUBROUTINE EXCHANGE_CC_NOADVANCE_INFO
Expand Down

0 comments on commit f3dbf79

Please sign in to comment.