Line data Source code
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 "NLBoundaryConvectiveHeatFluxIntegrator.h" 13 : 14 : namespace Moose::MFEM 15 : { 16 36 : NLBoundaryConvectiveHeatFluxIntegrator::NLBoundaryConvectiveHeatFluxIntegrator( 17 : mfem::Coefficient & k, 18 : mfem::Coefficient & dk_du, 19 : mfem::Coefficient & gf_offset, 20 36 : mfem::Coefficient & gf) 21 36 : : _shifted_gf_coef(gf, gf_offset, 1.0, -1.0), // u-u_inf 22 36 : _k_uinf_coef(k, gf_offset), // k(u)*u_inf 23 36 : _net_flux_du_coef(dk_du, _shifted_gf_coef), // dk/du*(u-u_inf) 24 36 : _inwards_flux(_k_uinf_coef), 25 36 : _outwards_flux(k), 26 36 : _jacobian_k_component(k), 27 72 : _jacobian_dk_du_component(_net_flux_du_coef) 28 : { 29 36 : _jacobian_action.AddIntegrator(&_jacobian_k_component); 30 36 : _jacobian_action.AddIntegrator(&_jacobian_dk_du_component); 31 36 : } 32 : 33 : void 34 1084 : NLBoundaryConvectiveHeatFluxIntegrator::AssembleElementVector(const mfem::FiniteElement & el, 35 : mfem::ElementTransformation & Tr, 36 : const mfem::Vector & elfun, 37 : mfem::Vector & elvect) 38 : { 39 1084 : mfem::Vector ext_flux_elvect; // vector to store flux coming from outside of domain 40 1084 : _outwards_flux.AssembleElementVector(el, Tr, elfun, elvect); // (k(u)*u, v) 41 1084 : _inwards_flux.AssembleRHSElementVect(el, Tr, ext_flux_elvect); // (k(u)*u_inf, v) 42 1084 : elvect -= ext_flux_elvect; // (k(u)*(u-u_inf),v) 43 1084 : } 44 : 45 : void 46 1060 : NLBoundaryConvectiveHeatFluxIntegrator::AssembleElementGrad(const mfem::FiniteElement & el, 47 : mfem::ElementTransformation & Tr, 48 : const mfem::Vector & elfun, 49 : mfem::DenseMatrix & elmat) 50 : { 51 : // (k + dk_du (u-u_inf)) phi, v); 52 1060 : _jacobian_action.AssembleElementGrad(el, Tr, elfun, elmat); // 53 1060 : } 54 : } 55 : 56 : #endif