45 RegisterCreatorFunction(
"Body",
56 const Array<OneD, MultiRegions::ExpListSharedPtr>& pFields,
57 const unsigned int& pNumForcingFields,
58 const TiXmlElement* pForce)
61 int nq = pFields[0]->GetTotPoints();
63 const TiXmlElement* funcNameElmt = pForce->FirstChildElement(
"BODYFORCE");
64 ASSERTL0(funcNameElmt,
"Requires BODYFORCE tag specifying function "
65 "name which prescribes body force.");
67 string funcName = funcNameElmt->GetText();
69 "Function '" + funcName +
"' not defined.");
71 bool singleMode, halfMode;
72 m_session->MatchSolverInfo(
"ModeType",
"SingleMode", singleMode,
false);
73 m_session->MatchSolverInfo(
"ModeType",
"HalfMode", halfMode,
false);
76 std::string s_FieldStr;
79 m_Forcing[i] = Array<OneD, NekDouble> (nq, 0.0);
82 "Variable '" + s_FieldStr +
"' not defined.");
90 if (singleMode || halfMode)
93 Array<OneD, NekDouble> forcingCoeff(pFields[0]->GetNcoeffs(), 0.0);
95 bool w = pFields[0]->GetWaveSpace();
99 pFields[0]->SetWaveSpace(
false);
100 pFields[0]->FwdTrans_IterPerExp(
m_Forcing[i], forcingCoeff);
102 pFields[0]->SetWaveSpace(
true);
103 pFields[0]->BwdTrans(forcingCoeff,
m_Forcing[i]);
105 pFields[0]->SetWaveSpace(w);
111 const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
112 const Array<
OneD, Array<OneD, NekDouble> > &inarray,
113 Array<
OneD, Array<OneD, NekDouble> > &outarray,
118 Vmath::Vadd(outarray[i].num_elements(), outarray[i], 1,