40 #ifndef GETFEM_PLASTICITY_H__
41 #define GETFEM_PLASTICITY_H__
51 enum plasticity_unknowns_type {
52 DISPLACEMENT_ONLY = 0,
53 DISPLACEMENT_AND_PLASTIC_MULTIPLIER = 1,
54 DISPLACEMENT_AND_PRESSURE = 2,
55 DISPLACEMENT_AND_PLASTIC_MULTIPLIER_AND_PRESSURE = 3
136 (model &md,
const mesh_im &mim,
137 std::string lawname, plasticity_unknowns_type unknowns_type,
138 const std::vector<std::string> &varnames,
139 const std::vector<std::string> ¶ms,
154 (model &md,
const mesh_im &mim,
155 std::string lawname, plasticity_unknowns_type unknowns_type,
156 const std::vector<std::string> &varnames,
157 const std::vector<std::string> ¶ms,
168 (model &md,
const mesh_im &mim,
169 std::string lawname, plasticity_unknowns_type unknowns_type,
170 const std::vector<std::string> &varnames,
171 const std::vector<std::string> ¶ms,
172 const mesh_fem &mf_vm, model_real_plain_vector &VM,
193 virtual void do_projection(
const base_matrix& tau,
194 scalar_type stress_threshold,
198 flag_hyp(flag_hyp_) {}
202 typedef std::shared_ptr<const abstract_constraints_projection>
203 pconstraints_projection;
214 template<
typename MAT>
215 void tau_m_Id(
const MAT& tau, MAT &taumid)
const {
216 scalar_type trace = gmm::mat_trace(tau);
217 size_type size_of_tau = gmm::mat_nrows(tau);
218 gmm::copy(gmm::identity_matrix(),taumid);
219 gmm::scale(taumid, trace / scalar_type(size_of_tau));
223 template<
typename MAT>
224 void tau_d(
const MAT& tau, MAT &taud)
const {
226 gmm::scale(taud, scalar_type(-1));
236 scalar_type stress_threshold,
241 GMM_ASSERT1(flag_proj == 0 || flag_proj ==1,
242 "wrong value for the projection flag, "
246 GMM_ASSERT1(stress_threshold>=0.,
"s is not a positive number "
247 << stress_threshold <<
". You need to set "
248 <<
"s as a positive number");
251 size_type projsize = (flag_proj == 0) ? N : gmm::sqr(N);
252 scalar_type normtaud;
255 base_matrix taumId(N, N);
256 tau_m_Id(tau, taumId);
259 base_matrix taud(N,N);
260 gmm::add(gmm::scaled(taumId, scalar_type(-1)), tau, taud);
265 GMM_ASSERT1(!N,
"wrong value for CALCULATION HYPOTHESIS, "
266 "must be /=1 SINCE n/=2");
269 base_matrix tau_aux(3,3); gmm::clear(tau_aux);
270 gmm::copy(tau,gmm::sub_matrix
271 (tau_aux,gmm::sub_interval(0,2)));
273 base_matrix taud_aux(3,3);
274 tau_d(tau_aux, taud_aux);
275 normtaud=gmm::mat_euclidean_norm(taud_aux);
277 else normtaud=gmm::mat_euclidean_norm(taud);
282 gmm::resize(proj, projsize, projsize);
284 if (normtaud <= stress_threshold) {
286 case 0: gmm::copy(tau, proj);
break;
287 case 1: gmm::copy(gmm::identity_matrix(), proj);
break;
293 gmm::copy(gmm::scaled(taud, stress_threshold/normtaud),
295 gmm::add(taumId,proj);
298 base_matrix Igrad(projsize, projsize);
299 gmm::copy(gmm::identity_matrix(),Igrad);
300 base_matrix Igrad2(projsize, projsize);
304 base_vector aux(projsize);
306 aux[i*N + i] = scalar_type(1);
310 gmm::copy(aux, gmm::mat_col(Igrad2, i*N + i));
313 base_matrix Id_grad(projsize, projsize);
314 scalar_type rr = scalar_type(1)/scalar_type(N);
315 gmm::copy(gmm::scaled(Igrad2, -rr), Id_grad);
316 gmm::add(Igrad, Id_grad);
320 base_matrix ngrad2(projsize, projsize);
322 base_matrix un(N, N);
323 gmm::copy(gmm::scaled(taud, 1./normtaud),un);
327 std::copy(un.begin(), un.end(), aux.begin());
331 gmm::copy(gmm::scaled(aux,aux[j]),
332 gmm::mat_col(ngrad2,j));
336 gmm::copy(gmm::identity_matrix(), proj);
337 gmm::add(gmm::scaled(ngrad2, scalar_type(-1)), proj);
338 base_matrix aux2(projsize, projsize);
339 gmm::copy(gmm::scaled(proj, stress_threshold/normtaud),
341 gmm::mult(aux2,Id_grad,proj);
342 gmm::add(gmm::scaled(Igrad2, rr),proj);
364 (
const std::string &name, scalar_type sigma_y0, scalar_type H,
bool frobenius=
true);
374 (
const std::string &name,
375 scalar_type sigma_ref, scalar_type eps_ref, scalar_type n,
376 bool frobenius=
false);
386 (
const std::string &name, scalar_type sigma_ref, scalar_type E,
387 scalar_type alpha, scalar_type n,
bool frobenius=
false) {
389 (name, sigma_ref, alpha*sigma_ref/E, n, frobenius);
425 (model &md,
const mesh_im &mim,
426 std::string lawname, plasticity_unknowns_type unknowns_type,
427 const std::vector<std::string> &varnames,
428 const std::vector<std::string> ¶ms,
442 (model &md,
const mesh_im &mim,
443 std::string lawname, plasticity_unknowns_type unknowns_type,
444 const std::vector<std::string> &varnames,
445 const std::vector<std::string> ¶ms,
454 (model &md,
const mesh_im &mim,
455 std::string lawname, plasticity_unknowns_type unknowns_type,
456 const std::vector<std::string> &varnames,
457 const std::vector<std::string> ¶ms,
458 const mesh_fem &mf_vm, model_real_plain_vector &VM,
496 const pconstraints_projection &ACP,
497 const std::string &varname,
498 const std::string &previous_dep_name,
499 const std::string &datalambda,
500 const std::string &datamu,
501 const std::string &datathreshold,
502 const std::string &datasigma,
519 const std::string &varname,
520 const std::string &previous_dep_name,
521 const pconstraints_projection &ACP,
522 const std::string &datalambda,
523 const std::string &datamu,
524 const std::string &datathreshold,
525 const std::string &datasigma);
535 const std::string &datasigma,
536 const mesh_fem &mf_vm,
537 model_real_plain_vector &VM,
547 const mesh_fem &mf_pl,
548 const std::string &varname,
549 const std::string &previous_dep_name,
550 const pconstraints_projection &ACP,
551 const std::string &datalambda,
552 const std::string &datamu,
553 const std::string &datathreshold,
554 const std::string &datasigma,
555 model_real_plain_vector &plast);