LCOV - code coverage report
Current view: top level - src/materials - TwoPhaseStressMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 0 28 0.0 %
Date: 2025-07-25 05:00:39 Functions: 0 3 0.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 "TwoPhaseStressMaterial.h"
      11             : #include "RankTwoTensor.h"
      12             : #include "RankFourTensor.h"
      13             : 
      14             : registerMooseObject("SolidMechanicsApp", TwoPhaseStressMaterial);
      15             : 
      16             : InputParameters
      17           0 : TwoPhaseStressMaterial::validParams()
      18             : {
      19           0 :   InputParameters params = Material::validParams();
      20           0 :   params.addClassDescription("Compute a global stress in a two phase model");
      21           0 :   params.addParam<MaterialPropertyName>(
      22             :       "h", "h", "Switching Function Material that provides h(eta)");
      23           0 :   params.addRequiredParam<std::string>("base_A", "Base name for the Phase A strain.");
      24           0 :   params.addRequiredParam<std::string>("base_B", "Base name for the Phase B strain.");
      25           0 :   params.addParam<std::string>("base_name", "Base name for the computed global stress (optional).");
      26           0 :   return params;
      27           0 : }
      28             : 
      29           0 : TwoPhaseStressMaterial::TwoPhaseStressMaterial(const InputParameters & parameters)
      30             :   : DerivativeMaterialInterface<Material>(parameters),
      31           0 :     _h_eta(getMaterialProperty<Real>("h")),
      32             : 
      33           0 :     _base_A(getParam<std::string>("base_A") + "_"),
      34           0 :     _stress_A(getMaterialPropertyByName<RankTwoTensor>(_base_A + "stress")),
      35           0 :     _dstress_dstrain_A(getMaterialPropertyByName<RankFourTensor>(_base_A + "Jacobian_mult")),
      36             : 
      37           0 :     _base_B(getParam<std::string>("base_B") + "_"),
      38           0 :     _stress_B(getMaterialPropertyByName<RankTwoTensor>(_base_B + "stress")),
      39           0 :     _dstress_dstrain_B(getMaterialPropertyByName<RankFourTensor>(_base_B + "Jacobian_mult")),
      40             : 
      41           0 :     _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
      42           0 :     _stress(declareProperty<RankTwoTensor>(_base_name + "stress")),
      43           0 :     _dstress_dstrain(declareProperty<RankFourTensor>(_base_name + "Jacobian_mult")),
      44           0 :     _global_extra_stress(getDefaultMaterialProperty<RankTwoTensor>("extra_stress"))
      45             : {
      46           0 : }
      47             : 
      48             : void
      49           0 : TwoPhaseStressMaterial::computeQpProperties()
      50             : {
      51           0 :   _stress[_qp] = _h_eta[_qp] * _stress_B[_qp] + (1.0 - _h_eta[_qp]) * _stress_A[_qp];
      52             : 
      53             :   // Add in global extra stress
      54           0 :   _stress[_qp] += _global_extra_stress[_qp];
      55             : 
      56           0 :   _dstress_dstrain[_qp] =
      57           0 :       _h_eta[_qp] * _dstress_dstrain_B[_qp] + (1.0 - _h_eta[_qp]) * _dstress_dstrain_A[_qp];
      58           0 : }

Generated by: LCOV version 1.14