LCOV - code coverage report
Current view: top level - src/materials - ComputeCosseratSmallStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 26 28 92.9 %
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 "ComputeCosseratSmallStrain.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "PermutationTensor.h"
      14             : 
      15             : #include "libmesh/quadrature.h"
      16             : 
      17             : registerMooseObject("SolidMechanicsApp", ComputeCosseratSmallStrain);
      18             : 
      19             : InputParameters
      20         440 : ComputeCosseratSmallStrain::validParams()
      21             : {
      22         440 :   InputParameters params = ComputeStrainBase::validParams();
      23         440 :   params.addClassDescription("Compute small Cosserat strains");
      24         880 :   params.addRequiredCoupledVar("Cosserat_rotations", "The 3 Cosserat rotation variables");
      25         440 :   return params;
      26           0 : }
      27             : 
      28         330 : ComputeCosseratSmallStrain::ComputeCosseratSmallStrain(const InputParameters & parameters)
      29             :   : ComputeStrainBase(parameters),
      30         330 :     _curvature(declareProperty<RankTwoTensor>("curvature")),
      31         330 :     _nrots(coupledComponents("Cosserat_rotations")),
      32         330 :     _wc(coupledValues("Cosserat_rotations")),
      33         660 :     _grad_wc(coupledGradients("Cosserat_rotations"))
      34             : {
      35         330 :   if (_nrots != 3)
      36           0 :     mooseError("ComputeCosseratSmallStrain: This Material is only defined for 3-dimensional "
      37             :                "simulations so 3 Cosserat rotation variables are needed");
      38         330 : }
      39             : 
      40             : void
      41      112464 : ComputeCosseratSmallStrain::computeQpProperties()
      42             : {
      43             :   auto strain = RankTwoTensor::initializeFromRows(
      44      112464 :       (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
      45      112464 :   RealVectorValue wc_vector((*_wc[0])[_qp], (*_wc[1])[_qp], (*_wc[2])[_qp]);
      46             : 
      47      449856 :   for (unsigned i = 0; i < LIBMESH_DIM; ++i)
      48     1349568 :     for (unsigned j = 0; j < LIBMESH_DIM; ++j)
      49     4048704 :       for (unsigned k = 0; k < LIBMESH_DIM; ++k)
      50     3036528 :         strain(i, j) += PermutationTensor::eps(i, j, k) * wc_vector(k);
      51             : 
      52      112464 :   _total_strain[_qp] = strain;
      53             : 
      54      112464 :   _mechanical_strain[_qp] = strain;
      55      114864 :   for (auto es : _eigenstrains)
      56        2400 :     _mechanical_strain[_qp] -= (*es)[_qp];
      57             : 
      58      112464 :   _curvature[_qp] = RankTwoTensor::initializeFromRows(
      59      112464 :       (*_grad_wc[0])[_qp], (*_grad_wc[1])[_qp], (*_grad_wc[2])[_qp]);
      60      112464 : }

Generated by: LCOV version 1.14