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 38 : NLBoundaryConvectiveHeatFluxIntegrator::NLBoundaryConvectiveHeatFluxIntegrator( 17 : mfem::Coefficient & k, 18 : mfem::Coefficient & dk_du, 19 : mfem::Coefficient & duinf_du, 20 : mfem::Coefficient & gf_offset, 21 38 : mfem::Coefficient & gf) 22 38 : : _shifted_gf_coef(gf, gf_offset, 1.0, -1.0), // u-u_inf 23 38 : _k_uinf_coef(k, gf_offset), // k(u)*u_inf 24 38 : _net_flux_du_coef(dk_du, _shifted_gf_coef), // dk/du*(u-u_inf) 25 38 : _k_duinf_du_coef(k, duinf_du), // k(u) * du_inf/du 26 38 : _duinf_du_flux_coef(-1.0, _k_duinf_du_coef), // -k(u) * du_inf/du 27 38 : _inwards_flux(_k_uinf_coef), 28 38 : _outwards_flux(k), 29 38 : _jacobian_k_component(k), 30 38 : _jacobian_dk_du_component(_net_flux_du_coef), 31 76 : _jacobian_duinf_du_component(_duinf_du_flux_coef) 32 : { 33 38 : _jacobian_action.AddIntegrator(&_jacobian_k_component); 34 38 : _jacobian_action.AddIntegrator(&_jacobian_dk_du_component); 35 38 : _jacobian_action.AddIntegrator(&_jacobian_duinf_du_component); 36 38 : } 37 : 38 : void 39 56 : NLBoundaryConvectiveHeatFluxIntegrator::AssembleElementVector(const mfem::FiniteElement & el, 40 : mfem::ElementTransformation & Tr, 41 : const mfem::Vector & elfun, 42 : mfem::Vector & elvect) 43 : { 44 56 : mfem::Vector ext_flux_elvect; // vector to store flux coming from outside of domain 45 56 : _outwards_flux.AssembleElementVector(el, Tr, elfun, elvect); // (k(u)*u, v) 46 56 : _inwards_flux.AssembleRHSElementVect(el, Tr, ext_flux_elvect); // (k(u)*u_inf, v) 47 56 : elvect -= ext_flux_elvect; // (k(u)*(u-u_inf),v) 48 56 : } 49 : 50 : void 51 26 : NLBoundaryConvectiveHeatFluxIntegrator::AssembleElementGrad(const mfem::FiniteElement & el, 52 : mfem::ElementTransformation & Tr, 53 : const mfem::Vector & elfun, 54 : mfem::DenseMatrix & elmat) 55 : { 56 : // (k (1 - du_inf/du) + dk_du (u-u_inf)) phi, v); 57 26 : _jacobian_action.AssembleElementGrad(el, Tr, elfun, elmat); 58 26 : } 59 : } 60 : 61 : #endif