https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMComplexWeakForm.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
12#include "MFEMComplexWeakForm.h"
15#include "MFEMComplexKernel.h"
16
18
21{
23 params.addClassDescription("Builds a complex-valued MFEM ComplexEquationSystem from the "
24 "complex kernels and boundary conditions named by this weak form.");
25 return params;
26}
27
32
35{
36 return cast_ref<Moose::MFEM::ComplexEquationSystem &>(*_equation_system);
37}
38
39void
41 std::shared_ptr<MFEMBoundaryCondition> bc)
42{
43 if (auto integrated_bc = std::dynamic_pointer_cast<MFEMComplexIntegratedBC>(bc))
44 complexEquationSystem().AddComplexIntegratedBC(std::move(integrated_bc));
45 else if (auto essential_bc = std::dynamic_pointer_cast<MFEMComplexEssentialBC>(bc))
46 complexEquationSystem().AddComplexEssentialBCs(std::move(essential_bc));
47 else
48 mooseError("Unsupported bc of name '", name, "' detected.");
49}
50
51void
52MFEMComplexWeakForm::addKernel(const std::string & name, std::shared_ptr<MFEMKernel> kernel)
53{
54 if (auto complex_kernel = std::dynamic_pointer_cast<MFEMComplexKernel>(kernel))
55 complexEquationSystem().AddComplexKernel(std::move(complex_kernel));
56 else
57 mooseError("Unsupported kernel of name '", name, "' detected.");
58}
59
60std::shared_ptr<Moose::MFEM::EquationSystem>
62{
63 return std::make_shared<Moose::MFEM::ComplexEquationSystem>();
64}
65
66#endif
registerMooseObject("MooseApp", MFEMComplexWeakForm)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
Constructs and stores a Moose::MFEM::ComplexEquationSystem object.
virtual void addBoundaryCondition(const std::string &name, std::shared_ptr< MFEMBoundaryCondition > bc) override
virtual std::shared_ptr< Moose::MFEM::EquationSystem > makeEquationSystem() override
Constructs the empty EquationSystem of the type this weak form builds.
static InputParameters validParams()
MFEMComplexWeakForm(const InputParameters &parameters)
Moose::MFEM::ComplexEquationSystem & complexEquationSystem()
The equation system as a ComplexEquationSystem, which is the type this class builds in makeEquationSy...
virtual void addKernel(const std::string &name, std::shared_ptr< MFEMKernel > kernel) override
Base class for MOOSE objects that construct objects derived from Moose::MFEM::EquationSystem.
std::shared_ptr< Moose::MFEM::EquationSystem > _equation_system
Stores the constructed EquationSystem.
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
Class to store weak form components (bilinear and linear forms, and optionally mixed and nonlinear fo...
void AddComplexKernel(std::shared_ptr< MFEMComplexKernel > kernel)
Add complex kernels.
void AddComplexIntegratedBC(std::shared_ptr< MFEMComplexIntegratedBC > bc)
Add complex integrated BCs.
void AddComplexEssentialBCs(std::shared_ptr< MFEMComplexEssentialBC > bc)
Add complex essential BCs.