LCOV - code coverage report
Current view: top level - src/materials - FluxBasedStrainIncrement.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 0 35 0.0 %
Date: 2025-07-25 05:00:39 Functions: 0 5 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 "FluxBasedStrainIncrement.h"
      11             : #include "libmesh/quadrature.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", FluxBasedStrainIncrement);
      14             : 
      15             : InputParameters
      16           0 : FluxBasedStrainIncrement::validParams()
      17             : {
      18           0 :   InputParameters params = Material::validParams();
      19           0 :   params.addClassDescription("Compute strain increment based on flux");
      20           0 :   params.addRequiredCoupledVar("xflux", "x or 0-direction component of flux");
      21           0 :   params.addCoupledVar("yflux", "y or 1-direction component of flux");
      22           0 :   params.addCoupledVar("zflux", "z or 2-direction component of flux");
      23           0 :   params.addCoupledVar("gb", "Grain boundary order parameter");
      24           0 :   params.addRequiredParam<MaterialPropertyName>("property_name",
      25             :                                                 "Name of diffusive strain increment property");
      26           0 :   return params;
      27           0 : }
      28             : 
      29           0 : FluxBasedStrainIncrement::FluxBasedStrainIncrement(const InputParameters & parameters)
      30             :   : DerivativeMaterialInterface<Material>(parameters),
      31           0 :     _grad_jx(&coupledGradient("xflux")),
      32           0 :     _has_yflux(isCoupled("yflux")),
      33           0 :     _has_zflux(isCoupled("zflux")),
      34           0 :     _grad_jy(_has_yflux ? &coupledGradient("yflux") : nullptr),
      35           0 :     _grad_jz(_has_zflux ? &coupledGradient("zflux") : nullptr),
      36           0 :     _gb(isCoupled("gb") ? coupledValue("gb") : _zero),
      37           0 :     _strain_increment(
      38           0 :         declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("property_name")))
      39             : {
      40           0 : }
      41             : 
      42             : void
      43           0 : FluxBasedStrainIncrement::initQpStatefulProperties()
      44             : {
      45           0 :   _strain_increment[_qp].zero();
      46           0 : }
      47             : 
      48             : void
      49           0 : FluxBasedStrainIncrement::computeQpProperties()
      50             : {
      51           0 :   computeFluxGradTensor();
      52             : 
      53           0 :   _strain_increment[_qp] = -0.5 * (_flux_grad_tensor + _flux_grad_tensor.transpose());
      54           0 :   _strain_increment[_qp] *= (1.0 - _gb[_qp]) * _dt;
      55           0 : }
      56             : 
      57             : void
      58           0 : FluxBasedStrainIncrement::computeFluxGradTensor()
      59             : {
      60             :   _flux_grad_tensor.zero();
      61             : 
      62           0 :   _flux_grad_tensor.fillRow(0, (*_grad_jx)[_qp]);
      63             : 
      64           0 :   if (_has_yflux)
      65           0 :     _flux_grad_tensor.fillRow(1, (*_grad_jy)[_qp]);
      66             : 
      67           0 :   if (_has_zflux)
      68           0 :     _flux_grad_tensor.fillRow(2, (*_grad_jz)[_qp]);
      69           0 : }

Generated by: LCOV version 1.14