Skip to content

Commit

Permalink
FDS Source: Check names of STATISTICS
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgratta committed Sep 12, 2023
1 parent f76ecc6 commit e9e492f
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Source/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ SUBROUTINE END_FDS

! Print out device activation times to the .out file

CALL TIMINGS
IF (STOP_STATUS/=SETUP_STOP) CALL TIMINGS

! Print out stop status to .err and .out files

Expand Down
144 changes: 95 additions & 49 deletions Source/read.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12349,7 +12349,7 @@ SUBROUTINE READ_DEVC
DEVC_PIPE_OPERATING
USE GEOMETRY_FUNCTIONS, ONLY: TRANSFORM_COORDINATES,SEARCH_OTHER_MESHES
INTEGER :: N,NN,NM,MESH_NUMBER=0,N_DEVC_READ,IOR,TRIP_DIRECTION,VELO_INDEX,POINTS,I_POINT,PIPE_INDEX,ORIENTATION_INDEX, &
N_INTERVALS,MOVE_INDEX,IIG,JJG,KKG,NOM
N_INTERVALS,MOVE_INDEX,IIG,JJG,KKG,NOM,ERROR_CODE
REAL(EB) :: DEPTH,ORIENTATION(3),ROTATION,SETPOINT,FLOWRATE,BYPASS_FLOWRATE,DELAY,XYZ(3),CONVERSION_FACTOR,CONVERSION_ADDEND, &
SMOOTHING_FACTOR,QUANTITY_RANGE(2),STATISTICS_START,STATISTICS_END,COORD_FACTOR,CELL_L,&
TIME_PERIOD,FORCE_DIRECTION(3),XI,YJ,ZK,XBP(6),DX,DY,DZ,&
Expand Down Expand Up @@ -12508,55 +12508,12 @@ SUBROUTINE READ_DEVC
XB = -1.E6_EB
ENDIF

! Assign STATISTICS to SPATIAL or TEMPORAL
! Reassign the old parameter STATISTICS to either SPATIAL_STATISTIC or TEMPORAL_STATISTIC.
! Also, look for names that do not exist.

SELECT CASE(STATISTICS)

CASE('null')
CASE('INSTANT VALUE') ; TEMPORAL_STATISTIC = 'INSTANT VALUE'
CASE('TIME AVERAGE') ; TEMPORAL_STATISTIC = 'TIME AVERAGE'
CASE('FAVRE AVERAGE') ; TEMPORAL_STATISTIC = 'FAVRE AVERAGE'
CASE('RUNNING AVERAGE') ; TEMPORAL_STATISTIC = 'RUNNING AVERAGE'
CASE('TIME INTEGRAL') ; TEMPORAL_STATISTIC = 'TIME INTEGRAL'
CASE('TIME MAX') ; TEMPORAL_STATISTIC = 'MAX'
CASE('TIME MIN') ; TEMPORAL_STATISTIC = 'MIN'
CASE('MAX TIME') ; TEMPORAL_STATISTIC = 'MAX TIME'
CASE('MIN TIME') ; TEMPORAL_STATISTIC = 'MIN TIME'
CASE('RMS') ; TEMPORAL_STATISTIC = 'RMS'
CASE('FAVRE RMS') ; TEMPORAL_STATISTIC = 'FAVRE RMS'
CASE('COV') ; TEMPORAL_STATISTIC = 'COV'
CASE('CORRCOEF') ; TEMPORAL_STATISTIC = 'CORRCOEF'

