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"
17
19
22{
24 params.addClassDescription("Builds a complex-valued MFEM ComplexEquationSystem from the "
25 "complex kernels and boundary conditions named by this weak form.");
26 return params;
27}
28
33
36{
37 return cast_ref<Moose::MFEM::ComplexEquationSystem &>(*_equation_system);
38}
39
40void
42 std::shared_ptr<MFEMBoundaryCondition> bc)
43{
44 if (auto integrated_bc = std::dynamic_pointer_cast<MFEMComplexIntegratedBC>(bc))
45 complexEquationSystem().AddComplexIntegratedBC(std::move(integrated_bc));
46 else if (auto essential_bc = std::dynamic_pointer_cast<MFEMComplexEssentialBC>(bc))
47 complexEquationSystem().AddComplexEssentialBCs(std::move(essential_bc));
48 else
49 mooseError("Unsupported bc of name '", name, "' detected.");
50}
51
52void
53MFEMComplexWeakForm::addKernel(const std::string & name, std::shared_ptr<MFEMKernel> kernel)
54{
55 if (auto complex_kernel = std::dynamic_pointer_cast<MFEMComplexKernel>(kernel))
56 complexEquationSystem().AddComplexKernel(std::move(complex_kernel));
57 else
58 mooseError("Unsupported kernel of name '", name, "' detected.");
59}
60
61void
62MFEMComplexWeakForm::addConstraint(const std::string & name,
63 std::shared_ptr<MFEMConstraint> constraint)
64{
65 if (auto essential_constraint =
66 std::dynamic_pointer_cast<MFEMComplexEssentialConstraint>(constraint))
67 complexEquationSystem().AddComplexEssentialConstraint(std::move(essential_constraint));
68 else
69 mooseError("Unsupported constraint of name '", name, "' detected.");
70}
71
72std::shared_ptr<Moose::MFEM::EquationSystem>
74{
75 return std::make_shared<Moose::MFEM::ComplexEquationSystem>();
76}
77
78#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()
virtual void addConstraint(const std::string &name, std::shared_ptr< MFEMConstraint > constraint) override
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 AddComplexEssentialConstraint(std::shared_ptr< MFEMComplexEssentialConstraint > constraint)
Add complex essential (volumetric) constraints.
void AddComplexIntegratedBC(std::shared_ptr< MFEMComplexIntegratedBC > bc)
Add complex integrated BCs.
void AddComplexEssentialBCs(std::shared_ptr< MFEMComplexEssentialBC > bc)
Add complex essential BCs.