LCOV - code coverage report
Current view: top level - src/mfem/auxkernels - MFEMComplexCurlAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 28 33 84.8 %
Date: 2026-05-29 20:35:17 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      12             : #include "MFEMComplexCurlAux.h"
      13             : #include "MFEMProblem.h"
      14             : 
      15             : registerMooseObject("MooseApp", MFEMComplexCurlAux);
      16             : 
      17             : InputParameters
      18        2102 : MFEMComplexCurlAux::validParams()
      19             : {
      20        2102 :   InputParameters params = MFEMComplexAuxKernel::validParams();
      21        4204 :   params.addClassDescription(
      22             :       "Calculates the curl of a complex H(curl) conforming ND source variable and stores the result"
      23             :       " on an H(div) conforming RT result complex auxvariable");
      24        8408 :   MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
      25             :       params, "source", "Vector H(curl) MFEMComplexVariable to take the curl of.");
      26        6306 :   params.addParam<mfem::real_t>(
      27        4204 :       "scale_factor_real", 1.0, "Real part of the factor to scale result auxvariable by.");
      28        4204 :   params.addParam<mfem::real_t>(
      29        4204 :       "scale_factor_imag", 0.0, "Imaginary part of the factor to scale result auxvariable by.");
      30        2102 :   return params;
      31           0 : }
      32             : 
      33           2 : MFEMComplexCurlAux::MFEMComplexCurlAux(const InputParameters & parameters)
      34             :   : MFEMComplexAuxKernel(parameters),
      35           2 :     _source_var_name(getParam<VariableName>("source")),
      36           2 :     _source_var(*getMFEMProblem().getComplexGridFunction(_source_var_name)),
      37           2 :     _scale_factor(getParam<mfem::real_t>("scale_factor_real"),
      38           6 :                   getParam<mfem::real_t>("scale_factor_imag")),
      39           4 :     _curl(_source_var.ParFESpace(), _result_var.ParFESpace())
      40             : {
      41           2 :   _sequence = _source_var.GetSequence() + _result_var.GetSequence();
      42           2 :   _curl.Assemble();
      43           2 :   _curl.Finalize();
      44           2 : }
      45             : 
      46             : // Computes the auxvariable.
      47             : void
      48           2 : MFEMComplexCurlAux::execute()
      49             : {
      50           2 :   update();
      51           2 :   _curl.AddMult(_source_var.real(), _result_var.real() = 0);
      52           2 :   _curl.AddMult(_source_var.imag(), _result_var.imag() = 0);
      53             : 
      54           2 :   complexScale(_result_var, _scale_factor);
      55           2 : }
      56             : 
      57             : void
      58           2 : MFEMComplexCurlAux::update()
      59             : {
      60           2 :   if (long sequence = _source_var.GetSequence() + _result_var.GetSequence() > _sequence)
      61             :   {
      62           0 :     _sequence = sequence;
      63           0 :     _curl.Update();
      64           0 :     _curl.Assemble();
      65           0 :     _curl.Finalize();
      66             :   }
      67           2 : }
      68             : 
      69             : #endif

Generated by: LCOV version 1.14