Commit 312d8991 authored by Michael Turner's avatar Michael Turner

Merge branch 'perf/ExtractTracePhys2D' into 'master'

Improve performance of ExtractTracePhys in 2D

See merge request !824
parents 7c21046a 9f52f74e
......@@ -23,6 +23,7 @@ v5.0.0
- Refactor ParseUtils to be more consistent (!843)
- Added support for using the distance to a specific region (e.g. outlet) in the
function definitions for the Absorption Forcing (!769)
- Improve performance of DisContField2D::v_ExtractTracePhys (!824)
**NekMesh**:
- Add feature to read basic 2D geo files as CAD (!731)
......@@ -73,7 +74,7 @@ v4.4.1
- Fix deadlock with HDF5 input (!786)
- Fix missing entriess in LibUtilities::kPointsTypeStr (!792)
- Fix compiler warnings with CommDataType (!793)
- Fix ability to set default implementation in Collections and added an option
- Fix ability to set default implementation in Collections and added an option
to set eNoCollections in FieldConvert as default (!789)
- Fix performance issue in ProcessIsoContour in relation to memory consumption
(!821)
......@@ -83,7 +84,7 @@ v4.4.1
- Fix overwriting and backup of chk/fld files on slow file systes (!741)
- Fix DriverAdaptive with second order IMEX (!850)
- Fixed typo in eIMEXGear part (!854)
- Added regression tests for IMEXOrder1, IMEXOrder2, IMEXOrder3, MCNAB,
- Added regression tests for IMEXOrder1, IMEXOrder2, IMEXOrder3, MCNAB,
IMEXGear, CNAB, 2nd order IMEX-DIRK, 3rd order IMEX-DIRK (!854)
- Fix bug due to subtractive cancellation in polylib routines (!778)
......
......@@ -1488,28 +1488,43 @@ namespace Nektar
const Array<OneD, const NekDouble> &inarray,
Array<OneD, NekDouble> &outarray)
{
// Loop over elemente and collect forward expansion
int nexp = GetExpSize();
int n, e, offset, phys_offset;
Array<OneD,NekDouble> e_tmp;
Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
&elmtToTrace = m_traceMap->GetElmtToTrace();
LibUtilities::BasisSharedPtr basis = (*m_exp)[0]->GetBasis(0);
if (basis->GetBasisType() != LibUtilities::eGauss_Lagrange)
{
Vmath::Zero(outarray.num_elements(), outarray, 1);
Array<OneD, NekDouble> tracevals(
m_locTraceToTraceMap->GetNFwdLocTracePts());
m_locTraceToTraceMap->FwdLocTracesFromField(inarray,tracevals);
m_locTraceToTraceMap->
InterpLocEdgesToTrace(0,tracevals,outarray);
m_traceMap->UniversalTraceAssemble(outarray);
}
else
{
// Loop over elemente and collect forward expansion
int nexp = GetExpSize();
int n, e, offset, phys_offset;
Array<OneD,NekDouble> e_tmp;
Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
&elmtToTrace = m_traceMap->GetElmtToTrace();
ASSERTL1(outarray.num_elements() >= m_trace->GetNpoints(),
"input array is of insufficient length");
ASSERTL1(outarray.num_elements() >= m_trace->GetNpoints(),
"input array is of insufficient length");
// use m_trace tmp space in element to fill values
for(n = 0; n < nexp; ++n)
{
phys_offset = GetPhys_Offset(n);
for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
// use m_trace tmp space in element to fill values
for(n = 0; n < nexp; ++n)
{
offset = m_trace->GetPhys_Offset(
elmtToTrace[n][e]->GetElmtId());
(*m_exp)[n]->GetEdgePhysVals(e, elmtToTrace[n][e],
inarray + phys_offset,
e_tmp = outarray + offset);
phys_offset = GetPhys_Offset(n);
for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
{
offset = m_trace->GetPhys_Offset(
elmtToTrace[n][e]->GetElmtId());
(*m_exp)[n]->GetEdgePhysVals(e, elmtToTrace[n][e],
inarray + phys_offset,
e_tmp = outarray + offset);
}
}
}
}
......
......@@ -84,36 +84,25 @@ namespace Nektar
int nCoeffs = fields[0]->GetNcoeffs();
int nTracePts = fields[0]->GetTrace()->GetTotPoints();
Array<OneD, NekDouble> qcoeffs(nCoeffs);
Array<OneD, Array<OneD, NekDouble> > fluxvector(nDim);
Array<OneD, NekDouble> tmp(nCoeffs);
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > flux (nDim);
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > qfield(nDim);
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > qfieldStd(nDim);
for (j = 0; j < nDim; ++j)
{
qfield[j] =
Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
qfieldStd[j] =
Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
flux[j] =
Array<OneD, Array<OneD, NekDouble> >(nConvectiveFields);
for (i = 0; i < nConvectiveFields; ++i)
{
qfield[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
qfieldStd[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
flux[j][i] = Array<OneD, NekDouble>(nTracePts, 0.0);
}
}
for (k = 0; k < nDim; ++k)
{
fluxvector[k] = Array<OneD, NekDouble>(nPts, 0.0);
}
// Compute q_{\eta} and q_{\xi}
// Obtain numerical fluxes
......@@ -123,12 +112,12 @@ namespace Nektar
{
for (i = 0; i < nConvectiveFields; ++i)
{
fields[i]->IProductWRTDerivBase(j, inarray[i], qcoeffs);
Vmath::Neg (nCoeffs, qcoeffs, 1);
fields[i]->AddTraceIntegral (flux[j][i], qcoeffs);
fields[i]->IProductWRTDerivBase(j, inarray[i], tmp);
Vmath::Neg (nCoeffs, tmp, 1);
fields[i]->AddTraceIntegral (flux[j][i], tmp);
fields[i]->SetPhysState (false);
fields[i]->MultiplyByElmtInvMass(qcoeffs, qcoeffs);
fields[i]->BwdTrans (qcoeffs, qfield[j][i]);
fields[i]->MultiplyByElmtInvMass(tmp, tmp);
fields[i]->BwdTrans (tmp, qfield[j][i]);
}
}
// Compute u from q_{\eta} and q_{\xi}
......@@ -198,7 +187,6 @@ namespace Nektar
}
}
Array<OneD, NekDouble> tmp = Array<OneD, NekDouble>(nCoeffs, 0.0);
Array<OneD, Array<OneD, NekDouble> > qdbase(nDim);
for (i = 0; i < nConvectiveFields; ++i)
......
......@@ -8,18 +8,18 @@
</files>
<metrics>
<metric type="L2" id="1">
<value variable="rho" tolerance="1e-12">0.000483148</value>
<value variable="rho" tolerance="1e-12">0.000483154</value>
<value variable="rhou" tolerance="1e-12">48.1265</value>
<value variable="rhov" tolerance="1e-12">0.177369</value>
<value variable="rhow" tolerance="1e-12">7.074e-06</value>
<value variable="rhov" tolerance="1e-12">0.177367</value>
<value variable="rhow" tolerance="1e-12">7.87069e-06</value>
<value variable="E" tolerance="1e-12">17518.9</value>
</metric>
<metric type="Linf" id="2">
<value variable="rho" tolerance="1e-12">0.00207205</value>
<value variable="rhou" tolerance="1e-12">83.3318</value>
<value variable="rhov" tolerance="1e-12">0.7524</value>
<value variable="rhow" tolerance="1e-12">3.34657e-05</value>
<value variable="E" tolerance="1e-12">18726.1</value>
<value variable="rho" tolerance="1e-12">0.00207196</value>
<value variable="rhou" tolerance="1e-12">83.332</value>
<value variable="rhov" tolerance="1e-12">0.752414</value>
<value variable="rhow" tolerance="1e-12">5.89513e-05</value>
<value variable="E" tolerance="1e-12">18726.3</value>
</metric>
</metrics>
</test>
......
......@@ -8,18 +8,18 @@
</files>
<metrics>
<metric type="L2" id="1">
<value variable="rho" tolerance="1e-12">0.000483148</value>
<value variable="rho" tolerance="1e-12">0.000483154</value>
<value variable="rhou" tolerance="1e-12">48.1265</value>
<value variable="rhov" tolerance="1e-12">0.177369</value>
<value variable="rhow" tolerance="1e-12"> 7.074e-06</value>
<value variable="rhov" tolerance="1e-12">0.177367</value>
<value variable="rhow" tolerance="1e-12"> 7.87069e-06</value>
<value variable="E" tolerance="1e-12">17518.9</value>
</metric>
<metric type="Linf" id="2">
<value variable="rho" tolerance="1e-12">0.00207205</value>
<value variable="rhou" tolerance="1e-12">83.3318</value>
<value variable="rhov" tolerance="1e-12">0.7524</value>
<value variable="rhow" tolerance="1e-12">3.34657e-05</value>
<value variable="E" tolerance="1e-12">18726.1</value>
<value variable="rho" tolerance="1e-12">0.00207196</value>
<value variable="rhou" tolerance="1e-12">83.332</value>
<value variable="rhov" tolerance="1e-12">0.752414</value>
<value variable="rhow" tolerance="1e-12">5.89513e-05</value>
<value variable="E" tolerance="1e-12">18726.3</value>
</metric>
</metrics>
</test>
......
......@@ -8,16 +8,16 @@
</files>
<metrics>
<metric type="L2" id="1">
<value variable="rho" tolerance="1e-8">0.0889271</value>
<value variable="rhou" tolerance="1e-12">62.1128</value>
<value variable="rhov" tolerance="1e-8">0.175956</value>
<value variable="E" tolerance="1e-12">4905.04</value>
<value variable="rho" tolerance="1e-8">0.0889266</value>
<value variable="rhou" tolerance="1e-12">62.1102</value>
<value variable="rhov" tolerance="1e-8">0.175939</value>
<value variable="E" tolerance="1e-12">4904.77</value>
</metric>
<metric type="Linf" id="2">
<value variable="rho" tolerance="1e-12">0.0760154</value>
<value variable="rhou" tolerance="1e-12">56.0464</value>
<value variable="rhov" tolerance="2e-6">0.265763</value>
<value variable="E" tolerance="1e-12">4381.12</value>
<value variable="rho" tolerance="1e-12">0.0760033</value>
<value variable="rhou" tolerance="1e-12">56.0587</value>
<value variable="rhov" tolerance="2e-6">0.26569</value>
<value variable="E" tolerance="1e-12">4376.14</value>
</metric>
</metrics>
</test>
......
......@@ -11,15 +11,15 @@
<value variable="rho" tolerance="1e-12">0.000391074</value>
<value variable="rhou" tolerance="1e-12">48.1285</value>
<value variable="rhov" tolerance="1e-12">0.143445</value>
<value variable="rhow" tolerance="1e-12"> 6.90409e-06</value>
<value variable="rhow" tolerance="1e-12"> 6.96136e-06</value>
<value variable="E" tolerance="1e-12">17519.5</value>
</metric>
<metric type="Linf" id="2">
<value variable="rho" tolerance="1e-12">0.00162551</value>
<value variable="rho" tolerance="1e-12">0.0016255</value>
<value variable="rhou" tolerance="1e-12">83.3449</value>
<value variable="rhov" tolerance="1e-12">0.588196</value>
<value variable="rhow" tolerance="1e-12">3.33264e-05</value>
<value variable="E" tolerance="1e-12">18878.3</value>
<value variable="rhow" tolerance="1e-12">4.16796e-05</value>
<value variable="E" tolerance="1e-12">18878.4</value>
</metric>
</metrics>
</test>
......
......@@ -11,15 +11,15 @@
<value variable="rho" tolerance="1e-12">0.000391074</value>
<value variable="rhou" tolerance="1e-12">48.1285</value>
<value variable="rhov" tolerance="1e-12">0.143445</value>
<value variable="rhow" tolerance="1e-12"> 6.90409e-06</value>
<value variable="rhow" tolerance="1e-12"> 6.96136e-06</value>
<value variable="E" tolerance="1e-12">17519.5</value>
</metric>
<metric type="Linf" id="2">
<value variable="rho" tolerance="1e-12">0.00162551</value>
<value variable="rho" tolerance="1e-12">0.0016255</value>
<value variable="rhou" tolerance="1e-12">83.3449</value>
<value variable="rhov" tolerance="1e-12">0.588196</value>
<value variable="rhow" tolerance="1e-12">3.33264e-05</value>
<value variable="E" tolerance="1e-12">18878.3</value>
<value variable="rhow" tolerance="1e-12">4.16796e-05</value>
<value variable="E" tolerance="1e-12">18878.4</value>
</metric>
</metrics>
</test>
......
......@@ -8,16 +8,16 @@
</files>
<metrics>
<metric type="L2" id="1">
<value variable="rho" tolerance="1e-12">0.0889271</value>
<value variable="rhou" tolerance="1e-12">62.1128</value>
<value variable="rhov" tolerance="1e-8">0.175956</value>
<value variable="E" tolerance="1e-12">4905.04</value>
<value variable="rho" tolerance="1e-12">0.0889266</value>
<value variable="rhou" tolerance="1e-12">62.1102</value>
<value variable="rhov" tolerance="1e-8">0.175939</value>
<value variable="E" tolerance="1e-12">4904.77</value>
</metric>
<metric type="Linf" id="2">
<value variable="rho" tolerance="1e-12">0.0760154</value>
<value variable="rhou" tolerance="1e-12">56.0464</value>
<value variable="rhov" tolerance="2e-6">0.265763</value>
<value variable="E" tolerance="1e-12">4381.12</value>
<value variable="rho" tolerance="1e-12">0.0760033</value>
<value variable="rhou" tolerance="1e-12">56.0587</value>
<value variable="rhov" tolerance="2e-6">0.26569</value>
<value variable="E" tolerance="1e-12">4376.14</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