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 "PorousFlowVolumetricStrain.h" 11 : #include "MooseMesh.h" 12 : 13 : #include "libmesh/quadrature.h" 14 : 15 : registerMooseObject("PorousFlowApp", PorousFlowVolumetricStrain); 16 : 17 : InputParameters 18 5000 : PorousFlowVolumetricStrain::validParams() 19 : { 20 5000 : InputParameters params = PorousFlowMaterialVectorBase::validParams(); 21 10000 : params.addParam<std::string>("base_name", 22 : "This should be the same base_name as given to the TensorMechanics " 23 : "object that computes strain"); 24 10000 : params.addRequiredCoupledVar( 25 : "displacements", 26 : "The displacements appropriate for the simulation geometry and coordinate system"); 27 5000 : params.addClassDescription( 28 : "Compute volumetric strain and the volumetric_strain rate, for use in PorousFlow."); 29 5000 : params.set<std::string>("pf_material_type") = "volumetric_strain"; 30 5000 : params.set<bool>("stateful_displacements") = true; 31 5000 : params.set<bool>("at_nodes") = false; 32 5000 : return params; 33 0 : } 34 : 35 3903 : PorousFlowVolumetricStrain::PorousFlowVolumetricStrain(const InputParameters & parameters) 36 : : PorousFlowMaterialVectorBase(parameters), 37 3903 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 38 7806 : _total_strain(getMaterialProperty<RankTwoTensor>(_base_name + "total_strain")), 39 7806 : _total_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "total_strain")), 40 3903 : _ndisp(coupledComponents("displacements")), 41 3903 : _disp_var_num(coupledIndices("displacements")), 42 : 43 3903 : _vol_strain_rate_qp(declareProperty<Real>("PorousFlow_volumetric_strain_rate_qp")), 44 3903 : _dvol_strain_rate_qp_dvar( 45 3903 : declareProperty<std::vector<RealGradient>>("dPorousFlow_volumetric_strain_rate_qp_dvar")), 46 3903 : _vol_total_strain_qp(declareProperty<Real>("PorousFlow_total_volumetric_strain_qp")), 47 3903 : _dvol_total_strain_qp_dvar( 48 7806 : declareProperty<std::vector<RealGradient>>("dPorousFlow_total_volumetric_strain_qp_dvar")) 49 : { 50 3903 : if (_ndisp != _mesh.dimension()) 51 0 : paramError("displacements", "The number of variables supplied must match the mesh dimension."); 52 : 53 3903 : if (_nodal_material) 54 0 : mooseError("PorousFlowVolumetricStrain classes are only defined for at_nodes = false"); 55 3903 : } 56 : 57 : void 58 1545530 : PorousFlowVolumetricStrain::initQpStatefulProperties() 59 : { 60 1545530 : _vol_total_strain_qp[_qp] = 0.0; 61 1545530 : } 62 : 63 : void 64 19073498 : PorousFlowVolumetricStrain::computeQpProperties() 65 : { 66 19073498 : _vol_total_strain_qp[_qp] = _total_strain[_qp].trace(); 67 19073498 : _vol_strain_rate_qp[_qp] = (_vol_total_strain_qp[_qp] - _total_strain_old[_qp].trace()) / _dt; 68 : 69 : // prepare the derivatives with zeroes 70 19073498 : _dvol_strain_rate_qp_dvar[_qp].resize(_num_var, RealGradient()); 71 19073498 : _dvol_total_strain_qp_dvar[_qp].resize(_num_var, RealGradient()); 72 76125428 : for (unsigned i = 0; i < _ndisp; ++i) 73 57051930 : if (_dictator.isPorousFlowVariable(_disp_var_num[i])) 74 : { 75 : // the i_th displacement is a PorousFlow variable 76 42545722 : const unsigned int pvar = _dictator.porousFlowVariableNum(_disp_var_num[i]); 77 42545722 : _dvol_strain_rate_qp_dvar[_qp][pvar](i) = 1.0 / _dt; 78 42545722 : _dvol_total_strain_qp_dvar[_qp][pvar](i) = 1.0; 79 : } 80 19073498 : }