Commit 88d05f41 authored by Andrea Cassinelli's avatar Andrea Cassinelli

Added summary output, user guide comments

parent 9f041ec4
......@@ -67,7 +67,7 @@ parameters below to the filter of interest:
\end{center}
For instance, to activate phase averaging with a period of $\mathcal{T}=10$
at phase $n_{\mathcal{T}}=1$:
at phase $n_{\mathcal{T}}=0.5$:
\begin{lstlisting}[style=XMLStyle,gobble=2]
<FILTER TYPE="FilterName">
......@@ -75,12 +75,20 @@ at phase $n_{\mathcal{T}}=1$:
<PARAM NAME="Param2"> Value2 </PARAM>
<PARAM NAME="PhaseAverage"> True </PARAM>
<PARAM NAME="PhaseAveragePeriod"> 10 </PARAM>
<PARAM NAME="PhaseAveragePhase"> 1 </PARAM>
<PARAM NAME="PhaseAveragePhase"> 0.5 </PARAM>
</FILTER>
\end{lstlisting}
Since this feature monitors $n_{\mathcal{T}}$ every \inltt{SampleFrequency},
for best results it is recommended to set \inltt{SampleFrequency}$=1$.
for best results it is recommended to set \inltt{SampleFrequency}$=1$. \\
The maximum error in sampling phase is $n_{\mathcal{T}, \text{tol}} =
\frac{\Delta t}{ 2\mathcal{T}}\cdot$ \inltt{SampleFrequency}, which is displayed
at the beginning of the simulation. \\
The number of periods elapsed is calculated based on simulation time. Caution
is therefore recommended when modifying time information in the restart field,
because if the new time does not correspond to the same phase the feature
will produce erroneous results.
\subsection{FieldConvert checkpoints}
......
......@@ -50,6 +50,8 @@ FilterFieldConvert::FilterFieldConvert(
const ParamMap &pParams)
: Filter(pSession, pEquation)
{
m_dt = m_session->GetParameter("TimeStep");
// OutputFile
auto it = pParams.find("OutputFile");
if (it == pParams.end())
......@@ -119,10 +121,6 @@ FilterFieldConvert::FilterFieldConvert(
}
else
{
// LibUtilities::Equation equ(
// m_session->GetExpressionEvaluator(), it->second);
// m_phaseAverage = round(equ.Evaluate());
std::string sOption = it->second.c_str();
m_phaseAverage = (boost::iequals(sOption, "true")) ||
(boost::iequals(sOption, "yes"));
......@@ -149,12 +147,36 @@ FilterFieldConvert::FilterFieldConvert(
// Check that phase is within required limits
ASSERTL0(m_phaseAveragePhase>=0 && m_phaseAveragePhase<=1,
"PhaseAveragePhase must be between 0 and 1.")
// Load sampling frequency, overriding the previous value
it = pParams.find("SampleFrequency");
if (it == pParams.end())
{
m_sampleFrequency = 1;
}
else
{
LibUtilities::Equation equ(
m_session->GetExpressionEvaluator(), it->second);
m_sampleFrequency = round(equ.Evaluate());
}
// Compute tolerance within which sampling occurs.
m_phaseTolerance = m_dt * m_sampleFrequency /
(m_phaseAveragePeriod * 2);
// Display worst case scenario sampling tolerance for exact phase.
if (m_session->GetComm()->GetRank() == 0)
{
cout << "Phase sampling feature is activated." << endl <<
"Sampling within " << setprecision(2) <<
m_phaseTolerance*100 << "% of the exact phase." << endl;
}
}
m_numSamples = 0;
m_index = 0;
m_outputIndex = 0;
m_dt = m_session->GetParameter("TimeStep");
//
// FieldConvert modules
......@@ -336,11 +358,9 @@ void FilterFieldConvert::v_Update(
NekDouble currentPhase = time / m_phaseAveragePeriod - currentCycle;
// Evaluate if the current time is closest to correct phase.
NekDouble tolerance = m_dt * m_sampleFrequency /
(m_phaseAveragePeriod * 2);
NekDouble relativePhase = abs(m_phaseAveragePhase - currentPhase);
if (relativePhase < tolerance)
if (relativePhase < m_phaseTolerance)
{
m_numSamples++;
v_ProcessSample(pFields, coeffs, time);
......
......@@ -124,6 +124,7 @@ protected:
bool m_phaseAverage;
NekDouble m_phaseAveragePeriod;
NekDouble m_phaseAveragePhase;
NekDouble m_phaseTolerance;
NekDouble m_dt;
vector<ModuleSharedPtr> m_modules;
LibUtilities::FieldMetaDataMap m_fieldMetaData;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment