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 : #include "SideAverageMaterialProperty.h" 11 : 12 : registerMooseObject("MooseApp", SideAverageMaterialProperty); 13 : registerMooseObject("MooseApp", ADSideAverageMaterialProperty); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 28689 : SideAverageMaterialPropertyTempl<is_ad>::validParams() 18 : { 19 28689 : InputParameters params = SideIntegralMaterialPropertyTempl<is_ad>::validParams(); 20 28689 : params.addClassDescription("Computes the average of a material property over a side set."); 21 28689 : return params; 22 0 : } 23 : 24 : template <bool is_ad> 25 83 : SideAverageMaterialPropertyTempl<is_ad>::SideAverageMaterialPropertyTempl( 26 : const InputParameters & parameters) 27 83 : : SideIntegralMaterialPropertyTempl<is_ad>(parameters), _area(0.0) 28 : { 29 83 : } 30 : 31 : template <bool is_ad> 32 : void 33 72 : SideAverageMaterialPropertyTempl<is_ad>::initialize() 34 : { 35 72 : SideIntegralMaterialPropertyTempl<is_ad>::initialize(); 36 72 : _area = 0.0; 37 72 : } 38 : 39 : template <bool is_ad> 40 : void 41 480 : SideAverageMaterialPropertyTempl<is_ad>::execute() 42 : { 43 480 : SideIntegralMaterialPropertyTempl<is_ad>::execute(); 44 : 45 480 : _area += this->_current_side_volume; 46 480 : } 47 : 48 : template <bool is_ad> 49 : Real 50 66 : SideAverageMaterialPropertyTempl<is_ad>::getValue() const 51 : { 52 66 : return _integral_value / _area; 53 : } 54 : 55 : template <bool is_ad> 56 : void 57 66 : SideAverageMaterialPropertyTempl<is_ad>::finalize() 58 : { 59 66 : SideIntegralMaterialPropertyTempl<is_ad>::gatherSum(_area); 60 66 : SideIntegralMaterialPropertyTempl<is_ad>::gatherSum(_integral_value); 61 66 : } 62 : 63 : template <bool is_ad> 64 : void 65 6 : SideAverageMaterialPropertyTempl<is_ad>::threadJoin(const UserObject & y) 66 : { 67 6 : SideIntegralMaterialPropertyTempl<is_ad>::threadJoin(y); 68 : 69 6 : const auto & pps = static_cast<const SideAverageMaterialPropertyTempl<is_ad> &>(y); 70 6 : _area += pps._area; 71 6 : } 72 : 73 : template class SideAverageMaterialPropertyTempl<false>; 74 : template class SideAverageMaterialPropertyTempl<true>;