45 "White Noise Forcing");
48 const std::weak_ptr<EquationSystem> &pEquation)
55 const unsigned int &pNumForcingFields,
const TiXmlElement *pForce)
58 int nq = pFields[0]->GetTotPoints();
60 const TiXmlElement *noiseElmt = pForce->FirstChildElement(
"WHITENOISE");
61 ASSERTL0(noiseElmt,
"Requires WHITENOISE tag specifying "
62 "magnitude of white noise force.");
64 string noiseValue = noiseElmt->GetText();
66 m_noise = std::stod(noiseValue);
69 const TiXmlElement *freqElmt = pForce->FirstChildElement(
"UPDATEFREQ");
72 string freqValue = freqElmt->GetText();
81 const TiXmlElement *stepsElmt = pForce->FirstChildElement(
"NSTEPS");
84 string stepsValue = stepsElmt->GetText();
85 m_numSteps = boost::lexical_cast<int>(stepsValue);
96 int seed = -
m_session->GetComm()->GetRank();
#define ASSERTL0(condition, msg)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Defines a forcing term to be explicitly applied.
int m_NumVariable
Number of variables.
Array< OneD, Array< OneD, NekDouble > > m_Forcing
Evaluated forcing function.
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
static SOLVER_UTILS_EXPORT ForcingSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
Creates an instance of this class.
SOLVER_UTILS_EXPORT void v_Apply(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time) override
SOLVER_UTILS_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce) override
static std::string className
Name of the class.
ForcingNoise(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void FillWhiteNoise(int n, const T eps, T *x, const int incx, int outseed)
Fills a vector with white noise.