41#include <boost/test/unit_test.hpp>
45using namespace MultiRegions;
58 R
"END(<?xml version="1.0" encoding="UTF-8"?>
60 <GEOMETRY DIM="2" SPACE="2">
63 <V ID="0"> 0.0 0.0 0.0 </V>
64 <V ID="1"> 0.5 0.0 0.0 </V>
65 <V ID="2"> 1.0 0.0 0.0 </V>
66 <V ID="3"> 0.0 0.5 0.0 </V>
67 <V ID="4"> 0.5 0.5 0.0 </V>
68 <V ID="5"> 1.0 0.5 0.0 </V>
69 <V ID="6"> 0.0 1.0 0.0 </V>
70 <V ID="7"> 0.5 1.0 0.0 </V>
71 <V ID="8"> 1.0 1.0 0.0 </V>
90 <Q ID="0"> 0 3 5 2 </Q>
91 <Q ID="1"> 1 4 6 3 </Q>
92 <Q ID="2"> 5 8 10 7 </Q>
93 <Q ID="3"> 6 9 11 8 </Q>
97 <C ID="0"> Q[0-3] </C>
98 <C ID="1"> E[0,1] </C> <!-- Lower wall -->
99 <C ID="2"> E[2,7] </C> <!-- Inflow -->
100 <C ID="3"> E[4,9] </C> <!-- Outflow -->
101 <C ID="4"> E[10,11] </C> <!-- Upper wall -->
104 <DOMAIN> C[0] </DOMAIN>
109 <E COMPOSITE="C[0]" FIELDS="u" TYPE="MODIFIED" NUMMODES="3"/>
115 <P> lambda = 1.0 </P>
129 <REGION REF="0"> <!-- Stationary -->
130 <D VAR="u" VALUE="0" />
132 <REGION REF="1"> <!-- Inflow -->
133 <D VAR="u" VALUE="y" />
135 <REGION REF="2"> <!-- Outflow -->
136 <N VAR="u" VALUE="0" />
138 <REGION REF="3"> <!-- Moving -->
139 <D VAR="u" VALUE="1" />
141 </BOUNDARYCONDITIONS>
143 <FUNCTION NAME="d00">
144 <E VAR="u" VALUE="0.1*y" />
147 <FUNCTION NAME="d00B">
148 <E VAR="u" VALUE="0.5*y" />
151 <FUNCTION NAME="Forcing">
152 <E VAR="u" VALUE="sin(y)" />
155 <FUNCTION NAME="ExactSolution">
156 <E VAR="u" VALUE="y" />
172 fs::create_directories(ph);
175 ph /=
"TestVarcoeffHashing.xml";
176 std::ofstream sfile(ph);
193 const std::wstring input_file_wstr(ph.c_str());
194 const std::string input_file_str(input_file_wstr.begin(),
195 input_file_wstr.end());
196 char *input_file = (
char *)input_file_str.c_str();
198 char *input_file = (
char *)ph.c_str();
203 char *argv[] = {(
char *)(
"IncNavierStokesSolver"), input_file,
nullptr};
210 Session,
Graph, Session->GetVariable(0));
219 unsigned int npoints = Exp->GetNpoints();
220 unsigned int coordim = Exp->GetCoordim(0);
227 Exp->GetCoords(x0, x1, x2);
230 d00func->Evaluate(x0, x1, x2, d00);
234 d00Bfunc->Evaluate(x0, x1, x2, d00B);
238 ffunc->Evaluate(x0, x1, x2, fcePhys);
239 Fce->SetPhys(fcePhys);
245 for (
int i = 0; i < coordim; i++)
252 Vmath::Zero(Exp->GetNcoeffs(), Exp->UpdateCoeffs(), 1);
262 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 0);
269 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 1);
276 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 2);
283 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 2);
290 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 2);
299 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 0);
302 auto gkey1 =
contfield->LinearAdvectionDiffusionReactionSolve(
306 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 1);
309 auto gkey2 =
contfield->LinearAdvectionDiffusionReactionSolve(
313 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 2);
316 contfield->UnsetGlobalLinSys(gkey1,
true);
319 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 1);
322 contfield->UnsetGlobalLinSys(gkey2,
true);
325 BOOST_CHECK_EQUAL(
contfield->GetPoolCount(
"GlobalLinSys"), 0);
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true, SpatialDomains::MeshGraphSharedPtr partitionedGraph=nullptr)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Equation > EquationSharedPtr
static fs::path UniquePath(std::string specFileStem)
Create a unique (random) path, based on an input stem string. The returned string is a filename or di...
std::shared_ptr< ContField > ContFieldSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::map< ConstFactorType, NekDouble > ConstFactorMap
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
MultiRegions::ContFieldSharedPtr forcefield
void setupContFieldSolve(fs::path &ph, LibUtilities::SessionReaderSharedPtr &Session, MultiRegions::ContFieldSharedPtr &Exp, MultiRegions::ContFieldSharedPtr &Fce)
static const std::string sessionfile
MultiRegions::ContFieldSharedPtr contfield
BOOST_AUTO_TEST_CASE(TestVarcoeffHashing)
LibUtilities::SessionReaderSharedPtr lsession
StdRegions::VarCoeffMap varcoeffs1
void createSessionFile(fs::path &ph)
StdRegions::VarCoeffMap varcoeffs2
StdRegions::ConstFactorMap factors
void Zero(int n, T *x, const int incx)
Zero vector.