38 #include <boost/core/ignore_unused.hpp> 50 "Dummy Equation System that only sends/receives fields");
73 if (
m_session->DefinesElement(
"Nektar/Coupling"))
75 TiXmlElement *vCoupling =
m_session->GetElement(
"Nektar/Coupling");
77 ASSERTL0(vCoupling->Attribute(
"TYPE"),
78 "Missing TYPE attribute in Coupling");
79 string vType = vCoupling->Attribute(
"TYPE");
81 "TYPE attribute must be non-empty in Coupling");
86 for (
auto const &sendVar : m_coupling->GetSendFieldNames())
88 auto match =
find(sV.begin(), sV.end(), sendVar);
89 if (match != sV.end())
91 int id = distance(sV.begin(), match);
112 int numForceFields = 0;
115 numForceFields += x->GetForces().num_elements();
117 vector<string> varNames;
120 for (
int i = 0; i <
m_fields.num_elements(); ++i)
122 varNames.push_back(
m_session->GetVariable(i));
123 phys[i] =
m_fields[i]->UpdatePhys();
127 for (
auto &x : m_forcing)
129 for (
int i = 0; i < x->GetForces().num_elements(); ++i)
131 phys[
m_fields.num_elements() + f + i] = x->GetForces()[i];
132 varNames.push_back(
"F_" + boost::lexical_cast<string>(f) +
"_" +
156 for (
auto const &sendVar :
m_coupling->GetSendFieldNames())
158 auto match =
find(sV.begin(), sV.end(), sendVar);
159 if (match != sV.end())
161 int id = distance(sV.begin(), match);
168 if (
m_session->DefinesCmdLineArgument(
"verbose"))
170 cout <<
"Field evaluation time: " << timer1.
TimePerTest(1) << endl;
174 for (
int i = 0; i <
m_session->GetVariables().size(); ++i)
197 for (
int i = 0; i < x->GetForces().num_elements(); ++i)
203 for (
int j = 0; j < npts; ++j)
205 l2err += x->GetForces()[i][j] * x->GetForces()[i][j];
206 linferr = max(linferr, fabs(x->GetForces()[i][j]));
216 if (
m_comm->TreatAsRankZero())
218 cout <<
"L 2 error (variable " 219 <<
"F_" + boost::lexical_cast<
string>(f) +
"_" +
221 <<
") : " << l2err << endl;
223 cout <<
"L inf error (variable " 224 <<
"F_" + boost::lexical_cast<
string>(f) +
"_" +
226 <<
") : " << linferr << endl;
240 boost::ignore_unused(time);
242 int nVariables = inarray.num_elements();
245 for (
int i = 0; i < nVariables; ++i)
260 boost::ignore_unused(time);
262 int nvariables = inarray.num_elements();
266 for (
int i = 0; i < nvariables; ++i)
#define ASSERTL0(condition, msg)
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate(int step)
NekDouble m_time
Current time of simulation.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
NekDouble TimePerTest(unsigned int n)
Returns amount of seconds per iteration in a test with n iterations.
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the right-hand side.
virtual ~Dummy()
Destructor.
SolverUtils::CouplingSharedPtr m_coupling
LibUtilities::CommSharedPtr m_comm
Communicator.
SOLVER_UTILS_EXPORT int GetTotPoints()
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the projection and call the method for imposing the boundary conditions in case of discontinu...
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate(int step)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
Base class for unsteady solvers.
virtual SOLVER_UTILS_EXPORT void v_Output(void)
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Init object for UnsteadySystem class.
virtual void v_InitObject()
Initialization object for the Dummy class.
EquationSystemFactory & GetEquationSystemFactory()
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
Get a SessionFunction by name.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
virtual bool v_PreIntegrate(int step)
v_PreIntegrate
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
virtual bool v_PostIntegrate(int step)
v_PostIntegrate
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
CouplingFactory & GetCouplingFactory()
Declaration of the Coupling factory singleton.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::vector< int > m_intVariables