Commit 665bf3b3 authored by Dave Moxey's avatar Dave Moxey
Browse files

Merge branch 'fix/Filters-AdaptiveP' into 'master'

Fix filters output with adaptive driver

This is a small change I forgot to make when introducing DriverAdaptive. Basically, in this case the filters writing text files need to append the file, since otherwise only the last run in the adaptive procedure would be obtained.

I changed the behaviour only when using the adaptive driver, to avoid causing confusion in other cases. However, this could also be used to facilitate restarting from the same directory (although in this case it would be desirable to edit the existing file to keep only times before the restart).

See merge request !588
parents 5621f904 371c8f3e
......@@ -15,6 +15,8 @@ v4.4.0
v4.3.3
------
**Library**:
- Fix filters when using adaptive driver to avoid output being overwritten after
each adaptive update (!588)
- Minor fix to suppress Xxt output unless `--verbose` is specified (!642)
- Fix of DirectFull solver in case where only Neumann boundary conditions
are imposed. (!655)
......
......@@ -310,7 +310,17 @@ void FilterAeroForces::v_Initialise(
if (vComm->GetRank() == 0)
{
// Open output stream
m_outputStream.open(m_outputFile.c_str());
bool adaptive;
m_session->MatchSolverInfo("Driver", "Adaptive",
adaptive, false);
if (adaptive)
{
m_outputStream.open(m_outputFile.c_str(), ofstream::app);
}
else
{
m_outputStream.open(m_outputFile.c_str());
}
m_outputStream << "# Forces acting on bodies" << endl;
for( int i = 0; i < expdim; i++ )
{
......
......@@ -368,7 +368,17 @@ void FilterHistoryPoints::v_Initialise(
}
// Open output stream
m_outputStream.open(m_outputFile.c_str());
bool adaptive;
m_session->MatchSolverInfo("Driver", "Adaptive",
adaptive, false);
if (adaptive)
{
m_outputStream.open(m_outputFile.c_str(), ofstream::app);
}
else
{
m_outputStream.open(m_outputFile.c_str());
}
m_outputStream << "# History data for variables (:";
for (i = 0; i < pFields.num_elements(); ++i)
......
......@@ -136,15 +136,24 @@ void FilterModalEnergy::v_Initialise(
if (vComm->GetRank() == 0)
{
// Open output stream
if(m_isHomogeneous1D)
bool adaptive;
m_session->MatchSolverInfo("Driver", "Adaptive",
adaptive, false);
if (adaptive)
{
m_outputStream.open(m_outputFile.c_str(), ofstream::app);
}
else
{
m_outputStream.open(m_outputFile.c_str());
}
if(m_isHomogeneous1D)
{
m_outputStream << "# Time, Fourier Mode, Energy ";
m_outputStream << endl;
}
else
{
m_outputStream.open(m_outputFile.c_str());
m_outputStream << "# Time, Energy ";
m_outputStream << endl;
}
......
Supports Markdown
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