CASE('AREA') ; SPATIAL_STATISTIC = 'AREA'
CASE('AREA INTEGRAL') ; SPATIAL_STATISTIC = 'AREA INTEGRAL'
CASE('VOLUME INTEGRAL') ; SPATIAL_STATISTIC = 'VOLUME INTEGRAL'
CASE('VOLUME MEAN') ; SPATIAL_STATISTIC = 'VOLUME MEAN'
CASE('VOLUME') ; SPATIAL_STATISTIC = 'VOLUME'
CASE('SURFACE INTEGRAL') ; SPATIAL_STATISTIC = 'SURFACE INTEGRAL'
CASE('SURFACE AREA') ; SPATIAL_STATISTIC = 'SURFACE AREA'
CASE('SUM') ; SPATIAL_STATISTIC = 'SUM'
CASE('MASS INTEGRAL') ; SPATIAL_STATISTIC = 'MASS INTEGRAL'
CASE('MASS MEAN') ; SPATIAL_STATISTIC = 'MASS MEAN'
CASE('CENTROID X') ; SPATIAL_STATISTIC = 'CENTROID X'
CASE('CENTROID Y') ; SPATIAL_STATISTIC = 'CENTROID Y'
CASE('CENTROID Z') ; SPATIAL_STATISTIC = 'CENTROID Z'
CASE('MASS') ; SPATIAL_STATISTIC = 'MASS'
CASE('MAX') ; SPATIAL_STATISTIC = 'MAX'
CASE('MAXLOC X') ; SPATIAL_STATISTIC = 'MAXLOC X'
CASE('MAXLOC Y') ; SPATIAL_STATISTIC = 'MAXLOC Y'
CASE('MAXLOC Z') ; SPATIAL_STATISTIC = 'MAXLOC Z'
CASE('MIN') ; SPATIAL_STATISTIC = 'MIN'
CASE('MINLOC X') ; SPATIAL_STATISTIC = 'MINLOC X'
CASE('MINLOC Y') ; SPATIAL_STATISTIC = 'MINLOC Y'
CASE('MINLOC Z') ; SPATIAL_STATISTIC = 'MINLOC Z'
CASE('MEAN') ; SPATIAL_STATISTIC = 'MEAN'
CASE('INTERPOLATION') ; SPATIAL_STATISTIC = 'INTERPOLATION'

CASE DEFAULT
WRITE(MESSAGE,'(A,A,A)') 'ERROR: DEVC ',TRIM(ID),' STATISTICS is not recognized'
CALL SHUTDOWN(MESSAGE) ; RETURN

END SELECT
CALL CHECK_STATISTIC_NAME(STATISTICS,1,ERROR_CODE) ; IF (ERROR_CODE>0) THEN ; CALL SHUTDOWN(MESSAGE) ; RETURN ; ENDIF
CALL CHECK_STATISTIC_NAME(TEMPORAL_STATISTIC,2,ERROR_CODE) ; IF (ERROR_CODE>0) THEN ; CALL SHUTDOWN(MESSAGE) ; RETURN ; ENDIF
CALL CHECK_STATISTIC_NAME(SPATIAL_STATISTIC,3,ERROR_CODE) ; IF (ERROR_CODE>0) THEN ; CALL SHUTDOWN(MESSAGE) ; RETURN ; ENDIF

! Backward compartibility

Expand Down Expand Up @@ -13181,6 +13138,95 @@ SUBROUTINE SET_DEVC_DEFAULTS

END SUBROUTINE SET_DEVC_DEFAULTS


!> \brief Check if the STATISTIC name is on the list
!> \param STAT_NAME Name of the statistic
!> \param TYPE_CODE 1 means STATISTICS, 2 means TEMPORAL_STATISTIC, 3 means SPATIAL_STATISTIC
!> \param ERROR_CODE Returns 1 if the name is not found

SUBROUTINE CHECK_STATISTIC_NAME(STAT_NAME,TYPE_CODE,ERROR_CODE)

CHARACTER(LABEL_LENGTH), INTENT(IN) :: STAT_NAME
INTEGER, INTENT(IN) :: TYPE_CODE
INTEGER, INTENT(OUT) :: ERROR_CODE
LOGICAL :: NO_TEMPORAL_STATISTIC_FOUND,NO_SPATIAL_STATISTIC_FOUND

ERROR_CODE = 0
NO_TEMPORAL_STATISTIC_FOUND = .FALSE.
NO_SPATIAL_STATISTIC_FOUND = .FALSE.

