LCOV - code coverage report
Current view: top level - src/materials - ComputeElasticityTensor.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #32971 (54bef8) with base c6cf66 Lines: 22 23 95.7 %
Date: 2026-05-29 20:40:07 Functions: 6 6 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 "ComputeElasticityTensor.h"
      11             : #include "RotationTensor.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", ComputeElasticityTensor);
      14             : registerMooseObject("SolidMechanicsApp", ADComputeElasticityTensor);
      15             : 
      16             : template <bool is_ad>
      17             : InputParameters
      18        7025 : ComputeElasticityTensorTempl<is_ad>::validParams()
      19             : {
      20        7025 :   InputParameters params = ComputeRotatedElasticityTensorBaseTempl<is_ad>::validParams();
      21        7025 :   params.addClassDescription("Compute an elasticity tensor.");
      22       14050 :   params.addRequiredParam<std::vector<Real>>("C_ijkl", "Stiffness tensor for material");
      23       14050 :   params.addParam<MooseEnum>(
      24       14050 :       "fill_method", RankFourTensor::fillMethodEnum() = "symmetric9", "The fill method");
      25        7025 :   return params;
      26           0 : }
      27             : 
      28             : template <bool is_ad>
      29        5265 : ComputeElasticityTensorTempl<is_ad>::ComputeElasticityTensorTempl(
      30             :     const InputParameters & parameters)
      31             :   : ComputeRotatedElasticityTensorBaseTempl<is_ad>(parameters),
      32       15795 :     _Cijkl(this->template getParam<std::vector<Real>>("C_ijkl"),
      33        5265 :            (RankFourTensor::FillMethod)(int)this->template getParam<MooseEnum>("fill_method"))
      34             : {
      35       10530 :   if (!isParamValid("elasticity_tensor_prefactor"))
      36       10530 :     issueGuarantee(_elasticity_tensor_name, Guarantee::CONSTANT_IN_TIME);
      37             : 
      38        5265 :   if (_Cijkl.isIsotropic())
      39        7830 :     issueGuarantee(_elasticity_tensor_name, Guarantee::ISOTROPIC);
      40             :   else
      41             :   {
      42             :     // Use user-provided rotation matrix if given
      43        2700 :     if (parameters.isParamValid("rotation_matrix"))
      44          61 :       _Cijkl.rotate(_rotation_matrix);
      45             :     else
      46             :     {
      47             :       // Define a rotation according to Euler angle parameters
      48        1289 :       RotationTensor R(_Euler_angles); // R type: RealTensorValue
      49             : 
      50             :       // rotate elasticity tensor
      51        1289 :       _Cijkl.rotate(R);
      52             :     }
      53             :   }
      54        5265 : }
      55             : 
      56             : template <bool is_ad>
      57             : void
      58     5980262 : ComputeElasticityTensorTempl<is_ad>::computeQpElasticityTensor()
      59             : {
      60             :   // Assign elasticity tensor at a given quad point
      61     5980262 :   _elasticity_tensor[_qp] = _Cijkl;
      62     5980262 : }
      63             : 
      64             : template class ComputeElasticityTensorTempl<false>;
      65             : template class ComputeElasticityTensorTempl<true>;

Generated by: LCOV version 1.14