54 const std::weak_ptr<EquationSystem> &pEquation)
71 [[maybe_unused]]
const unsigned int &pNumForcingFields,
76 m_session->MatchSolverInfo(
"Homogeneous",
"1D", isH1d,
false);
77 m_session->MatchSolverInfo(
"Homogeneous",
"2D", isH2d,
false);
78 int expdim = isH2d ? 1 : pFields[0]->GetGraph()->GetMeshDimension();
79 m_spacedim = expdim + (isH1d ? 1 : 0) + (isH2d ? 2 : 0);
80 auto equ =
m_equ.lock();
81 ASSERTL0(equ,
"Weak pointer to the equation system is expired");
82 m_FluidEq = std::dynamic_pointer_cast<VelocityCorrectionScheme>(equ);
86 "ElectricConductivity should be defined and be positive.");
90 std::vector<std::string> elecVars = {
"Ex",
"Ey",
"Ez"};
91 std::vector<std::string> magVars = {
"Bx",
"By",
"Bz"};
93 "Requires ELECTRICMAGNETICFIELDS tag specifying the function "
94 "that prescribes the external electric and magnetic fields.");
95 std::string electromagneticFields =
96 pForce.
GetValue(
"ELECTRICMAGNETICFIELDS");
98 "Function '" + electromagneticFields +
99 "' is not defined in the session.");
100 for (
size_t i = 0; i < 3; ++i)
102 if (
m_session->DefinesFunction(electromagneticFields, elecVars[i]))
105 m_session->GetFunction(electromagneticFields, elecVars[i]);
106 m_E0[i] = fieldEquation->Evaluate(0., 0., 0., 0.);
108 if (
m_session->DefinesFunction(electromagneticFields, magVars[i]))
111 m_session->GetFunction(electromagneticFields, magVars[i]);
112 m_B0[i] = fieldEquation->Evaluate(0., 0., 0., 0.);
121 const std::string &text = pForce.
GetValue(
"IMPLICITDAMPING");
124 "IMPLICITDAMPING must be either True or False.");
135 for (
size_t i = 0; i < 3; ++i)
154 size_t physTot = fields[0]->GetTotPoints();
171 for (
size_t i = 0; i < 3; ++i)
#define ASSERTL0(condition, msg)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
A single node of a format-neutral session configuration tree.
const std::string & GetValue(const std::string &name) const
Returns the text of the first child called name.
bool DefinesChild(const std::string &name) const
Returns true if this node has at least one child called name.
Defines a forcing term to be explicitly applied.
const std::weak_ptr< EquationSystem > m_equ
Weak pointer to equation system using this forcing.
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
Array< OneD, Array< OneD, NekDouble > > m_Efield
ForcingLorentz(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation)
VelocityCorrectionSchemeSharedPtr m_FluidEq
static std::string classNameBody
Name of the class.
static ForcingSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const LibUtilities::SessionNode &pForce)
Creates an instance of this class.
Array< OneD, NekDouble > m_B0
Array< OneD, NekDouble > m_E0
~ForcingLorentz(void) override
void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const LibUtilities::SessionNode &pForce) override
Initialise the forcing module.
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
Adds the body force, -Omega X u.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Equation > EquationSharedPtr
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
bool IEquals(std::string_view a, std::string_view b)
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
Svtsvtp (scalar times vector plus scalar times vector):
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.