10#ifdef MOOSE_MFEM_ENABLED
22 "Projects $s \\vec u \\cdot \\vec v*$ onto a complex scalar MFEM auxvariable");
23 MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
24 params,
"first_source_vec",
"Complex vector variable");
25 MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
26 params,
"second_source_vec",
"Complex vector variable");
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 _dot_ur_vr(_u_coef_real, _v_coef_real),
42 _dot_ur_vi(_u_coef_real, _v_coef_imag),
43 _dot_ui_vr(_u_coef_imag, _v_coef_real),
44 _dot_ui_vi(_u_coef_imag, _v_coef_imag),
45 _final_coef_real(_dot_ur_vr, _dot_ui_vi, 1.0, 1.0),
46 _final_coef_imag(_dot_ur_vi, _dot_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() != 1)
53 mooseError(
"MFEMComplexInnerProductAux requires the target variable to be scalar L2.");
56 if (fes->GetTrueVSize() != fes->GetVSize())
57 mooseError(
"MFEMComplexInnerProductAux currently supports only L2 spaces with interior DOFs "
58 "(no shared/constrained DOFs).");
registerMooseObject("MooseApp", MFEMComplexInnerProductAux)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Class to construct an auxiliary solver used to update a complex auxvariable.
mfem::ParComplexGridFunction & _result_var
Reference to result complex gridfunction.
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.
static InputParameters validParams()
Project onto a complex scalar MFEM auxvariable.
MFEMComplexInnerProductAux(const InputParameters ¶meters)
static InputParameters validParams()
mfem::SumCoefficient _final_coef_imag
const std::complex< mfem::real_t > _scale_factor
Scaling factor applied on the resulting field.
mfem::SumCoefficient _final_coef_real
Final coefficient that sums the inner product terms.
void execute() override
Perform the main work for this object.