Line data Source code
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 : // Plastic Model base class.
11 : //
12 : #include "TensorMechanicsPlasticModel.h"
13 : #include "RankFourTensor.h"
14 :
15 : InputParameters
16 1780 : TensorMechanicsPlasticModel::validParams()
17 : {
18 1780 : InputParameters params = GeneralUserObject::validParams();
19 3560 : params.addRequiredRangeCheckedParam<Real>("yield_function_tolerance",
20 : "yield_function_tolerance>0",
21 : "If the yield function is less than this amount, the "
22 : "(stress, internal parameter) are deemed admissible.");
23 3560 : params.addRequiredRangeCheckedParam<Real>("internal_constraint_tolerance",
24 : "internal_constraint_tolerance>0",
25 : "The Newton-Raphson process is only deemed converged "
26 : "if the internal constraint is less than this.");
27 1780 : params.addClassDescription(
28 : "Plastic Model base class. Override the virtual functions in your class");
29 1780 : return params;
30 0 : }
31 :
32 893 : TensorMechanicsPlasticModel::TensorMechanicsPlasticModel(const InputParameters & parameters)
33 : : GeneralUserObject(parameters),
34 893 : _f_tol(getParam<Real>("yield_function_tolerance")),
35 2679 : _ic_tol(getParam<Real>("internal_constraint_tolerance"))
36 : {
37 893 : }
38 :
39 : void
40 6336 : TensorMechanicsPlasticModel::initialize()
41 : {
42 6336 : }
43 :
44 : void
45 6336 : TensorMechanicsPlasticModel::execute()
46 : {
47 6336 : }
48 :
49 : void
50 6336 : TensorMechanicsPlasticModel::finalize()
51 : {
52 6336 : }
53 :
54 : unsigned
55 47554114 : TensorMechanicsPlasticModel::numberSurfaces() const
56 : {
57 47554114 : return 1;
58 : }
59 :
60 : Real
61 0 : TensorMechanicsPlasticModel::yieldFunction(const RankTwoTensor & /*stress*/, Real /*intnl*/) const
62 : {
63 0 : return 0.0;
64 : }
65 :
66 : void
67 1274656 : TensorMechanicsPlasticModel::yieldFunctionV(const RankTwoTensor & stress,
68 : Real intnl,
69 : std::vector<Real> & f) const
70 : {
71 1274656 : f.assign(1, yieldFunction(stress, intnl));
72 1274656 : }
73 :
74 : RankTwoTensor
75 0 : TensorMechanicsPlasticModel::dyieldFunction_dstress(const RankTwoTensor & /*stress*/,
76 : Real /*intnl*/) const
77 : {
78 0 : return RankTwoTensor();
79 : }
80 :
81 : void
82 450594 : TensorMechanicsPlasticModel::dyieldFunction_dstressV(const RankTwoTensor & stress,
83 : Real intnl,
84 : std::vector<RankTwoTensor> & df_dstress) const
85 : {
86 450594 : df_dstress.assign(1, dyieldFunction_dstress(stress, intnl));
87 450594 : }
88 :
89 : Real
90 0 : TensorMechanicsPlasticModel::dyieldFunction_dintnl(const RankTwoTensor & /*stress*/,
91 : Real /*intnl*/) const
92 : {
93 0 : return 0.0;
94 : }
95 : void
96 400132 : TensorMechanicsPlasticModel::dyieldFunction_dintnlV(const RankTwoTensor & stress,
97 : Real intnl,
98 : std::vector<Real> & df_dintnl) const
99 : {
100 400132 : return df_dintnl.assign(1, dyieldFunction_dintnl(stress, intnl));
101 : }
102 :
103 : RankTwoTensor
104 0 : TensorMechanicsPlasticModel::flowPotential(const RankTwoTensor & /*stress*/, Real /*intnl*/) const
105 : {
106 0 : return RankTwoTensor();
107 : }
108 : void
109 1345118 : TensorMechanicsPlasticModel::flowPotentialV(const RankTwoTensor & stress,
110 : Real intnl,
111 : std::vector<RankTwoTensor> & r) const
112 : {
113 1345118 : return r.assign(1, flowPotential(stress, intnl));
114 : }
115 :
116 : RankFourTensor
117 0 : TensorMechanicsPlasticModel::dflowPotential_dstress(const RankTwoTensor & /*stress*/,
118 : Real /*intnl*/) const
119 : {
120 0 : return RankFourTensor();
121 : }
122 : void
123 431598 : TensorMechanicsPlasticModel::dflowPotential_dstressV(const RankTwoTensor & stress,
124 : Real intnl,
125 : std::vector<RankFourTensor> & dr_dstress) const
126 : {
127 431598 : return dr_dstress.assign(1, dflowPotential_dstress(stress, intnl));
128 : }
129 :
130 : RankTwoTensor
131 0 : TensorMechanicsPlasticModel::dflowPotential_dintnl(const RankTwoTensor & /*stress*/,
132 : Real /*intnl*/) const
133 : {
134 0 : return RankTwoTensor();
135 : }
136 : void
137 431598 : TensorMechanicsPlasticModel::dflowPotential_dintnlV(const RankTwoTensor & stress,
138 : Real intnl,
139 : std::vector<RankTwoTensor> & dr_dintnl) const
140 : {
141 431598 : return dr_dintnl.assign(1, dflowPotential_dintnl(stress, intnl));
142 : }
143 :
144 : Real
145 1381470 : TensorMechanicsPlasticModel::hardPotential(const RankTwoTensor & /*stress*/, Real /*intnl*/) const
146 : {
147 1381470 : return -1.0;
148 : }
149 : void
150 1406718 : TensorMechanicsPlasticModel::hardPotentialV(const RankTwoTensor & stress,
151 : Real intnl,
152 : std::vector<Real> & h) const
153 : {
154 1406718 : h.assign(numberSurfaces(), hardPotential(stress, intnl));
155 1406718 : }
156 :
157 : RankTwoTensor
158 375142 : TensorMechanicsPlasticModel::dhardPotential_dstress(const RankTwoTensor & /*stress*/,
159 : Real /*intnl*/) const
160 : {
161 375142 : return RankTwoTensor();
162 : }
163 : void
164 381718 : TensorMechanicsPlasticModel::dhardPotential_dstressV(const RankTwoTensor & stress,
165 : Real intnl,
166 : std::vector<RankTwoTensor> & dh_dstress) const
167 : {
168 381718 : dh_dstress.assign(numberSurfaces(), dhardPotential_dstress(stress, intnl));
169 381718 : }
170 :
171 : Real
172 375142 : TensorMechanicsPlasticModel::dhardPotential_dintnl(const RankTwoTensor & /*stress*/,
173 : Real /*intnl*/) const
174 : {
175 375142 : return 0.0;
176 : }
177 : void
178 381718 : TensorMechanicsPlasticModel::dhardPotential_dintnlV(const RankTwoTensor & stress,
179 : Real intnl,
180 : std::vector<Real> & dh_dintnl) const
181 : {
182 381718 : dh_dintnl.resize(numberSurfaces(), dhardPotential_dintnl(stress, intnl));
183 381718 : }
184 :
185 : void
186 65064 : TensorMechanicsPlasticModel::activeConstraints(const std::vector<Real> & f,
187 : const RankTwoTensor & /*stress*/,
188 : Real /*intnl*/,
189 : const RankFourTensor & /*Eijkl*/,
190 : std::vector<bool> & act,
191 : RankTwoTensor & /*returned_stress*/) const
192 : {
193 : mooseAssert(f.size() == numberSurfaces(),
194 : "f incorrectly sized at " << f.size() << " in activeConstraints");
195 65064 : act.resize(numberSurfaces());
196 130128 : for (unsigned surface = 0; surface < numberSurfaces(); ++surface)
197 65064 : act[surface] = (f[surface] > _f_tol);
198 65064 : }
199 :
200 : std::string
201 0 : TensorMechanicsPlasticModel::modelName() const
202 : {
203 0 : return "None";
204 : }
205 :
206 : bool
207 0 : TensorMechanicsPlasticModel::useCustomReturnMap() const
208 : {
209 0 : return false;
210 : }
211 :
212 : bool
213 4528 : TensorMechanicsPlasticModel::useCustomCTO() const
214 : {
215 4528 : return false;
216 : }
217 :
218 : bool
219 207800 : TensorMechanicsPlasticModel::returnMap(const RankTwoTensor & trial_stress,
220 : Real intnl_old,
221 : const RankFourTensor & /*E_ijkl*/,
222 : Real /*ep_plastic_tolerance*/,
223 : RankTwoTensor & /*returned_stress*/,
224 : Real & /*returned_intnl*/,
225 : std::vector<Real> & /*dpm*/,
226 : RankTwoTensor & /*delta_dp*/,
227 : std::vector<Real> & yf,
228 : bool & trial_stress_inadmissible) const
229 : {
230 207800 : trial_stress_inadmissible = false;
231 207800 : yieldFunctionV(trial_stress, intnl_old, yf);
232 :
233 481552 : for (unsigned sf = 0; sf < numberSurfaces(); ++sf)
234 273752 : if (yf[sf] > _f_tol)
235 150184 : trial_stress_inadmissible = true;
236 :
237 : // example of checking Kuhn-Tucker
238 207800 : std::vector<Real> dpm(numberSurfaces(), 0);
239 329272 : for (unsigned sf = 0; sf < numberSurfaces(); ++sf)
240 260504 : if (!KuhnTuckerSingleSurface(yf[sf], dpm[sf], 0))
241 : return false;
242 : return true;
243 : }
244 :
245 : bool
246 312520 : TensorMechanicsPlasticModel::KuhnTuckerSingleSurface(Real yf, Real dpm, Real dpm_tol) const
247 : {
248 312520 : return (dpm == 0 && yf <= _f_tol) || (dpm > -dpm_tol && yf <= _f_tol && yf >= -_f_tol);
249 : }
250 :
251 : RankFourTensor
252 0 : TensorMechanicsPlasticModel::consistentTangentOperator(
253 : const RankTwoTensor & /*trial_stress*/,
254 : Real /*intnl_old*/,
255 : const RankTwoTensor & /*stress*/,
256 : Real /*intnl*/,
257 : const RankFourTensor & E_ijkl,
258 : const std::vector<Real> & /*cumulative_pm*/) const
259 : {
260 0 : return E_ijkl;
261 : }
|