LCOV - code coverage report
Current view: top level - src/materials - ComputeCosseratSmallStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 26 28 92.9 %
Date: 2024-02-27 11:53:14 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://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 "ComputeCosseratSmallStrain.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "PermutationTensor.h"
      14             : 
      15             : #include "libmesh/quadrature.h"
      16             : 
      17             : registerMooseObject("TensorMechanicsApp", ComputeCosseratSmallStrain);
      18             : 
      19             : InputParameters
      20         220 : ComputeCosseratSmallStrain::validParams()
      21             : {
      22         220 :   InputParameters params = ComputeStrainBase::validParams();
      23         220 :   params.addClassDescription("Compute small Cosserat strains");
      24         440 :   params.addRequiredCoupledVar("Cosserat_rotations", "The 3 Cosserat rotation variables");
      25         220 :   return params;
      26           0 : }
      27             : 
      28         165 : ComputeCosseratSmallStrain::ComputeCosseratSmallStrain(const InputParameters & parameters)
      29             :   : ComputeStrainBase(parameters),
      30         165 :     _curvature(declareProperty<RankTwoTensor>("curvature")),
      31         165 :     _nrots(coupledComponents("Cosserat_rotations")),
      32         165 :     _wc(coupledValues("Cosserat_rotations")),
      33         330 :     _grad_wc(coupledGradients("Cosserat_rotations"))
      34             : {
      35         165 :   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         165 : }
      39             : 
      40             : void
      41       74944 : ComputeCosseratSmallStrain::computeQpProperties()
      42             : {
      43             :   auto strain = RankTwoTensor::initializeFromRows(
      44       74944 :       (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]);
      45       74944 :   RealVectorValue wc_vector((*_wc[0])[_qp], (*_wc[1])[_qp], (*_wc[2])[_qp]);
      46             : 
      47      299776 :   for (unsigned i = 0; i < LIBMESH_DIM; ++i)
      48      899328 :     for (unsigned j = 0; j < LIBMESH_DIM; ++j)
      49     2697984 :       for (unsigned k = 0; k < LIBMESH_DIM; ++k)
      50     2023488 :         strain(i, j) += PermutationTensor::eps(i, j, k) * wc_vector(k);
      51             : 
      52       74944 :   _total_strain[_qp] = strain;
      53             : 
      54       74944 :   _mechanical_strain[_qp] = strain;
      55       76480 :   for (auto es : _eigenstrains)
      56        1536 :     _mechanical_strain[_qp] -= (*es)[_qp];
      57             : 
      58       74944 :   _curvature[_qp] = RankTwoTensor::initializeFromRows(
      59       74944 :       (*_grad_wc[0])[_qp], (*_grad_wc[1])[_qp], (*_grad_wc[2])[_qp]);
      60       74944 : }

Generated by: LCOV version 1.14