https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMWeakForm.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 "MFEMWeakForm.h"
13#include "MFEMIntegratedBC.h"
14#include "MFEMEssentialBC.h"
16
18
21{
23 params.addClassDescription("Builds a real-valued MFEM EquationSystem from the kernels and "
24 "boundary conditions named by this weak form.");
25 return params;
26}
27
29
30void
31MFEMWeakForm::addBoundaryCondition(const std::string & name,
32 std::shared_ptr<MFEMBoundaryCondition> bc)
33{
34 if (auto integrated_bc = std::dynamic_pointer_cast<MFEMIntegratedBC>(bc))
35 _equation_system->AddIntegratedBC(std::move(integrated_bc));
36 else if (auto essential_bc = std::dynamic_pointer_cast<MFEMEssentialBC>(bc))
37 _equation_system->AddEssentialBC(std::move(essential_bc));
38 else
39 mooseError("Unsupported bc of name '", name, "' detected.");
40}
41
42void
43MFEMWeakForm::addKernel(const std::string & /*name*/, std::shared_ptr<MFEMKernel> kernel)
44{
45 _equation_system->AddKernel(std::move(kernel));
46}
47
48void
49MFEMWeakForm::addConstraint(const std::string & name, std::shared_ptr<MFEMConstraint> constraint)
50{
51 if (auto essential_constraint = std::dynamic_pointer_cast<MFEMEssentialConstraint>(constraint))
52 _equation_system->AddEssentialConstraint(std::move(essential_constraint));
53 else
54 mooseError("Unsupported constraint of name '", name, "' detected.");
55}
56
57std::shared_ptr<Moose::MFEM::EquationSystem>
59{
60 return std::make_shared<Moose::MFEM::EquationSystem>();
61}
62
63#endif
registerMooseObject("MooseApp", MFEMWeakForm)
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.
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()
Constructs and stores a Moose::MFEM::EquationSystem object.
virtual void addKernel(const std::string &name, std::shared_ptr< MFEMKernel > kernel) override
static InputParameters validParams()
virtual std::shared_ptr< Moose::MFEM::EquationSystem > makeEquationSystem() override
Constructs the empty EquationSystem of the type this weak form builds.
MFEMWeakForm(const InputParameters &parameters)
virtual void addConstraint(const std::string &name, std::shared_ptr< MFEMConstraint > constraint) override
virtual void addBoundaryCondition(const std::string &name, std::shared_ptr< MFEMBoundaryCondition > bc) override
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103