LCOV - code coverage report
Current view: top level - src/materials/small_deformation_models - ComputeSmallDeformationStress.C (source / functions) Hit Total Coverage
Test: coverage.info Lines: 27 34 79.4 %
Date: 2025-02-21 01:06:12 Functions: 4 5 80.0 %

          Line data    Source code
       1             : //* This file is part of the RACCOON application
       2             : //* being developed at Dolbow lab at Duke University
       3             : //* http://dolbow.pratt.duke.edu
       4             : 
       5             : #include "ComputeSmallDeformationStress.h"
       6             : #include "SmallDeformationElasticityModel.h"
       7             : #include "SmallDeformationPlasticityModel.h"
       8             : 
       9             : registerMooseObject("raccoonApp", ComputeSmallDeformationStress);
      10             : 
      11             : InputParameters
      12         214 : ComputeSmallDeformationStress::validParams()
      13             : {
      14         214 :   InputParameters params = Material::validParams();
      15         214 :   params += BaseNameInterface::validParams();
      16         214 :   params.addClassDescription("The stress calculator given an elasticity model and a plasticity "
      17             :                              "model. Small deformation is assumed.");
      18             : 
      19         428 :   params.addRequiredParam<MaterialName>("elasticity_model",
      20             :                                         "Name of the elastic stress-strain constitutive model");
      21         428 :   params.addParam<MaterialName>("plasticity_model", "Name of the plasticity model");
      22             : 
      23         214 :   params.suppressParameter<bool>("use_displaced_mesh");
      24         214 :   return params;
      25           0 : }
      26             : 
      27          57 : ComputeSmallDeformationStress::ComputeSmallDeformationStress(const InputParameters & parameters)
      28             :   : Material(parameters),
      29             :     BaseNameInterface(parameters),
      30         114 :     _mechanical_strain(getADMaterialProperty<RankTwoTensor>(prependBaseName("mechanical_strain"))),
      31         114 :     _stress(declareADProperty<RankTwoTensor>(prependBaseName("stress")))
      32             : {
      33         114 :   if (getParam<bool>("use_displaced_mesh"))
      34           0 :     mooseError("The stress calculator needs to run on the undisplaced mesh.");
      35          57 : }
      36             : 
      37             : void
      38          57 : ComputeSmallDeformationStress::initialSetup()
      39             : {
      40          57 :   _elasticity_model =
      41          57 :       dynamic_cast<SmallDeformationElasticityModel *>(&getMaterial("elasticity_model"));
      42          57 :   if (!_elasticity_model)
      43           0 :     paramError("elasticity_model",
      44           0 :                "Elasticity model " + getParam<MaterialName>("elasticity_model") +
      45             :                    " is not compatible with ComputeSmallDeformationStress");
      46             : 
      47          57 :   _plasticity_model =
      48          57 :       isParamValid("plasticity_model")
      49          63 :           ? dynamic_cast<SmallDeformationPlasticityModel *>(&getMaterial("plasticity_model"))
      50             :           : nullptr;
      51          57 :   if (_plasticity_model)
      52           6 :     _elasticity_model->setPlasticityModel(_plasticity_model);
      53          57 : }
      54             : 
      55             : void
      56           0 : ComputeSmallDeformationStress::initQpStatefulProperties()
      57             : {
      58           0 :   _stress[_qp].zero();
      59           0 : }
      60             : 
      61             : void
      62    12039692 : ComputeSmallDeformationStress::computeQpProperties()
      63             : {
      64    12039692 :   _elasticity_model->setQp(_qp);
      65    12039692 :   _elasticity_model->updateState(_mechanical_strain[_qp], _stress[_qp]);
      66    12039692 : }

Generated by: LCOV version 1.16