https://mooseframework.inl.gov
MFEMComplexVectorPeriodAveragedPostprocessor.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #ifdef MOOSE_MFEM_ENABLED
11 
13 #include "MFEMProblem.h"
14 
16 
19 {
22  params.addClassDescription("Calculates the time average of the inner product between two "
23  "complex MFEM vector FE variables, scaled by an optional scalar "
24  "coefficient.");
25  params.addParam<MFEMScalarCoefficientName>(
26  "coefficient", "1.", "Name of optional scalar coefficient to scale integrand by.");
27  MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
28  params, "primal_variable", "Name of the first complex vector variable in the inner product.");
29  MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
30  params, "dual_variable", "Name of the second complex vector variable in the inner product.");
31  return params;
32 }
33 
35  const InputParameters & parameters)
36  : MFEMPostprocessor(parameters),
38  parameters,
39  getMFEMProblem().getMFEMVariableMesh(getParam<VariableName>("primal_variable"))),
40  _l2_fec(getMFEMProblem()
41  .getComplexGridFunction(getParam<VariableName>("primal_variable"))
42  ->ParFESpace()
43  ->GetMaxElementOrder(),
44  getMesh().Dimension()),
45  _scalar_test_fespace(const_cast<mfem::ParMesh *>(&getMesh()), &_l2_fec),
46  _scalar_var(&_scalar_test_fespace),
47  _scalar_coef(getScalarCoefficient("coefficient")),
48  _primal_var_real_coef(
49  getVectorCoefficientByName(getParam<VariableName>("primal_variable") + "_real")),
50  _primal_var_imag_coef(
51  getVectorCoefficientByName(getParam<VariableName>("primal_variable") + "_imag")),
52  _dual_var_real_coef(
53  getVectorCoefficientByName(getParam<VariableName>("dual_variable") + "_real")),
54  _dual_var_imag_coef(
55  getVectorCoefficientByName(getParam<VariableName>("dual_variable") + "_imag")),
56  _real_inner_product_coef(_primal_var_real_coef, _dual_var_real_coef),
57  _imag_inner_product_coef(_primal_var_imag_coef, _dual_var_imag_coef),
58  _sum_coef(_real_inner_product_coef, _imag_inner_product_coef, 0.5, 0.5),
59  _subdomain_integrator(&_scalar_test_fespace)
60 {
62  _subdomain_integrator.AddDomainIntegrator(new mfem::DomainLFIntegrator(_sum_coef),
64  else
65  _subdomain_integrator.AddDomainIntegrator(new mfem::DomainLFIntegrator(_sum_coef));
66 }
67 
68 void
70 {
71  _scalar_var.ProjectCoefficient(_scalar_coef);
72  _subdomain_integrator.Assemble();
74 }
75 
78 {
79  return _integral;
80 }
81 
82 #endif
mfem::Array< int > & getSubdomainMarkers()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", MFEMComplexVectorPeriodAveragedPostprocessor)
bool isSubdomainRestricted()
Returns a bool indicating if the object is restricted to a subset of subdomains.
Postprocessor for MFEM results.
Real PostprocessorValue
various MOOSE typedefs
Definition: MooseTypes.h:230
virtual PostprocessorValue getValue() const override final
Return the last evaluated integral value.
static InputParameters validParams()
Compute the time average of the inner product between two complex MFEM vector FE variables, scaled by an optional scalar coefficient.
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
Base class for construction of an object that is restricted to a subset of subdomains of the problem ...