LCOV - code coverage report
Current view: top level - src/postprocessors - SidesetReaction.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 13 14 92.9 %
Date: 2024-02-27 11:53:14 Functions: 3 6 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "SidesetReaction.h"
      11             : #include "metaphysicl/raw_type.h"
      12             : 
      13             : registerMooseObject("TensorMechanicsApp", SidesetReaction);
      14             : registerMooseObject("TensorMechanicsApp", ADSidesetReaction);
      15             : 
      16             : template <bool is_ad>
      17             : InputParameters
      18           6 : SidesetReactionTempl<is_ad>::validParams()
      19             : {
      20           6 :   InputParameters params = SideIntegralPostprocessor::validParams();
      21           6 :   params.addClassDescription("Computes the integrated reaction force in a user-specified direction "
      22             :                              "on a sideset from the surface traction");
      23          12 :   params.addRequiredParam<MaterialPropertyName>("stress_tensor", "The rank two stress tensor name");
      24          12 :   params.addRequiredParam<RealVectorValue>("direction",
      25             :                                            "Direction in which the force is to be computed");
      26           6 :   params.set<bool>("use_displaced_mesh") = true;
      27           6 :   return params;
      28           0 : }
      29             : 
      30             : template <bool is_ad>
      31           3 : SidesetReactionTempl<is_ad>::SidesetReactionTempl(const InputParameters & parameters)
      32             :   : SideIntegralPostprocessor(parameters),
      33           3 :     _tensor(getGenericMaterialProperty<RankTwoTensor, is_ad>("stress_tensor")),
      34           9 :     _dir(getParam<RealVectorValue>("direction"))
      35             : {
      36           3 : }
      37             : 
      38             : template <bool is_ad>
      39             : Real
      40         160 : SidesetReactionTempl<is_ad>::computeQpIntegral()
      41             : {
      42         160 :   return _normals[_qp] * (MetaPhysicL::raw_value(_tensor[_qp]) * _dir);
      43             : }
      44             : 
      45             : template class SidesetReactionTempl<false>;
      46             : template class SidesetReactionTempl<true>;

Generated by: LCOV version 1.14