https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NLCurlCurlIntegrator.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
11#ifdef MOOSE_MFEM_ENABLED
12
14
15namespace Moose::MFEM
16{
18 mfem::Coefficient & curlu_dk_dcurlu,
19 mfem::VectorCoefficient & curlu_vec,
20 mfem::real_t curlu_zero_tol)
21 : mfem::MatrixCoefficient(curlu_vec.GetVDim()),
22 _k_coef(k),
23 _curlu_dk_dcurlu_coef(curlu_dk_dcurlu),
24 _curlu_zero_tol(curlu_zero_tol),
25 _curlu_hat_coef(curlu_vec, _curlu_zero_tol)
26{
27}
28
29void
31{
32 MatrixCoefficient::SetTime(t);
33 _k_coef.SetTime(t);
34 _curlu_dk_dcurlu_coef.SetTime(t);
35 _curlu_hat_coef.SetTime(t);
36}
37
38void
40 mfem::ElementTransformation & T,
41 const mfem::IntegrationPoint & ip)
42{
43 const int dim = GetHeight();
44 mfem::Vector curlu_hat(dim);
45
46 _curlu_hat_coef.Eval(curlu_hat, T, ip);
47 const mfem::real_t k = _k_coef.Eval(T, ip);
48 const mfem::real_t curlu_dk_dcurlu = _curlu_dk_dcurlu_coef.Eval(T, ip);
49
50 K.Diag(k, dim);
51 for (int i = 0; i < dim; ++i)
52 for (int j = 0; j < dim; ++j)
53 K(i, j) += curlu_dk_dcurlu * curlu_hat(i) * curlu_hat(j);
54}
55
57 mfem::Coefficient & curlu_dk_dcurlu,
58 mfem::VectorCoefficient & curlu_vec,
59 mfem::real_t curlu_zero_tol,
60 const mfem::IntegrationRule * ir)
61 : _curlcurl_res_integ(k, ir),
62 _curlcurl_jac_matrix_coef(k, curlu_dk_dcurlu, curlu_vec, curlu_zero_tol),
63 _curlcurl_jac_integ(_curlcurl_jac_matrix_coef, ir)
64{
65}
66
67void
68NLCurlCurlIntegrator::AssembleElementVector(const mfem::FiniteElement & el,
69 mfem::ElementTransformation & Tr,
70 const mfem::Vector & elfun,
71 mfem::Vector & elvect)
72{
73 _curlcurl_res_integ.AssembleElementVector(el, Tr, elfun, elvect);
74}
75
76void
77NLCurlCurlIntegrator::AssembleElementGrad(const mfem::FiniteElement & el,
78 mfem::ElementTransformation & Tr,
79 const mfem::Vector & elfun,
80 mfem::DenseMatrix & elmat)
81{
82 _curlcurl_jac_integ.AssembleElementGrad(el, Tr, elfun, elmat);
83}
84}
85
86#endif
NLCurlCurlIntegrator(mfem::Coefficient &k, mfem::Coefficient &curlu_dk_dcurlu, mfem::VectorCoefficient &curlu_vec, mfem::real_t curlu_zero_tol=1e-32, const mfem::IntegrationRule *ir=nullptr)
mfem::CurlCurlIntegrator _curlcurl_jac_integ
mfem::CurlCurlIntegrator _curlcurl_res_integ
virtual void AssembleElementGrad(const mfem::FiniteElement &el, mfem::ElementTransformation &Tr, const mfem::Vector &elfun, mfem::DenseMatrix &elmat) override
virtual void AssembleElementVector(const mfem::FiniteElement &el, mfem::ElementTransformation &Tr, const mfem::Vector &elfun, mfem::Vector &elvect) override
mfem::NormalizedVectorCoefficient _curlu_hat_coef
NLCurlCurlJacMatrixCoefficient(mfem::Coefficient &k, mfem::Coefficient &curlu_dk_dcurlu, mfem::VectorCoefficient &curlu_vec, mfem::real_t curlu_zero_tol)
void Eval(mfem::DenseMatrix &K, mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) override
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition Moose.h:165