Permalink
Browse files

FDS Verification: Add example case for RANDOM NUMBER and RMS

  • Loading branch information...
mcgratta committed Mar 1, 2018
1 parent c99bddc commit 937525702d73016bd2039233d395b3b50177393f
@@ -5226,13 +5226,15 @@ \subsection{Energy conservation and pressure (\texorpdfstring{\textct{HVAC\_mass
\chapter{Outputs}
\section{Statistical Quantities (\texorpdfstring{\textct{rms\_cov\_corr}}{rms\_cov\_corr})}
\section{Statistical Quantities}
\subsection{RMS, Co-Variance, and Cross-Correlation (\texorpdfstring{\textct{rms\_cov\_corr}}{rms\_cov\_corr})}
FDS can output the root mean square (RMS), co-variance, and cross-correlation for both point and line {\ct DEVC} outputs. To test these outputs a 1 m$^3$ box with open sides and a 10 cm grid size is defined with two inlet vents centered on adjacent faces. This results in two orthogonal flow streams that collide at the center of the box and exit diagonally. Within the diagonal portion of the flow, are placed point measurements for the FDS outputs of the u-velocity RMS, the u-velocity/w-velocity co-variance, and the u-velocity/w-velocity cross-correlation.
Computation of the these quantities by their typical statistical definition would require having the entire time history for the velocities. This is obviously not possible during run-time. Instead FDS computes the values using logarithmic averaging and a user-defined averaging window. One would expect, once steady-state conditions are reached, that the FDS predicted values should approach the analytic values. Results are shown in Fig.~\ref{rms_cov_corr_plots}. In each figure the red line represents the value computed using the entire time history after steady-state is reached. As seen, the FDS predicted values approach the analytic values.
\begin{figure}[h!]
\begin{figure}[p]
\centering
\begin{tabular}{l}
\includegraphics[height=2.2in]{SCRIPT_FIGURES/rms_cov_corr_rms}\\
@@ -5243,7 +5245,43 @@ \section{Statistical Quantities (\texorpdfstring{\textct{rms\_cov\_corr}}{rms\_c
\label{rms_cov_corr_plots}
\end{figure}
\FloatBarrier
\subsection{RMS as a Running Average (\texorpdfstring{\textct{rms\_example}}{rms\_example})}
\label{rms_example}
In this example, we want to compute the mean and rms of a hypothetical velocity time series
\be
u(t) = \tanh(t) + {\cal U}(-0.5,0.5)
\ee
where ${\cal U}(-0.5,0.5)$ is a uniformly distributed random variable. The expected RMS of the time series beyond its initial transient is equal to the standard deviation of the uniform distribution over the unit interval, $\sigma=\sqrt{1/12}\approx 0.2887$. The expected mean is 1. This exercise is as much a check of the intrinsic random number generator in Fortran as it is the computation within FDS. Figure~\ref{rms_example_plot} displays the result.
\begin{figure}[h!]
\centering
\includegraphics[height=2.2in]{SCRIPT_FIGURES/rms_example}
\caption[Sample case \textct{rms\_example}]{Output of the \textct{rms\_example} test case in which the mean and RMS of the time series is compared to expected values.}
\label{rms_example_plot}
\end{figure}
Note that this example is also a useful demonstration of how to use the math functions within FDS. Although there is not a tanh function included, it can be constructed from the expression:
\be
\tanh(t) = \frac{{\rm e}^t - {\rm e}^{-t}}{{\rm e}^t + {\rm e}^{-t}}
\ee
using the base functions as shown below.
\begin{lstlisting}
&DEVC ID='rn', QUANTITY='RANDOM NUMBER', XYZ=0,0,0 /
&DEVC ID='t', QUANTITY='TIME', XYZ=0,0,0 /
&DEVC ID='u', QUANTITY='CONTROL VALUE', CTRL_ID='sum', XYZ=0,0,1, UNITS='m/s' /
&DEVC ID='u_rms', QUANTITY='CONTROL VALUE', CTRL_ID='sum', XYZ=0,0,1, UNITS='m/s',
STATISTICS='RMS', STATISTICS_START=5. /
&CTRL ID='exp(t)', FUNCTION_TYPE='EXP', INPUT_ID='t' /
&CTRL ID='-t', FUNCTION_TYPE='MULTIPLY', INPUT_ID='t','CONSTANT', CONSTANT=-1. /
&CTRL ID='exp(-t)', FUNCTION_TYPE='EXP', INPUT_ID='-t' /
&CTRL ID='num', FUNCTION_TYPE='SUBTRACT', INPUT_ID='exp(t)','exp(-t)' /
&CTRL ID='den', FUNCTION_TYPE='SUM', INPUT_ID='exp(t)','exp(-t)' /
&CTRL ID='tanh', FUNCTION_TYPE='DIVIDE', INPUT_ID='num','den' /
&CTRL ID='rn2', FUNCTION_TYPE='SUBTRACT', INPUT_ID='rn','CONSTANT', CONSTANT=0.5 /
&CTRL ID='sum', FUNCTION_TYPE='SUM', INPUT_ID='tanh','rn2' /
\end{lstlisting}
@@ -278,6 +278,7 @@ d,reactionrate_fast_slow,Species/reactionrate_fast_slow_git.txt,Species/reaction
d,reactionrate_lumped_two_air,Species/reactionrate_lumped_two_air_git.txt,Species/reactionrate_lumped_two_air_soln.csv,1,2,Time,C3H8|AIR1|AIR2|P1,Expected C3H8|Expected AIR1|Expected AIR2|Expected Products,bo|ko|ro|go,0,100000,,0,100000,0,Species/reactionrate_lumped_two_air_devc.csv,2,3,Time,C3H8|AIR1|AIR2|P1,FDS C3H8|FDS AIR1|FDS AIR2|FDS Products,b|k|r|g,0,100000,,0,100000,0,Species Mass Fraction (Two Lumped),Time (s),Mass Fraction,0,1,1,0,1,1,no,0.05 0.90,SouthEast,,1,linear,FDS_Verification_Guide/SCRIPT_FIGURES/reactionrate_lumped_two_air,Absolute Error,end,1.00E-03,Species,mx,m
d,reactionrate_series_reaction,Species/reactionrate_series_reaction_git.txt,Species/reactionrate_series_reaction_soln.csv,1,2,Time,O2|C3H8|CO2|H2O,Expected O2|Expected C3H8|Expected CO2|Expected H2O,bo|ko|ro|go,0,100000,,0,100000,0,Species/reactionrate_series_reaction_devc.csv,2,3,Time,O2|C3H8|CO2|H2O,FDS O2|FDS C3H8|FDS CO2|FDS H2O,b|k|r|g,0,100000,,0,100000,0,Species Mass Fraction (Series Reaction),Time (s),Mass Fraction,0,1,1,0,0.3,1,no,0.05 0.90,EastOutside,,1.365,linear,FDS_Verification_Guide/SCRIPT_FIGURES/reactionrate_series_reaction,Absolute Error,end,1.00E-03,Species,mx,m
d,realizable_mass_fractions,Flowfields/realizable_mass_fractions_git.txt,Flowfields/realizable_mass_fractions.csv,1,2,Time,Sum,Expected,ko,0,100000,,0,100000,0,Flowfields/realizable_mass_fractions_devc.csv,2,3,Time,YF|YA|YP|SUMZ,$Z$ Fuel|$Z$ Air|$Z$ Prod|Sum $Z$,k-|b-|r-|k--,0,100000,,0,100000,0,Realizable Mass Fractions,Time (s),Mass Fraction,0,10,1,0,1.2,1,no,0.05 0.90,East,,1,linear,FDS_Verification_Guide/SCRIPT_FIGURES/realizable_mass_fractions,Absolute Error,max_1_4,1.00E-06,Species,mx,m
d,rms_example,Controls/rms_example_git.txt,Controls/rms_example.csv,1,2,Time,mean|sd,Expected Mean|Expected RMS,k--|r--,0,100000,,5,20,0,Controls/rms_example_devc.csv,2,3,Time,u|u_rms,FDS (u)|FDS (u\_rms),k-|r-,0,100000,,5,20,0,rms\_example,Time (s),Velocity (m/s),0,20,1,0,2.5,1,no,0.05 0.90,NorthEast,,1,linear,FDS_Verification_Guide/SCRIPT_FIGURES/rms_example,Relative Error,mean,4.00E-02,Controls,mx,m
d,screen_drag_1,Sprinklers_and_Sprays/screen_drag_1_git.txt,Sprinklers_and_Sprays/screen_drag_1.csv,1,1,Time,Exact 0.1|Exact 0.4|Exact 0.8,Exact 0.1|Exact 0.4|Exact 0.8,ko|ro|bo,0,100000,,0,100000,0,Sprinklers_and_Sprays/screen_drag_1_devc.csv,2,3,Time,FDS 0.1|FDS 0.4|FDS 0.8,FDS 0.1|FDS 0.4|FDS 0.8,k-|r-|b-,0,100000,,0,100000,0,Screen Pressure Drop,Time (s),Pressure Drop (Pa),0,4,1,0,150,1,no,0.05 0.90,East,,1,linear,FDS_Verification_Guide/SCRIPT_FIGURES/screen_drag_1,Relative Error,end,0.03,Sprinklers and Sprays,bs,b
d,screen_drag_2,Sprinklers_and_Sprays/screen_drag_2_git.txt,Sprinklers_and_Sprays/screen_drag_2.csv,1,1,Time,Exact 0.1|Exact 0.4|Exact 0.8,Exact 0.1|Exact 0.4|Exact 0.8,ko|ro|bo,0,100000,,8,10,0,Sprinklers_and_Sprays/screen_drag_2_devc.csv,2,3,Time,FDS 0.1|FDS 0.4|FDS 0.8,FDS 0.1|FDS 0.4|FDS 0.8,k-|r-|b-,0,100000,,8,10,0,Screen Pressure Drop,Time (s),Pressure Drop (Pa),0,10,1,0,1500,1,no,0.05 0.90,East,,1,linear,FDS_Verification_Guide/SCRIPT_FIGURES/screen_drag_2,Relative Error,mean,0.06,Sprinklers and Sprays,bs,b
d,shrink_swell,Pyrolysis/shrink_swell_git.txt,Pyrolysis/shrink_swell.csv,1,2,Time,M_1 (kg/m2),Expected,ko,0,100000,,0,100000,0,Pyrolysis/shrink_swell_devc.csv,2,3,Time,M_1|M_2|M_3,Shrink 1|Shrink 2|Shrink 3,k--|b-|r-.,0,100000,,0,100000,0,Shrink Mass Conservation (shrink\_swell),Time (s),Surface density (kg/m$^2$),0,15,1,0,1,1,no,0.05 0.90,South,,1,linear,FDS_Verification_Guide/SCRIPT_FIGURES/shrink_mass_conservation,Relative Error,end_1_1,0.01,Pyrolysis,rx,r
@@ -0,0 +1,3 @@
Time,mean,sd
5,1,0.2887
20,1,0.2887
@@ -0,0 +1,26 @@
This test takes the function u(t)=tanh(t) and adds uniformly distributed random noise. Taking the rms of the function
ought to return the standard deviation of the uniform distribution over the unit interval, which is sqrt(1/12).
&HEAD CHID='rms_example', TITLE='Demonstration of math control functions and RMS stats' /
&MESH IJK=3,3,3, XB=0.0,1.0,0.0,1.0,0.0,1.0 /
&TIME T_END=20., DT=0.01 /
&DEVC ID='rn', QUANTITY='RANDOM NUMBER', XYZ=0,0,0 /
&DEVC ID='t', QUANTITY='TIME', XYZ=0,0,0 /
&DEVC ID='u', QUANTITY='CONTROL VALUE', CTRL_ID='sum', XYZ=0,0,1, UNITS='m/s' /
&DEVC ID='u_rms', QUANTITY='CONTROL VALUE', CTRL_ID='sum', XYZ=0,0,1, UNITS='m/s', STATISTICS='RMS', STATISTICS_START=5. /
&CTRL ID='exp(t)', FUNCTION_TYPE='EXP', INPUT_ID='t' /
&CTRL ID='-t', FUNCTION_TYPE='MULTIPLY', INPUT_ID='t','CONSTANT', CONSTANT=-1. /
&CTRL ID='exp(-t)', FUNCTION_TYPE='EXP', INPUT_ID='-t' /
&CTRL ID='num', FUNCTION_TYPE='SUBTRACT', INPUT_ID='exp(t)','exp(-t)' /
&CTRL ID='den', FUNCTION_TYPE='SUM', INPUT_ID='exp(t)','exp(-t)' /
&CTRL ID='tanh', FUNCTION_TYPE='DIVIDE', INPUT_ID='num','den' /
&CTRL ID='rn2', FUNCTION_TYPE='SUBTRACT', INPUT_ID='rn','CONSTANT', CONSTANT=0.5 /
&CTRL ID='sum', FUNCTION_TYPE='SUM', INPUT_ID='tanh','rn2' /
&TAIL /
@@ -53,6 +53,7 @@ $QFDS -d Controls cycle_test.fds
$QFDS -d Controls device_test.fds
$QFDS -d Controls hrr_freeze.fds
$QFDS -d Controls rms_cov_corr.fds
$QFDS -d Controls rms_example.fds
$QFDS -d Detectors aspiration_detector.fds
$QFDS -d Detectors beam_detector.fds

0 comments on commit 9375257

Please sign in to comment.