https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMMeridionalCurlAux.C
Go to the documentation of this file.
1
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#include "MFEMProblem.h"
14
16
17namespace Moose::MFEM
18{
20 mfem::Coefficient & a_theta, mfem::VectorCoefficient & grad_a_theta)
21 : mfem::VectorCoefficient(2), _a_theta(a_theta), _grad_a_theta(grad_a_theta)
22{
23}
24
25void
27 mfem::ElementTransformation & T,
28 const mfem::IntegrationPoint & ip)
29{
30 mfem::Vector A_grad;
31 _grad_a_theta.Eval(A_grad, T, ip);
32
33 mfem::Vector physical_point;
34 T.Transform(ip, physical_point);
35
36 const mfem::real_t r = physical_point[0];
37 const mfem::real_t A = _a_theta.Eval(T, ip);
38
39 const mfem::real_t dA_dr = A_grad[0];
40 const mfem::real_t dA_dz = A_grad[1];
41
42 V.SetSize(2);
43 V[0] = -dA_dz;
44 V[1] = dA_dr + A / r;
45}
46}
47
50{
52
54 "Calculates the meridional curl associated with an azimuthal scalar variable A_theta "
55 "on a 2D meridional mesh with x = r and y = z, and stores the result in a vector "
56 "MFEM auxvariable.");
57
58 MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
59 params, "source", "Scalar H1 MFEMVariable storing A_theta.");
60
61 return params;
62}
63
65 : MFEMAuxKernel(parameters),
66 _curl_coef(getScalarCoefficientByName(getParam<VariableName>("source")),
67 getVectorCoefficientByName(getParam<VariableName>("source") + "_grad"))
68{
69}
70
71void
73{
74 _result_var.ProjectCoefficient(_curl_coef);
75}
76
77#endif
registerMooseObject("MooseApp", MFEMMeridionalCurlAux)
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.
Class to construct an auxiliary solver used to update a real auxvariable.
static InputParameters validParams()
mfem::ParGridFunction & _result_var
Reference to result gridfunction.
Auxiliary kernel computing the meridional curl associated with an azimuthal scalar field A_theta.
virtual void execute() override
Computes the auxvariable.
MFEMMeridionalCurlAux(const InputParameters &parameters)
static InputParameters validParams()
Moose::MFEM::MeridionalCurlVectorCoefficient _curl_coef
Custom coefficient implementing meridional curl.
void Eval(mfem::Vector &V, mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) override
MeridionalCurlVectorCoefficient(mfem::Coefficient &a_theta, mfem::VectorCoefficient &grad_a_theta)
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).