www.mooseframework.org
MultiPlasticityDebugger.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
13 
15 
16 template <>
17 InputParameters validParams<MultiPlasticityDebugger>();
18 
25 {
26 public:
27  static InputParameters validParams();
28 
29  MultiPlasticityDebugger(const MooseObject * moose_object);
30 
36 
41  void checkDerivatives();
42 
48  void checkJacobian(const RankFourTensor & E_inv, const std::vector<Real> & intnl_old);
49 
53  void checkSolution(const RankFourTensor & E_inv);
54 
55 protected:
62  MooseEnum _fspb_debug;
63 
66 
68  std::vector<Real> _fspb_debug_pm;
69 
71  std::vector<Real> _fspb_debug_intnl;
72 
75 
77  std::vector<Real> _fspb_debug_pm_change;
78 
80  std::vector<Real> _fspb_debug_intnl_change;
81 
82 private:
90  void fddyieldFunction_dstress(const RankTwoTensor & stress,
91  const std::vector<Real> & intnl,
92  std::vector<RankTwoTensor> & df_dstress);
93 
101  void fddyieldFunction_dintnl(const RankTwoTensor & stress,
102  const std::vector<Real> & intnl,
103  std::vector<Real> & df_dintnl);
104 
112  virtual void fddflowPotential_dstress(const RankTwoTensor & stress,
113  const std::vector<Real> & intnl,
114  std::vector<RankFourTensor> & dr_dstress);
115 
122  virtual void fddflowPotential_dintnl(const RankTwoTensor & stress,
123  const std::vector<Real> & intnl,
124  std::vector<RankTwoTensor> & dr_dintnl);
125 
141  virtual void fdJacobian(const RankTwoTensor & stress,
142  const std::vector<Real> & intnl_old,
143  const std::vector<Real> & intnl,
144  const std::vector<Real> & pm,
145  const RankTwoTensor & delta_dp,
146  const RankFourTensor & E_inv,
147  bool eliminate_ld,
148  std::vector<std::vector<Real>> & jac);
149 
150  bool dof_included(unsigned int dof, const std::vector<bool> & deactivated_due_to_ld);
151 };
MultiPlasticityDebugger::validParams
static InputParameters validParams()
Definition: MultiPlasticityDebugger.C:17
MultiPlasticityDebugger::_fspb_debug_intnl
std::vector< Real > _fspb_debug_intnl
Debug the Jacobian entires at these internal parameters.
Definition: MultiPlasticityDebugger.h:71
MultiPlasticityDebugger::fdJacobian
virtual void fdJacobian(const RankTwoTensor &stress, const std::vector< Real > &intnl_old, const std::vector< Real > &intnl, const std::vector< Real > &pm, const RankTwoTensor &delta_dp, const RankFourTensor &E_inv, bool eliminate_ld, std::vector< std::vector< Real >> &jac)
The Jacobian calculated using finite differences.
Definition: MultiPlasticityDebugger.C:221
MultiPlasticityDebugger::_fspb_debug
MooseEnum _fspb_debug
none - don't do any debugging crash - currently inactive jacobian - check the jacobian entries jacobi...
Definition: MultiPlasticityDebugger.h:62
MultiPlasticityDebugger::fddyieldFunction_dstress
void fddyieldFunction_dstress(const RankTwoTensor &stress, const std::vector< Real > &intnl, std::vector< RankTwoTensor > &df_dstress)
The finite-difference derivative of yield function(s) with respect to stress.
Definition: MultiPlasticityDebugger.C:519
MultiPlasticityDebugger::fddflowPotential_dintnl
virtual void fddflowPotential_dintnl(const RankTwoTensor &stress, const std::vector< Real > &intnl, std::vector< RankTwoTensor > &dr_dintnl)
The finite-difference derivative of the flow potentials with respect to internal parameters.
Definition: MultiPlasticityDebugger.C:607
MultiPlasticityDebugger::_fspb_debug_stress
RankTwoTensor _fspb_debug_stress
Debug the Jacobian entries at this stress.
Definition: MultiPlasticityDebugger.h:65
validParams< MultiPlasticityDebugger >
InputParameters validParams< MultiPlasticityDebugger >()
MultiPlasticityDebugger::dof_included
bool dof_included(unsigned int dof, const std::vector< bool > &deactivated_due_to_ld)
Definition: MultiPlasticityDebugger.C:349
MultiPlasticityDebugger::_fspb_debug_stress_change
Real _fspb_debug_stress_change
Debug finite-differencing parameter for the stress.
Definition: MultiPlasticityDebugger.h:74
MultiPlasticityLinearSystem
MultiPlasticityLinearSystem computes the linear system and handles linear-dependence removal for use ...
Definition: MultiPlasticityLinearSystem.h:124
MultiPlasticityDebugger::_fspb_debug_intnl_change
std::vector< Real > _fspb_debug_intnl_change
Debug finite-differencing parameters for the internal parameters.
Definition: MultiPlasticityDebugger.h:80
MultiPlasticityDebugger::fddflowPotential_dstress
virtual void fddflowPotential_dstress(const RankTwoTensor &stress, const std::vector< Real > &intnl, std::vector< RankFourTensor > &dr_dstress)
The finite-difference derivative of the flow potential(s) with respect to stress.
Definition: MultiPlasticityDebugger.C:578
MultiPlasticityDebugger::MultiPlasticityDebugger
MultiPlasticityDebugger(const MooseObject *moose_object)
Definition: MultiPlasticityDebugger.C:42
MultiPlasticityDebugger::outputAndCheckDebugParameters
void outputAndCheckDebugParameters()
Outputs the debug parameters: _fspb_debug_stress, _fspd_debug_pm, etc and checks that they are sized ...
Definition: MultiPlasticityDebugger.C:55
MultiPlasticityDebugger::_fspb_debug_pm
std::vector< Real > _fspb_debug_pm
Debug the Jacobian entires at these plastic multipliers.
Definition: MultiPlasticityDebugger.h:68
MultiPlasticityLinearSystem.h
MultiPlasticityDebugger::checkDerivatives
void checkDerivatives()
Checks the derivatives, eg dyieldFunction_dstress by using finite difference approximations.
Definition: MultiPlasticityDebugger.C:85
MultiPlasticityDebugger
MultiPlasticityDebugger computes various finite-difference things to help developers remove bugs in t...
Definition: MultiPlasticityDebugger.h:24
RankFourTensorTempl< Real >
MultiPlasticityDebugger::fddyieldFunction_dintnl
void fddyieldFunction_dintnl(const RankTwoTensor &stress, const std::vector< Real > &intnl, std::vector< Real > &df_dintnl)
The finite-difference derivative of yield function(s) with respect to internal parameter(s)
Definition: MultiPlasticityDebugger.C:547
MultiPlasticityDebugger::checkJacobian
void checkJacobian(const RankFourTensor &E_inv, const std::vector< Real > &intnl_old)
Checks the full Jacobian, which is just certain linear combinations of the dyieldFunction_dstress,...
Definition: MultiPlasticityDebugger.C:161
MultiPlasticityDebugger::checkSolution
void checkSolution(const RankFourTensor &E_inv)
Checks that Ax does equal b in the NR procedure.
Definition: MultiPlasticityDebugger.C:367
MultiPlasticityDebugger::_fspb_debug_pm_change
std::vector< Real > _fspb_debug_pm_change
Debug finite-differencing parameters for the plastic multipliers.
Definition: MultiPlasticityDebugger.h:77
RankTwoTensorTempl< Real >