https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowVolumetricStrain.C
Go to the documentation of this file.
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
11#include "MooseMesh.h"
12
13#include "libmesh/quadrature.h"
14
16
19{
21 params.addParam<std::string>("base_name",
22 "This should be the same base_name as given to the TensorMechanics "
23 "object that computes strain");
25 "displacements",
26 "The displacements appropriate for the simulation geometry and coordinate system");
28 "Compute volumetric strain and the volumetric_strain rate, for use in PorousFlow.");
29 params.set<std::string>("pf_material_type") = "volumetric_strain";
30 params.set<bool>("stateful_displacements") = true;
31 params.set<bool>("at_nodes") = false;
32 return params;
33}
34
36 : PorousFlowMaterialVectorBase(parameters),
37 _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
38 _total_strain(getMaterialProperty<RankTwoTensor>(_base_name + "total_strain")),
39 _total_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "total_strain")),
40 _ndisp(coupledComponents("displacements")),
41 _disp_var_num(coupledIndices("displacements")),
42
43 _vol_strain_rate_qp(declareProperty<Real>("PorousFlow_volumetric_strain_rate_qp")),
44 _dvol_strain_rate_qp_dvar(
45 declareProperty<std::vector<RealGradient>>("dPorousFlow_volumetric_strain_rate_qp_dvar")),
46 _vol_total_strain_qp(declareProperty<Real>("PorousFlow_total_volumetric_strain_qp")),
47 _dvol_total_strain_qp_dvar(
48 declareProperty<std::vector<RealGradient>>("dPorousFlow_total_volumetric_strain_qp_dvar"))
49{
50 if (_ndisp != _mesh.dimension())
51 paramError("displacements", "The number of variables supplied must match the mesh dimension.");
52
53 if (_nodal_material)
54 mooseError("PorousFlowVolumetricStrain classes are only defined for at_nodes = false");
55}
56
57void
62
63void
65{
66 _vol_total_strain_qp[_qp] = _total_strain[_qp].trace();
67 _vol_strain_rate_qp[_qp] = (_vol_total_strain_qp[_qp] - _total_strain_old[_qp].trace()) / _dt;
68
69 // prepare the derivatives with zeroes
70 _dvol_strain_rate_qp_dvar[_qp].resize(_num_var, RealGradient());
71 _dvol_total_strain_qp_dvar[_qp].resize(_num_var, RealGradient());
72 for (unsigned i = 0; i < _ndisp; ++i)
73 if (_dictator.isPorousFlowVariable(_disp_var_num[i]))
74 {
75 // the i_th displacement is a PorousFlow variable
76 const unsigned int pvar = _dictator.porousFlowVariableNum(_disp_var_num[i]);
77 _dvol_strain_rate_qp_dvar[_qp][pvar](i) = 1.0 / _dt;
78 _dvol_total_strain_qp_dvar[_qp][pvar](i) = 1.0;
79 }
80}
void mooseError(Args &&... args)
registerMooseObject("PorousFlowApp", PorousFlowVolumetricStrain)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
virtual void resize(const std::size_t size) override final
Base class for all PorousFlow vector materials.
const unsigned int _num_var
Number of PorousFlow variables.
PorousFlowVolumetricStrain computes volumetric strains, and derivatives thereof.
virtual void initQpStatefulProperties() override
const MaterialProperty< RankTwoTensor > & _total_strain_old
Old value of total strain calculated by a Tensor Mechanics strain calculator.
MaterialProperty< std::vector< RealGradient > > & _dvol_strain_rate_qp_dvar
The derivative of the volumetric strain rate with respect to the porous flow variables.
MaterialProperty< std::vector< RealGradient > > & _dvol_total_strain_qp_dvar
The derivative of the total volumetric strain with respect to the porous flow variables.
virtual void computeQpProperties() override
MaterialProperty< Real > & _vol_total_strain_qp
The total volumetric strain at the quadpoints.
PorousFlowVolumetricStrain(const InputParameters &parameters)
const unsigned int _ndisp
Number of displacements supplied (1 in 1D, 2 in 2D, 3 in 3D)
static InputParameters validParams()
const MaterialProperty< RankTwoTensor > & _total_strain
total strain calculated by a Tensor Mechanics strain calculator
std::vector< unsigned int > _disp_var_num
MOOSE variable number of the displacements variables provided.
MaterialProperty< Real > & _vol_strain_rate_qp
The volumetric strain rate at the quadpoints.