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 : // Plastic Model base class.
11 : //
12 : #include "SolidMechanicsPlasticModel.h"
13 : #include "RankFourTensor.h"
14 :
15 : InputParameters
16 3560 : SolidMechanicsPlasticModel::validParams()
17 : {
18 3560 : InputParameters params = GeneralUserObject::validParams();
19 7120 : 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 7120 : 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 3560 : params.addClassDescription(
28 : "Plastic Model base class. Override the virtual functions in your class");
29 3560 : return params;
30 0 : }
31 :
32 1786 : SolidMechanicsPlasticModel::SolidMechanicsPlasticModel(const InputParameters & parameters)
33 : : GeneralUserObject(parameters),
34 1786 : _f_tol(getParam<Real>("yield_function_tolerance")),
35 5358 : _ic_tol(getParam<Real>("internal_constraint_tolerance"))
36 : {
37 1786 : }
38 :
39 : void
40 12672 : SolidMechanicsPlasticModel::initialize()
41 : {
42 12672 : }
43 :
44 : void
45 12672 : SolidMechanicsPlasticModel::execute()
46 : {
47 12672 : }
48 :
49 : void
50 12672 : SolidMechanicsPlasticModel::finalize()
51 : {
52 12672 : }
53 :
54 : unsigned
55 91423844 : SolidMechanicsPlasticModel::numberSurfaces() const
56 : {
57 91423844 : return 1;
58 : }
59 :
60 : Real
61 0 : SolidMechanicsPlasticModel::yieldFunction(const RankTwoTensor & /*stress*/, Real /*intnl*/) const
62 : {
63 0 : return 0.0;
64 : }
65 :
66 : void
67 2287420 : SolidMechanicsPlasticModel::yieldFunctionV(const RankTwoTensor & stress,
68 : Real intnl,
69 : std::vector<Real> & f) const
70 : {
71 2287420 : f.assign(1, yieldFunction(stress, intnl));
72 2287420 : }
73 :
74 : RankTwoTensor
75 0 : SolidMechanicsPlasticModel::dyieldFunction_dstress(const RankTwoTensor & /*stress*/,
76 : Real /*intnl*/) const
77 : {
78 0 : return RankTwoTensor();
79 : }
80 :
81 : void
82 861076 : SolidMechanicsPlasticModel::dyieldFunction_dstressV(const RankTwoTensor & stress,
83 : Real intnl,
84 : std::vector<RankTwoTensor> & df_dstress) const
85 : {
86 861076 : df_dstress.assign(1, dyieldFunction_dstress(stress, intnl));
87 861076 : }
88 :
89 : Real
90 0 : SolidMechanicsPlasticModel::dyieldFunction_dintnl(const RankTwoTensor & /*stress*/,
91 : Real /*intnl*/) const
92 : {
93 0 : return 0.0;
94 : }
95 : void
96 762752 : SolidMechanicsPlasticModel::dyieldFunction_dintnlV(const RankTwoTensor & stress,
97 : Real intnl,
98 : std::vector<Real> & df_dintnl) const
99 : {
100 762752 : return df_dintnl.assign(1, dyieldFunction_dintnl(stress, intnl));
101 : }
102 :
103 : RankTwoTensor
104 0 : SolidMechanicsPlasticModel::flowPotential(const RankTwoTensor & /*stress*/, Real /*intnl*/) const
105 : {
106 0 : return RankTwoTensor();
107 : }
108 : void
109 2479108 : SolidMechanicsPlasticModel::flowPotentialV(const RankTwoTensor & stress,
110 : Real intnl,
111 : std::vector<RankTwoTensor> & r) const
112 : {
113 2479108 : return r.assign(1, flowPotential(stress, intnl));
114 : }
115 :
116 : RankFourTensor
117 0 : SolidMechanicsPlasticModel::dflowPotential_dstress(const RankTwoTensor & /*stress*/,
118 : Real /*intnl*/) const
119 : {
120 0 : return RankFourTensor();
121 : }
122 : void
123 824020 : SolidMechanicsPlasticModel::dflowPotential_dstressV(const RankTwoTensor & stress,
124 : Real intnl,
125 : std::vector<RankFourTensor> & dr_dstress) const
126 : {
127 824020 : return dr_dstress.assign(1, dflowPotential_dstress(stress, intnl));
128 : }
129 :
130 : RankTwoTensor
131 0 : SolidMechanicsPlasticModel::dflowPotential_dintnl(const RankTwoTensor & /*stress*/,
132 : Real /*intnl*/) const
133 : {
134 0 : return RankTwoTensor();
135 : }
136 : void
137 824020 : SolidMechanicsPlasticModel::dflowPotential_dintnlV(const RankTwoTensor & stress,
138 : Real intnl,
139 : std::vector<RankTwoTensor> & dr_dintnl) const
140 : {
141 824020 : return dr_dintnl.assign(1, dflowPotential_dintnl(stress, intnl));
142 : }
143 :
144 : Real
145 2551556 : SolidMechanicsPlasticModel::hardPotential(const RankTwoTensor & /*stress*/, Real /*intnl*/) const
146 : {
147 2551556 : return -1.0;
148 : }
149 : void
150 2602052 : SolidMechanicsPlasticModel::hardPotentialV(const RankTwoTensor & stress,
151 : Real intnl,
152 : std::vector<Real> & h) const
153 : {
154 2602052 : h.assign(numberSurfaces(), hardPotential(stress, intnl));
155 2602052 : }
156 :
157 : RankTwoTensor
158 711620 : SolidMechanicsPlasticModel::dhardPotential_dstress(const RankTwoTensor & /*stress*/,
159 : Real /*intnl*/) const
160 : {
161 711620 : return RankTwoTensor();
162 : }
163 : void
164 724772 : SolidMechanicsPlasticModel::dhardPotential_dstressV(const RankTwoTensor & stress,
165 : Real intnl,
166 : std::vector<RankTwoTensor> & dh_dstress) const
167 : {
168 724772 : dh_dstress.assign(numberSurfaces(), dhardPotential_dstress(stress, intnl));
169 724772 : }
170 :
171 : Real
172 711620 : SolidMechanicsPlasticModel::dhardPotential_dintnl(const RankTwoTensor & /*stress*/,
173 : Real /*intnl*/) const
174 : {
175 711620 : return 0.0;
176 : }
177 : void
178 724772 : SolidMechanicsPlasticModel::dhardPotential_dintnlV(const RankTwoTensor & stress,
179 : Real intnl,
180 : std::vector<Real> & dh_dintnl) const
181 : {
182 724772 : dh_dintnl.resize(numberSurfaces(), dhardPotential_dintnl(stress, intnl));
183 724772 : }
184 :
185 : void
186 128336 : SolidMechanicsPlasticModel::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 128336 : act.resize(numberSurfaces());
196 256672 : for (unsigned surface = 0; surface < numberSurfaces(); ++surface)
197 128336 : act[surface] = (f[surface] > _f_tol);
198 128336 : }
199 :
200 : std::string
201 0 : SolidMechanicsPlasticModel::modelName() const
202 : {
203 0 : return "None";
204 : }
205 :
206 : bool
207 0 : SolidMechanicsPlasticModel::useCustomReturnMap() const
208 : {
209 0 : return false;
210 : }
211 :
212 : bool
213 9056 : SolidMechanicsPlasticModel::useCustomCTO() const
214 : {
215 9056 : return false;
216 : }
217 :
218 : bool
219 315024 : SolidMechanicsPlasticModel::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 315024 : trial_stress_inadmissible = false;
231 315024 : yieldFunctionV(trial_stress, intnl_old, yf);
232 :
233 705952 : for (unsigned sf = 0; sf < numberSurfaces(); ++sf)
234 390928 : if (yf[sf] > _f_tol)
235 299216 : trial_stress_inadmissible = true;
236 :
237 : // example of checking Kuhn-Tucker
238 315024 : std::vector<Real> dpm(numberSurfaces(), 0);
239 402544 : for (unsigned sf = 0; sf < numberSurfaces(); ++sf)
240 364432 : if (!KuhnTuckerSingleSurface(yf[sf], dpm[sf], 0))
241 : return false;
242 : return true;
243 : }
244 :
245 : bool
246 467120 : SolidMechanicsPlasticModel::KuhnTuckerSingleSurface(Real yf, Real dpm, Real dpm_tol) const
247 : {
248 467120 : return (dpm == 0 && yf <= _f_tol) || (dpm > -dpm_tol && yf <= _f_tol && yf >= -_f_tol);
249 : }
250 :
251 : RankFourTensor
252 0 : SolidMechanicsPlasticModel::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 : }
|