https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMCoordinateTransformations.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
15
18{
21 "Function object that declares MFEM coordinate-dependent coefficients.");
23 "coord_type", MooseEnum("RZ"), "Coordinate system type. Currently only RZ is supported.");
24 params.addParam<mfem::real_t>(
25 "inv_r_eps", 1e-12, "Regularization parameter for the inverse radial coefficient.");
26 return params;
27}
28
30 : Function(parameters),
31 _mfem_problem(
32 cast_ref<MFEMProblem &>(*parameters.getCheckedPointerParam<SubProblem *>("_subproblem"))),
33 _coord_type(getParam<MooseEnum>("coord_type")),
34 _inv_r_eps(getParam<mfem::real_t>("inv_r_eps"))
35{
36 if (_coord_type == "RZ")
38}
39
40void
42{
44 auto & r = coeffs.declareScalar<mfem::CylindricalRadialCoefficient>(name() + "_r");
45 coeffs.declareScalar<mfem::CylindricalAzimuthalCoefficient>(name() + "_p");
46 coeffs.declareScalar<mfem::CylindricalZCoefficient>(name() + "_z");
47 coeffs.declareScalar<mfem::ProductCoefficient>(name() + "_two_pi_r", 8 * atan(1), r);
48 coeffs.declareScalar<mfem::TransformedCoefficient>(name() + "_inv_r",
49 &r,
50 [eps = _inv_r_eps](mfem::real_t r)
51 { return 1. / std::sqrt(r * r + eps * eps); });
52}
53
54#endif
registerMooseObject("MooseApp", MFEMCoordinateTransformations)
Base class for function objects.
Definition Function.h:30
static InputParameters validParams()
Class constructor.
Definition Function.C:16
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
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.
Function object that declares MFEM coordinate-dependent coefficients.
MFEMCoordinateTransformations(const InputParameters &parameters)
MFEMProblem & _mfem_problem
Reference to the MFEMProblem instance.
const MooseEnum _coord_type
Coordinate system type.
const mfem::real_t _inv_r_eps
Regularization parameter used in inv_r = 1/sqrt(r^2 + eps^2)
Moose::MFEM::CoefficientManager & getCoefficients()
Method to get the PropertyManager object for storing material properties and converting them to MFEM ...
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
Front-end class for creating and storing MFEM coefficients.
mfem::Coefficient & declareScalar(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing scalar coefficient or, if it does not exist, try interpreting the nam...
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79