Commit dfb6f903 authored by Kilian Lackhove's avatar Kilian Lackhove
Browse files

APE: Port to forcing framework

parent ab2af0af
......@@ -148,12 +148,13 @@ void APE::v_InitObject()
m_bfField->BwdTrans(tmpC, m_bf[i]);
}
// Initialize the sourceterm
m_sourceTerms = Array<OneD, NekDouble>(GetTotPoints(), 0.0);
m_forcing = SolverUtils::Forcing::Load(m_session, m_fields, 1);
EvaluateFunction("S", m_sourceTerms, "Source", m_time);
m_fields[0]->FwdTrans(m_sourceTerms, tmpC);
m_fields[0]->BwdTrans(tmpC, m_sourceTerms);
std::vector<SolverUtils::ForcingSharedPtr>::const_iterator x;
for (x = m_forcing.begin(); x != m_forcing.end(); ++x)
{
(*x)->Smooth(m_bfField);
}
// Do not forwards transform initial condition
m_homoInitialFwd = false;
......@@ -324,12 +325,14 @@ bool APE::v_PostIntegrate(int step)
}
}
EvaluateFunction("S", m_sourceTerms, "Source", m_time);
EvaluateFunction(m_bfNames, m_bf, "Baseflow", m_time);
Array<OneD, NekDouble> tmpC(GetNcoeffs());
m_fields[0]->FwdTrans(m_sourceTerms, tmpC);
m_fields[0]->BwdTrans(tmpC, m_sourceTerms);
std::vector<SolverUtils::ForcingSharedPtr>::const_iterator x;
for (x = m_forcing.begin(); x != m_forcing.end(); ++x)
{
(*x)->Smooth(m_bfField);
}
for (int i = 0; i < m_spacedim + 2; ++i)
{
......@@ -365,7 +368,11 @@ void APE::DoOdeRhs(const Array<OneD, const Array<OneD, NekDouble> >&inarray,
Vmath::Neg(nq, outarray[i], 1);
}
AddSource(outarray);
std::vector<SolverUtils::ForcingSharedPtr>::const_iterator x;
for (x = m_forcing.begin(); x != m_forcing.end(); ++x)
{
(*x)->Apply(m_fields, outarray, outarray, m_time);
}
}
......@@ -493,15 +500,6 @@ void APE::WallBC(int bcRegion, int cnt,
}
/**
* @brief sourceterm for p' equation obtained from GetSource
*/
void APE::AddSource(Array< OneD, Array< OneD, NekDouble > > &outarray)
{
Vmath::Vadd(GetTotPoints(), m_sourceTerms, 1, outarray[0], 1, outarray[0], 1);
}
/**
* @brief Compute the advection velocity in the standard space
* for each element of the expansion.
......@@ -602,8 +600,6 @@ void APE::v_ExtraFldOutput(
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables)
{
const int nCoeffs = m_fields[0]->GetNcoeffs();
for (int i = 0; i < m_spacedim + 2; i++)
{
Array<OneD, NekDouble> tmpC(GetNcoeffs());
......@@ -619,10 +615,22 @@ void APE::v_ExtraFldOutput(
fieldcoeffs.push_back(tmpC);
}
variables.push_back("S");
Array<OneD, NekDouble> FwdS(nCoeffs);
m_fields[0]->FwdTrans(m_sourceTerms, FwdS);
fieldcoeffs.push_back(FwdS);
std::vector<SolverUtils::ForcingSharedPtr>::const_iterator x;
for (x = m_forcing.begin(); x != m_forcing.end(); ++x)
{
for (int i = 0; i < (*x)->GetForces().num_elements(); ++i)
{
Array<OneD, NekDouble> tmpC(GetNcoeffs());
m_bfField->IProductWRTBase((*x)->GetForces()[i], tmpC);
m_bfField->MultiplyByElmtInvMass(tmpC, tmpC);
m_bfField->LocalToGlobal(tmpC, tmpC);
m_bfField->GlobalToLocal(tmpC, tmpC);
variables.push_back("S");
fieldcoeffs.push_back(tmpC);
}
}
}
......
......@@ -39,6 +39,7 @@
#include <SolverUtils/UnsteadySystem.h>
#include <SolverUtils/Advection/Advection.h>
#include <SolverUtils/Forcing/Forcing.h>
#include <SolverUtils/RiemannSolvers/RiemannSolver.h>
using namespace Nektar::SolverUtils;
......@@ -72,12 +73,12 @@ class APE : public UnsteadySystem
protected:
SolverUtils::AdvectionSharedPtr m_advection;
std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
SolverUtils::RiemannSolverSharedPtr m_riemannSolver;
Array<OneD, Array<OneD, NekDouble> > m_traceBasefield;
Array<OneD, Array<OneD, NekDouble> > m_vecLocs;
/// Isentropic coefficient, Ratio of specific heats (APE)
NekDouble m_gamma;
Array<OneD, NekDouble> m_sourceTerms;
Array<OneD, Array<OneD, NekDouble> > m_bf;
MultiRegions::ExpListSharedPtr m_bfField;
std::vector<std::string> m_bfNames;
......@@ -103,8 +104,6 @@ class APE : public UnsteadySystem
virtual bool v_PostIntegrate(int step);
void AddSource(Array< OneD, Array< OneD, NekDouble > >& outarray);
void GetStdVelocity(Array< OneD, NekDouble >& stdV);
virtual void v_ExtraFldOutput(std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
......
......@@ -806,10 +806,6 @@
<E VAR="p0" VALUE="Pinfinity" />
<E VAR="rho0" VALUE="Rho0" />
</FUNCTION>
<FUNCTION NAME="Source"> <!-- Incompressible base flow -->
<E VAR="S" VALUE="0" />
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0" />
......
......@@ -358,11 +358,7 @@
<E VAR="p0" VALUE="Pinfinity" />
<E VAR="rho0" VALUE="Rho0" />
</FUNCTION>
<FUNCTION NAME="Source"> <!-- Incompressible base flow -->
<E VAR="S" VALUE="0" />
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0" />
<E VAR="u" VALUE="0" />
......
......@@ -75,7 +75,7 @@
<E VAR="rho0" VALUE="Rho0"/>
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="pmax*omega0*cos(omega0*t)*exp(-32*x^2)"/>
<E VAR="p" VALUE="pmax*omega0*cos(omega0*t)*exp(-32*x^2)"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0"/>
......@@ -86,4 +86,9 @@
<E VAR="u" VALUE="0"/>
</FUNCTION>
</CONDITIONS>
<FORCING>
<FORCE TYPE="Body">
<BODYFORCE> Source <BODYFORCE/>
</FORCE>
</FORCING>
</NEKTAR>
......@@ -79,9 +79,6 @@
<E VAR="p0" VALUE="Pinfinity"/>
<E VAR="rho0" VALUE="Rho0"/>
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="0"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0"/>
<E VAR="u" VALUE="0"/>
......
......@@ -796,9 +796,6 @@
<E VAR="u0" VALUE="200" />
<E VAR="v0" VALUE="0" />
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="0"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0"/>
<E VAR="u" VALUE="0"/>
......
......@@ -347,9 +347,6 @@
<E VAR="p0" VALUE="Pinfinity"/>
<E VAR="rho0" VALUE="Rho0"/>
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="0"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0"/>
<E VAR="u" VALUE="0"/>
......
......@@ -347,9 +347,6 @@
<E VAR="p0" VALUE="Pinfinity"/>
<E VAR="rho0" VALUE="Rho0"/>
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="0"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p,u,v" VALUE="0"/>
</FUNCTION>
......
......@@ -353,9 +353,6 @@
<E VAR="p0" VALUE="Pinfinity"/>
<E VAR="rho0" VALUE="Rho0"/>
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="0"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0"/>
<E VAR="u" VALUE="0"/>
......
......@@ -130,9 +130,6 @@
<E VAR="u0" VALUE="100" />
<E VAR="v0" VALUE="0" />
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="0"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0"/>
<E VAR="u" VALUE="0"/>
......
......@@ -1405,9 +1405,6 @@
<E VAR="p0" VALUE="Pinfinity"/>
<E VAR="rho0" VALUE="Rho0"/>
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="0"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0"/>
<E VAR="u" VALUE="0"/>
......
......@@ -1398,9 +1398,6 @@
<E VAR="p0" VALUE="Pinfinity"/>
<E VAR="rho0" VALUE="Rho0"/>
</FUNCTION>
<FUNCTION NAME="Source">
<E VAR="S" VALUE="0"/>
</FUNCTION>
<FUNCTION NAME="ExactSolution"> <!-- Not really the exact solution -->
<E VAR="p" VALUE="0"/>
<E VAR="u" VALUE="0"/>
......
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