LCOV - code coverage report
Current view: top level - src/auxkernels - ShellResultantsAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 50 53 94.3 %
Date: 2025-07-25 05:00:39 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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 "ShellResultantsAux.h"
      11             : #include "ArbitraryQuadrature.h"
      12             : #include "libmesh/quadrature.h"
      13             : #include "libmesh/utility.h"
      14             : #include "libmesh/enum_quadrature_type.h"
      15             : #include "libmesh/fe_type.h"
      16             : #include "libmesh/string_to_enum.h"
      17             : #include "libmesh/quadrature_gauss.h"
      18             : 
      19             : registerMooseObject("SolidMechanicsApp", ShellResultantsAux);
      20             : 
      21             : InputParameters
      22         156 : ShellResultantsAux::validParams()
      23             : {
      24         156 :   InputParameters params = AuxKernel::validParams();
      25         156 :   params.addClassDescription(
      26             :       "Computes the local forces, bending moments and shear forces acting on shell elements");
      27         312 :   params.addParam<std::string>("base_name", "Mechanical property base name");
      28         312 :   params.addRequiredCoupledVar(
      29             :       "thickness",
      30             :       "Thickness of the shell. Can be supplied as either a number or a variable name.");
      31         312 :   params.addRequiredParam<std::string>("through_thickness_order",
      32             :                                        "Quadrature order in out of plane direction");
      33             :   MooseEnum stress_resultant(
      34             :       "axial_force_0 axial_force_1 normal_force bending_moment_0 bending_moment_1 "
      35         312 :       "bending_moment_01 shear_force_01 shear_force_02 shear_force_12");
      36         312 :   params.addRequiredParam<MooseEnum>(
      37             :       "stress_resultant",
      38             :       stress_resultant,
      39             :       "The stress resultant type to output, calculated on the shell element.");
      40             : 
      41         156 :   return params;
      42         156 : }
      43             : 
      44          78 : ShellResultantsAux::ShellResultantsAux(const InputParameters & parameters)
      45             :   : AuxKernel(parameters),
      46          78 :     _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
      47          78 :     _thickness(coupledValue("thickness")),
      48         234 :     _resultant(getParam<MooseEnum>("stress_resultant").getEnum<ResultantType>())
      49             : {
      50          78 :   _t_qrule = std::make_unique<QGauss>(
      51         234 :       1, Utility::string_to_enum<Order>(getParam<std::string>("through_thickness_order")));
      52          78 :   _t_points = _t_qrule->get_points();
      53          78 :   _t_weights = _t_qrule->get_weights();
      54          78 :   _local_stress_t_points.resize(_t_points.size());
      55             : 
      56         234 :   for (const auto t : index_range(_t_points))
      57         156 :     _local_stress_t_points[t] = &getMaterialProperty<RankTwoTensor>(
      58         312 :         _base_name + "local_stress_t_points_" + std::to_string(t));
      59          78 : }
      60             : 
      61             : Real
      62       26272 : ShellResultantsAux::computeValue()
      63             : {
      64             :   Real _shell_resultant = 0.0;
      65             : 
      66       26272 :   switch (_resultant)
      67             :   {
      68             :     case ResultantType::axial_force_0:
      69        4800 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
      70             :       {
      71        3200 :         _shell_resultant +=
      72        3200 :             (*_local_stress_t_points[i])[_qp](0, 0) * _t_weights[i] * (_thickness[_qp] / 2);
      73             :       }
      74             :       break;
      75             : 
      76             :     case ResultantType::axial_force_1:
      77       41280 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
      78             :       {
      79       27520 :         _shell_resultant +=
      80       27520 :             (*_local_stress_t_points[i])[_qp](1, 1) * _t_weights[i] * (_thickness[_qp] / 2);
      81             :       }
      82             :       break;
      83             : 
      84             :     case ResultantType::normal_force:
      85           0 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
      86             :       {
      87           0 :         _shell_resultant +=
      88           0 :             (*_local_stress_t_points[i])[_qp](2, 2) * _t_weights[i] * (_thickness[_qp] / 2);
      89             :       }
      90             :       break;
      91             : 
      92             :     case ResultantType::bending_moment_0:
      93        4800 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
      94             :       {
      95        3200 :         _shell_resultant -= (*_local_stress_t_points[i])[_qp](1, 1) * _t_points[i](0) *
      96        3200 :                             _t_weights[i] * (_thickness[_qp] / 2) * (_thickness[_qp] / 2);
      97             :       }
      98             :       break;
      99             : 
     100             :     case ResultantType::bending_moment_1:
     101        7008 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
     102             :       {
     103        4672 :         _shell_resultant -= (*_local_stress_t_points[i])[_qp](0, 0) * _t_points[i](0) *
     104        4672 :                             _t_weights[i] * (_thickness[_qp] / 2) * (_thickness[_qp] / 2);
     105             :       }
     106             :       break;
     107             : 
     108             :     case ResultantType::bending_moment_01:
     109        4800 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
     110             :       {
     111        3200 :         _shell_resultant -= (*_local_stress_t_points[i])[_qp](0, 1) * _t_points[i](0) *
     112        3200 :                             _t_weights[i] * (_thickness[_qp] / 2) * (_thickness[_qp] / 2);
     113             :       }
     114             :       break;
     115             : 
     116             :     case ResultantType::shear_force_01:
     117        4800 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
     118             :       {
     119        3200 :         _shell_resultant +=
     120        3200 :             (*_local_stress_t_points[i])[_qp](0, 1) * _t_weights[i] * (_thickness[_qp] / 2);
     121             :       }
     122             :       break;
     123             : 
     124             :     case ResultantType::shear_force_02:
     125        6528 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
     126             :       {
     127        4352 :         _shell_resultant +=
     128        4352 :             (*_local_stress_t_points[i])[_qp](0, 2) * _t_weights[i] * (_thickness[_qp] / 2);
     129             :       }
     130             :       break;
     131             : 
     132             :     case ResultantType::shear_force_12:
     133        4800 :       for (unsigned int i = 0; i < _t_points.size(); ++i)
     134             :       {
     135        3200 :         _shell_resultant +=
     136        3200 :             (*_local_stress_t_points[i])[_qp](1, 2) * _t_weights[i] * (_thickness[_qp] / 2);
     137             :       }
     138             :       break;
     139             :   }
     140             : 
     141       26272 :   return _shell_resultant;
     142             : }

Generated by: LCOV version 1.14