Skip to content

Commit

Permalink
Merge pull request #12214 from drjfloyd/master
Browse files Browse the repository at this point in the history
FDS Source: Do smoothing on DV%VALUE when TEMPORAL_STATISTIC is not I…
  • Loading branch information
drjfloyd authored Nov 8, 2023
2 parents b8ee05f + 2095c66 commit 273a7a3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Source/dump.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6802,7 +6802,6 @@ SUBROUTINE UPDATE_DEVICES_2(T,DT)
! Create a smoothed output

IF (DV%SMOOTHED_VALUE < -1.E9_EB) DV%SMOOTHED_VALUE = DV%INSTANT_VALUE
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%INSTANT_VALUE*(1._EB-DV%SMOOTHING_FACTOR)

! Do not start summing time devices if this is the start of the simulation

Expand All @@ -6823,18 +6822,22 @@ SUBROUTINE UPDATE_DEVICES_2(T,DT)
CASE('INSTANT VALUE')
DV%VALUE = DV%INSTANT_VALUE
DV%TIME_INTERVAL = 1.
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%INSTANT_VALUE*(1._EB-DV%SMOOTHING_FACTOR)
CASE('TIME AVERAGE')
DV%VALUE = DV%VALUE + DV%INSTANT_VALUE*DT
DV%TIME_INTERVAL = DV%TIME_INTERVAL + DT
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%INSTANT_VALUE*(1._EB-DV%SMOOTHING_FACTOR)
CASE('RUNNING AVERAGE')
WGT = DT/MAX(DT,T-DV%STATISTICS_START)
DV%AVERAGE_VALUE = (1._EB-WGT)*DV%AVERAGE_VALUE + WGT*DV%INSTANT_VALUE
DV%VALUE = DV%AVERAGE_VALUE
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
DV%TIME_INTERVAL = 1._EB
CASE('TIME INTEGRAL')
WGT = DT/MAX(DT,T-DV%STATISTICS_START)
DV%AVERAGE_VALUE = (1._EB-WGT)*DV%AVERAGE_VALUE + WGT*DV%INSTANT_VALUE
DV%VALUE = DV%AVERAGE_VALUE*(T-DV%STATISTICS_START)
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
DV%TIME_INTERVAL = 1._EB
CASE('MAX','MAX TIME')
INTERVAL_INDEX = INT((T-DV%STATISTICS_START)/(DV%STATISTICS_END-DV%STATISTICS_START)*REAL(DV%N_INTERVALS)) + 1
Expand All @@ -6853,6 +6856,7 @@ SUBROUTINE UPDATE_DEVICES_2(T,DT)
ELSE
DV%VALUE = DV%TIME_MAX_VALUE(INTERVAL_INDEX)
ENDIF
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
CASE('MIN','MIN TIME')
INTERVAL_INDEX = INT((T-DV%STATISTICS_START)/(DV%STATISTICS_END-DV%STATISTICS_START)*REAL(DV%N_INTERVALS)) + 1
INTERVAL_INDEX = MAX(1,MIN(DV%N_INTERVALS,INTERVAL_INDEX))
Expand All @@ -6870,12 +6874,14 @@ SUBROUTINE UPDATE_DEVICES_2(T,DT)
ELSE
DV%VALUE = DV%TIME_MIN_VALUE(INTERVAL_INDEX)
ENDIF
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
CASE('RMS')
WGT = DT/MAX(DT,T-DV%STATISTICS_START)
DV%AVERAGE_VALUE = (1._EB-WGT)*DV%AVERAGE_VALUE + WGT*DV%INSTANT_VALUE
WGT_UNBIASED = DT/MAX(DT,T-DV%STATISTICS_START+DT)
DV%RMS_VALUE = (1._EB-WGT_UNBIASED)*DV%RMS_VALUE + WGT_UNBIASED*(DV%INSTANT_VALUE-DV%AVERAGE_VALUE)**2
DV%VALUE = SQRT(DV%RMS_VALUE)
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
DV%TIME_INTERVAL = 1._EB
CASE('COV')
WGT = DT/MAX(DT,T-DV%STATISTICS_START)
Expand All @@ -6885,6 +6891,7 @@ SUBROUTINE UPDATE_DEVICES_2(T,DT)
DV%COV_VALUE = (1._EB-WGT_UNBIASED)*DV%COV_VALUE + &
WGT_UNBIASED*(DV%INSTANT_VALUE-DV%AVERAGE_VALUE)*(DV%VALUE_2-DV%AVERAGE_VALUE2)
DV%VALUE = DV%COV_VALUE
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
DV%TIME_INTERVAL = 1._EB
CASE('CORRCOEF')
WGT = DT/MAX(DT,T-DV%STATISTICS_START)
Expand All @@ -6896,12 +6903,14 @@ SUBROUTINE UPDATE_DEVICES_2(T,DT)
DV%RMS_VALUE = (1._EB-WGT_UNBIASED)*DV%RMS_VALUE + WGT_UNBIASED*(DV%INSTANT_VALUE-DV%AVERAGE_VALUE )**2
DV%RMS_VALUE2 = (1._EB-WGT_UNBIASED)*DV%RMS_VALUE2+ WGT_UNBIASED*(DV%VALUE_2 -DV%AVERAGE_VALUE2)**2
DV%VALUE = DV%COV_VALUE/(SQRT(ABS(DV%RMS_VALUE*DV%RMS_VALUE2))+1.E-8_EB)
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
DV%TIME_INTERVAL = 1._EB
CASE('FAVRE AVERAGE')
WGT = DT/MAX(DT,T-DV%STATISTICS_START)
DV%AVERAGE_VALUE = (1._EB-WGT)*DV%AVERAGE_VALUE + WGT*DV%VALUE_1
DV%AVERAGE_VALUE2 = (1._EB-WGT)*DV%AVERAGE_VALUE2 + WGT*DV%VALUE_2
DV%VALUE = DV%AVERAGE_VALUE/DV%AVERAGE_VALUE2 * DV%CONVERSION_FACTOR + DV%CONVERSION_ADDEND
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
DV%TIME_INTERVAL = 1._EB
CASE('FAVRE RMS')
WGT = DT/MAX(DT,T-DV%STATISTICS_START)
Expand All @@ -6911,8 +6920,10 @@ SUBROUTINE UPDATE_DEVICES_2(T,DT)
DV%RMS_VALUE = (1._EB-WGT_UNBIASED)*DV%RMS_VALUE &
+ WGT_UNBIASED*(DV%VALUE_1/DV%VALUE_2-DV%AVERAGE_VALUE/DV%AVERAGE_VALUE2)**2
DV%VALUE = SQRT(DV%RMS_VALUE) * DV%CONVERSION_FACTOR + DV%CONVERSION_ADDEND
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%VALUE*(1._EB-DV%SMOOTHING_FACTOR)
DV%TIME_INTERVAL = 1._EB
CASE('SMOOTHED')
DV%SMOOTHED_VALUE = DV%SMOOTHED_VALUE*DV%SMOOTHING_FACTOR + DV%INSTANT_VALUE*(1._EB-DV%SMOOTHING_FACTOR)
DV%VALUE = DV%SMOOTHED_VALUE
DV%TIME_INTERVAL = 1.
END SELECT
Expand Down

0 comments on commit 273a7a3

Please sign in to comment.