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 : // This post processor returns the mass value of an element. It is used 11 : // to check that mass is conserved (per the evolving density calculation) 12 : // when volume changes occur. 13 : // 14 : #include "Mass.h" 15 : 16 : #include "metaphysicl/raw_type.h" 17 : 18 : registerMooseObject("SolidMechanicsApp", Mass); 19 : registerMooseObject("SolidMechanicsApp", ADMass); 20 : 21 : template <bool is_ad> 22 : InputParameters 23 0 : MassTempl<is_ad>::validParams() 24 : { 25 0 : InputParameters params = ElementIntegralVariablePostprocessor::validParams(); 26 0 : params.addClassDescription( 27 : "Computes the mass of the solid as the integral of the density material property"); 28 0 : params.set<bool>("use_displaced_mesh") = true; 29 0 : return params; 30 0 : } 31 : 32 : template <bool is_ad> 33 0 : MassTempl<is_ad>::MassTempl(const InputParameters & parameters) 34 : : ElementIntegralVariablePostprocessor(parameters), 35 0 : _density(getGenericMaterialProperty<Real, is_ad>("density")) 36 : { 37 0 : } 38 : 39 : template <bool is_ad> 40 : Real 41 0 : MassTempl<is_ad>::computeQpIntegral() 42 : { 43 0 : return MetaPhysicL::raw_value(_density[_qp]); 44 : } 45 : 46 : template class MassTempl<false>; 47 : template class MassTempl<true>;