LCOV - code coverage report
Current view: top level - src/materials - ComputeVariableEigenstrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 0 32 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 "ComputeVariableEigenstrain.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", ComputeVariableEigenstrain);
      13             : 
      14             : InputParameters
      15           0 : ComputeVariableEigenstrain::validParams()
      16             : {
      17           0 :   InputParameters params = ComputeEigenstrain::validParams();
      18           0 :   params.addClassDescription("Computes an Eigenstrain and its derivatives that is a function of "
      19             :                              "multiple variables, where the prefactor is defined in a derivative "
      20             :                              "material");
      21           0 :   params.addRequiredCoupledVar("args", "variable dependencies for the prefactor");
      22           0 :   return params;
      23           0 : }
      24             : 
      25           0 : ComputeVariableEigenstrain::ComputeVariableEigenstrain(const InputParameters & parameters)
      26             :   : DerivativeMaterialInterface<ComputeEigenstrain>(parameters),
      27           0 :     _num_args(coupledComponents("args")),
      28           0 :     _dprefactor(_num_args),
      29           0 :     _d2prefactor(_num_args),
      30           0 :     _delastic_strain(_num_args),
      31           0 :     _d2elastic_strain(_num_args)
      32             : {
      33             :   // fetch prerequisite derivatives and build elastic_strain derivatives and cross-derivatives
      34           0 :   for (unsigned int i = 0; i < _num_args; ++i)
      35             :   {
      36           0 :     const VariableName & iname = coupledName("args", i);
      37           0 :     _dprefactor[i] = &getMaterialPropertyDerivative<Real>("prefactor", iname);
      38           0 :     _delastic_strain[i] =
      39           0 :         &declarePropertyDerivative<RankTwoTensor>(_base_name + "elastic_strain", iname);
      40             : 
      41           0 :     _d2prefactor[i].resize(_num_args);
      42           0 :     _d2elastic_strain[i].resize(_num_args);
      43             : 
      44           0 :     for (unsigned int j = i; j < _num_args; ++j)
      45             :     {
      46           0 :       const VariableName & jname = coupledName("args", j);
      47           0 :       _d2prefactor[i][j] = &getMaterialPropertyDerivative<Real>("prefactor", iname, jname);
      48           0 :       _d2elastic_strain[i][j] =
      49           0 :           &declarePropertyDerivative<RankTwoTensor>(_base_name + "elastic_strain", iname, jname);
      50             :     }
      51             :   }
      52           0 : }
      53             : 
      54             : void
      55           0 : ComputeVariableEigenstrain::computeQpEigenstrain()
      56             : {
      57           0 :   ComputeEigenstrain::computeQpEigenstrain();
      58             : 
      59             :   // Define derivatives of the elastic strain
      60           0 :   for (unsigned int i = 0; i < _num_args; ++i)
      61             :   {
      62           0 :     (*_delastic_strain[i])[_qp] = -_eigen_base_tensor * (*_dprefactor[i])[_qp];
      63           0 :     for (unsigned int j = i; j < _num_args; ++j)
      64           0 :       (*_d2elastic_strain[i][j])[_qp] = -_eigen_base_tensor * (*_d2prefactor[i][j])[_qp];
      65             :   }
      66           0 : }

Generated by: LCOV version 1.14