Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nektar
Nektar
Commits
dfd6d635
Commit
dfd6d635
authored
Apr 03, 2015
by
Dave Moxey
Browse files
Add a couple of parameters, do some tidying
parent
cdad2f37
Changes
3
Hide whitespace changes
Inline
Side-by-side
docs/user-guide/xml/xml-filters.tex
View file @
dfd6d635
...
...
@@ -203,6 +203,42 @@ which produces a field file \inlsh{threshold\_max.fld}.
Performs the same function as the
\inltt
{
ThresholdMax
}
filter but records the
time at which the threshold variable drops below a prescribed value.
\subsection
{
One-dimensional energy
}
This filter is designed to output the energy spectrum of one-dimensional
elements. It transforms the solution field at each timestep into a orthogonal
basis defined by the functions
\[
\psi
_
p
(
\xi
)
=
L
_
p
(
\xi
)
\]
where
$
L
_
p
$
is the
$
p
$
-th Legendre polynomial. This can be used to show the
presence of, for example, oscillations in the underlying field due to numerical
instability. The resulting output is written into a file called
\inltt
{
session.eny
}
by default. The following parameters are supported:
\begin{center}
\begin{tabularx}
{
0.99
\textwidth
}{
lllX
}
\toprule
\textbf
{
Option name
}
&
\textbf
{
Required
}
&
\textbf
{
Default
}
&
\textbf
{
Description
}
\\
\midrule
\inltt
{
OutputFile
}
&
\xmark
&
\inltt
{
session
}
&
Prefix of the output filename to which the energy spectrum is written.
\\
\inltt
{
OutputFrequency
}
&
\xmark
&
1
&
Number of timesteps after which output is written.
\\
\bottomrule
\end{tabularx}
\end{center}
An example syntax is given below:
\begin{lstlisting}
[style=XMLStyle,gobble=2]
<FILTER TYPE="Energy1D">
<PARAM NAME="OutputFile">EnergyFile</PARAM>
<PARAM NAME="OutputFrequency">10</PARAM>
</FILTER>
\end{lstlisting}
\subsection
{
Modal energy
}
\begin{notebox}
...
...
library/SolverUtils/Filters/FilterEnergy1D.cpp
View file @
dfd6d635
...
...
@@ -29,7 +29,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Outputs
solution fields during time-stepping
.
// Description: Outputs
orthogonal expansion of 1D elements
.
//
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -46,9 +46,37 @@ namespace Nektar
FilterEnergy1D
::
FilterEnergy1D
(
const
LibUtilities
::
SessionReaderSharedPtr
&
pSession
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
pParams
)
:
Filter
(
pSession
)
Filter
(
pSession
),
m_index
(
0
)
{
m_out
.
open
(
"energy-out.txt"
);
std
::
string
outName
;
if
(
pParams
.
find
(
"OutputFile"
)
==
pParams
.
end
())
{
outName
=
m_session
->
GetSessionName
();
}
else
{
ASSERTL0
(
!
(
pParams
.
find
(
"OutputFile"
)
->
second
.
empty
()),
"Missing parameter 'OutputFile'."
);
outName
=
pParams
.
find
(
"OutputFile"
)
->
second
;
}
if
(
pParams
.
find
(
"OutputFrequency"
)
==
pParams
.
end
())
{
m_outputFrequency
=
1
;
}
else
{
m_outputFrequency
=
atoi
(
pParams
.
find
(
"OutputFrequency"
)
->
second
.
c_str
());
}
outName
+=
".eny"
;
ASSERTL0
(
pSession
->
GetComm
()
->
GetSize
()
==
1
,
"The 1D energy filter currently only works in serial."
);
m_out
.
open
(
outName
);
}
FilterEnergy1D
::~
FilterEnergy1D
()
...
...
@@ -60,15 +88,27 @@ namespace Nektar
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pFields
,
const
NekDouble
&
time
)
{
ASSERTL0
(
pFields
[
0
]
->
GetExp
(
0
)
->
GetNumBases
()
==
1
,
"The Energy 1D filter is only valid in 1D."
);
}
void
FilterEnergy1D
::
v_Update
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pFields
,
const
NekDouble
&
time
)
{
// Only output every m_outputFrequency
if
((
m_index
++
)
%
m_outputFrequency
)
{
return
;
}
int
nElmt
=
pFields
[
0
]
->
GetExpSize
();
// Loop over all elements
m_out
<<
"##"
<<
endl
;
m_out
<<
"## Time = "
<<
time
<<
endl
;
m_out
<<
"##"
<<
endl
;
for
(
int
i
=
0
;
i
<
nElmt
;
++
i
)
{
// Figure out number of modes in this expansion.
...
...
@@ -87,7 +127,8 @@ namespace Nektar
exp
->
GetBasis
(
0
)
->
GetPointsKey
());
// Find coeffs for this element in the list of all coefficients
Array
<
OneD
,
NekDouble
>
coeffs
=
pFields
[
0
]
->
GetCoeffs
()
+
pFields
[
0
]
->
GetCoeff_Offset
(
i
);
Array
<
OneD
,
NekDouble
>
coeffs
=
pFields
[
0
]
->
GetCoeffs
()
+
pFields
[
0
]
->
GetCoeff_Offset
(
i
);
// Storage for orthogonal coefficients
Array
<
OneD
,
NekDouble
>
coeffsOrth
(
nModes
);
...
...
@@ -96,11 +137,14 @@ namespace Nektar
LibUtilities
::
InterpCoeff1D
(
bkey
,
coeffs
,
bkeyOrth
,
coeffsOrth
);
// Write coeffs to file
m_out
<<
"# Element "
<<
i
<<
" (ID "
<<
exp
->
GetGeom
()
->
GetGlobalID
()
<<
")"
<<
endl
;
for
(
int
j
=
0
;
j
<
nModes
;
++
j
)
{
m_out
<<
coeffsOrth
[
j
]
<<
endl
;
}
}
m_out
<<
endl
;
}
void
FilterEnergy1D
::
v_Finalise
(
...
...
library/SolverUtils/Filters/FilterEnergy1D.h
View file @
dfd6d635
///////////////////////////////////////////////////////////////////////////////
//
// File Filter
Checkpoint
.h
// File Filter
Energy1D
.h
//
// For more information, please see: http://www.nektar.info
//
...
...
@@ -29,12 +29,12 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Outputs
solution fields during time-stepping
.
// Description: Outputs
orthogonal expansion of 1D elements
.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERUTILS_FILTERS_FILTER
CHECKPOINT
_H
#define NEKTAR_SOLVERUTILS_FILTERS_FILTER
CHECKPOINT
_H
#ifndef NEKTAR_SOLVERUTILS_FILTERS_FILTER
ENERGY1D
_H
#define NEKTAR_SOLVERUTILS_FILTERS_FILTER
ENERGY1D
_H
#include <SolverUtils/Filters/Filter.h>
...
...
@@ -51,8 +51,8 @@ namespace Nektar
static
FilterSharedPtr
create
(
const
LibUtilities
::
SessionReaderSharedPtr
&
pSession
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
pParams
)
{
FilterSharedPtr
p
=
MemoryManager
<
FilterEnergy1D
>
::
AllocateSharedPtr
(
pSession
,
pParams
);
//p->InitObject(
);
FilterSharedPtr
p
=
MemoryManager
<
FilterEnergy1D
>
::
AllocateSharedPtr
(
pSession
,
pParams
);
return
p
;
}
...
...
@@ -65,15 +65,26 @@ namespace Nektar
SOLVER_UTILS_EXPORT
~
FilterEnergy1D
();
protected:
virtual
void
v_Initialise
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pFields
,
const
NekDouble
&
time
);
virtual
void
v_Update
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pFields
,
const
NekDouble
&
time
);
virtual
void
v_Finalise
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pFields
,
const
NekDouble
&
time
);
virtual
void
v_Initialise
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pField
,
const
NekDouble
&
time
);
virtual
void
v_Update
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pField
,
const
NekDouble
&
time
);
virtual
void
v_Finalise
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pField
,
const
NekDouble
&
time
);
virtual
bool
v_IsTimeDependent
();
private:
/// Output file.
ofstream
m_out
;
/// Output frequency.
unsigned
int
m_outputFrequency
;
/// Current index counter.
unsigned
int
m_index
;
};
}
}
#endif
/* NEKTAR_SOLVERUTILS_FILTERS_FILTERCHECKPOINT_H */
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment