Commit 427168f0 authored by Dave Moxey's avatar Dave Moxey

Merge branch 'fix/boundary-output-filter' into 'master'

Fix for parallel output with HDF5 and boundary output

Closes #136

See merge request !1027
parents 13554f37 5af59fe5
......@@ -101,9 +101,7 @@ void OutputFileBase::Process(po::variables_map &vm)
}
cout << endl;
}
}
if (m_f->m_writeBndFld)
{
int nfields = m_f->m_variables.size();
int normdim = m_f->m_graph->GetMeshDimension();
......@@ -141,10 +139,12 @@ void OutputFileBase::Process(po::variables_map &vm)
const SpatialDomains::BoundaryRegionCollection bregions =
bcs.GetBoundaryRegions();
map<int, int> BndRegionMap;
map<int, LibUtilities::CommSharedPtr> BndRegionComm;
int cnt = 0;
for (auto &breg_it : bregions)
{
BndRegionMap[breg_it.first] = cnt++;
BndRegionComm[breg_it.first] = bcs.GetBoundaryCommunicators()[breg_it.first];
}
// find ending of output file and insert _b1, _b2
......@@ -152,6 +152,9 @@ void OutputFileBase::Process(po::variables_map &vm)
string ext = filename.substr(dot, filename.length() - dot);
string name = filename.substr(0, dot - 1);
// Store temporary communicator
LibUtilities::CommSharedPtr tmpComm = m_f->m_comm;
for (int i = 0; i < m_f->m_bndRegionsToWrite.size(); ++i)
{
string outname =
......@@ -167,6 +170,8 @@ void OutputFileBase::Process(po::variables_map &vm)
if (BndRegionMap.count(m_f->m_bndRegionsToWrite[i]) == 1)
{
m_f->m_comm = BndRegionComm[m_f->m_bndRegionsToWrite[i]];
int Border = BndRegionMap[m_f->m_bndRegionsToWrite[i]];
for (int j = 0; j < exp.size(); ++j)
......@@ -201,22 +206,9 @@ void OutputFileBase::Process(po::variables_map &vm)
{
PrintErrorFromExp();
}
}
else
{
// Empty expansion for parallel communication
for (int j = 0; j < exp.size(); ++j)
{
m_f->m_exp[j] =
MemoryManager<MultiRegions::ExpList>::
AllocateSharedPtr();
}
OutputFromExp(vm);
// output error for regression checking.
if (vm.count("error"))
{
PrintErrorFromExp();
}
// Reset communicator
m_f->m_comm = tmpComm;
}
// put outfile back to filename in case of nparts option
......
......@@ -262,6 +262,11 @@ namespace Nektar
return m_session->GetVariable(indx);
}
std::map<int, LibUtilities::CommSharedPtr> GetBoundaryCommunicators() const
{
return m_boundaryCommunicators;
}
protected:
/// The mesh graph to use for referencing geometry info.
MeshGraphSharedPtr m_meshGraph;
......
......@@ -183,6 +183,7 @@ IF( NEKTAR_SOLVER_INCNAVIERSTOKES )
ADD_NEKTAR_TEST(TriQuadChannelHdf5)
ADD_NEKTAR_TEST(Tet_channel_m8_hdf)
ADD_NEKTAR_TEST(KovaFlow_3DH1D_P5_20modes_MVM_hdf5)
ADD_NEKTAR_TEST(CylFlow2D_FieldConvertFilter_Hdf5)
IF (NEKTAR_USE_SCOTCH)
ADD_NEKTAR_TEST(CubeAllElements_ChanFlow)
ENDIF()
......
<?xml version="1.0" encoding="utf-8" ?>
<test>
<description>2D cylinder flow, P=4, parallel HDF5 input/output and FieldConvert filter</description>
<executable>IncNavierStokesSolver</executable>
<parameters>--io-format Hdf5 CylFlow2D_FieldConvertFilter_Hdf5.xml</parameters>
<processes>2</processes>
<files>
<file description="Session File">CylFlow2D_FieldConvertFilter_Hdf5.xml</file>
</files>
<metrics>
<metric type="L2" id="1">
<value variable="u" tolerance="1e-8">21.4085</value>
<value variable="v" tolerance="1e-8">0.640317</value>
<value variable="p" tolerance="1e-6">1.03461</value>
</metric>
<metric type="Linf" id="2">
<value variable="u" tolerance="1e-8">1.84427</value>
<value variable="v" tolerance="1e-8">0.872692</value>
<value variable="p" tolerance="1e-6">1.38755</value>
</metric>
</metrics>
</test>
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