Commit a3466629 authored by Dave Moxey's avatar Dave Moxey

Fixes for flowrate

parent 4a722037
......@@ -34,6 +34,7 @@
///////////////////////////////////////////////////////////////////////////////
#include <LocalRegions/Expansion1D.h>
#include <LocalRegions/Expansion2D.h>
using namespace std;
......@@ -425,7 +426,7 @@ namespace Nektar
Vmath::Vmul (nq, &vec[0][0], 1, &normals[0][0], 1, &Fn[0], 1);
Vmath::Vvtvp(nq, &vec[1][0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
return v_Integral(Fn);
return Integral(Fn);
}
} //end of namespace
} //end of namespace
......
......@@ -34,6 +34,7 @@
///////////////////////////////////////////////////////////////////////////////
#include <LocalRegions/Expansion2D.h>
#include <LocalRegions/Expansion1D.h>
#include <LocalRegions/Expansion3D.h>
#include <SpatialDomains/Geometry.h>
#include <SpatialDomains/Geometry2D.h>
#include <LibUtilities/Foundations/InterpCoeff.h>
......@@ -1444,7 +1445,7 @@ namespace Nektar
Vmath::Vvtvp(nq, &vec[1][0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
Vmath::Vvtvp(nq, &vec[2][0], 1, &normals[2][0], 1, &Fn[0], 1, &Fn[0], 1);
return v_Integral(Fn);
return StdExpansion::Integral(Fn);
}
}
}
......@@ -551,29 +551,16 @@ namespace Nektar
for (auto &it : bregions)
{
const SpatialDomains::BoundaryConditionShPtr boundaryCondition =
<<<<<<< HEAD
GetBoundaryCondition(bconditions, it->first, variable);
SpatialDomains::BoundaryRegion::iterator bregionIt;
for (bregionIt = it->second->begin();
bregionIt != it->second->end(); bregionIt++)
{
cnt += bregionIt->second->size();
=======
GetBoundaryCondition(bconditions, it.first, variable);
if (boundaryCondition->GetBoundaryConditionType() !=
SpatialDomains::ePeriodic )
SpatialDomains::BoundaryRegion::iterator bregionIt;
for (auto &bregionIt : *(it.second))
{
for (auto &bregionIt : *it.second)
{
cnt += bregionIt.second->m_geomVec.size();
}
>>>>>>> master
cnt += bregionIt.second->m_geomVec.size();
}
}
m_bndCondExpansions
= Array<OneD,MultiRegions::ExpListSharedPtr>(cnt);
m_bndConditions
= Array<OneD,SpatialDomains::BoundaryConditionShPtr>(cnt);
......@@ -722,10 +709,6 @@ namespace Nektar
= bcs.GetBoundaryRegions();
const SpatialDomains::BoundaryConditionCollection &bconditions
= bcs.GetBoundaryConditions();
<<<<<<< HEAD
SpatialDomains::BoundaryRegionCollection::const_iterator it;
=======
>>>>>>> master
MultiRegions::ExpList0DSharedPtr locPointExp;
SpatialDomains::BoundaryConditionShPtr locBCond;
......@@ -736,16 +719,13 @@ namespace Nektar
{
locBCond = GetBoundaryCondition(bconditions, it.first, variable);
SpatialDomains::BoundaryRegion::iterator bregionIt;
for (bregionIt = it->second->begin();
bregionIt != it->second->end(); bregionIt++)
for (auto &bregionIt : *(it.second))
{
<<<<<<< HEAD
for (k = 0; k < bregionIt->second->size(); k++)
for (k = 0; k < bregionIt.second->m_geomVec.size(); k++)
{
if((vert = boost::dynamic_pointer_cast
if((vert = std::dynamic_pointer_cast
<SpatialDomains::PointGeom>(
(*bregionIt->second)[k])))
bregionIt.second->m_geomVec[k])))
{
locPointExp
= MemoryManager<MultiRegions::ExpList0D>
......@@ -757,27 +737,6 @@ namespace Nektar
{
ASSERTL0(false,
"dynamic cast to a vertex failed");
=======
for (auto &bregionIt : *it.second)
{
for (k = 0; k < bregionIt.second->m_geomVec.size(); k++)
{
if((vert = std::dynamic_pointer_cast
<SpatialDomains::PointGeom>(
bregionIt.second->m_geomVec[k])))
{
locPointExp
= MemoryManager<MultiRegions::ExpList0D>
::AllocateSharedPtr(vert);
bndCondExpansions[cnt] = locPointExp;
bndConditions[cnt++] = locBCond;
}
else
{
ASSERTL0(false,
"dynamic cast to a vertex failed");
}
>>>>>>> master
}
}
}
......
......@@ -653,7 +653,7 @@ namespace Nektar
bc = GetBoundaryCondition(bconditions, it.first, variable);
locExpList = MemoryManager<MultiRegions::ExpList1D>
::AllocateSharedPtr(m_session, *(it->second), graph2D,
::AllocateSharedPtr(m_session, *(it.second), graph2D,
DeclareCoeffPhysArrays, variable,
bc->GetComm());
......
......@@ -385,9 +385,9 @@ namespace Nektar
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const bool DeclareCoeffPhysArrays,
const std::string variable,
const Collections::ImplementationType ImpType,
const LibUtilities::CommSharedPtr comm):
ExpList(pSession,graph2D)
const LibUtilities::CommSharedPtr comm,
const Collections::ImplementationType ImpType)
: ExpList(pSession,graph2D)
{
SetExpType(e1D);
......
......@@ -115,10 +115,10 @@ namespace Nektar
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const bool DeclareCoeffPhysArrays = true,
const std::string variable = "DefaultVar",
const Collections::ImplementationType ImpType
= Collections::eNoImpType,
const LibUtilities::CommSharedPtr comm
= LibUtilities::CommSharedPtr());
= LibUtilities::CommSharedPtr(),
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
MULTI_REGIONS_EXPORT ExpList1D(
const LibUtilities::SessionReaderSharedPtr &pSession,
......
......@@ -805,8 +805,8 @@ namespace Nektar
const SpatialDomains::CompositeMap &domain,
const SpatialDomains::MeshGraphSharedPtr &graph3D,
const std::string variable,
const Collections::ImplementationType ImpType,
const LibUtilities::CommSharedPtr comm)
const LibUtilities::CommSharedPtr comm,
const Collections::ImplementationType ImpType)
: ExpList(pSession, graph3D)
{
SetExpType(e2D);
......
......@@ -124,10 +124,10 @@ namespace Nektar
const SpatialDomains::CompositeMap &domain,
const SpatialDomains::MeshGraphSharedPtr &graph3D,
const std::string variable = "DefaultVar",
const Collections::ImplementationType ImpType
= Collections::eNoImpType,
const LibUtilities::CommSharedPtr comm =
LibUtilities::CommSharedPtr());
LibUtilities::CommSharedPtr(),
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
/// Destructor.
MULTI_REGIONS_EXPORT virtual ~ExpList2D();
......
......@@ -147,7 +147,6 @@ namespace Nektar
const LibUtilities::CommSharedPtr comm=LibUtilities::CommSharedPtr()):
BoundaryConditionBase(eNeumann, userDefined, comm),
m_neumannCondition(pSession->GetExpressionEvaluator(), eqn),
m_neumannCondition(pSession, eqn),
m_filename(filename)
{
}
......
......@@ -199,7 +199,7 @@ namespace Nektar
const Array<OneD, const SpatialDomains::BoundaryConditionShPtr> &bcs =
m_fields[0]->GetBndConditions();
char *forces[] = { "X", "Y", "Z" };
std::string forces[] = { "X", "Y", "Z" };
Array<OneD, NekDouble> flowrateForce(m_spacedim);
for (int i = 0; i < m_spacedim; ++i)
......@@ -323,7 +323,7 @@ namespace Nektar
for (int i = 0; i < m_spacedim; ++i)
{
m_fields[i]->ExtractElmtToBndPhys(
m_fields[i]->ExtractPhysToBnd(
m_flowrateBndID, inarray[i], boundary[i]);
}
......@@ -341,6 +341,7 @@ namespace Nektar
}
else if (m_HomogeneousType == eHomogeneous1D)
{
// Remaining homogeneous processors that do not contain boundary.
m_comm->GetColumnComm()->AllReduce(
flowrate, LibUtilities::ReduceSum);
}
......@@ -354,10 +355,13 @@ namespace Nektar
bool VelocityCorrectionScheme::v_PostIntegrate(int step)
{
if (m_comm->GetRank() == 0 && (step + 1) % m_flowrateSteps == 0)
if (m_flowrateSteps > 0)
{
m_flowrateStream << setw(8) << step << setw(16) << m_time
<< setw(16) << m_alpha << endl;
if (m_comm->GetRank() == 0 && (step + 1) % m_flowrateSteps == 0)
{
m_flowrateStream << setw(8) << step << setw(16) << m_time
<< setw(16) << m_alpha << endl;
}
}
return IncNavierStokes::v_PostIntegrate(step);
......@@ -450,6 +454,13 @@ namespace Nektar
*/
void VelocityCorrectionScheme::v_DoInitialise(void)
{
m_F = Array<OneD, Array<OneD, NekDouble> > (m_nConvectiveFields);
for (int i = 0; i < m_nConvectiveFields; ++i)
{
m_F[i] = Array< OneD, NekDouble> (m_fields[0]->GetTotPoints(), 0.0);
}
// Set up flowrate before m_fields are initialised.
if (m_flowrate > 0.0)
{
......@@ -469,7 +480,6 @@ namespace Nektar
// field below
SetBoundaryConditions(m_time);
m_F = Array<OneD, Array< OneD, NekDouble> > (m_nConvectiveFields);
for(int i = 0; i < m_nConvectiveFields; ++i)
{
m_fields[i]->LocalToGlobal();
......@@ -477,7 +487,6 @@ namespace Nektar
m_fields[i]->GlobalToLocal();
m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
m_fields[i]->UpdatePhys());
m_F[i] = Array< OneD, NekDouble> (m_fields[0]->GetTotPoints(), 0.0);
}
}
......@@ -568,6 +577,8 @@ namespace Nektar
const NekDouble time,
const NekDouble aii_Dt)
{
int physTot = m_fields[0]->GetTotPoints();
// Substep the pressure boundary condition if using substepping
m_extrapolation->SubStepSetPressureBCs(inarray,aii_Dt,m_kinvis);
......@@ -591,7 +602,7 @@ namespace Nektar
for (int i = 0; i < m_spacedim; ++i)
{
Vmath::Svtvp(phystot, m_alpha, m_flowrateStokes[i], 1,
Vmath::Svtvp(physTot, m_alpha, m_flowrateStokes[i], 1,
outarray[i], 1, outarray[i], 1);
}
}
......
......@@ -9,14 +9,14 @@
</files>
<metrics>
<metric type="L2" id="1">
<value variable="u" tolerance="1e-12">9.73822e-13</value>
<value variable="v" tolerance="1e-12">1.29647e-12</value>
<value variable="p" tolerance="1e-8">9.23756e-10</value>
<value variable="u" tolerance="1e-12">7.66614e-11</value>
<value variable="v" tolerance="1e-12">4.52553e-12</value>
<value variable="p" tolerance="1e-8">7.0151e-09</value>
</metric>
<metric type="Linf" id="2">
<value variable="u" tolerance="1e-12">2.33813e-12</value>
<value variable="v" tolerance="1e-12">2.31607e-12</value>
<value variable="p" tolerance="1e-8">1.23396e-09</value>
<value variable="u" tolerance="1e-12">1.1156e-10</value>
<value variable="v" tolerance="1e-12">1.17928e-11</value>
<value variable="p" tolerance="1e-8">8.32526e-09</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