10 #ifdef MOOSE_MFEM_ENABLED 22 "Projects $s \\vec u \\wedge \\vec v*$ onto a complex vector MFEM auxvariable");
23 MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
24 params,
"first_source_vec",
"Complex vector variable (3D)");
25 MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
26 params,
"second_source_vec",
"Complex vector variable (3D)");
27 params.addParam<mfem::real_t>(
"scale_factor_real", 1.0,
"Real part of constant multiplier");
28 params.addParam<mfem::real_t>(
"scale_factor_imag", 0.0,
"Imaginary part of constant multiplier");
35 _scale_factor(getParam<mfem::real_t>(
"scale_factor_real"),
36 getParam<mfem::real_t>(
"scale_factor_imag")),
37 _u_coef_real(getVectorCoefficientByName(getParam<VariableName>(
"first_source_vec") +
"_real")),
38 _u_coef_imag(getVectorCoefficientByName(getParam<VariableName>(
"first_source_vec") +
"_imag")),
39 _v_coef_real(getVectorCoefficientByName(getParam<VariableName>(
"second_source_vec") +
"_real")),
40 _v_coef_imag(getVectorCoefficientByName(getParam<VariableName>(
"second_source_vec") +
"_imag")),
41 _cross_ur_vr(_u_coef_real, _v_coef_real),
42 _cross_ur_vi(_u_coef_real, _v_coef_imag),
43 _cross_ui_vr(_u_coef_imag, _v_coef_real),
44 _cross_ui_vi(_u_coef_imag, _v_coef_imag),
45 _final_coef_real(_cross_ur_vr, _cross_ui_vi, 1.0, 1.0),
46 _final_coef_imag(_cross_ur_vi, _cross_ui_vr, -1.0, 1.0)
49 mfem::ParFiniteElementSpace * fes =
_result_var.ParFESpace();
52 if (!dynamic_cast<const mfem::L2_FECollection *>(fes->FEColl()) || fes->GetVDim() != 3)
53 mooseError(
"MFEMComplexExteriorProductAux requires the target variable to be vector [L2]^3.");
56 if (fes->GetTrueVSize() != fes->GetVSize())
57 mooseError(
"MFEMComplexExteriorProductAux currently supports only L2 spaces with interior DOFs " 58 "(no shared/constrained DOFs).");
69 #endif // MOOSE_MFEM_ENABLED
mfem::VectorSumCoefficient _final_coef_imag
void execute() override
Perform the main work for this object.
static InputParameters validParams()
static InputParameters validParams()
Project onto a complex vector MFEM auxvariable.
void complexScale(mfem::ParComplexGridFunction &a, const std::complex< mfem::real_t > scale={1.0, 0.0})
Method to scale a complex variable by a complex constant.
registerMooseObject("MooseApp", MFEMComplexExteriorProductAux)
const std::complex< mfem::real_t > _scale_factor
Scaling factor applied on the resulting field.
mfem::ParComplexGridFunction & _result_var
Reference to result complex gridfunction.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
mfem::VectorSumCoefficient _final_coef_real
Final coefficient that sums the crossproduct terms.
MFEMComplexExteriorProductAux(const InputParameters ¶meters)
Class to construct an auxiliary solver used to update a complex auxvariable.