IF (TYPE_CODE==1 .OR. TYPE_CODE==2) THEN
SELECT CASE(STAT_NAME)
CASE('null')
CASE('INSTANT VALUE') ; TEMPORAL_STATISTIC = 'INSTANT VALUE'
CASE('TIME AVERAGE') ; TEMPORAL_STATISTIC = 'TIME AVERAGE'
CASE('FAVRE AVERAGE') ; TEMPORAL_STATISTIC = 'FAVRE AVERAGE'
CASE('RUNNING AVERAGE') ; TEMPORAL_STATISTIC = 'RUNNING AVERAGE'
CASE('TIME INTEGRAL') ; TEMPORAL_STATISTIC = 'TIME INTEGRAL'
CASE('MAX') ; TEMPORAL_STATISTIC = 'MAX'
CASE('MIN') ; TEMPORAL_STATISTIC = 'MIN'
CASE('MAX TIME') ; TEMPORAL_STATISTIC = 'MAX TIME'
CASE('MIN TIME') ; TEMPORAL_STATISTIC = 'MIN TIME'
CASE('RMS') ; TEMPORAL_STATISTIC = 'RMS'
CASE('FAVRE RMS') ; TEMPORAL_STATISTIC = 'FAVRE RMS'
CASE('COV') ; TEMPORAL_STATISTIC = 'COV'
CASE('CORRCOEF') ; TEMPORAL_STATISTIC = 'CORRCOEF'
CASE DEFAULT
IF (TYPE_CODE==2) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: TEMPORAL_STATISTIC for DEVC ',TRIM(ID),' is not recognized'
ERROR_CODE = 1
RETURN
ELSE
NO_TEMPORAL_STATISTIC_FOUND = .TRUE.
ENDIF
END SELECT
ENDIF

IF (TYPE_CODE==1 .OR. TYPE_CODE==3) THEN
SELECT CASE(STAT_NAME)
CASE('null')
CASE('AREA') ; SPATIAL_STATISTIC = 'AREA'
CASE('AREA INTEGRAL') ; SPATIAL_STATISTIC = 'AREA INTEGRAL'
CASE('VOLUME INTEGRAL') ; SPATIAL_STATISTIC = 'VOLUME INTEGRAL'
CASE('VOLUME MEAN') ; SPATIAL_STATISTIC = 'VOLUME MEAN'
CASE('VOLUME') ; SPATIAL_STATISTIC = 'VOLUME'
CASE('SURFACE INTEGRAL') ; SPATIAL_STATISTIC = 'SURFACE INTEGRAL'
CASE('SURFACE AREA') ; SPATIAL_STATISTIC = 'SURFACE AREA'
CASE('SUM') ; SPATIAL_STATISTIC = 'SUM'
CASE('MASS INTEGRAL') ; SPATIAL_STATISTIC = 'MASS INTEGRAL'
CASE('MASS MEAN') ; SPATIAL_STATISTIC = 'MASS MEAN'
CASE('CENTROID X') ; SPATIAL_STATISTIC = 'CENTROID X'
CASE('CENTROID Y') ; SPATIAL_STATISTIC = 'CENTROID Y'
CASE('CENTROID Z') ; SPATIAL_STATISTIC = 'CENTROID Z'
CASE('MASS') ; SPATIAL_STATISTIC = 'MASS'
CASE('MAX') ; SPATIAL_STATISTIC = 'MAX'
CASE('MAXLOC X') ; SPATIAL_STATISTIC = 'MAXLOC X'
CASE('MAXLOC Y') ; SPATIAL_STATISTIC = 'MAXLOC Y'
CASE('MAXLOC Z') ; SPATIAL_STATISTIC = 'MAXLOC Z'
CASE('MIN') ; SPATIAL_STATISTIC = 'MIN'
CASE('MINLOC X') ; SPATIAL_STATISTIC = 'MINLOC X'
CASE('MINLOC Y') ; SPATIAL_STATISTIC = 'MINLOC Y'
CASE('MINLOC Z') ; SPATIAL_STATISTIC = 'MINLOC Z'
CASE('MEAN') ; SPATIAL_STATISTIC = 'MEAN'
CASE('INTERPOLATION') ; SPATIAL_STATISTIC = 'INTERPOLATION'
CASE DEFAULT
IF (TYPE_CODE==3) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: SPATIAL_STATISTIC for DEVC ',TRIM(ID),' is not recognized'
ERROR_CODE = 1
RETURN
ELSE
NO_SPATIAL_STATISTIC_FOUND = .TRUE.
ENDIF
END SELECT
ENDIF

IF (NO_TEMPORAL_STATISTIC_FOUND .AND. NO_SPATIAL_STATISTIC_FOUND) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: STATISTICS for DEVC ',TRIM(ID),' is not recognized'
ERROR_CODE = 1
ENDIF

END SUBROUTINE CHECK_STATISTIC_NAME

END SUBROUTINE READ_DEVC


Expand Down

0 comments on commit e9e492f

Please sign in to comment.