Skip to content

Commit

Permalink
FDS source: add some error checking the .bnd file reads
Browse files Browse the repository at this point in the history
  • Loading branch information
gforney committed Nov 2, 2023
1 parent 6bdfcb1 commit 98b07ee
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Source/dump.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5652,6 +5652,7 @@ SUBROUTINE DUMP_SLCF(T,DT,NM,IFRMT)
INTEGER :: IFACT, JFACT, KFACT
REAL(FB), ALLOCATABLE, DIMENSION(:) :: QQ_PACK
REAL(FB) :: UVEL, VVEL, WVEL, VEL, PLOT3D_MIN, PLOT3D_MAX
INTEGER :: IERROR

! Return if there are no slices to process and this is not a Plot3D dump

Expand Down Expand Up @@ -5990,13 +5991,13 @@ SUBROUTINE DUMP_SLCF(T,DT,NM,IFRMT)
CHANGE_BOUND = 1
ELSE
OPEN(LU_SLCF(IQ2,NM),FILE=FN_SLCF(IQ2,NM),ACTION='READ')
READ(LU_SLCF(IQ2,NM),*)T_BOUND, SLICE_MIN_BOUND, SLICE_MAX_BOUND
READ(LU_SLCF(IQ2,NM),FMT=*,IOSTAT=IERROR)T_BOUND, SLICE_MIN_BOUND, SLICE_MAX_BOUND
CLOSE(LU_SLCF(IQ2,NM))
IF (SLICE_MIN < SLICE_MIN_BOUND) THEN
IF (IERROR /= 0 .OR. SLICE_MIN < SLICE_MIN_BOUND) THEN
SLICE_MIN_BOUND = SLICE_MIN
CHANGE_BOUND = 1
ENDIF
IF (SLICE_MAX > SLICE_MAX_BOUND) THEN
IF (IERROR /= 0 .OR. SLICE_MAX > SLICE_MAX_BOUND) THEN
SLICE_MAX_BOUND = SLICE_MAX
CHANGE_BOUND = 1
ENDIF
Expand All @@ -6010,6 +6011,7 @@ SUBROUTINE DUMP_SLCF(T,DT,NM,IFRMT)
IQ2 = IQ + N_SLCF_MAX
STIME = REAL(T_BEGIN + (T-T_BEGIN)*TIME_SHRINK_FACTOR,FB)
! write geometry for slice file
CHANGE_BOUND = 0
IF (ABS(STIME-T_BEGIN)<TWO_EPSILON_EB) THEN
! geometry and data file at first time step
OPEN(LU_SLCF_GEOM(IQ,NM),FILE=FN_SLCF_GEOM(IQ,NM),FORM='UNFORMATTED',STATUS='REPLACE')
Expand All @@ -6032,13 +6034,13 @@ SUBROUTINE DUMP_SLCF(T,DT,NM,IFRMT)
IND,IND2,Y_INDEX,Z_INDEX,PART_INDEX,VELO_INDEX,0,PROP_INDEX,REAC_INDEX,MATL_INDEX,T,DT,NM, &
SLICE_MIN, SLICE_MAX)
OPEN(LU_SLCF(IQ2,NM),FILE=FN_SLCF(IQ2,NM),ACTION='READ')
READ(LU_SLCF(IQ2,NM),*)T_BOUND, SLICE_MIN_BOUND, SLICE_MAX_BOUND
READ(LU_SLCF(IQ2,NM),FMT=*,IOSTAT=IERROR)T_BOUND, SLICE_MIN_BOUND, SLICE_MAX_BOUND
CLOSE(LU_SLCF(IQ2,NM))
IF (SLICE_MIN < SLICE_MIN_BOUND) THEN
IF (IERROR /= 0 .OR. SLICE_MIN < SLICE_MIN_BOUND) THEN
SLICE_MIN_BOUND = SLICE_MIN
CHANGE_BOUND = 1
ENDIF
IF (SLICE_MAX > SLICE_MAX_BOUND) THEN
IF (IERROR /= 0 .OR. SLICE_MAX > SLICE_MAX_BOUND) THEN
SLICE_MAX_BOUND = SLICE_MAX
CHANGE_BOUND = 1
ENDIF
Expand Down Expand Up @@ -10350,7 +10352,7 @@ SUBROUTINE DUMP_BNDF(T,DT,NM)
INTEGER, INTENT(IN) :: NM
TYPE(PATCH_TYPE), POINTER :: PA
REAL(FB) BNDF_TIME, BNDF_VAL_MIN, BNDF_VAL_MAX
INTEGER :: CHANGE_BOUND
INTEGER :: CHANGE_BOUND, IERROR

IF (MESHES(NM)%N_PATCH==0 .AND. MESHES(NM)%N_INTERNAL_CFACE_CELLS==0) RETURN

Expand Down Expand Up @@ -10483,13 +10485,13 @@ SUBROUTINE DUMP_BNDF(T,DT,NM)
CHANGE_BOUND = 1
ELSE
OPEN(LU_BNDF(NF+N_BNDF,NM),FILE=FN_BNDF(NF+N_BNDF,NM),ACTION='READ')
READ(LU_BNDF(NF+N_BNDF,NM),*)BNDF_TIME, BNDF_VAL_MIN, BNDF_VAL_MAX
READ(LU_BNDF(NF+N_BNDF,NM),FMT=*,IOSTAT=IERROR)BNDF_TIME, BNDF_VAL_MIN, BNDF_VAL_MAX
CLOSE(LU_BNDF(NF+N_BNDF,NM))
IF( BOUND_MIN < BNDF_VAL_MIN) THEN
IF( IERROR /= 0 .OR. BOUND_MIN < BNDF_VAL_MIN) THEN
BNDF_VAL_MIN = BOUND_MIN
CHANGE_BOUND = 1
ENDIF
IF( BOUND_MAX > BNDF_VAL_MAX) THEN
IF( IERROR /= 0 .OR. BOUND_MAX > BNDF_VAL_MAX) THEN
BNDF_VAL_MAX = BOUND_MAX
CHANGE_BOUND = 1
ENDIF
Expand Down Expand Up @@ -10528,13 +10530,13 @@ SUBROUTINE DUMP_BNDF(T,DT,NM)
IND,0,BF%Y_INDEX,BF%Z_INDEX,BF%PART_INDEX,0,0,BF%PROP_INDEX,0,0,T,DT,NM, &
BOUND_MIN, BOUND_MAX)
OPEN(LU_BNDG(NF+N_BNDF,NM),FILE=FN_BNDG(NF+N_BNDF,NM), ACTION='READ')
READ(LU_BNDG(NF+N_BNDF,NM),*)BNDF_TIME, BNDF_VAL_MIN, BNDF_VAL_MAX
READ(LU_BNDG(NF+N_BNDF,NM),FMT=*,IOSTAT=IERROR)BNDF_TIME, BNDF_VAL_MIN, BNDF_VAL_MAX
CLOSE(LU_BNDG(NF+N_BNDF,NM))
IF (BOUND_MIN < BNDF_VAL_MIN) THEN
IF (IERROR /= 0 .OR. BOUND_MIN < BNDF_VAL_MIN) THEN
BNDF_VAL_MIN = BOUND_MIN
CHANGE_BOUND = 1
ENDIF
IF (BOUND_MAX > BNDF_VAL_MAX) THEN
IF (IERROR /= 0 .OR. BOUND_MAX > BNDF_VAL_MAX) THEN
BNDF_VAL_MAX = BOUND_MAX
CHANGE_BOUND = 1
ENDIF
Expand Down

0 comments on commit 98b07ee

Please sign in to comment.