deal.II version 9.8.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
ALE_Finite_Strain_Plasticity.h
Go to the documentation of this file.
1
171 *  
172 *   #ifndef BODYFORCEAPPLIER_H_
173 *   #define BODYFORCEAPPLIER_H_
174 *  
175 *   namespace PlasticityLab {
176 *  
177 *   template <int dim, typename Number = double>
178 *   class BodyForceApplier {
179 *   public:
180 *   BodyForceApplier();
181 *   BodyForceApplier(int direction, Number bodyForceMagnitude = 0);
182 *   virtual ~BodyForceApplier();
183 *   inline Number apply(const unsigned int direction,
184 *   const Number shapeFunctionValue,
185 *   const Number JxW) const;
186 *   private:
187 *   const unsigned int direction;
188 *   const Number bodyForceMagnitude;
189 *   };
190 *  
191 *  
192 *   template <int dim, typename Number>
193 *   BodyForceApplier<dim, Number>::
194 *   BodyForceApplier(int direction, Number bodyForceMagnitude)
195 *   : direction(direction), bodyForceMagnitude(bodyForceMagnitude) {
196 *   }
197 *  
198 *  
199 *   template <int dim, typename Number>
200 *   BodyForceApplier<dim, Number>::~BodyForceApplier() {
201 *   }
202 *  
203 *   template <int dim, typename Number>
204 *   Number BodyForceApplier<dim, Number>::
205 *   apply(const unsigned int direction,
206 *   const Number shapeFunctionValue,
207 *   const Number JxW) const {
208 *   if (this->direction == direction)
209 *   return -shapeFunctionValue * this->bodyForceMagnitude * JxW;
210 *   return 0.0;
211 *   }
212 *  
213 *   } /* namespace PlasticityLab */
214 *  
215 *   #endif /* BODYFORCEAPPLIER_H_ */
216 * @endcode
217
218
219<a name="ann-src/BoundaryUnidirectionalPenaltySpec.h"></a>
220<h1>Annotated version of src/BoundaryUnidirectionalPenaltySpec.h</h1>
221 *
222 *
223 *
224 *
225 * @code
226 *   /*
227 *   * BoundaryUnidirectionalPenaltySpec.h
228 *   *
229 *   * Created on: 04 May 2021
230 *   * Author: maien
231 *   */
232 *  
233 *   #ifndef BOUNDARYUNIDIRECTIONALPENALTYSPEC_H_
234 *   #define BOUNDARYUNIDIRECTIONALPENALTYSPEC_H_
235 *  
236 *   namespace PlasticityLab {
237 *  
238 *   template<typename Number = double>
239 *   class BoundaryUnidirectionalPenaltySpec {
240 *   public:
241 *   BoundaryUnidirectionalPenaltySpec(
242 *   unsigned int boundary_id,
243 *   Number reference_displacement_increment,
244 *   Number residual_force,
245 *   Number quadratic_spring_factor) :
247 *   reference_displacement_increment(reference_displacement_increment),
248 *   residual_force(residual_force),
249 *   quadratic_spring_factor(quadratic_spring_factor) {}
250 *  
251 *   unsigned int get_boundary_id() const { return boundary_id; }
252 *   Number get_reference_displacement_increment() const { return reference_displacement_increment; }
253 *   Number get_residual_force() const { return residual_force; }
254 *   Number get_quadratic_spring_factor() const { return quadratic_spring_factor; }
255 *  
256 *   private:
257 *   const unsigned int boundary_id;
258 *   const Number reference_displacement_increment;
259 *   const Number residual_force;
260 *   const Number quadratic_spring_factor;
261 *   };
262 *  
263 *   } /* namespace PlasticityLab */
264 *  
265 *   #endif /* BOUNDARYUNIDIRECTIONALPENALTYSPEC_H_ */
266 * @endcode
267
268
269<a name="ann-src/Constants.h"></a>
270<h1>Annotated version of src/Constants.h</h1>
271 *
272 *
273 *
274 *
275 * @code
276 *   /*
277 *   * Constants.h
278 *   *
279 *   * Created on: 10 Feb 2015
280 *   * Author: maien
281 *   */
282 *  
283 *   #ifndef CONSTANTS_H_
284 *   #define CONSTANTS_H_
285 *  
286 *   namespace PlasticityLab {
287 *  
288 *  
289 *   template <int dim, typename Number>
290 *   class Constants {
291 *   public:
292 *   inline static const Number one_third() {
293 *   return static_cast<Number>(0.33333333333333333333333333333333333333333333333333);
294 *   }
295 *  
296 *   inline static const Number sqrt2thirds() {
297 *   return static_cast<Number>(0.81649658092772603273242802490196379732198249355222);
298 *   }
299 *  
300 *   inline static const Number two_thirds() {
301 *   return static_cast<Number>(0.66666666666666666666666666666666666666666666666666);
302 *   }
303 *  
304 *   inline static const Number sqrt_half() {
305 *   return static_cast<Number>(0.70710678118654752440084436210484903928483593768847);
306 *   }
307 *  
308 *   inline static const Number sqrt_2() {
309 *   return static_cast<Number>(1.41421356237309504880168872420969807856967187537694);
310 *   }
311 *  
312 *  
313 *   inline static const Number one_over_dim() {
314 *   if(3==dim)
315 *   return static_cast<Number>(0.33333333333333333333333333333333333333333333333333);
316 *   else if (2==dim)
317 *   return static_cast<Number>(0.5);
318 *   else
319 *   return static_cast<Number>(1./static_cast<Number>(dim));
320 *   }
321 *  
322 *   inline static const Number two_over_dim() {
323 *   if(3==dim)
324 *   return static_cast<Number>(0.66666666666666666666666666666666666666666666666666);
325 *   else if (2==dim)
326 *   return static_cast<Number>(1.0);
327 *   else
328 *   return static_cast<Number>(2./static_cast<Number>(dim));
329 *   }
330 *  
331 *   };
332 *  
333 *   inline void get_generalized_alpha_method_params(
334 *   double *alpha_m,
335 *   double *alpha_f,
336 *   double *gamma,
337 *   double *beta,
338 *   double rho_infty
339 *   ) {
340 *   *alpha_m = (2. * rho_infty - 1.)/(rho_infty + 1.);
341 *   *alpha_f = rho_infty / (rho_infty + 1.);
342 *   *gamma = 0.5 - *alpha_m + *alpha_f;
343 *   *beta = 0.25 * (1. - *alpha_m + *alpha_f) * (1. - *alpha_m + *alpha_f);
344 *   }
345 *  
346 *   } /* namespace PlasticityLab */
347 *  
348 *   #endif /* CONSTANTS_H_ */
349 * @endcode
350
351
352<a name="ann-src/ConstitModelUpdateFlags.h"></a>
353<h1>Annotated version of src/ConstitModelUpdateFlags.h</h1>
354 *
355 *
356 *
357 *
358 * @code
359 *   /*
360 *   * ConstitModelUpdateFlags.h
361 *   *
362 *   * Created on: 04 Jan 2015
363 *   * Author: maien
364 *   */
365 *  
366 *   #ifndef CONSTITMODELUPDATEFLAGS_H_
367 *   #define CONSTITMODELUPDATEFLAGS_H_
368 *  
369 *   namespace PlasticityLab {
370 *  
371 *   enum ConstitutiveModelUpdateFlags {
372 *   update_default = 0x0000,
373 *   update_pressure = 0x0001,
374 *   update_pressure_tangent = 0x0002,
375 *   update_stress_deviator = 0x0004,
376 *   update_stress_deviator_tangent = 0x0008,
377 *   update_heat_flux = 0x0010,
378 *   update_heat_flux_tangent = 0x0020,
379 *   update_elastic_entropy = 0x0040,
380 *   update_elastic_entropy_tangent = 0x0080,
381 *   update_mechanical_dissipation = 0x0100,
382 *   update_mechanical_dissipation_tangent = 0x0200,
383 *   update_thermoelastic_heating = 0x0400,
384 *   update_thermoelastic_heating_tangent = 0x0800,
385 *   update_stored_heat = 0x1000,
386 *   update_stored_heat_tangent = 0x2000,
387 *   update_material_point_history = 0x4000
388 *   };
389 *  
390 *   inline
391 *   ConstitutiveModelUpdateFlags
392 *   operator | (ConstitutiveModelUpdateFlags f1, ConstitutiveModelUpdateFlags f2) {
393 *   return static_cast<ConstitutiveModelUpdateFlags> (
394 *   static_cast<unsigned int> (f1) |
395 *   static_cast<unsigned int> (f2));
396 *   }
397 *  
398 *   inline
399 *   const ConstitutiveModelUpdateFlags &
400 *   operator |= (ConstitutiveModelUpdateFlags &f1, ConstitutiveModelUpdateFlags f2) {
401 *   f1 = f1 | f2;
402 *   return f1;
403 *   }
404 *  
405 *   inline
406 *   ConstitutiveModelUpdateFlags
407 *   operator & (ConstitutiveModelUpdateFlags f1, ConstitutiveModelUpdateFlags f2) {
408 *   return static_cast<ConstitutiveModelUpdateFlags> (
409 *   static_cast<unsigned int> (f1) &
410 *   static_cast<unsigned int> (f2));
411 *   }
412 *  
413 *   inline
414 *   const ConstitutiveModelUpdateFlags &
415 *   operator &= (ConstitutiveModelUpdateFlags &f1, ConstitutiveModelUpdateFlags f2) {
416 *   f1 = f1 & f2;
417 *   return f1;
418 *   }
419 *  
420 *   } /* namespace PlasticityLab */
421 *  
422 *   #endif /*CONSTITMODELUPDATEFLAGS_H_*/
423 * @endcode
424
425
426<a name="ann-src/ConstitutiveModelRequest.h"></a>
427<h1>Annotated version of src/ConstitutiveModelRequest.h</h1>
428 *
429 *
430 *
431 *
432 * @code
433 *   /*
434 *   * ConstitutiveModelRequest.h
435 *   *
436 *   * Created on: 03 Feb 2015
437 *   * Author: maien
438 *   */
439 *  
440 *   #ifndef CONSTITUTIVEMODELREQUEST_H_
441 *   #define CONSTITUTIVEMODELREQUEST_H_
442 *  
443 *   #include <deal.II/base/tensor.h>
444 *   #include <deal.II/base/symmetric_tensor.h>
445 *  
446 *   #include "Constants.h"
447 *   #include "ConstitModelUpdateFlags.h"
448 *   #include "TensorUtilities.h"
449 *  
450 *   namespace PlasticityLab {
451 *  
452 *   template <int dim, typename Number>
453 *   class ConstitutiveModelRequest {
454 *   public:
455 *   ConstitutiveModelRequest(ConstitutiveModelUpdateFlags);
456 *   virtual ~ConstitutiveModelRequest();
457 *  
458 * @endcode
459 *
460 * Interface to be used by request client (FE system assembler)
461 * --request configuration stage--
462 *
463 * @code
464 *   void set_deformation_gradient(const Tensor<2, dim, Number> &deformation_gradient);
465 *   void set_deformation_Jacobian(const Number deformation_Jacobian);
466 *   void set_unprojected_deformation_Jacobian(const Number unprojected_deformation_Jacobian);
467 *   void set_previous_deformation_Jacobian(const Number previous_deformation_Jacobian);
468 *   void set_deformation_Jacobian_time_rate(const Number deformation_Jacobian_time_rate);
469 *   void set_temperature(const Number temperature);
470 *   void set_previous_temperature(const Number previous_temperature);
471 *   void set_temperature_time_rate(const Number temperature_time_rate);
472 *   void set_thermal_gradient(const Tensor<1, dim, Number> &thermalGradient);
473 *   void set_time_increment(const Number timeIncrement);
474 *  
475 * @endcode
476 *
477 * Interface to be used by request client (FE system assembler)
478 * --request response retrieval and interrogation stage--
479 *
480 * @code
481 *   Number get_pressure();
482 *   Number get_pressure_tangent(const Number volume_change_increment);
483 *   SymmetricTensor<2, dim, Number> get_stress_deviator() const;
484 *   SymmetricTensor<2, dim, Number> get_stress_deviator_tangent(const Tensor<2, dim, Number> &strain_increment) const;
485 *   Tensor<1, dim, Number> get_heat_flux() const;
486 *   Tensor<1, dim, Number> get_heat_flux_tangent(const Tensor<1, dim, Number> &thermal_gradient_increment) const;
487 *   Number get_stored_heat_rate() const;
488 *   Number get_stored_heat_rate_tangent(const Number temperature_increment) const;
489 *   Number get_elastic_entropy() const;
490 *   bool get_is_plastic() const;
491 *   Number get_elastic_entropy_tangent(const Number temperature_increment) const;
492 *   Number get_mechanical_dissipation() const;
493 *   Number get_mechanical_dissipation_tangent(const Number temperature_increment) const;
494 *   Number get_thermo_elastic_heating() const;
495 *   Number get_thermo_elastic_heating_tangent(const Number temperature_increment) const;
496 *  
497 * @endcode
498 *
499 * interface used by constitutive model object to perform computation
500 * TODO consider hiding this interface and exposing it through adapter
501 *
502 * @code
503 *   ConstitutiveModelUpdateFlags get_update_flags() const;
504 *   Tensor<2, dim, Number> get_deformation_gradient() const;
505 *   Number get_deformation_Jacobian() const;
506 *   Number get_unprojected_deformation_Jacobian() const;
507 *   Number get_previous_deformation_Jacobian() const;
508 *   Number get_deformation_Jacobian_time_rate() const;
509 *   Number get_temperature() const;
510 *   Number get_previous_temperature() const;
511 *   Number get_temperature_time_rate() const;
512 *   Tensor<1, dim, Number> get_thermal_gradient() const;
513 *   Number get_time_increment() const;
514 *  
515 *   void set_pressure(Number pressure);
516 *   void set_stress_deviator(const SymmetricTensor<2, dim, Number> &stress_deviator);
517 *   void set_heat_flux(const Tensor<1, dim, Number> &heat_flux);
518 *   void set_stored_heat_rate(const Number stored_heat_rate);
519 *   void set_elastic_entropy(const Number elastic_entropy);
520 *   void set_mechanical_dissipation(const Number mechanical_dissipation);
521 *   void set_thermo_elastic_heating(const Number thermo_elastic_heating);
522 *  
523 * @endcode
524 *
525 * TODO this can be changed so that smaller objects can be set and used
526 * to construct the tangents than the full moduli tensors
527 *
528 * @code
529 *   void set_pressure_tangent_modulus(const Number pressure_tangent_modulus);
530 *   void set_b_e_bar(const SymmetricTensor<2, dim, Number> &b_e_bar);
531 *   void set_mu(const Number mu);
532 *   void set_is_plastic(const bool is_plastic);
533 *   void set_delta_gamma(const Number delta_gamma);
534 *   void set_dK(const Number dK);
535 *   void set_dH(const Number dH);
536 *   void set_heat_flux_tangent_moduli(const SymmetricTensor<2, dim, Number> &heat_flux_tangent_modului);
537 *   void set_stored_heat_rate_tangent_modulus(const Number stored_heat_rate_tangent_modulus);
538 *   void set_elastic_entropy_tangent_modulus(const Number elastic_entropy_tangent_modulus);
539 *   void set_mechanical_dissipation_tangent_modulus(const Number mechanicalDissipationTangentModulus);
540 *   void set_thermo_elastic_heating_tangent_modulus(const Number thermo_elastic_heating_tangent_modulus);
541 *  
542 *   protected:
543 *   ConstitutiveModelUpdateFlags update_flags;
544 *  
545 *   Tensor<2, dim, Number> deformation_gradient;
546 *   Number deformation_Jacobian, previous_deformation_Jacobian, deformation_Jacobian_time_rate;
547 *   Number unprojected_deformation_Jacobian;
548 *   Number temperature, previous_temperature, temperature_time_rate;
549 *   Tensor<1, dim, Number> thermal_gradient;
550 *  
551 *   Number pressure;
552 *   SymmetricTensor<2, dim, Number> stress_deviator;
553 *   Tensor<1, dim, Number> heat_flux;
554 *   Number stored_heat_rate;
555 *   Number elastic_entropy;
556 *   Number mechanical_dissipation;
557 *   Number thermo_elastic_heating;
558 *  
560 *  
561 *   bool is_plastic;
562 *   Number pressure_tangent_modulus;
563 *   Number dK, dH, mu, delta_gamma;
564 *   SymmetricTensor<2, dim, Number> b_e_bar;
565 *   SymmetricTensor<2, dim, Number> heat_flux_tangent_moduli;
566 *   Number stored_heat_rate_tangent_modulus;
567 *   Number elastic_entropy_tangent_modulus;
568 *   Number mechanical_dissipation_tangent_modulus;
569 *   Number thermo_elastic_heating_tangent_modulus;
570 *   };
571 *  
572 *   template <int dim, typename Number>
573 *   ConstitutiveModelRequest<dim, Number>::
574 *   ConstitutiveModelRequest(ConstitutiveModelUpdateFlags update_flags):
575 *   update_flags(update_flags) {
576 *   is_plastic = true; // not necessarily elastic
577 *   }
578 *  
579 *   template <int dim, typename Number>
580 *   bool ConstitutiveModelRequest<dim, Number>::get_is_plastic() const {
581 *   return is_plastic;
582 *   }
583 *  
584 *   template <int dim, typename Number>
585 *   ConstitutiveModelRequest<dim, Number>::~ConstitutiveModelRequest() { }
586 *  
587 *   template <int dim, typename Number>
588 *   void ConstitutiveModelRequest<dim, Number>::
589 *   set_deformation_gradient(const Tensor<2, dim, Number> &deformation_gradient) {
590 *   this->deformation_gradient = deformation_gradient;
591 *   }
592 *  
593 *   template <int dim, typename Number>
594 *   void ConstitutiveModelRequest<dim, Number>::
595 *   set_deformation_Jacobian(Number deformation_Jacobian) {
596 *   this->deformation_Jacobian = deformation_Jacobian;
597 *   }
598 *  
599 *   template <int dim, typename Number>
600 *   void ConstitutiveModelRequest<dim, Number>::
601 *   set_unprojected_deformation_Jacobian(Number unprojected_deformation_Jacobian) {
602 *   this->unprojected_deformation_Jacobian = unprojected_deformation_Jacobian;
603 *   }
604 *  
605 *   template <int dim, typename Number>
606 *   void ConstitutiveModelRequest<dim, Number>::
607 *   set_previous_deformation_Jacobian(Number previous_deformation_Jacobian) {
608 *   this->previous_deformation_Jacobian = previous_deformation_Jacobian;
609 *   }
610 *  
611 *   template <int dim, typename Number>
612 *   void ConstitutiveModelRequest<dim, Number>::
613 *   set_deformation_Jacobian_time_rate(Number deformation_Jacobian_time_rate) {
614 *   this->deformation_Jacobian_time_rate = deformation_Jacobian_time_rate;
615 *   }
616 *  
617 *   template <int dim, typename Number>
618 *   void ConstitutiveModelRequest<dim, Number>::
619 *   set_temperature(const Number temperature) {
620 *   this->temperature = temperature;
621 *   }
622 *  
623 *   template <int dim, typename Number>
624 *   void ConstitutiveModelRequest<dim, Number>::
625 *   set_previous_temperature(const Number previous_temperature) {
626 *   this->previous_temperature = previous_temperature;
627 *   }
628 *  
629 *   template <int dim, typename Number>
630 *   void ConstitutiveModelRequest<dim, Number>::
631 *   set_temperature_time_rate(const Number temperature_time_rate) {
632 *   this->temperature_time_rate = temperature_time_rate;
633 *   }
634 *  
635 *   template <int dim, typename Number>
636 *   void ConstitutiveModelRequest<dim, Number>::
637 *   set_thermal_gradient(const Tensor<1, dim, Number> &thermal_gradient) {
638 *   this->thermal_gradient = thermal_gradient;
639 *   }
640 *  
641 *   template <int dim, typename Number>
642 *   void ConstitutiveModelRequest<dim, Number>::
645 *   }
646 *  
647 *   template <int dim, typename Number>
648 *   Number ConstitutiveModelRequest<dim, Number>::get_pressure() {
649 *   return pressure;
650 *   }
651 *  
652 *   template <int dim, typename Number>
653 *   Number
654 *   ConstitutiveModelRequest<dim, Number>::
655 *   get_pressure_tangent(const Number volume_change_increment) {
656 *   return pressure_tangent_modulus * volume_change_increment;
657 *   }
658 *  
659 *   template <int dim, typename Number>
660 *   SymmetricTensor<2, dim, Number> ConstitutiveModelRequest<dim, Number>::
661 *   get_stress_deviator() const {
662 *   return stress_deviator;
663 *   }
664 *  
665 *   template <int dim, typename Number>
666 *   SymmetricTensor<2, dim, Number> ConstitutiveModelRequest<dim, Number>::
667 *   get_stress_deviator_tangent(const Tensor<2, dim, Number> &strain_increment) const {
668 *   const Number twothirds = Constants<dim, Number>::two_thirds();
669 *   const auto tensor_b_e_bar = static_cast<Tensor<2,dim,Number> >(b_e_bar);
670 *   SymmetricTensor<2, dim, Number> d_b_e_bar = symmetrize(2 * strain_increment * tensor_b_e_bar);
671 *   SymmetricTensor<2, dim, Number> d_dev_b_e_bar = get_log_of_tensor_variation(b_e_bar, d_b_e_bar);
672 *   SymmetricTensor<2, dim, Number> d_trial_stress_dev = mu * d_dev_b_e_bar;
673 *  
674 * @endcode
675 *
676 * TODO ensure that all the debugging tests were removed
677 *
678 * @code
679 *   if (is_plastic) {
680 * @endcode
681 *
682 * Number mu_bar = Constants<dim, Number>::one_third() * mu * trace(b_e_bar);
683 * Number d_mu_bar = Constants<dim, Number>::one_third() * mu * trace(d_b_e_bar);
684 * Number norm_dev_b_e_bar = (deviator(b_e_bar)).norm();
685 * SymmetricTensor<2, dim, Number> dev_b_e_direction = deviator(b_e_bar) / norm_dev_b_e_bar;
686 *
687 * @code
688 *   Number mu_bar = mu;
689 *   Number d_mu_bar = 0;
690 *  
691 *   const auto epsilon_e_bar = get_log_of_tensor(b_e_bar);
692 *   Number norm_dev_b_e_bar = (epsilon_e_bar).norm();
693 *   SymmetricTensor<2, dim, Number> dev_b_e_direction = epsilon_e_bar / norm_dev_b_e_bar;
694 *  
695 *   SymmetricTensor<2, dim, Number> d_dev_b_e_direction =
696 *   (1.0 / norm_dev_b_e_bar) * (d_dev_b_e_bar - dev_b_e_direction * (dev_b_e_direction * d_dev_b_e_bar));
697 *   Number d_delta_gamma = (dev_b_e_direction * d_trial_stress_dev - 2 * d_mu_bar * delta_gamma) / (2 * mu_bar + twothirds * (dK + dH));
698 *  
699 *   return deviator(d_trial_stress_dev
700 *   - ( 2 * mu_bar * delta_gamma * d_dev_b_e_direction
701 *   + 2 * mu_bar * d_delta_gamma * dev_b_e_direction
702 *   + 2 * d_mu_bar * delta_gamma * dev_b_e_direction));
703 *   }
704 *  
705 *   return deviator(d_trial_stress_dev);
706 *   }
707 *  
708 *   template <int dim, typename Number>
709 *   Tensor<1, dim, Number>
710 *   ConstitutiveModelRequest<dim, Number>::get_heat_flux() const {
711 *   return heat_flux;
712 *   }
713 *  
714 *   template <int dim, typename Number>
715 *   Tensor<1, dim, Number>
716 *   ConstitutiveModelRequest<dim, Number>::
717 *   get_heat_flux_tangent(const Tensor<1, dim, Number> &thermal_gradient_increment) const {
718 *   return heat_flux_tangent_moduli * thermal_gradient_increment;
719 *   }
720 *  
721 *   template <int dim, typename Number>
722 *   Number
723 *   ConstitutiveModelRequest<dim, Number>::get_stored_heat_rate() const {
724 *   return stored_heat_rate;
725 *   }
726 *  
727 *   template <int dim, typename Number>
728 *   Number ConstitutiveModelRequest<dim, Number>::
729 *   get_stored_heat_rate_tangent(const Number temperature_increment) const {
730 *   return stored_heat_rate_tangent_modulus * temperature_increment;
731 *   }
732 *  
733 *   template <int dim, typename Number>
734 *   Number ConstitutiveModelRequest<dim, Number>::
735 *   get_elastic_entropy() const {
736 *   return elastic_entropy;
737 *   }
738 *  
739 *   template <int dim, typename Number>
740 *   Number ConstitutiveModelRequest<dim, Number>::
741 *   get_elastic_entropy_tangent(const Number temperature_increment) const {
742 *   return elastic_entropy_tangent_modulus * time_increment;
743 *   }
744 *  
745 *   template <int dim, typename Number>
746 *   Number ConstitutiveModelRequest<dim, Number>::
747 *   get_mechanical_dissipation() const {
748 *   return mechanical_dissipation;
749 *   }
750 *  
751 *   template <int dim, typename Number>
752 *   Number ConstitutiveModelRequest<dim, Number>::
753 *   get_mechanical_dissipation_tangent(const Number temperature_increment) const {
754 *   return mechanical_dissipation_tangent_modulus * temperature_increment;
755 *   }
756 *  
757 *   template <int dim, typename Number>
758 *   Number ConstitutiveModelRequest<dim, Number>::
759 *   get_thermo_elastic_heating() const {
760 *   return thermo_elastic_heating;
761 *   }
762 *  
763 *   template <int dim, typename Number>
764 *   Number ConstitutiveModelRequest<dim, Number>::
765 *   get_thermo_elastic_heating_tangent(const Number temperature_increment) const {
766 *   return thermo_elastic_heating_tangent_modulus * temperature_increment;
767 *   }
768 *  
769 *   template <int dim, typename Number>
770 *   ConstitutiveModelUpdateFlags ConstitutiveModelRequest<dim, Number>::
771 *   get_update_flags() const {
772 *   return update_flags;
773 *   }
774 *  
775 *   template <int dim, typename Number>
776 *   Tensor<2, dim, Number> ConstitutiveModelRequest<dim, Number>::
777 *   get_deformation_gradient() const {
778 *   return deformation_gradient;
779 *   }
780 *  
781 *   template <int dim, typename Number>
782 *   Number ConstitutiveModelRequest<dim, Number>::
783 *   get_deformation_Jacobian() const {
784 *   return deformation_Jacobian;
785 *   }
786 *  
787 *   template <int dim, typename Number>
788 *   Number ConstitutiveModelRequest<dim, Number>::
789 *   get_unprojected_deformation_Jacobian() const {
790 *   return unprojected_deformation_Jacobian;
791 *   }
792 *  
793 *   template <int dim, typename Number>
794 *   Number ConstitutiveModelRequest<dim, Number>::
795 *   get_previous_deformation_Jacobian() const {
796 *   return previous_deformation_Jacobian;
797 *   }
798 *  
799 *   template <int dim, typename Number>
800 *   Number ConstitutiveModelRequest<dim, Number>::
801 *   get_deformation_Jacobian_time_rate() const {
802 *   return deformation_Jacobian_time_rate;
803 *   }
804 *  
805 *   template <int dim, typename Number>
806 *   Number ConstitutiveModelRequest<dim, Number>::
807 *   get_temperature() const {
808 *   return temperature;
809 *   }
810 *  
811 *   template <int dim, typename Number>
812 *   Number ConstitutiveModelRequest<dim, Number>::
813 *   get_previous_temperature() const {
814 *   return previous_temperature;
815 *   }
816 *  
817 *   template <int dim, typename Number>
818 *   Number ConstitutiveModelRequest<dim, Number>::
819 *   get_temperature_time_rate() const {
820 *   return temperature_time_rate;
821 *   }
822 *  
823 *   template <int dim, typename Number>
824 *   Tensor<1, dim, Number> ConstitutiveModelRequest<dim, Number>::
825 *   get_thermal_gradient() const {
826 *   return thermal_gradient;
827 *   }
828 *  
829 *   template <int dim, typename Number>
830 *   Number ConstitutiveModelRequest<dim, Number>::
831 *   get_time_increment() const {
832 *   return time_increment;
833 *   }
834 *  
835 *   template <int dim, typename Number>
836 *   void ConstitutiveModelRequest<dim, Number>::
837 *   set_pressure(Number pressure) {
838 *   this->pressure = pressure;
839 *   }
840 *  
841 *   template <int dim, typename Number>
842 *   void ConstitutiveModelRequest<dim, Number>::
843 *   set_stress_deviator(const SymmetricTensor<2, dim, Number> &stress_deviator) {
844 *   this->stress_deviator = stress_deviator;
845 *   }
846 *  
847 *   template <int dim, typename Number>
848 *   void ConstitutiveModelRequest<dim, Number>::
849 *   set_b_e_bar(const SymmetricTensor<2, dim, Number> &b_e_bar) {
850 *   this->b_e_bar = b_e_bar;
851 *   }
852 *  
853 *   template <int dim, typename Number>
854 *   void ConstitutiveModelRequest<dim, Number>::
855 *   set_mu(const Number mu) {
856 *   this->mu = mu;
857 *   }
858 *  
859 *   template <int dim, typename Number>
860 *   void ConstitutiveModelRequest<dim, Number>::
861 *   set_is_plastic(const bool is_plastic) {
862 *   this->is_plastic = is_plastic;
863 *   }
864 *  
865 *   template <int dim, typename Number>
866 *   void ConstitutiveModelRequest<dim, Number>::
867 *   set_delta_gamma(const Number delta_gamma) {
868 *   this->delta_gamma = delta_gamma;
869 *   }
870 *  
871 *   template <int dim, typename Number>
872 *   void ConstitutiveModelRequest<dim, Number>::
873 *   set_dK(const Number dK) {
874 *   this->dK = dK;
875 *   }
876 *  
877 *   template <int dim, typename Number>
878 *   void ConstitutiveModelRequest<dim, Number>::
879 *   set_dH(const Number dH) {
880 *   this->dH = dH;
881 *   }
882 *  
883 *   template <int dim, typename Number>
884 *   void ConstitutiveModelRequest<dim, Number>::
885 *   set_heat_flux(const Tensor<1, dim, Number> &heat_flux) {
886 *   this->heat_flux = heat_flux;
887 *   }
888 *  
889 *   template <int dim, typename Number>
890 *   void ConstitutiveModelRequest<dim, Number>::
891 *   set_stored_heat_rate(const Number stored_heat_rate) {
892 *   this->stored_heat_rate = stored_heat_rate;
893 *   }
894 *  
895 *   template <int dim, typename Number>
896 *   void ConstitutiveModelRequest<dim, Number>::
897 *   set_elastic_entropy(const Number elastic_entropy) {
898 *   this->elastic_entropy = elastic_entropy;
899 *   }
900 *  
901 *   template <int dim, typename Number>
902 *   void ConstitutiveModelRequest<dim, Number>::
903 *   set_mechanical_dissipation(const Number mechanical_dissipation) {
904 *   this->mechanical_dissipation = mechanical_dissipation;
905 *   }
906 *  
907 *   template <int dim, typename Number>
908 *   void ConstitutiveModelRequest<dim, Number>::
909 *   set_thermo_elastic_heating(const Number thermo_elastic_heating) {
910 *   this->thermo_elastic_heating = thermo_elastic_heating;
911 *   }
912 *  
913 *   template <int dim, typename Number>
914 *   void ConstitutiveModelRequest<dim, Number>::
915 *   set_pressure_tangent_modulus(const Number pressure_tangent_modulus) {
916 *   this->pressure_tangent_modulus = pressure_tangent_modulus;
917 *   }
918 *  
919 *   template <int dim, typename Number>
920 *   void ConstitutiveModelRequest<dim, Number>::
921 *   set_heat_flux_tangent_moduli(const SymmetricTensor<2, dim, Number> &heat_flux_tangent_modului) {
922 *   this->heat_flux_tangent_moduli = heat_flux_tangent_modului;
923 *   }
924 *  
925 *   template <int dim, typename Number>
926 *   void ConstitutiveModelRequest<dim, Number>::
927 *   set_stored_heat_rate_tangent_modulus(const Number stored_heat_rate_tangent_modulus) {
928 *   this->stored_heat_rate_tangent_modulus = stored_heat_rate_tangent_modulus;
929 *   }
930 *  
931 *   template <int dim, typename Number>
932 *   void ConstitutiveModelRequest<dim, Number>::
933 *   set_elastic_entropy_tangent_modulus(const Number elastic_entropy_tangent_modulus) {
934 *   this->elastic_entropy_tangent_modulus = elastic_entropy_tangent_modulus;
935 *   }
936 *  
937 *   template <int dim, typename Number>
938 *   void ConstitutiveModelRequest<dim, Number>::
939 *   set_mechanical_dissipation_tangent_modulus(const Number mechanicalDissipationTangentModulus) {
940 *   this->mechanical_dissipation_tangent_modulus = mechanicalDissipationTangentModulus;
941 *   }
942 *  
943 *   template <int dim, typename Number>
944 *   void ConstitutiveModelRequest<dim, Number>::
945 *   set_thermo_elastic_heating_tangent_modulus(const Number thermo_elastic_heating_tangent_modulus) {
946 *   this->thermo_elastic_heating_tangent_modulus = thermo_elastic_heating_tangent_modulus;
947 *   }
948 *  
949 *   } /* namespace PlasticityLab */
950 *  
951 *   #endif /* CONSTITUTIVEMODELREQUEST_H_ */
952 * @endcode
953
954
955<a name="ann-src/ConvectionBoundaryConditionApplier.h"></a>
956<h1>Annotated version of src/ConvectionBoundaryConditionApplier.h</h1>
957 *
958 *
959 *
960 *
961 * @code
962 *   /*
963 *   * ConvectionBoundaryConditionApplier.h
964 *   *
965 *   * Created on: 07 Oct 2017
966 *   * Author: maien
967 *   */
968 *  
969 *   #ifndef CONVECTIONBOUNDARYCONDITIONAPPLIER_H_
970 *   #define CONVECTIONBOUNDARYCONDITIONAPPLIER_H_
971 *  
972 *   namespace PlasticityLab {
973 *  
974 *   template <int dim, typename Number = double>
975 *   class ConvectionBoundaryConditionApplier {
976 *   public:
977 *   ConvectionBoundaryConditionApplier();
978 *   ConvectionBoundaryConditionApplier(
979 *   int direction,
980 *   Number convection_coefficient = 1.0,
981 *   Number ambient_field_value = 0.0);
982 *   virtual ~ConvectionBoundaryConditionApplier();
983 *   inline Number apply(const unsigned int direction,
984 *   const Number test_function_value,
985 *   const Number field_value,
986 *   const Number JxW) const;
987 *   inline Number apply_gradient(
988 *   const unsigned int direction,
989 *   const Number &test_gradient,
990 *   const Number &field_gradient,
991 *   const Number JxW) const;
992 *   private:
993 *   const unsigned int direction;
995 *   const Number ambient_field_value;
996 *   };
997 *  
998 *  
999 *   template <int dim, typename Number>
1000 *   ConvectionBoundaryConditionApplier<dim, Number>::
1001 *   ConvectionBoundaryConditionApplier(
1002 *   int direction,
1004 *   Number ambient_field_value)
1005 *   : direction(direction),
1007 *   ambient_field_value(ambient_field_value) {
1008 *   }
1009 *  
1010 *  
1011 *   template <int dim, typename Number>
1012 *   ConvectionBoundaryConditionApplier<dim, Number>::~ConvectionBoundaryConditionApplier() {
1013 *   }
1014 *  
1015 *   template <int dim, typename Number>
1016 *   Number ConvectionBoundaryConditionApplier<dim, Number>::
1017 *   apply(const unsigned int direction,
1018 *   const Number test_function_value,
1019 *   const Number field_value,
1020 *   const Number JxW) const {
1021 *   if (this->direction == direction)
1022 *   return test_function_value * convection_coefficient * (field_value - ambient_field_value) * JxW;
1023 *   return 0.0;
1024 *   }
1025 *  
1026 *   template <int dim, typename Number>
1027 *   Number ConvectionBoundaryConditionApplier<dim, Number>::apply_gradient(
1028 *   const unsigned int direction,
1029 *   const Number &test_gradient,
1030 *   const Number &field_gradient,
1031 *   const Number JxW) const {
1032 *   if (this->direction == direction) {
1033 *   return convection_coefficient * (test_gradient * field_gradient) * JxW;
1034 *   }
1035 *   return 0;
1036 *   }
1037 *  
1038 *  
1039 *   } /* namespace PlasticityLab */
1040 *  
1041 *   #endif /* CONVECTIONBOUNDARYCONDITIONAPPLIER_H_ */
1042 * @endcode
1043
1044
1045<a name="ann-src/DoFSystem.h"></a>
1046<h1>Annotated version of src/DoFSystem.h</h1>
1047 *
1048 *
1049 *
1050 *
1051 * @code
1052 *   /*
1053 *   * DoFSystem.h
1054 *   *
1055 *   * Created on: 05 May 2015
1056 *   * Author: maien
1057 *   */
1058 *  
1059 *   #ifndef DOFSYSTEM_H_
1060 *   #define DOFSYSTEM_H_
1061 *  
1062 *   #include <deal.II/dofs/dof_tools.h>
1063 *   #include <deal.II/base/conditional_ostream.h>
1064 *  
1065 *   #include "InterpolatoryConstraintApplier.h"
1066 *   #include "BodyForceApplier.h"
1067 *   #include "ConvectionBoundaryConditionApplier.h"
1068 *   #include "mpi.h"
1069 *   #include "utilities.h"
1070 *  
1071 *   using namespace dealii;
1072 *  
1073 *   namespace PlasticityLab {
1074 *  
1075 *   template <int dim, typename Number=double>
1076 *   class DoFSystem {
1077 *   public:
1078 *   DoFSystem (const ::Triangulation<dim> &triangulation,
1079 *   const ::Mapping<dim> &mapping);
1080 *  
1081 *   DoFHandler<dim> dof_handler;
1082 *  
1083 *   AffineConstraints<Number> nodal_constraints;
1084 *  
1085 *   IndexSet locally_owned_dofs;
1086 *   IndexSet locally_relevant_dofs;
1087 *  
1088 *   void setup_dof_system (const FiniteElement<dim> &fe);
1089 *   const ::Mapping<dim> &mapping;
1090 *  
1091 *   };
1092 *  
1093 *   template<int dim, typename Number>
1094 *   DoFSystem <dim, Number> :: DoFSystem(const ::Triangulation<dim> &triangulation,
1095 *   const ::Mapping<dim> &mapping) :
1096 *   dof_handler(triangulation),
1097 *   mapping(mapping) {
1098 *   }
1099 *  
1100 *   template <int dim, typename Number>
1101 *   void DoFSystem<dim, Number>::setup_dof_system (const FiniteElement<dim> &fe) {
1102 *   dof_handler.distribute_dofs(fe);
1103 *   locally_owned_dofs = dof_handler.locally_owned_dofs();
1104 *   locally_relevant_dofs = DoFTools::extract_locally_relevant_dofs(dof_handler);
1105 *  
1106 *   nodal_constraints.reinit(locally_owned_dofs, locally_relevant_dofs);
1107 *   DoFTools::make_hanging_node_constraints (dof_handler, nodal_constraints);
1108 *   }
1109 *  
1110 *   } /* namespace PlasticityLab */
1111 *  
1112 *   #endif /* DOFSYSTEM_H_ */
1113 * @endcode
1114
1115
1116<a name="ann-src/ExponentialHardeningElastoplasticMaterial.cpp"></a>
1117<h1>Annotated version of src/ExponentialHardeningElastoplasticMaterial.cpp</h1>
1118 *
1119 *
1120 *
1121 *
1122 * @code
1123 *   /*
1124 *   * ExponentialHardeningElastoplasticMaterial.cpp
1125 *   *
1126 *   * Created on: 10 Jul 2014
1127 *   * Author: cerecam
1128 *   */
1129 *  
1130 *  
1131 *   #include <math.h>
1132 *   #include <deal.II/base/symmetric_tensor.h>
1133 *  
1134 *   #include "ExponentialHardeningElastoplasticMaterial.h"
1135 *   #include "utilities.h"
1136 *  
1137 *   namespace PlasticityLab {
1138 *  
1139 *   template <int dim, typename Number>
1140 *   ExponentialHardeningElastoplasticMaterial<dim, Number>::
1141 *   ExponentialHardeningElastoplasticMaterial
1142 *   (const Number kappa,
1143 *   const Number mu,
1144 *   const Number K_0,
1145 *   const Number K_infty,
1146 *   const Number delta,
1147 *   const Number H_bar,
1148 *   const Number beta) :
1149 *   kappa (kappa),
1150 *   mu (mu),
1151 *   K_0(K_0),
1152 *   K_infty(K_infty),
1153 *   delta(delta),
1154 *   H_bar(H_bar),
1155 *   beta(beta),
1156 *  
1157 *   stress_strain_tensor_kappa (kappa
1159 *   unit_symmetric_tensor<dim>())),
1160 *   stress_strain_tensor_mu (2 * mu
1161 *   * (identity_tensor<dim>()
1163 *   unit_symmetric_tensor<dim>()) / 3.0)) {
1164 *  
1165 *   }
1166 *  
1167 *   template <int dim, typename Number>
1168 *   ExponentialHardeningElastoplasticMaterial<dim, Number>::
1169 *   ~ExponentialHardeningElastoplasticMaterial() {
1170 *   }
1171 *  
1172 *   template <int dim, typename Number>
1173 *   std::vector<Number> ExponentialHardeningElastoplasticMaterial<dim, Number>::get_state_parameters(
1174 *   const point_index_t &,
1175 *   const Tensor<2, dim, Number> &) const {
1176 *   throw NotImplementedException();
1177 *   }
1178 *  
1179 *   template <int dim, typename Number>
1180 *   void ExponentialHardeningElastoplasticMaterial<dim, Number>::
1181 *   set_state_parameters(
1182 *   const point_index_t &,
1183 *   const std::vector<Number> &,
1184 *   const Tensor<2, dim, Number> &) {
1185 *   throw NotImplementedException();
1186 *   }
1187 *  
1188 *   template <int dim, typename Number>
1189 *   size_t ExponentialHardeningElastoplasticMaterial<dim, Number>::
1190 *   get_material_parameter_count() const {
1191 *   throw NotImplementedException();
1192 *   }
1193 *  
1194 *  
1195 *   template <int dim, typename Number>
1196 *   Number ExponentialHardeningElastoplasticMaterial<dim, Number>::get_material_Jacobian(const point_index_t &) const {
1197 *   throw NotImplementedException();
1198 *   }
1199 *  
1200 *   template <int dim, typename Number>
1201 *   ::SymmetricTensor<2, dim, Number> ExponentialHardeningElastoplasticMaterial<dim, Number>::get_plastic_strain(const point_index_t &) const {
1202 *   throw NotImplementedException();
1203 *   }
1204 *  
1205 *  
1206 *   template <int dim, typename Number>
1207 *   void ExponentialHardeningElastoplasticMaterial<dim, Number>::
1208 *   compute_constitutive_request(ConstitutiveModelRequest<dim, Number> &constitutive_request,
1209 *   const point_index_t &point_index) {
1210 *   SymmetricTensor<2, dim, Number> plastic_strain = material_point_history[point_index].plastic_strain;
1211 *   typename PointHistory<dim, Number>::HardeningParameters
1212 *   hardening_parameters = material_point_history[point_index].hardening_parameters;
1213 *  
1214 *   auto deformation_gradient = static_cast<SymmetricTensor<2, dim, Number> >(constitutive_request.get_deformation_gradient());
1215 *   SymmetricTensor<4, dim, Number> elastoplastic_tangent_moduli;
1216 *   SymmetricTensor<2, dim, Number> deviator_strain_tensor = deviator(deformation_gradient);
1217 *  
1218 *   SymmetricTensor<2, dim, Number> dev_stress_trial = 2 * mu * (deviator_strain_tensor - plastic_strain);
1219 *   SymmetricTensor<2, dim, Number>
1220 *   ksi_trial = dev_stress_trial - hardening_parameters.kinematic_hardening;
1221 *  
1222 *   Number norm_ksi_trial = ksi_trial.norm();
1223 *   if (trial_yield_criterion( norm_ksi_trial, hardening_parameters.equivalent_plastic_strain ) > 0) {
1224 *   Number delta_gamma, alpha_n_plus_1;
1225 *   determine_delta_gamma(delta_gamma, alpha_n_plus_1,
1227 *   hardening_parameters.equivalent_plastic_strain,
1228 *   1e-10, 200);
1229 *   SymmetricTensor<2, dim, Number> stress_flow_direction = ksi_trial / norm_ksi_trial;
1230 *  
1231 * @endcode
1232 *
1233 * 4. Update back stress, plastic strain and stress
1234 *
1235 * @code
1236 *   const Number sqrt2thirds = sqrt((Number)2 / (Number)3);
1237 *   Number H_alpha_n_plus_1, H_alpha_n, K_alpha_n_plus_1, K_alpha_n;
1238 *   Number DH_alpha_n_plus_1, DK_alpha_n_plus_1;
1239 *   exponential_hardening_values(K_alpha_n, H_alpha_n, hardening_parameters.equivalent_plastic_strain);
1240 *   exponential_hardening_values(K_alpha_n_plus_1, H_alpha_n_plus_1, alpha_n_plus_1);
1241 *   exponential_hardening_derivatives(DK_alpha_n_plus_1, DH_alpha_n_plus_1, alpha_n_plus_1);
1242 *   if (update_material_point_history & constitutive_request.get_update_flags()) {
1243 *   material_point_history[point_index].hardening_parameters.equivalent_plastic_strain = alpha_n_plus_1;
1244 *   material_point_history[point_index].hardening_parameters.kinematic_hardening =
1245 *   hardening_parameters.kinematic_hardening
1246 *   + sqrt2thirds
1247 *   * (H_alpha_n_plus_1 - H_alpha_n)
1249 *   material_point_history[point_index].plastic_strain =
1250 *   plastic_strain + delta_gamma * stress_flow_direction;
1251 *   }
1252 *  
1253 *   SymmetricTensor<2, dim, Number>
1254 *   stress = kappa * trace(deformation_gradient) * unit_symmetric_tensor<dim, Number>()
1256 *   - 2 * mu * delta_gamma * stress_flow_direction;
1257 *  
1258 *   Number theta_n_plus_1 = 1 - 2 * mu * delta_gamma / norm_ksi_trial;
1259 *   Number theta_bar_n_plus_1 = 1 / (1 + (DK_alpha_n_plus_1 + DH_alpha_n_plus_1) / (3 * mu))
1260 *   - (1 - theta_n_plus_1);
1261 *   const SymmetricTensor<4, dim, Number> one_prod_one =
1263 *   elastoplastic_tangent_moduli = kappa * one_prod_one
1264 *   + 2 * mu * theta_n_plus_1 * (identity_tensor<dim, Number>() - 1 / 3 * one_prod_one)
1265 *   - 2 * mu * theta_bar_n_plus_1 * outer_product(stress_flow_direction, stress_flow_direction);
1266 *  
1267 * @endcode
1268 *
1269 * TODO change code such that request update flags are respected
1270 *
1271 * @code
1272 *   constitutive_request.set_stress_deviator(stress);
1273 * @endcode
1274 *
1275 * constitutiveRequest.setStressDeviatorTangentModuli(elastoplastic_tangent_moduli);
1276 *
1277 * @code
1278 *   } /*if ( trial yield criterion test )*/
1279 *   else {
1280 *   elastoplastic_tangent_moduli = stress_strain_tensor_kappa + stress_strain_tensor_mu;
1281 *   SymmetricTensor<2, dim, Number> stress = (stress_strain_tensor_kappa + stress_strain_tensor_mu) * deformation_gradient;
1282 *   constitutive_request.set_stress_deviator(stress);
1283 * @endcode
1284 *
1285 * constitutiveRequest.setStressDeviatorTangentModuli(elastoplastic_tangent_moduli);
1286 *
1287 * @code
1288 *   }
1289 *   }
1290 *  
1291 *   template <int dim, typename Number>
1292 *   void
1293 *   ExponentialHardeningElastoplasticMaterial<dim, Number>::
1294 *   setup_point_history (const point_index_t point_count) {
1295 *   {
1296 *   std::vector< PointHistory<dim, Number> > tmp;
1297 *   tmp.swap (material_point_history);
1298 *   }
1299 *   material_point_history.resize (point_count);
1300 *   }
1301 *  
1302 *   template <int dim, typename Number>
1303 *   inline void
1304 *   ExponentialHardeningElastoplasticMaterial<dim, Number>::
1305 *   determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
1306 *   const Number norm_ksi_trial,
1307 *   const Number alpha_n,
1308 *   Number tol, unsigned int max_iter) const {
1309 *   unsigned int k = 0;
1310 *   const Number sqrt2thirds = sqrt((Number)2 / (Number)3);
1311 *   Number g_of_gamma_k, Dg_of_gamma_k;
1312 *   Number K_alpha_n, K_alpha_n_plus_1, H_alpha_n, H_alpha_n_plus_1;
1313 *   Number DH_alpha_n_plus_1, DK_alpha_n_plus_1;
1314 *  
1315 *   delta_gamma = 0;
1316 *   alpha_n_plus_1 = alpha_n;
1317 *  
1318 *   exponential_hardening_values(K_alpha_n, H_alpha_n, alpha_n);
1319 *  
1320 *   do {
1321 *   k++;
1322 *   exponential_hardening_values(K_alpha_n_plus_1, H_alpha_n_plus_1, alpha_n_plus_1);
1323 *   g_of_gamma_k = -sqrt2thirds * K_alpha_n_plus_1 + norm_ksi_trial
1324 *   - (2 * mu * delta_gamma + sqrt2thirds * (H_alpha_n_plus_1 - H_alpha_n));
1325 *  
1326 *   exponential_hardening_derivatives(DK_alpha_n_plus_1, DH_alpha_n_plus_1, alpha_n_plus_1);
1327 *   Dg_of_gamma_k = -2 * mu * (1 + (DH_alpha_n_plus_1 + DK_alpha_n_plus_1) / (3 * mu));
1328 *  
1329 *   delta_gamma = delta_gamma - g_of_gamma_k / Dg_of_gamma_k;
1330 *   alpha_n_plus_1 = alpha_n + sqrt2thirds * delta_gamma;
1331 *  
1332 *   } while (std::fabs(g_of_gamma_k) > tol && k < max_iter);
1333 *   }
1334 *  
1335 *   template <int dim, typename Number>
1336 *   inline void
1337 *   ExponentialHardeningElastoplasticMaterial<dim, Number>::
1338 *   exponential_hardening_values(Number &kinematic_hardening,
1339 *   Number &isotropic_hardening,
1340 *   const Number alpha) const {
1341 *   Number h = K_infty - (K_infty - K_0) * exp(-delta * alpha) + H_bar * alpha;
1342 *   kinematic_hardening = beta * h;
1343 *   isotropic_hardening = (1 - beta) * h;
1344 *   }
1345 *  
1346 *   template <int dim, typename Number>
1347 *   inline void
1348 *   ExponentialHardeningElastoplasticMaterial<dim, Number>::
1349 *   exponential_hardening_derivatives(Number &D_kinematic_hardening,
1350 *   Number &D_isotropic_hardening,
1351 *   const Number alpha) const {
1352 *   Number Dh = delta * (K_infty - K_0) * exp(-delta * alpha) + H_bar;
1353 *   D_kinematic_hardening = beta * Dh;
1354 *   D_isotropic_hardening = (1 - beta) * Dh;
1355 *   }
1356 *  
1357 *   template <int dim, typename Number>
1358 *   inline Number
1359 *   ExponentialHardeningElastoplasticMaterial<dim, Number>::
1361 *   const Number alpha) const {
1362 *   Number H_alpha, K_alpha;
1363 *   exponential_hardening_values(K_alpha, H_alpha, alpha);
1364 *   const Number sqrt2thirds = sqrt((Number)2 / (Number)3);
1365 *   Number trial_yield_criterion = norm_ksi_trial - sqrt2thirds * K_alpha;
1366 *   return trial_yield_criterion;
1367 *   }
1368 *  
1369 *   template class ExponentialHardeningElastoplasticMaterial<3, double>;
1370 *   template class ExponentialHardeningElastoplasticMaterial<2, double>;
1371 *  
1372 *   } /* namespace PlasticityLab */
1373 * @endcode
1374
1375
1376<a name="ann-src/ExponentialHardeningElastoplasticMaterial.h"></a>
1377<h1>Annotated version of src/ExponentialHardeningElastoplasticMaterial.h</h1>
1378 *
1379 *
1380 *
1381 *
1382 * @code
1383 *   /*
1384 *   * ExponentialHardeningElastoplasticMaterial.h
1385 *   *
1386 *   * Created on: 10 Jul 2014
1387 *   * Author: cerecam
1388 *   */
1389 *  
1390 *   #ifndef EXPONENTIALHARDENINGMATERIAL_H_
1391 *   #define EXPONENTIALHARDENINGMATERIAL_H_
1392 *  
1393 *   #include "PointHistory.h"
1394 *   #include "Material.h"
1395 *   #include "ConstitutiveModelRequest.h"
1396 *  
1397 *   using namespace dealii;
1398 *  
1399 *   namespace PlasticityLab {
1400 *  
1401 *   template <int dim, typename Number = double>
1402 *   class ExponentialHardeningElastoplasticMaterial : public Material<dim, Number> {
1403 *   public:
1404 *   ExponentialHardeningElastoplasticMaterial(const Number E,
1405 *   const Number nu,
1406 *   const Number K_0,
1407 *   const Number K_infty,
1408 *   const Number delta,
1409 *   const Number H_bar,
1410 *   const Number beta);
1411 *  
1412 *   virtual ~ExponentialHardeningElastoplasticMaterial();
1413 *  
1414 *   void compute_constitutive_request(
1415 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
1416 *   const point_index_t &point_index) override;
1417 *  
1418 *   Number get_material_Jacobian(const point_index_t &point_index) const override;
1419 *   ::SymmetricTensor<2, dim, Number> get_plastic_strain(const point_index_t &point_index) const override;
1420 *  
1421 *   void setup_point_history (const point_index_t point_count) override;
1422 *  
1423 *   std::vector<Number> get_state_parameters(
1424 *   const point_index_t &point_index,
1425 *   const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) const override;
1426 *  
1427 *   void set_state_parameters(
1428 *   const point_index_t &point_index,
1429 *   const std::vector<Number> &state_parameters,
1430 *   const Tensor<2, dim, Number> &reference_transformation) override;
1431 *   size_t get_material_parameter_count() const override;
1432 *  
1433 *   private:
1434 *   const Number kappa;
1435 *   const Number mu;
1436 *  
1437 *   const Number K_0, K_infty, delta, H_bar; // hardening parameters (Simo & Hughes pp185)
1438 *   const Number beta; // isotropic/kinematic hardening parameter
1439 *  
1440 *  
1441 *   const SymmetricTensor<4, dim, Number> stress_strain_tensor_kappa;
1442 *   const SymmetricTensor<4, dim, Number> stress_strain_tensor_mu;
1443 *  
1444 *   std::vector< PointHistory< dim, Number> > material_point_history;
1445 *  
1446 *   inline void
1447 *   determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
1448 *   const Number norm_ksi_trial,
1449 *   const Number alpha_n,
1450 *   Number tol, unsigned int max_iter) const;
1451 *  
1452 *   inline void
1453 *   exponential_hardening_values(Number &kinematic_hardening,
1454 *   Number &isotropic_hardening,
1455 *   const Number alpha) const;
1456 *  
1457 *   inline void
1458 *   exponential_hardening_derivatives(Number &D_kinematic_hardening,
1459 *   Number &D_isotropic_hardening,
1460 *   const Number alpha) const;
1461 *  
1462 *   inline Number
1463 *   trial_yield_criterion(const Number norm_ksi_trial,
1464 *   const Number alpha) const;
1465 *  
1466 *   };
1467 *  
1468 *   } /* namespace PlasticityLab */
1469 *  
1470 *   #endif /* EXPONENTIALHARDENINGMATERIAL_H_ */
1471 * @endcode
1472
1473
1474<a name="ann-src/ExponentialHardeningThermoviscoplasticYieldLaw.h"></a>
1475<h1>Annotated version of src/ExponentialHardeningThermoviscoplasticYieldLaw.h</h1>
1476 *
1477 *
1478 *
1479 *
1480 * @code
1481 *   /*
1482 *   * ExponentialHardeningThermoviscoplasticYieldLaw.h
1483 *   *
1484 *   * Created on: 22 Nov 2019
1485 *   * Author: maien
1486 *   */
1487 *  
1488 *   #ifndef EXPONENTIALHARDENINGTHERMOVISCOPLASTICYIELDLAW_H_
1489 *   #define EXPONENTIALHARDENINGTHERMOVISCOPLASTICYIELDLAW_H_
1490 *  
1491 *   #include "Constants.h"
1492 *  
1493 *   namespace PlasticityLab {
1494 *  
1495 *   template<typename Number>
1496 *   class ExponentialHardeningThermoviscoplasticYieldLaw {
1497 *   public:
1498 *   ExponentialHardeningThermoviscoplasticYieldLaw(
1499 *   const Number K_0,
1500 *   const Number K_infty,
1501 *   const Number delta,
1502 *   const Number H_bar,
1503 *   const Number beta,
1504 *   const Number flow_stress_softening,
1505 *   const Number hardening_softening,
1506 *   const Number reference_temperature=293.0) :
1507 *   K_0(K_0),
1508 *   K_infty(K_infty),
1509 *   delta(delta),
1510 *   H_bar(H_bar),
1511 *   beta(beta),
1512 *   flow_stress_softening(flow_stress_softening),
1513 *   hardening_softening(hardening_softening),
1515 *   viscous_hardening_factor(0.0),
1516 *   sqrt2thirds(Constants<3, Number>::sqrt2thirds()) {}
1517 *  
1518 *   Number hardening_values(Number &isotropic_hardening,
1519 *   Number &kinematic_hardening,
1520 *   const Number alpha,
1521 *   const Number gamma,
1522 *   const Number time_increment,
1523 *   const Number temperature) const {
1524 *   Number h = K_0 * (1 - std::min(softening_threshold, flow_stress_softening * (temperature - reference_temperature)))
1525 *   + ((K_infty - K_0) * (1 - exp(-delta * alpha)) + H_bar * alpha) * (1 - std::min(softening_threshold, hardening_softening * (temperature - reference_temperature)))
1526 *   + viscous_hardening_factor * sqrt2thirds * gamma / time_increment;
1527 *   isotropic_hardening = beta * h;
1528 *   kinematic_hardening = (1 - beta) * h;
1529 *   return h;
1530 *   }
1531 *  
1532 *   Number hardening_alpha_derivatives(Number &D_isotropic_hardening,
1533 *   Number &D_kinematic_hardening,
1534 *   const Number alpha,
1535 *   [[maybe_unused]] const Number gamma,
1536 *   const Number time_increment,
1537 *   const Number temperature) const {
1538 *   Number Dh = (delta * (K_infty - K_0) * exp(-delta * alpha) + H_bar) * (1 - std::min(softening_threshold, hardening_softening * (temperature - reference_temperature)))
1539 *   + viscous_hardening_factor / time_increment;
1540 *   D_isotropic_hardening = beta * Dh;
1541 *   D_kinematic_hardening = (1 - beta) * Dh;
1542 *   return Dh;
1543 *   }
1544 *  
1545 *   Number hardening_temperature_derivatives(Number &D_isotropic_hardening,
1546 *   Number &D_kinematic_hardening,
1547 *   const Number alpha,
1548 *   [[maybe_unused]] const Number gamma,
1549 *   [[maybe_unused]] const Number time_increment,
1550 *   const Number temperature) const {
1551 *   Number Dh = (hardening_softening * (temperature - reference_temperature) < softening_threshold)?
1552 *   -flow_stress_softening * K_0
1553 *   - hardening_softening * ((K_infty - K_0) * (1 - exp(-delta * alpha)) + H_bar * alpha)
1554 *   : 0.0;
1555 *   D_isotropic_hardening = beta * Dh;
1556 *   D_kinematic_hardening = (1 - beta) * Dh;
1557 *   return Dh;
1558 *   }
1559 *  
1560 *   Number trial_yield_criterion(const Number norm_ksi_trial,
1561 *   const Number alpha,
1562 *   const Number gamma,
1563 *   const Number time_increment,
1564 *   const Number temperature) const {
1565 *   Number K_alpha, H_alpha;
1566 *   hardening_values(H_alpha, K_alpha, alpha, gamma, time_increment, temperature);
1567 *   const Number trial_yield_criterion = norm_ksi_trial - sqrt2thirds * (H_alpha);
1568 *   return trial_yield_criterion;
1569 *   }
1570 *   private:
1571 *   const Number K_0, K_infty, delta, H_bar; // hardening parameters (Simo & Hughes pp185)
1572 *   const Number beta; // isotropic/kinematic hardening parameter (1.0 for isotropic)
1573 *   const Number flow_stress_softening, hardening_softening; // thermal softening parameters (Simo & Miehe 1992 pp74)
1575 *   const Number viscous_hardening_factor;
1576 *   const Number sqrt2thirds;
1577 *   const Number softening_threshold = 0.98;
1578 *   };
1579 *  
1580 *   } /* namespace PlasticityLab */
1581 *  
1582 *   #endif /* EXPONENTIALHARDENINGTHERMOVISCOPLASTICYIELDLAW_H_ */ * @endcode
1583
1584
1585<a name="ann-src/IncrementInterpolationHandler.h"></a>
1586<h1>Annotated version of src/IncrementInterpolationHandler.h</h1>
1587 *
1588 *
1589 *
1590 *
1591 * @code
1592 *   /*
1593 *   * IncrementInterpolationHandler.h
1594 *   *
1595 *   * Created on: 25 Oct 2019
1596 *   * Author: maien
1597 *   */
1598 *  
1599 *   #ifndef INCREMENTINTERPOLATIONHANDLER_H_
1600 *   #define INCREMENTINTERPOLATIONHANDLER_H_
1601 *  
1602 *  
1603 *   using namespace dealii;
1604 *  
1605 *   namespace PlasticityLab {
1606 *   template <int dim, typename Number=double, int components=dim>
1607 *   class IncrementInterpolationHandler {
1608 *   public:
1609 *   IncrementInterpolationHandler(
1610 *   Function<dim, Number> *increment_interpolation_function,
1611 *   bool do_interpolate,
1612 *   ComponentMask interpolation_component_mask,
1613 *   bool do_constrain,
1614 *   ComponentMask constrain_component_mask,
1615 *   types::boundary_id constrain_boundary_id,
1616 *   Mapping<dim> &mapping)
1617 *   : increment_interpolation_function(increment_interpolation_function),
1618 *   do_interpolate(do_interpolate),
1619 *   interpolation_component_mask(interpolation_component_mask),
1620 *   do_constrain(do_constrain),
1621 *   constrain_component_mask(constrain_component_mask),
1622 *   constrain_boundary_id(constrain_boundary_id),
1623 *   mapping(mapping) { }
1624 *  
1625 *   ~IncrementInterpolationHandler(){
1626 *   delete increment_interpolation_function;
1627 *   }
1628 *  
1629 *   void advance_time(const Number delta_t);
1630 *  
1631 *   template<typename VectorType>
1632 *   void distribute_step_constraints(VectorType &increment) const {
1633 *   if(do_constrain) {
1634 *   function_constraint.distribute(increment);
1635 *   }
1636 *   }
1637 *  
1638 *   template<typename VectorType>
1639 *   void interpolate(VectorType &increment, const DoFSystem<dim, Number> &dof_system) const {
1640 *   if(do_interpolate) {
1642 *   mapping,
1643 *   dof_system.dof_handler,
1644 *   *increment_interpolation_function,
1645 *   increment,
1646 *   interpolation_component_mask);
1647 *   }
1648 *   }
1649 *  
1650 *   void reinit_constraint_matrix(const DoFSystem<dim, Number> &dof_system) {
1651 *   if(do_constrain) {
1652 *   function_constraint.reinit(dof_system.locally_relevant_dofs);
1653 *   DoFTools::make_hanging_node_constraints(dof_system.dof_handler, function_constraint);
1654 *   std::map< types::boundary_id, const Function< dim, Number > * > constraint_function_map;
1655 *   constraint_function_map.insert(std::make_pair(constrain_boundary_id, increment_interpolation_function));
1656 *   ::VectorTools::interpolate_boundary_values(dof_system.mapping, dof_system.dof_handler, constraint_function_map, function_constraint, constrain_component_mask);
1657 *   function_constraint.close();
1658 *   }
1659 *   }
1660 *  
1661 *   private:
1662 *   Function<dim, Number>* increment_interpolation_function;
1663 *   const bool do_interpolate;
1664 *   ComponentMask interpolation_component_mask;
1665 *   const bool do_constrain;
1666 *   ComponentMask constrain_component_mask;
1667 *   types::boundary_id constrain_boundary_id;
1668 *   AffineConstraints<Number> function_constraint;
1669 *   const Mapping<dim> &mapping;
1670 *   };
1671 *  
1672 *  
1673 *   template<int dim, typename Number, int components>
1674 *   void IncrementInterpolationHandler<dim, Number, components>::advance_time(const Number delta_t) {
1675 *   increment_interpolation_function->advance_time(delta_t);
1676 *   }
1677 *  
1678 *   } /* namespace PlasticityLab */
1679 *  
1680 *   #endif /* INCREMENTINTERPOLATIONHANDLER_H_ */
1681 * @endcode
1682
1683
1684<a name="ann-src/InterpolatoryConstraintApplier.h"></a>
1685<h1>Annotated version of src/InterpolatoryConstraintApplier.h</h1>
1686 *
1687 *
1688 *
1689 *
1690 * @code
1691 *   /*
1692 *   * InterpolatoryConstraintApplier.h
1693 *   *
1694 *   * Created on: 15 Jan 2015
1695 *   * Author: maien
1696 *   */
1697 *  
1698 *   #ifndef INTERPOLATORYCONSTRAINTAPPLIER_H_
1699 *   #define INTERPOLATORYCONSTRAINTAPPLIER_H_
1700 *  
1701 *   #include <deal.II/dofs/dof_tools.h>
1702 *   #include <deal.II/numerics/vector_tools.h>
1703 *  
1704 *   namespace PlasticityLab {
1705 *  
1706 *   template <int dim, typename Number = double>
1708 *   public:
1710 *   InterpolatoryConstraintApplier(const std::map< ::types::boundary_id, const ::Function< dim, Number > * > &constraintFunctionMap,
1711 *   ::ComponentMask componentMask);
1712 *   virtual ~InterpolatoryConstraintApplier();
1713 *  
1714 *   void configure(std::map< ::types::boundary_id, const ::Function< dim, Number > * > constraintFunctionMap,
1715 *   ::ComponentMask componentMask);
1716 *  
1717 *   void apply(const ::Mapping<dim> &mapping,
1718 *   ::DoFHandler<dim> &doFHandler,
1719 *   ::AffineConstraints<Number> &constraintMatrix,
1720 *   bool useComponentMask = true) const;
1721 *  
1722 *   private:
1723 *   std::map< ::types::boundary_id, const ::Function< dim, Number > * > constraintFunctionMap;
1724 *   ::ComponentMask componentMask;
1725 *   };
1726 *  
1727 *   template <int dim, typename Number>
1728 *   InterpolatoryConstraintApplier<dim, Number>::InterpolatoryConstraintApplier() {
1729 *   }
1730 *  
1731 *   template <int dim, typename Number>
1732 *   InterpolatoryConstraintApplier<dim, Number>::InterpolatoryConstraintApplier
1733 *   (const std::map< ::types::boundary_id, const ::Function< dim, Number > * > &constraintFunctionMap,
1734 *   ::ComponentMask componentMask):
1735 *   constraintFunctionMap(constraintFunctionMap),
1736 *   componentMask(componentMask) {
1737 *   }
1738 *  
1739 *   template <int dim, typename Number>
1740 *   InterpolatoryConstraintApplier<dim, Number>::~InterpolatoryConstraintApplier() {
1741 *   }
1742 *  
1743 *   template <int dim, typename Number>
1744 *   void InterpolatoryConstraintApplier<dim, Number>::configure
1745 *   (std::map< ::types::boundary_id, const ::Function< dim, Number > * > constraintFunctionMap,
1746 *   ::ComponentMask componentMask) {
1747 *   this->constraintFunctionMap = std::map< ::types::boundary_id, const ::Function< dim, Number > * >(constraintFunctionMap);
1748 *   this->componentMask = ::ComponentMask(componentMask);
1749 *   }
1750 *  
1751 *   template <int dim, typename Number>
1752 *   void InterpolatoryConstraintApplier<dim, Number>::apply(const ::Mapping<dim> &mapping,
1753 *   ::DoFHandler<dim> &doFHandler,
1754 *   ::AffineConstraints<Number> &constraintMatrix,
1755 *   bool useComponentMask) const {
1756 *   if (useComponentMask)
1757 *   ::VectorTools::interpolate_boundary_values(mapping,
1758 *   doFHandler,
1759 *   constraintFunctionMap,
1760 *   constraintMatrix,
1761 *   componentMask);
1762 *   else
1763 *   ::VectorTools::interpolate_boundary_values(mapping,
1764 *   doFHandler,
1765 *   constraintFunctionMap,
1766 *   constraintMatrix);
1767 *   }
1768 *  
1769 *   } /* namespace PlasticityLab */
1770 *  
1771 *   #endif /* INTERPOLATORYCONSTRAINTAPPLIER_H_ */
1772 * @endcode
1773
1774
1775<a name="ann-src/JohnsonCookThermoviscoplasticYieldLaw.h"></a>
1776<h1>Annotated version of src/JohnsonCookThermoviscoplasticYieldLaw.h</h1>
1777 *
1778 *
1779 *
1780 *
1781 * @code
1782 *   /*
1783 *   * JohnsonCookThermoviscoplasticYieldLaw.h
1784 *   *
1785 *   * Created on: 22 Nov 2019
1786 *   * Author: maien
1787 *   */
1788 *  
1789 *   #ifndef JOHNSONCOOKTHERMOVISCOPLASTICYIELDLAW_H_
1790 *   #define JOHNSONCOOKTHERMOVISCOPLASTICYIELDLAW_H_
1791 *  
1792 *   #include <math.h>
1793 *  
1794 *   #include "Constants.h"
1795 *  
1796 *  
1797 *   namespace PlasticityLab {
1798 *  
1799 *   template<typename Number>
1800 *   class JohnsonCookThermoviscoplasticYieldLaw {
1801 *   public:
1802 *   JohnsonCookThermoviscoplasticYieldLaw(
1803 *   const Number mu,
1804 *   const Number A,
1805 *   const Number B,
1806 *   const Number C,
1807 *   const Number m,
1808 *   const Number n,
1809 *   const Number melting_temperature,
1810 *   const Number reference_strain_rate=1.0,
1811 *   const Number reference_temperature=293.0,
1812 *   const Number beta=1.0) :
1813 *   mu(mu),
1814 *   A(A),
1815 *   B(B),
1816 *   C(C),
1817 *   m(m),
1818 *   n(n),
1819 *   melting_temperature(melting_temperature),
1820 *   reference_strain_rate(reference_strain_rate),
1822 *   beta(beta),
1823 *   sqrt2thirds(Constants<2, Number>::sqrt2thirds()),
1824 *   exp_one_half(std::exp(0.5)) {}
1825 *  
1826 *   Number hardening_values(Number &isotropic_hardening,
1827 *   Number &kinematic_hardening,
1828 *   const Number alpha,
1829 *   const Number gamma,
1830 *   const Number time_increment,
1831 *   const Number temperature) const {
1832 *   if(use_Carreau_viscous_law) {
1833 *   const Number creep_strain_rate_factor = std::pow(1-std::max(0., std::min(1., (temperature - reference_temperature)/(melting_temperature - reference_temperature))), 1.5);
1834 *   const Number minimum_strain_rate = creep_strain_rate_factor * epsilon_dot_0;
1835 *   const Number strain_rate = std::max(sqrt2thirds*gamma/time_increment, minimum_strain_rate);
1836 *   const Number softened_quasistatic_elastoplastic_stress = get_elastoplastic_factor(alpha) * get_softening_factor(temperature);
1837 *   const Number Carreau_viscocity = get_Carreau_viscocity(strain_rate, softened_quasistatic_elastoplastic_stress);
1838 *   const Number h = 3 * Carreau_viscocity * strain_rate;
1839 *   isotropic_hardening = beta * h;
1840 *   kinematic_hardening = (1 - beta) * h;
1841 *   return h;
1842 *   } else {
1843 *   const Number h =
1844 *   get_elastoplastic_factor(alpha)
1845 *   * get_viscosity_factor(gamma, time_increment)
1846 *   * get_softening_factor(temperature)
1847 *   + viscosity_regularization_factor * sqrt2thirds * gamma/time_increment;
1848 *   isotropic_hardening = beta * h;
1849 *   kinematic_hardening = (1 - beta) * h;
1850 *   return h;
1851 *   }
1852 *   }
1853 *  
1854 *   Number hardening_alpha_derivatives(Number &D_isotropic_hardening,
1855 *   Number &D_kinematic_hardening,
1856 *   const Number alpha,
1857 *   const Number gamma,
1858 *   const Number time_increment,
1859 *   const Number temperature) const {
1860 *   if(use_Carreau_viscous_law) {
1861 *   const Number creep_strain_rate_factor = std::pow(1-std::max(0., std::min(1., (temperature - reference_temperature)/(melting_temperature - reference_temperature))), 1.5);
1862 *   const Number minimum_strain_rate = creep_strain_rate_factor * epsilon_dot_0;
1863 *   const Number strain_rate = std::max(sqrt2thirds*gamma/time_increment, minimum_strain_rate);
1864 *   const Number softened_quasistatic_elastoplastic_stress = get_elastoplastic_factor(alpha) * get_softening_factor(temperature);
1865 *   const Number Carreau_viscocity = get_Carreau_viscocity(strain_rate, softened_quasistatic_elastoplastic_stress);
1866 *   const Number strain_rate_tangent = strain_rate > minimum_strain_rate? 1.0/time_increment : 0;
1867 *   const Number stress_tangent =
1868 *   get_elastoplastic_factor_tangent(alpha) * get_softening_factor(temperature);
1869 *   Number Carreau_viscocity_strain_rate_tangent, Carreau_viscocity_stress_tangent;
1870 *   get_Carreau_viscocity_tangents(
1871 *   strain_rate, softened_quasistatic_elastoplastic_stress,
1872 *   Carreau_viscocity_strain_rate_tangent,
1873 *   Carreau_viscocity_stress_tangent);
1874 * @endcode
1875 *
1876 * const Number Dh =
1877 * 3 * Carreau_viscocity * strain_rate > softened_quasistatic_elastoplastic_stress?
1878 * 3 * Carreau_viscocity * strain_rate_tangent
1879 * + 3 * Carreau_viscocity_stress_tangent * stress_tangent * strain_rate
1880 * + 3 * Carreau_viscocity_strain_rate_tangent * strain_rate_tangent * strain_rate
1881 * : 0;
1882 *
1883 * @code
1884 *   const Number Dh =
1885 *   3 * Carreau_viscocity * strain_rate_tangent
1886 *   + 3 * Carreau_viscocity_stress_tangent * stress_tangent * strain_rate
1887 *   + 3 * Carreau_viscocity_strain_rate_tangent * strain_rate_tangent * strain_rate;
1888 *   D_isotropic_hardening = beta * Dh;
1889 *   D_kinematic_hardening = (1.0 - beta) * Dh;
1890 *   return Dh;
1891 *   } else {
1892 *   const Number Dh =
1893 *   get_elastoplastic_factor_tangent(alpha)
1894 *   * get_viscosity_factor(gamma, time_increment)
1895 *   * get_softening_factor(temperature)
1896 *   + get_elastoplastic_factor(alpha)
1897 *   * get_viscosity_factor_tangent(gamma, time_increment)
1898 *   * get_softening_factor(temperature)
1899 *   + viscosity_regularization_factor/time_increment;
1900 *   D_isotropic_hardening = beta * Dh;
1901 *   D_kinematic_hardening = (1.0 - beta) * Dh;
1902 *   return Dh;
1903 *   }
1904 *   }
1905 *  
1906 *   Number hardening_temperature_derivatives(Number &D_isotropic_hardening,
1907 *   Number &D_kinematic_hardening,
1908 *   const Number alpha,
1909 *   const Number gamma,
1910 *   const Number time_increment,
1911 *   const Number temperature) const {
1912 *   if(use_Carreau_viscous_law) {
1913 *   const Number creep_strain_rate_factor = std::pow(1-std::max(0., std::min(1., (temperature - reference_temperature)/(melting_temperature - reference_temperature))), 1.5);
1914 *   const Number minimum_strain_rate = creep_strain_rate_factor * epsilon_dot_0;
1915 *   const Number strain_rate = std::max(sqrt2thirds*gamma/time_increment, minimum_strain_rate);
1916 *   const Number softened_quasistatic_elastoplastic_stress = get_elastoplastic_factor(alpha) * get_softening_factor(temperature);
1917 *   [[maybe_unused]] const Number Carreau_viscocity = get_Carreau_viscocity(strain_rate, softened_quasistatic_elastoplastic_stress);
1918 *   const Number stress_temperature_tangent =
1919 *   get_elastoplastic_factor(alpha) * get_softening_factor_tangent(temperature);
1920 *   Number Carreau_viscocity_strain_rate_tangent, Carreau_viscocity_stress_tangent;
1921 *   get_Carreau_viscocity_tangents(
1922 *   strain_rate, softened_quasistatic_elastoplastic_stress,
1923 *   Carreau_viscocity_strain_rate_tangent,
1924 *   Carreau_viscocity_stress_tangent);
1925 *   const Number Dh = 3 * Carreau_viscocity_stress_tangent * stress_temperature_tangent * strain_rate;
1926 *   D_isotropic_hardening = beta * Dh;
1927 *   D_kinematic_hardening = (1 - beta) * Dh;
1928 *   return Dh;
1929 *   } else {
1930 *   Number Dh =
1931 *   get_elastoplastic_factor(alpha)
1932 *   * get_viscosity_factor(gamma, time_increment)
1933 *   * get_softening_factor_tangent(temperature);
1934 *   D_isotropic_hardening = beta * Dh;
1935 *   D_kinematic_hardening = (1 - beta) * Dh;
1936 *   return Dh;
1937 *   }
1938 *   }
1939 *  
1940 *   Number trial_yield_criterion(const Number norm_ksi_trial,
1941 *   const Number alpha,
1942 *   const Number gamma,
1943 *   const Number time_increment,
1944 *   const Number temperature) const {
1945 *   Number K_alpha, H_alpha;
1946 *   hardening_values(H_alpha, K_alpha, alpha, gamma, time_increment, temperature);
1947 *   const Number trial_yield_criterion = norm_ksi_trial - sqrt2thirds * (H_alpha);
1948 *   return trial_yield_criterion;
1949 *   }
1950 *  
1951 *   Number get_elastoplastic_factor(const Number alpha) const {
1952 *   if(alpha > max_strain) {
1953 *   return A + B * std::pow(max_strain, n);
1954 *   }
1955 *   if(alpha >= eps) {
1956 *   return A + B * std::pow(alpha, n);
1957 *   }
1958 *   return A + B * alpha/eps * std::pow(eps, n);
1959 *   }
1960 *  
1961 *   Number get_viscosity_factor(const Number gamma, const Number time_increment) const {
1962 *   Number slope, intercept;
1963 *   get_small_hardening_fit(slope, intercept, time_increment);
1964 *   if(gamma >= intercept) {
1965 *   return 1.0 + C * std::log(sqrt2thirds*gamma/(time_increment*reference_strain_rate));
1966 *   } else if (gamma < 0.0) {
1967 *   return 1.0 - C * slope * sqrt2thirds * gamma * gamma;
1968 *   }
1969 *   return 1.0 + C * slope * sqrt2thirds * gamma * gamma;
1970 *   }
1971 *  
1972 *   Number get_softening_factor(const Number temperature) const {
1973 *   if(temperature > reference_temperature) {
1974 *   if(temperature < melting_temperature) {
1975 *   return (1.0 + softening_threshold - std::pow((temperature - reference_temperature)/(melting_temperature - reference_temperature), m));
1976 *   } else {
1977 *   return 0.0 + softening_threshold;
1978 *   }
1979 *   }
1980 *   return 1.0 + softening_threshold;
1981 *   }
1982 *  
1983 *   Number get_elastoplastic_factor_tangent(const Number alpha) const {
1984 *   if(alpha > max_strain) {
1985 *   return 0;
1986 *   }
1987 *   if(alpha >= eps) {
1988 *   return B * n * std::pow(alpha, n-1.0);
1989 *   }
1990 *   return B * 1.0/eps * std::pow(eps, n);
1991 *   }
1992 *  
1993 *   Number get_viscosity_factor_tangent(const Number gamma, const Number time_increment) const {
1994 *   Number slope, intercept;
1995 *   get_small_hardening_fit(slope, intercept, time_increment);
1996 *   if(gamma >= intercept) {
1997 *   return C / (sqrt2thirds * gamma);
1998 *   } else if (gamma < 0.0) {
1999 *   return -2 * C * slope * gamma;
2000 *   }
2001 *   return 2 * C * slope * gamma;
2002 *   }
2003 *  
2004 *   Number get_softening_factor_tangent(const Number temperature) const {
2005 *   if(temperature > reference_temperature) {
2006 *   if(temperature < melting_temperature) {
2007 *   return (-m/(melting_temperature - reference_temperature))
2008 *   * std::pow((temperature - reference_temperature)/(melting_temperature - reference_temperature), m-1.0);
2009 *   } else {
2010 *   return 0.0;
2011 *   }
2012 *   }
2013 *   return 0.0;
2014 *   }
2015 *  
2016 *   void get_small_hardening_fit(Number &slope, Number &intercept, const Number time_increment) const {
2017 * @endcode
2018 *
2019 * the log factor is annoying when below 1.0. Replace it by a parabula till it behaves.
2020 *
2021 * @code
2022 *   const Number log_factor = 1./(time_increment*reference_strain_rate);
2023 *   intercept = exp_one_half/(sqrt2thirds * log_factor);
2024 *   slope = 1./(2*intercept*intercept*sqrt2thirds);
2025 *   }
2026 *  
2027 *   Number get_Carreau_viscocity(Number strain_rate, Number sigma_0_theta) const {
2028 *   if(sigma_0_theta <= 0) {
2029 *   return mu_infty;
2030 *   }
2031 *   const Number g_sigma_epsilon_dot = std::pow(sigma_0_theta/(3*epsilon_dot_0*mu_0), (n_C/(1-n_C))) * (strain_rate/epsilon_dot_0);
2032 *   return std::pow(1 + std::pow(g_sigma_epsilon_dot, 2), ((1-n_C)/(2*n_C))) * (mu_0 - mu_infty) + mu_infty;
2033 *   }
2034 *  
2035 *   void get_Carreau_viscocity_tangents(
2036 *   Number strain_rate,
2037 *   Number sigma_0_theta,
2038 *   Number &Carreau_viscocity_strain_rate_tangent,
2039 *   Number &Carreau_viscocity_stress_tangent) const {
2040 *   if(sigma_0_theta <= 0) {
2041 *   Carreau_viscocity_strain_rate_tangent = 0;
2042 *   Carreau_viscocity_stress_tangent = 0;
2043 *   return;
2044 *   }
2045 *   const Number g_sigma_epsilon_dot = std::pow(sigma_0_theta/(3*epsilon_dot_0*mu_0), (n_C/(1-n_C))) * (strain_rate/epsilon_dot_0);
2046 *   const Number g_sigma_epsilon_dot_strain_rate_tangent = std::pow(sigma_0_theta/(3*epsilon_dot_0*mu_0), (n_C/(1-n_C))) * (1/epsilon_dot_0);
2047 *   const Number g_sigma_epsilon_dot_stress_tangent =
2048 *   (n_C / (1-n_C)) * std::pow(sigma_0_theta/(3*epsilon_dot_0*mu_0), ((2*n_C-1)/(1-n_C))) * (strain_rate/epsilon_dot_0) * (1/(3 * epsilon_dot_0 * mu_0));
2049 *   const Number Carreau_viscocity_g_tangent =
2050 *   ((1-n_C)/(2*n_C)) * std::pow(1 + std::pow(g_sigma_epsilon_dot, 2), ((1-3*n_C)/(2*n_C))) * (2*g_sigma_epsilon_dot) * (mu_0 - mu_infty);
2051 *  
2052 *   Carreau_viscocity_strain_rate_tangent = Carreau_viscocity_g_tangent * g_sigma_epsilon_dot_strain_rate_tangent;
2053 *   Carreau_viscocity_stress_tangent = Carreau_viscocity_g_tangent * g_sigma_epsilon_dot_stress_tangent;
2054 *   }
2055 *  
2056 *   private:
2057 *   const Number mu;
2058 *   const Number A;
2059 *   const Number B;
2060 *   const Number C;
2061 *   const Number m;
2062 *   const Number n;
2063 *   const Number melting_temperature;
2064 *   const Number reference_strain_rate;
2066 *   const Number beta;
2067 *   const Number sqrt2thirds;
2068 *   const Number exp_one_half;
2069 *  
2070 *   const Number eps = std::pow(B/mu, 1.0/(1.0-n));
2071 *   const Number softening_threshold = 0.0;
2072 *   const Number viscosity_regularization_factor = 0;
2073 *   const Number max_strain = std::numeric_limits<Number>::max();
2074 *  
2075 * @endcode
2076 *
2077 * Carreau fluid parameters
2078 *
2079 * @code
2080 *   const bool use_Carreau_viscous_law = false;
2081 *   const Number epsilon_dot_0 = 1;
2082 *   const Number n_C = 3;
2083 *   const Number mu_0 = 1e18;
2084 *   const Number mu_infty = 1e-4;
2085 *  
2086 *   };
2087 *  
2088 *   } /* namespace PlasticityLab */
2089 *  
2090 *   #endif /* JOHNSONCOOKTHERMOVISCOPLASTICYIELDLAW_H_ */ * @endcode
2091
2092
2093<a name="ann-src/LBCSystem.h"></a>
2094<h1>Annotated version of src/LBCSystem.h</h1>
2095 *
2096 *
2097 *
2098 *
2099 * @code
2100 *   /*
2101 *   * LBCSystem.h
2102 *   *
2103 *   * Created on: 08 Oct 2019
2104 *   * Author: maien
2105 *   */
2106 *  
2107 *   #ifndef LBCSYSTEM_H_
2108 *   #define LBCSYSTEM_H_
2109 *  
2110 *   #include <deal.II/base/function.h>
2111 *  
2112 *   #include "InterpolatoryConstraintApplier.h"
2113 *   #include "BodyForceApplier.h"
2114 *   #include "ConvectionBoundaryConditionApplier.h"
2115 *   #include "IncrementInterpolationHandler.h"
2116 *   #include "utilities.h"
2117 *   #include "DoFSystem.h"
2118 *   #include "BoundaryUnidirectionalPenaltySpec.h"
2119 *  
2120 *   using namespace dealii;
2121 *   using namespace Functions;
2122 *  
2123 *   namespace PlasticityLab {
2124 *  
2125 *   template <int dim, typename Number=double, int components=dim>
2126 *   class LBCSystem {
2127 *   public:
2128 *   LBCSystem(): zero_function(components){}
2129 *   ~LBCSystem() {
2130 *   for(auto increment_interpolation_handler: increment_interpolation_handlers) {
2131 *   delete increment_interpolation_handler;
2132 *   }
2133 *   for(auto initial_velocity_interpolation_handler: initial_velocity_interpolation_handlers) {
2134 *   delete initial_velocity_interpolation_handler;
2135 *   }
2136 *   for(auto initial_deformation_interpolation_handler: initial_deformation_interpolation_handlers) {
2137 *   delete initial_deformation_interpolation_handler;
2138 *   }
2139 *   for(auto boundary_unidirectional_penalty_spec: boundary_unidirectional_penalty_specs) {
2140 *   delete boundary_unidirectional_penalty_spec;
2141 *   }
2142 *   }
2143 *  
2144 *   void apply_constraints(DoFSystem<dim, Number> &dof_system) const;
2145 *  
2146 *   void clear();
2147 *  
2148 *   std::vector< BodyForceApplier<dim, Number> > bodyLoadAppliers;
2149 *   std::vector< std::pair<int, BodyForceApplier<dim, Number> > > boundaryLoadAppliers;
2150 *   std::vector< std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> > > convection_BC_appliers;
2151 *   std::vector< InterpolatoryConstraintApplier<dim, Number> > interpolatoryConstraintAppliers;
2152 *   std::vector<std::pair<unsigned int, std::set<types::boundary_id>>> no_normal_flux_constraints;
2153 *   std::vector<IncrementInterpolationHandler<dim, Number, components>*> increment_interpolation_handlers;
2154 *   std::vector<IncrementInterpolationHandler<dim, Number, components>*> initial_velocity_interpolation_handlers;
2155 *   std::vector<IncrementInterpolationHandler<dim, Number, components>*> initial_deformation_interpolation_handlers;
2156 *   std::vector<BoundaryUnidirectionalPenaltySpec<Number>*> boundary_unidirectional_penalty_specs;
2157 *  
2158 *   ZeroFunction<dim, Number> zero_function;
2159 *   };
2160 *  
2161 *  
2162 *   template<int dim, typename Number, int components>
2163 *   void LBCSystem<dim, Number, components>::apply_constraints(DoFSystem<dim, Number> &dof_system) const {
2164 *   for (auto constraintApplier = interpolatoryConstraintAppliers.cbegin();
2165 *   constraintApplier != interpolatoryConstraintAppliers.end();
2166 *   ++constraintApplier) {
2167 *   constraintApplier->apply(dof_system.mapping, dof_system.dof_handler, dof_system.nodal_constraints);
2168 *   }
2169 *  
2170 *   for (auto no_normal_flux_constraint : no_normal_flux_constraints) {
2172 *   dof_system.dof_handler,
2173 *   no_normal_flux_constraint.first,
2174 *   no_normal_flux_constraint.second,
2175 *   dof_system.nodal_constraints,
2176 *   dof_system.mapping);
2177 *   }
2178 *  
2179 *   dof_system.nodal_constraints.close();
2180 *   }
2181 *  
2182 *  
2183 *   template<int dim, typename Number, int components>
2184 *   void LBCSystem<dim, Number, components>::clear() {
2185 *   for(auto increment_interpolation_handler: increment_interpolation_handlers) {
2186 *   delete increment_interpolation_handler;
2187 *   }
2188 *   for(auto initial_velocity_interpolation_handler: initial_velocity_interpolation_handlers) {
2189 *   delete initial_velocity_interpolation_handler;
2190 *   }
2191 *   for(auto initial_deformation_interpolation_handler: initial_deformation_interpolation_handlers) {
2192 *   delete initial_deformation_interpolation_handler;
2193 *   }
2194 *   for(auto boundary_unidirectional_penalty_spec: boundary_unidirectional_penalty_specs) {
2195 *   delete boundary_unidirectional_penalty_spec;
2196 *   }
2197 *  
2198 *   bodyLoadAppliers.clear();
2199 *   boundaryLoadAppliers.clear();
2200 *   convection_BC_appliers.clear();
2201 *   interpolatoryConstraintAppliers.clear();
2202 *   no_normal_flux_constraints.clear();
2203 *   increment_interpolation_handlers.clear();
2204 *   initial_velocity_interpolation_handlers.clear();
2205 *   initial_deformation_interpolation_handlers.clear();
2206 *   boundary_unidirectional_penalty_specs.clear();
2207 *  
2208 *   }
2209 *  
2210 *  
2211 *   } /* namespace PlasticityLab */
2212 *  
2213 *   #endif /* LBCSYSTEM_H_ */
2214 * @endcode
2215
2216
2217<a name="ann-src/Material.h"></a>
2218<h1>Annotated version of src/Material.h</h1>
2219 *
2220 *
2221 *
2222 *
2223 * @code
2224 *   /*
2225 *   * Material.h
2226 *   *
2227 *   * Created on: 05 Jan 2015
2228 *   * Author: maien
2229 *   */
2230 *  
2231 *   #ifndef MATERIAL_H_
2232 *   #define MATERIAL_H_
2233 *  
2234 *   using namespace dealii;
2235 *  
2236 *   #include "ConstitutiveModelRequest.h"
2237 *   #include <stdexcept>
2238 *  
2239 *   namespace PlasticityLab {
2240 *  
2241 *   typedef size_t point_index_t;
2242 *  
2243 *   template <int dim, typename Number = double>
2244 *   class Material {
2245 *   public:
2246 *   virtual ~Material() = 0;
2247 *  
2248 *   virtual void compute_constitutive_request(
2249 *   ConstitutiveModelRequest <dim, Number> &constitutive_request,
2250 *   const point_index_t &point_index) = 0;
2251 *  
2252 *   virtual Number get_material_Jacobian(const point_index_t &point_index) const = 0;
2253 *   virtual ::SymmetricTensor<2, dim, Number> get_plastic_strain(const point_index_t &point_index) const = 0;
2254 *  
2255 *   virtual void setup_point_history(const point_index_t point_count) = 0;
2256 *  
2257 *   virtual std::vector<Number> get_state_parameters(
2258 *   const point_index_t &point_index,
2259 *   const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) const = 0;
2260 *  
2261 *   virtual void set_state_parameters(
2262 *   const point_index_t &point_index,
2263 *   const std::vector<Number> &state_parameters,
2264 *   const Tensor<2, dim, Number> &reference_transformation) = 0;
2265 *   virtual size_t get_material_parameter_count() const = 0;
2266 *  
2267 *   };
2268 *  
2269 *   template <int dim, typename Number>
2270 *   inline Material<dim, Number>::~Material() {
2271 *   }
2272 *  
2273 *   class MaterialDomainException: public std::runtime_error {
2274 *   public:
2275 *   MaterialDomainException();
2276 *   MaterialDomainException(std::string s): std::runtime_error(s) {};
2277 *   };
2278 *  
2279 *   } /* namespace PlasticityLab */
2280 *  
2281 *   #endif /* MATERIAL_H_ */
2282 * @endcode
2283
2284
2285<a name="ann-src/MixedFEProjector.h"></a>
2286<h1>Annotated version of src/MixedFEProjector.h</h1>
2287 *
2288 *
2289 *
2290 *
2291 * @code
2292 *   /*
2293 *   * MixedFEProjector.h
2294 *   *
2295 *   * Created on: 21 Jul 2015
2296 *   * Author: maien
2297 *   */
2298 *  
2299 *   #ifndef MIXEDFEPROJECTOR_H_
2300 *   #define MIXEDFEPROJECTOR_H_
2301 *  
2302 *   #include <vector>
2303 *  
2304 *   #include <deal.II/base/tensor.h>
2305 *   #include <deal.II/fe/fe_values.h>
2306 *  
2307 *   #include <deal.II/lac/vector.h>
2308 *  
2309 *   #include "utilities.h"
2310 *  
2311 *   template <int dim, typename Number = double>
2312 *   class MixedFEProjector {
2313 *   public:
2314 *   MixedFEProjector();
2315 *   MixedFEProjector(
2316 *   const unsigned int mixed_dofs_per_cell,
2317 *   const ::FEValues<dim> &mixed_fe_values);
2318 *   virtual ~MixedFEProjector();
2319 *  
2320 *   template <typename T>
2321 *   void project(
2322 *   std::vector<T> *coefficients_of_mixed_dofs,
2323 *   const std::vector<T> &values_at_q_points) const;
2324 *  
2325 *   private:
2326 *   unsigned int n_q_points;
2327 *   unsigned int mixed_dofs_per_cell;
2328 *   std::vector<std::vector<Number > > M_inv_ksi;
2329 *   };
2330 *  
2331 *   template <int dim, typename Number>
2332 *   MixedFEProjector<dim, Number>::MixedFEProjector():
2333 *   n_q_points(0),
2334 *   mixed_dofs_per_cell(0),
2335 *   M_inv_ksi(0) {
2336 *  
2337 *   }
2338 *  
2339 *   template <int dim, typename Number>
2340 *   MixedFEProjector<dim, Number>::MixedFEProjector(
2341 *   const unsigned int mixed_dofs_per_cell,
2342 *   const ::FEValues<dim> &mixed_fe_values)
2343 *   : n_q_points (mixed_fe_values.get_quadrature().size()),
2344 *   mixed_dofs_per_cell (mixed_dofs_per_cell),
2345 *   M_inv_ksi (n_q_points, std::vector<Number>(mixed_dofs_per_cell)) {
2346 *   ::FullMatrix<Number> M_matrix(mixed_dofs_per_cell, mixed_dofs_per_cell),
2347 *   M_inv(mixed_dofs_per_cell, mixed_dofs_per_cell);
2348 *   std::vector<::Vector<Number> > ksi(n_q_points, ::Vector<Number>(mixed_dofs_per_cell));
2349 *  
2350 *   M_matrix = 0;
2351 *   for (unsigned int q_point = 0; q_point < n_q_points;
2352 *   ++q_point) {
2353 * @endcode
2354 *
2355 * Prep to compute mixed primary variables (Simo & Miehe 1992)
2356 *
2357 * @code
2358 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
2359 *   const Number i_value = mixed_fe_values.shape_value (i, q_point);
2360 *   for (unsigned int j = 0; j < mixed_dofs_per_cell; ++j) {
2361 *   const Number j_value = mixed_fe_values.shape_value (j, q_point);
2362 *   M_matrix(i, j) += i_value * j_value * mixed_fe_values.quadrature_point(q_point)[0] * mixed_fe_values.JxW(q_point);
2363 *   }
2364 *   ksi.at(q_point)[i] = i_value * mixed_fe_values.quadrature_point(q_point)[0] * mixed_fe_values.JxW(q_point);
2365 *   }
2366 *   }
2367 *  
2368 *   M_inv.invert(M_matrix);
2369 *  
2370 *   for (unsigned int q_point = 0; q_point < n_q_points;
2371 *   ++q_point) {
2372 *   ::Vector<Number> M_inv_ksi_at_q_point(mixed_dofs_per_cell);
2373 *   M_inv.vmult(M_inv_ksi_at_q_point, ksi.at(q_point), false);
2374 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i)
2375 *   M_inv_ksi[q_point][i] = M_inv_ksi_at_q_point(i);
2376 *   }
2377 *   }
2378 *  
2379 *   template <int dim, typename Number>
2380 *   MixedFEProjector<dim, Number>::~MixedFEProjector() {}
2381 *  
2382 *   template <int dim, typename Number>
2383 *   template <typename T>
2384 *   void MixedFEProjector<dim, Number>::project(
2385 *   std::vector<T> *coefficients_of_mixed_dofs,
2386 *   const std::vector<T> &values_at_q_points) const {
2387 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
2388 *   coefficients_of_mixed_dofs->at(i) = M_inv_ksi[0][i] * values_at_q_points[0];
2389 *   for (unsigned int q_point = 1; q_point < n_q_points; ++q_point)
2390 *   coefficients_of_mixed_dofs->at(i) += M_inv_ksi[q_point][i] * values_at_q_points[q_point];
2391 *   }
2392 *   }
2393 *  
2394 *   #endif /* MIXEDFEPROJECTOR_H_ */
2395 * @endcode
2396
2397
2398<a name="ann-src/NewtonStepSystem.h"></a>
2399<h1>Annotated version of src/NewtonStepSystem.h</h1>
2400 *
2401 *
2402 *
2403 *
2404 * @code
2405 *   /*
2406 *   * NewtonStepSystem.h
2407 *   *
2408 *   * Created on: 05 May 2015
2409 *   * Author: maien
2410 *   */
2411 *  
2412 *   #ifndef NEWTONSTEPSYSTEM_H_
2413 *   #define NEWTONSTEPSYSTEM_H_
2414 *  
2415 *  
2416 *   #include <deal.II/lac/trilinos_sparse_matrix.h>
2417 *   #include <deal.II/lac/trilinos_vector.h>
2418 *   #include <deal.II/lac/sparsity_tools.h>
2419 *  
2420 *   #include "DoFSystem.h"
2421 *   #include "Constants.h"
2422 *  
2423 *   using namespace dealii;
2424 *  
2425 *   namespace PlasticityLab {
2426 *  
2427 *   class NewtonStepSystem {
2428 *   public:
2429 *  
2430 *   template<class DoFSystemType>
2431 *   void setup(const DoFSystemType &dof_system) {
2432 *   TrilinosWrappers::SparsityPattern sparsity_pattern(
2433 *   dof_system.locally_owned_dofs,
2434 *   mpi_communicator);
2435 *  
2437 *   dof_system.dof_handler, sparsity_pattern,
2438 *   dof_system.nodal_constraints,
2439 *   false,
2440 *   Utilities::MPI::this_mpi_process(mpi_communicator));
2441 *  
2442 *   sparsity_pattern.compress();
2443 *   Newton_step_matrix.reinit(sparsity_pattern);
2444 *   Newton_step_solution.reinit(
2445 *   dof_system.locally_owned_dofs,
2446 *   mpi_communicator);
2447 *   current_increment.reinit(
2448 *   dof_system.locally_owned_dofs,
2449 *   dof_system.locally_relevant_dofs,
2450 *   mpi_communicator);
2451 *   Newton_step_residual.reinit(
2452 *   dof_system.locally_owned_dofs,
2453 *   mpi_communicator);
2454 *   previous_deformation.reinit(
2455 *   dof_system.locally_owned_dofs,
2456 *   dof_system.locally_relevant_dofs,
2457 *   mpi_communicator);
2458 *  
2459 *   previous_time_derivative.reinit(
2460 *   dof_system.locally_owned_dofs,
2461 *   dof_system.locally_relevant_dofs,
2462 *   mpi_communicator);
2463 *   previous_second_time_derivative.reinit(
2464 *   dof_system.locally_owned_dofs,
2465 *   dof_system.locally_relevant_dofs,
2466 *   mpi_communicator);
2467 *  
2468 *   _locally_owned_current_increment.reinit(
2469 *   dof_system.locally_owned_dofs,
2470 *   mpi_communicator);
2471 *   _locally_owned_previous_deformation.reinit(
2472 *   dof_system.locally_owned_dofs,
2473 *   mpi_communicator);
2474 *  
2475 *   _locally_owned_previous_time_derivative.reinit(
2476 *   dof_system.locally_owned_dofs,
2477 *   mpi_communicator);
2478 *   _locally_owned_previous_second_time_derivative.reinit(
2479 *   dof_system.locally_owned_dofs,
2480 *   mpi_communicator);
2481 *   }
2482 *  
2483 *   template<class DoFSystemType>
2484 *   void update_matrix_constraints(const DoFSystemType &dof_system) {
2485 *   TrilinosWrappers::SparsityPattern sparsity_pattern(
2486 *   dof_system.locally_owned_dofs,
2487 *   mpi_communicator);
2488 *  
2490 *   dof_system.dof_handler, sparsity_pattern,
2491 *   dof_system.nodal_constraints,
2492 *   false,
2493 *   Utilities::MPI::this_mpi_process(mpi_communicator));
2494 *  
2495 *   sparsity_pattern.compress();
2496 *   Newton_step_matrix.reinit(sparsity_pattern);
2497 *   }
2498 *  
2499 *   void advance_time(double delta_t, double rho_infty, const bool reset_increment=true) {
2500 *   {
2501 *   double alpha_m, alpha_f, gamma, beta;
2502 *   get_generalized_alpha_method_params(
2503 *   &alpha_m, &alpha_f, &gamma, &beta, rho_infty);
2504 *  
2505 *   _locally_owned_previous_time_derivative = previous_time_derivative;
2506 *   _locally_owned_previous_second_time_derivative = previous_second_time_derivative;
2507 *  
2508 *   const TrilinosWrappers::MPI::Vector previous_second_time_derivative_backup(_locally_owned_previous_second_time_derivative);
2509 *  
2510 *   _locally_owned_previous_second_time_derivative = current_increment;
2511 *   _locally_owned_previous_second_time_derivative.add(
2512 *   -delta_t,
2513 *   _locally_owned_previous_time_derivative,
2514 *   -delta_t*delta_t*(0.5-beta),
2515 *   previous_second_time_derivative_backup);
2516 *   _locally_owned_previous_second_time_derivative *= (1./(beta*delta_t*delta_t));
2517 *   _locally_owned_previous_time_derivative.add(
2518 *   delta_t*(1.-gamma),
2519 *   previous_second_time_derivative_backup,
2520 *   delta_t*gamma,
2521 *   _locally_owned_previous_second_time_derivative);
2522 *  
2523 *  
2524 *   previous_time_derivative = _locally_owned_previous_time_derivative;
2525 *   previous_second_time_derivative = _locally_owned_previous_second_time_derivative;
2526 *  
2527 *   }
2528 *  
2529 * @endcode
2530 *
2531 * Update the deformation vector with the computed increment.
2532 *
2533 * @code
2534 *   add_current_increment_to_previous_deformation();
2535 *  
2536 *   if(reset_increment) {
2537 *   current_increment = 0;
2538 *   }
2539 *   }
2540 *  
2541 * @endcode
2542 *
2543 * Add the current Newton increment into the deformation vector, i.e.
2544 * compute previous_deformation += current_increment.
2545 *
2546
2547 *
2548 * 'previous_deformation' is a vector with ghost entries and therefore
2549 * read-only: we are not allowed to write into it (with the exception of
2550 * setting it to zero). We therefore carry out the arithmetic in
2551 * fully-distributed (locally-owned) temporary vectors and only assign the
2552 * result back into the ghosted vector at the very end; that assignment
2553 * performs the necessary ghost-value communication.
2554 *
2555 * @code
2556 *   void add_current_increment_to_previous_deformation() {
2557 *   _locally_owned_previous_deformation = previous_deformation;
2558 *   _locally_owned_current_increment = current_increment;
2559 *   _locally_owned_previous_deformation += _locally_owned_current_increment;
2560 *   previous_deformation = _locally_owned_previous_deformation;
2561 *   }
2562 *  
2563 * @endcode
2564 *
2565 * Set the deformation vector to the negative of the current increment,
2566 * i.e. compute previous_deformation = -current_increment.
2567 *
2568
2569 *
2570 * As above, 'previous_deformation' is a ghosted, read-only vector, so the
2571 * negation is performed in a fully-distributed temporary and only the
2572 * result is assigned back into the ghosted vector.
2573 *
2574 * @code
2575 *   void set_previous_deformation_to_negative_current_increment() {
2576 *   _locally_owned_current_increment = current_increment;
2577 *   _locally_owned_current_increment *= -1;
2578 *   previous_deformation = _locally_owned_current_increment;
2579 *   }
2580 *  
2581 *   TrilinosWrappers::SparseMatrix Newton_step_matrix;
2582 *   TrilinosWrappers::MPI::Vector previous_deformation;
2583 *   TrilinosWrappers::MPI::Vector current_increment;
2584 *   TrilinosWrappers::MPI::Vector Newton_step_solution;
2585 *   TrilinosWrappers::MPI::Vector Newton_step_residual;
2586 *  
2587 *   TrilinosWrappers::MPI::Vector previous_time_derivative;
2588 *   TrilinosWrappers::MPI::Vector previous_second_time_derivative;
2589 *  
2590 *   TrilinosWrappers::MPI::Vector _locally_owned_previous_deformation;
2591 *   TrilinosWrappers::MPI::Vector _locally_owned_current_increment;
2592 *   TrilinosWrappers::MPI::Vector _locally_owned_previous_time_derivative;
2593 *   TrilinosWrappers::MPI::Vector _locally_owned_previous_second_time_derivative;
2594 *   };
2595 *  
2596 *   } /* namespace PlasticityLab */
2597 *  
2598 *   #endif /* NEWTONSTEPSYSTEM_H_ */
2599 * @endcode
2600
2601
2602<a name="ann-src/PlasticityLabProg.cpp"></a>
2603<h1>Annotated version of src/PlasticityLabProg.cpp</h1>
2604 *
2605 *
2606 *
2607 *
2608 * @code
2609 *   /*
2610 *   * PlasticityLabProg.cpp
2611 *   *
2612 *   * Created on: 09 Jul 2014
2613 *   * Author: cerecam
2614 *   */
2615 *  
2616 *   #include <deal.II/lac/sparsity_tools.h>
2617 *   #include <deal.II/lac/solver_bicgstab.h>
2618 *   #include <deal.II/lac/solver_gmres.h>
2619 *   #include <deal.II/lac/precondition.h>
2620 *   #include <deal.II/lac/trilinos_block_sparse_matrix.h>
2621 *   #include <deal.II/lac/trilinos_parallel_block_vector.h>
2622 *   #include <deal.II/lac/trilinos_precondition.h>
2623 *   #include <deal.II/lac/trilinos_solver.h>
2624 *  
2625 *   #include <deal.II/lac/affine_constraints.h>
2626 *  
2627 *   #include "TimeRateUpdateFlags.h"
2628 *   #include "TimeRateRequest.h"
2629 *  
2630 *   #include "PlasticityLabProg.h"
2631 *   #include "PlasticityLabProgDrivers.cpp"
2632 *  
2633 *   #include "ReferencePoint.h"
2634 *   #include "RemappedPoint.h"
2635 *  
2636 *   using namespace dealii;
2637 *   using std::endl;
2638 *  
2639 *   namespace PlasticityLab {
2640 *   template <int dim, typename Number>
2641 *   PlasticityLabProg<dim, Number>::PlasticityLabProg(
2642 *   Material<dim+1, Number> &material) :
2643 *   mpi_communicator(MPI_COMM_WORLD),
2644 *   pcout(std::cout,
2645 *   (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)),
2646 *   order(1),
2647 *   mech_fe(FE_Q<dim>(order), dim, FE_Q<dim>(order), 1),
2648 *   therm_fe(order),
2649 *   mixed_var_fe(order-1),
2650 *   mesh_motion_fe(FE_Q<dim>(order), dim),
2651 *   mapping (order),
2652 *   triangulation(mpi_communicator),
2653 *   mech_dof_system(triangulation, mapping),
2654 *   therm_dof_system (triangulation, mapping),
2655 *   mixed_fe_dof_system(triangulation, mapping),
2656 *   mesh_motion_dof_system(triangulation, mapping),
2657 *   quadrature_formula(order+1),
2658 *   face_quadrature_formula(order+1),
2659 *   material(material) { }
2660 *  
2661 *  
2662 *   template <int dim, typename Number>
2663 *   PlasticityLabProg<dim, Number>::~PlasticityLabProg() {
2664 *  
2665 *   }
2666 *  
2667 *   template <int dim, typename Number>
2668 *   template <typename TriangulationType, typename MaterialType>
2669 *   void PlasticityLabProg<dim, Number>::setup_material_data(
2670 *   TriangulationType &triangulation,
2671 *   MaterialType &material) {
2672 *   const unsigned int num_cells = triangulation.n_active_cells();
2673 *   triangulation.clear_user_data();
2674 *   material.setup_point_history(num_cells * quadrature_formula.size());
2675 *   unsigned int history_index = 0;
2677 *   cell = triangulation.begin_active();
2678 *   cell != triangulation.end(); ++cell) {
2679 *   cell->set_user_index (history_index);
2680 *   history_index += quadrature_formula.size();
2681 *   }
2682 *   }
2683 *  
2684 *   template <int dim, typename Number>
2685 *   void PlasticityLabProg<dim, Number>::setup_material_area_factors(
2686 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
2687 *   std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors) {
2688 *  
2690 *   mapping,
2691 *   mesh_motion_fe,
2692 *   face_quadrature_formula,
2694 *   const unsigned int n_face_q_points = face_quadrature_formula.size();
2695 *  
2696 *   for (auto cell = mesh_motion_dof_system.dof_handler.begin_active();
2697 *   cell != mesh_motion_dof_system.dof_handler.end();
2698 *   ++cell) {
2699 *   if (cell->is_locally_owned()) {
2700 *   for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
2701 *   if(cell->at_boundary(face)) {
2702 *   fe_face_values.reinit(cell, face);
2703 *  
2704 *   for (unsigned int q_point = 0; q_point < n_face_q_points; q_point++) {
2705 *   const unsigned int cell_index = cell->user_index() / quadrature_formula.size();
2706 *   const unsigned int surface_point_key =
2707 *   cell_index * GeometryInfo<dim>::faces_per_cell * n_face_q_points
2708 *   + face * n_face_q_points
2709 *   + q_point;
2710 *   material_area_factors[surface_point_key] = postprocess_tensor_dimension(fe_face_values.normal_vector(q_point), 0);
2711 *   }
2712 *   }
2713 *   }
2714 *   }
2715 *   }
2716 *   }
2717 *  
2718 *   template <int dim, typename Number>
2719 *   void PlasticityLabProg<dim, Number>::update_material_area_factors(
2720 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
2721 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
2722 *   std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors) {
2723 *  
2725 *   mapping,
2726 *   mesh_motion_fe,
2727 *   face_quadrature_formula,
2729 *  
2730 *   const unsigned int n_face_q_points = face_quadrature_formula.size();
2731 *  
2732 *   const FEValuesExtractors::Vector displacements (0);
2733 *  
2734 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_face_q_points);
2735 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_face_q_points);
2736 *  
2737 *   for (auto cell = mesh_motion_dof_system.dof_handler.begin_active();
2738 *   cell != mesh_motion_dof_system.dof_handler.end();
2739 *   ++cell) {
2740 *   if (cell->is_locally_owned()) {
2741 *   for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
2742 *   if(cell->at_boundary(face)) {
2743 *   fe_face_values.reinit(cell, face);
2744 *  
2745 *   fe_face_values[displacements].get_function_gradients(
2746 *   mesh_motion_nonlinear_system.current_increment,
2747 *   mesh_motion_gradient_increments);
2748 *  
2749 *   fe_face_values[displacements].get_function_values(
2750 *   mesh_motion_nonlinear_system.current_increment,
2751 *   mesh_motion_value_increments);
2752 *  
2753 *   for (unsigned int q_point = 0; q_point < n_face_q_points; q_point++) {
2754 *   const unsigned int cell_index = cell->user_index() / quadrature_formula.size();
2755 *   const unsigned int surface_point_key =
2756 *   cell_index * GeometryInfo<dim>::faces_per_cell * n_face_q_points
2757 *   + face * n_face_q_points
2758 *   + q_point;
2759 *  
2760 *   const auto mesh_motion_gradient = get_deformation_gradient(
2761 *   -mesh_motion_gradient_increments[q_point],
2762 *   -mesh_motion_value_increments[q_point][0]
2763 *   /fe_face_values.quadrature_point(q_point)[0]);
2764 *  
2765 *   material_area_factors[surface_point_key] = std::pow(determinant(mesh_motion_gradient), -1)
2766 *   * transpose(mesh_motion_gradient)
2767 *   * material_area_factors[surface_point_key];
2768 *   }
2769 *   }
2770 *   }
2771 *   }
2772 *   }
2773 *   }
2774 *  
2775 *   template <int dim, typename Number>
2776 *   template <typename TriangulationType>
2777 *   void PlasticityLabProg<dim, Number>::setup_mixed_fe_projection_data(
2778 *   const TriangulationType &triangulation,
2779 *   std::vector< MixedFEProjector<dim, Number> > &MixedFeProjectors,
2780 *   const FiniteElement<dim> &MixedFE,
2781 *   const Quadrature<dim> &quadrature_formula) {
2782 *  
2783 *   FEValues<dim> mixed_fe_values(
2784 *   mapping,
2785 *   MixedFE,
2786 *   quadrature_formula,
2788 *  
2789 *   const unsigned int num_cells = triangulation.n_active_cells(),
2790 *   n_q_points = quadrature_formula.size(),
2791 *   mixed_dofs_per_cell = MixedFE.dofs_per_cell;
2792 *   MixedFeProjectors.clear();
2793 *   MixedFeProjectors.resize(num_cells);
2795 *   cell = triangulation.begin_active();
2796 *   cell != triangulation.end(); ++cell) {
2797 *   mixed_fe_values.reinit(cell);
2798 *   MixedFeProjectors.at(cell->user_index() / n_q_points) =
2799 *   MixedFEProjector<dim, Number>(mixed_dofs_per_cell,
2800 *   mixed_fe_values);
2801 *   }
2802 *   }
2803 *  
2804 *   template<int dim, typename Number>
2805 *   void PlasticityLabProg<dim, Number>::remap_material_state_variables(
2806 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
2807 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
2808 *   const NewtonStepSystem &mechanical_nonlinear_system,
2809 *   const DoFSystem<dim, Number> &mechanical_dof_system,
2810 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
2811 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
2812 *   Material<dim+1, Number> &material,
2813 *   std::unordered_map<point_index_t, Tensor<2, dim+1, Number>> &remapped_deformation_gradients) {
2814 *  
2815 *   const unsigned int n_q_points = quadrature_formula.size();
2816 *   [[maybe_unused]] const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
2817 *   const unsigned int mixed_dofs_per_cell = mixed_fe_dof_system.dof_handler.get_fe().dofs_per_cell;
2818 *  
2819 *   FEValues<dim> mesh_motion_fe_values(
2820 *   mapping,
2821 *   mesh_motion_fe,
2822 *   quadrature_formula,
2824 *  
2825 *   FEValues<dim> mechanical_fe_values(
2826 *   mapping,
2827 *   mech_fe,
2828 *   quadrature_formula,
2830 *  
2831 *   FEValues<dim> mixed_fe_values(
2832 *   mapping,
2833 *   mixed_fe_dof_system.dof_handler.get_fe(),
2834 *   quadrature_formula,
2835 *   update_values);
2836 *  
2837 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
2838 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
2839 *  
2840 *   std::vector< Tensor<1, dim, Number> > previous_deformation_values(n_q_points);
2841 *   std::vector< Tensor<2, dim, Number> > previous_deformation_gradients(n_q_points);
2842 *   std::vector< Tensor<1, dim, Number> > previous_deformation_value_at_remapped_point(1);
2843 *   std::vector< Tensor<2, dim, Number> > previous_deformation_gradient_at_remapped_point(1);
2844 *  
2845 *   const unsigned int material_parameter_count = material.get_material_parameter_count();
2846 *  
2847 *   const FEValuesExtractors::Vector displacements(0);
2849 *  
2850 *   std::vector<ReferencePoint<dim, Number>> reference_points;
2851 *   std::vector<Point<dim, Number>> remapped_point_positions;
2852 *  
2853 *   for (auto cell = mesh_motion_dof_system.dof_handler.begin_active();
2854 *   cell != mesh_motion_dof_system.dof_handler.end();
2855 *   ++cell) {
2856 *   if (cell->is_locally_owned()) {
2857 *   mesh_motion_fe_values.reinit(cell);
2858 *  
2859 *   mesh_motion_fe_values[displacements].get_function_values(
2860 *   mesh_motion_nonlinear_system.current_increment,
2861 *   mesh_motion_value_increments);
2862 *  
2863 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
2864 *   [[maybe_unused]] const point_index_t quadrature_point_index = cell->user_index() + q_point;
2865 *   const Point<dim, Number> reference_point_position = mesh_motion_fe_values.quadrature_point(q_point);
2866 *   const Point<dim, Number> remapped_point_position = reference_point_position - mesh_motion_value_increments[q_point];
2867 *  
2868 *   ReferencePoint<dim, Number> reference_point;
2869 *   reference_point.mesh_motion_cell = cell;
2870 *   reference_point.q_point = q_point;
2871 *   reference_point.reference_point = reference_point_position;
2872 *   reference_point.remapped_point = remapped_point_position;
2873 *  
2874 *   reference_points.push_back(reference_point);
2875 *   remapped_point_positions.push_back(remapped_point_position);
2876 *  
2877 *   }
2878 *  
2879 *   }
2880 *   }
2881 *  
2882 *   MPI_Barrier(mpi_communicator);
2883 *  
2884 *   MPI_Datatype PointType;
2885 *   MPI_Type_contiguous(dim, MPI_DOUBLE, &PointType);
2886 *   MPI_Type_commit(&PointType);
2887 *   std::vector<int> displs;
2888 *   std::vector< Point<dim, Number>> received_remapped_positions;
2889 *   std::vector<RemappedPoint<dim, Number>> remapped_points;
2890 *   int nprocesses, this_process;
2891 *   int num_reference_points = reference_points.size();
2892 *   MPI_Comm_size(mpi_communicator, &nprocesses);
2893 *   std::vector<int> reference_point_counts(nprocesses);
2894 *   MPI_Allgather(
2895 *   &num_reference_points,
2896 *   1, MPI_INT,
2897 *   &reference_point_counts[0],
2898 *   1, MPI_INT,
2899 *   mpi_communicator);
2900 *   MPI_Comm_rank(mpi_communicator, &this_process);
2901 *   displs.resize(nprocesses);
2902 *   displs[0] = 0;
2903 *   for (int i = 1; i < nprocesses; ++i) {
2904 *   displs[i] = displs[i - 1] + reference_point_counts[i - 1];
2905 *   }
2906 *  
2907 *   const unsigned int count_received_reference_points = displs[nprocesses - 1] + reference_point_counts[nprocesses - 1];
2908 *   received_remapped_positions.resize(count_received_reference_points);
2909 *   remapped_points.resize(count_received_reference_points);
2910 *   std::vector<char> this_process_owns_remapped_point(count_received_reference_points);
2911 *  
2912 *   MPI_Allgatherv(
2913 *   &remapped_point_positions[0],
2914 *   num_reference_points,
2915 *   PointType,
2916 *   &received_remapped_positions[0],
2917 *   &reference_point_counts[0],
2918 *   &displs[0],
2919 *   PointType,
2920 *   mpi_communicator);
2921 *  
2922 *   MPI_Barrier(mpi_communicator);
2923 *  
2924 *   for(unsigned int received_point_id=0; received_point_id < count_received_reference_points; received_point_id++) {
2925 *   auto point = received_remapped_positions[received_point_id];
2926 *   auto cell_and_point = GridTools::find_active_cell_around_point(
2927 *   mapping,
2928 *   mesh_motion_dof_system.dof_handler,
2929 *   point);
2930 *   auto cell = cell_and_point.first;
2931 *   auto unit_cell_point = cell_and_point.second;
2932 * @endcode
2933 *
2934 * here, we're assuming that `find_active_cell_around_point` returns the same
2935 * cell and point when called with different dof_handlers
2936 *
2937 * @code
2938 *   auto mechanical_cell_and_point = GridTools::find_active_cell_around_point(
2939 *   mapping,
2940 *   mechanical_dof_system.dof_handler,
2941 *   point);
2942 *   auto mechanical_cell = mechanical_cell_and_point.first;
2943 *   auto mixed_fe_cell_and_point = GridTools::find_active_cell_around_point(
2944 *   mapping,
2945 *   mixed_fe_dof_system.dof_handler,
2946 *   point);
2947 *   auto mixed_fe_cell = mixed_fe_cell_and_point.first;
2948 *  
2949 *   remapped_points[received_point_id].remapped_point = point;
2950 *   remapped_points[received_point_id].mesh_motion_cell = cell;
2951 *   remapped_points[received_point_id].unit_cell_point = unit_cell_point;
2952 *   remapped_points[received_point_id].field_cell = mechanical_cell;
2953 *   remapped_points[received_point_id].mixed_fe_cell = mixed_fe_cell;
2954 *   this_process_owns_remapped_point[received_point_id] = cell.state() == IteratorState::valid && cell->is_locally_owned()? 1 : 0;
2955 *   }
2956 *  
2957 *   MPI_Barrier(mpi_communicator);
2958 *  
2959 *   std::vector<char> remapped_point_candidates(num_reference_points * nprocesses);
2960 *   for (int process = 0; process < nprocesses; ++process) {
2961 *   if (reference_point_counts[process] > 0)
2962 *   MPI_Gather(
2963 *   &this_process_owns_remapped_point[displs[process]],
2964 *   reference_point_counts[process],
2965 *   MPI_C_BOOL,
2966 *   &remapped_point_candidates[0],
2967 *   reference_point_counts[process],
2968 *   MPI_C_BOOL,
2969 *   process,
2970 *   mpi_communicator);
2971 *   }
2972 *  
2973 *   std::vector<unsigned int> remapped_point_owning_process(num_reference_points);
2974 *  
2975 *   for (int i = 0; i < num_reference_points; ++i) {
2976 *   remapped_point_owning_process[i] = 0;
2977 *   for (int j = 1; j < nprocesses; ++j) {
2978 *   if (remapped_point_candidates[j * num_reference_points + i] == 1) {
2979 *   remapped_point_owning_process[i] = j;
2980 *   continue;
2981 *   }
2982 *   }
2983 *   }
2984 *  
2985 *   std::vector<RemappedPoint<dim, Number>> mapping_remapped_points;
2986 *   std::vector<unsigned int> mapping_reference_point_owning_process;
2987 *   std::vector<unsigned int> mapping_reference_point_index_at_remote_process;
2988 *  
2989 * @endcode
2990 *
2991 * This should really be a vector<bool>, but addresses of individual elements of
2992 * vector<bool> cannot be taken. It's a template specialization to save space
2993 *
2994 * @code
2995 *   std::vector<char> remote_remapped_point_is_accepted(num_reference_points * nprocesses);
2996 *   std::vector<char> local_remapped_point_is_accepted(count_received_reference_points);
2997 *   for (int i = 0; i < num_reference_points; ++i) {
2998 *   for (unsigned int j = 0; j < static_cast<unsigned int>(nprocesses); ++j) {
2999 *   remote_remapped_point_is_accepted[j * num_reference_points + i] = (remapped_point_owning_process[i] == j) ? 1 : 0;
3000 *   }
3001 *   }
3002 *  
3003 *   MPI_Barrier(mpi_communicator);
3004 *  
3005 *   for (int process = 0; process < nprocesses; ++process) {
3006 *   if (reference_point_counts[process] > 0) {
3007 *   MPI_Scatter(
3008 *   &remote_remapped_point_is_accepted[0],
3009 *   reference_point_counts[process],
3010 *   MPI_C_BOOL,
3011 *   &local_remapped_point_is_accepted[displs[process]],
3012 *   reference_point_counts[process],
3013 *   MPI_C_BOOL,
3014 *   process,
3015 *   mpi_communicator);
3016 *   }
3017 *   }
3018 *  
3019 *   std::vector<unsigned int> mapping_remote_reference_point_counts(nprocesses, 0);
3020 *   for (int process = 0; process < nprocesses; ++process) {
3021 *   for (int i = 0; i < reference_point_counts[process]; ++i) {
3022 *   if (local_remapped_point_is_accepted[displs[process] + i]) {
3023 *   RemappedPoint<dim, Number> accepted_remapped_point = remapped_points[displs[process] + i];
3024 *  
3025 *   mapping_remapped_points.push_back(accepted_remapped_point);
3026 *   mapping_reference_point_owning_process.push_back(process);
3027 *   mapping_reference_point_index_at_remote_process.push_back(i);
3028 *   ++mapping_remote_reference_point_counts[process];
3029 *   }
3030 *   }
3031 *   }
3032 *  
3033 *   MPI_Barrier(mpi_communicator);
3034 *  
3035 *   std::vector<unsigned int> mapping_remote_remapped_point_counts(nprocesses);
3036 *   for (int i = 0; i < nprocesses; ++i) {
3037 *   MPI_Scatter(
3038 *   &mapping_remote_reference_point_counts[0],
3039 *   1, MPI_UNSIGNED,
3040 *   &mapping_remote_remapped_point_counts[i],
3041 *   1, MPI_UNSIGNED,
3042 *   i, mpi_communicator);
3043 *   }
3044 *  
3045 *   {
3046 *   std::vector<std::vector<Number> > local_state_parameter_groups(nprocesses);
3047 *   std::vector<std::vector<Number> > remote_state_parameter_groups(nprocesses);
3048 *  
3049 *   std::vector<std::vector<Number> > local_deformation_gradient_groups(nprocesses);
3050 *   std::vector<std::vector<Number> > remote_deformation_gradient_groups(nprocesses);
3051 *  
3052 *   for (int i = 0; i < nprocesses; ++i) {
3053 *   local_state_parameter_groups.at(i).resize(material_parameter_count * mapping_remote_reference_point_counts.at(i));
3054 *   remote_state_parameter_groups.at(i).resize(material_parameter_count * mapping_remote_remapped_point_counts.at(i));
3055 *  
3056 *   local_deformation_gradient_groups.at(i).resize((dim+1) * (dim+1) * mapping_remote_reference_point_counts.at(i));
3057 *   remote_deformation_gradient_groups.at(i).resize((dim+1) * (dim+1) * mapping_remote_remapped_point_counts.at(i));
3058 *   }
3059 *  
3060 *   std::vector<unsigned int> next_to_process(nprocesses, 0);
3061 *   for (unsigned int i = 0; i < mapping_remapped_points.size(); ++i) {
3062 *   const unsigned int group = mapping_reference_point_owning_process.at(i);
3063 *   const RemappedPoint<dim, Number> remapped_point = mapping_remapped_points.at(i);
3064 *  
3065 *   Quadrature<dim> remapped_point_quadrature(
3066 *   std::vector<Point<dim, Number>> (1, remapped_point.unit_cell_point));
3067 *  
3068 *   FEValues<dim> remapped_point_fe_values(
3069 *   mapping,
3070 *   mesh_motion_fe,
3071 *   remapped_point_quadrature,
3073 *  
3074 *   FEValues<dim> remapped_point_mechanical_fe_values(
3075 *   mapping,
3076 *   mech_fe,
3077 *   remapped_point_quadrature,
3079 *  
3080 *   FEValues<dim> remapped_point_mixed_fe_values(
3081 *   mapping,
3082 *   mixed_fe_dof_system.dof_handler.get_fe(),
3083 *   remapped_point_quadrature,
3084 *   update_values);
3085 *  
3086 *   remapped_point_fe_values.reinit(remapped_point.mesh_motion_cell);
3087 *   mesh_motion_fe_values.reinit(remapped_point.mesh_motion_cell);
3088 *  
3089 *   remapped_point_mechanical_fe_values.reinit(remapped_point.field_cell);
3090 *   mechanical_fe_values.reinit(remapped_point.field_cell);
3091 *  
3092 *   remapped_point_mixed_fe_values.reinit(remapped_point.mixed_fe_cell);
3093 *  
3094 *   mesh_motion_fe_values[displacements].get_function_gradients(
3095 *   mesh_motion_nonlinear_system.current_increment,
3096 *   mesh_motion_gradient_increments);
3097 *  
3098 *   mesh_motion_fe_values[displacements].get_function_values(
3099 *   mesh_motion_nonlinear_system.current_increment,
3100 *   mesh_motion_value_increments);
3101 *  
3102 *   mechanical_fe_values[displacements].get_function_gradients(
3103 *   mechanical_nonlinear_system.previous_deformation,
3104 *   previous_deformation_gradients);
3105 *  
3106 *   mechanical_fe_values[displacements].get_function_values(
3107 *   mechanical_nonlinear_system.previous_deformation,
3108 *   previous_deformation_values);
3109 *  
3110 *   remapped_point_mechanical_fe_values[displacements].get_function_gradients(
3111 *   mechanical_nonlinear_system.previous_deformation,
3112 *   previous_deformation_gradient_at_remapped_point);
3113 *  
3114 *   remapped_point_mechanical_fe_values[displacements].get_function_values(
3115 *   mechanical_nonlinear_system.previous_deformation,
3116 *   previous_deformation_value_at_remapped_point);
3117 *  
3118 *   std::vector< std::vector<Number> > material_parameters_at_q_points(
3119 *   material_parameter_count,
3120 *   std::vector<Number>(n_q_points));
3121 *  
3122 *   for(unsigned int q_point=0; q_point<n_q_points; q_point++) {
3123 *   const point_index_t quadrature_point_index = remapped_point.mesh_motion_cell->user_index() + q_point;
3124 *  
3125 *   [[maybe_unused]] const auto deformation_gradient =
3126 *   get_deformation_gradient(
3127 *   previous_deformation_gradients[q_point],
3128 *   previous_deformation_values[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
3129 *  
3130 *   std::vector<Number> state_parameters = material.get_state_parameters(quadrature_point_index, /*deformation_gradient*/unit_symmetric_tensor<dim+1, Number>());
3131 *  
3132 *   for(unsigned int parameter_index=0; parameter_index<material_parameter_count; parameter_index++) {
3133 *   material_parameters_at_q_points[parameter_index][q_point] = state_parameters[parameter_index];
3134 *   }
3135 *   }
3136 *  
3137 *   std::vector<std::vector<Number> > projected_material_parameters_coefficients(
3138 *   material_parameter_count,
3139 *   std::vector<Number>(mixed_dofs_per_cell));
3140 *  
3141 *   const unsigned int cell_index = remapped_point.mesh_motion_cell->user_index() / n_q_points;
3142 *   for(unsigned int parameter_index=0; parameter_index<material_parameter_count; parameter_index++) {
3143 *   mixed_fe_projector[cell_index].project(
3144 *   &projected_material_parameters_coefficients[parameter_index],
3145 *   material_parameters_at_q_points[parameter_index]);
3146 *   }
3147 *  
3148 *   Vector<Number> mixed_values (mixed_dofs_per_cell);
3149 *   for (unsigned int mixed_dof = 0; mixed_dof < mixed_dofs_per_cell; ++mixed_dof) {
3150 *   mixed_values(mixed_dof) = remapped_point_mixed_fe_values.shape_value(mixed_dof, 0);
3151 *   }
3152 *  
3153 *   std::vector<Number> projected_state_parameters(material_parameter_count, 0);
3154 *   for(unsigned int parameter_index=0; parameter_index<material_parameter_count; parameter_index++) {
3155 *   for (unsigned int mixed_dof = 0; mixed_dof < mixed_dofs_per_cell; mixed_dof++) {
3156 *   projected_state_parameters[parameter_index] += mixed_values(mixed_dof) * projected_material_parameters_coefficients[parameter_index][mixed_dof];
3157 *   }
3158 *   }
3159 *  
3160 *  
3161 *   for(unsigned int parameter_index=0; parameter_index<material_parameter_count; parameter_index++) {
3162 *   local_state_parameter_groups.at(group).at(next_to_process.at(group)*material_parameter_count + parameter_index) = projected_state_parameters[parameter_index];
3163 *   }
3164 *  
3165 *   const Tensor<2, dim+1, Number> previous_deformation_gradient =
3166 *   get_deformation_gradient(
3167 *   previous_deformation_gradient_at_remapped_point[0],
3168 *   previous_deformation_value_at_remapped_point[0][0]/remapped_point_fe_values.quadrature_point(0)[0]);
3169 *  
3170 *   for(unsigned int dim_i=0; dim_i<dim+1; dim_i++) {
3171 *   const unsigned int current_i_index = next_to_process.at(group) * (dim+1) + dim_i;
3172 *   for(unsigned int dim_j=0; dim_j<dim+1; dim_j++) {
3173 *   local_deformation_gradient_groups.at(group).at(current_i_index * (dim+1) + dim_j) = previous_deformation_gradient[dim_i][dim_j];
3174 *   }
3175 *   }
3176 *  
3177 *   ++next_to_process.at(group);
3178 *   }
3179 *  
3180 *  
3181 *  
3182 *   enum MessageFlag {
3183 *   MATERIAL_STATE_PARAMETER,
3184 *   REMAPPED_DEFORMATION_GRADIENT
3185 *   };
3186 *  
3187 *   const unsigned int
3188 *   material_state_parameter_requests_offset = 0,
3189 *   remapped_deformation_gradient_requests_offset = 1,
3190 *   request_array_size = 2;
3191 *  
3192 *   std::vector<MPI_Request> requests_vector(2 * nprocesses * request_array_size);
3193 *  
3194 *   for (int i = 0; i < nprocesses; ++i) {
3195 *   MPI_Isend(
3196 *   local_state_parameter_groups.at(i).data(),
3197 *   material_parameter_count * mapping_remote_reference_point_counts.at(i),
3198 *   MPI_DOUBLE, i, MATERIAL_STATE_PARAMETER,
3199 *   mpi_communicator,
3200 *   &requests_vector[i + nprocesses * material_state_parameter_requests_offset]);
3201 *   }
3202 *  
3203 *   for (int i = 0; i < nprocesses; ++i) {
3204 *   MPI_Isend(
3205 *   local_deformation_gradient_groups.at(i).data(),
3206 *   (dim+1) * (dim+1) * mapping_remote_reference_point_counts.at(i),
3207 *   MPI_DOUBLE, i, REMAPPED_DEFORMATION_GRADIENT,
3208 *   mpi_communicator,
3209 *   &requests_vector[i + nprocesses * remapped_deformation_gradient_requests_offset]);
3210 *   }
3211 *  
3212 *   for (int i = 0; i < nprocesses; ++i) {
3213 *   const unsigned int row_start = i + nprocesses * request_array_size;
3214 *  
3215 *   MPI_Irecv(
3216 *   remote_state_parameter_groups.at(i).data(),
3217 *   material_parameter_count * mapping_remote_remapped_point_counts.at(i),
3218 *   MPI_DOUBLE, i, MATERIAL_STATE_PARAMETER,
3219 *   mpi_communicator,
3220 *   &requests_vector[row_start + nprocesses * material_state_parameter_requests_offset]);
3221 *  
3222 *   MPI_Irecv(
3223 *   remote_deformation_gradient_groups.at(i).data(),
3224 *   (dim+1) * (dim+1) * mapping_remote_remapped_point_counts.at(i),
3225 *   MPI_DOUBLE, i, REMAPPED_DEFORMATION_GRADIENT,
3226 *   mpi_communicator,
3227 *   &requests_vector[row_start + nprocesses * remapped_deformation_gradient_requests_offset]);
3228 *  
3229 *   }
3230 *  
3231 *   std::vector<MPI_Status> statuses_vector(2 * request_array_size * nprocesses);
3232 *   MPI_Waitall(
3233 *   2 * request_array_size * nprocesses,
3234 *   &requests_vector[0],
3235 *   &statuses_vector[0]);
3236 *  
3237 *   next_to_process.clear();
3238 *   next_to_process.resize(nprocesses, 0);
3239 *   for (unsigned int i = 0; i < reference_points.size(); ++i) {
3240 *   unsigned int group = remapped_point_owning_process.at(i);
3241 *  
3242 *   ReferencePoint<dim, Number> &reference_point = reference_points[i];
3243 *  
3244 *   mesh_motion_fe_values.reinit(reference_point.mesh_motion_cell);
3245 *  
3246 *   std::vector<Number> remapped_state_parameters(material_parameter_count);
3247 *   for(unsigned int state_index=0; state_index<material_parameter_count; state_index++) {
3248 *   remapped_state_parameters[state_index] = remote_state_parameter_groups.at(group).at(next_to_process.at(group) * material_parameter_count + state_index);
3249 *   }
3250 *  
3251 *   Tensor<2, dim+1, Number> previous_deformation_gradient;
3252 *   for(unsigned int dim_i=0; dim_i<dim+1; dim_i++) {
3253 *   const unsigned int current_i_index = next_to_process.at(group) * (dim+1) + dim_i;
3254 *   for(unsigned int dim_j=0; dim_j<dim+1; dim_j++) {
3255 *   previous_deformation_gradient[dim_i][dim_j] = remote_deformation_gradient_groups.at(group).at(current_i_index * (dim+1) + dim_j);
3256 *   }
3257 *   }
3258 *  
3259 *   mesh_motion_fe_values[displacements].get_function_gradients(
3260 *   mesh_motion_nonlinear_system.current_increment,
3261 *   mesh_motion_gradient_increments);
3262 *  
3263 *   mesh_motion_fe_values[displacements].get_function_values(
3264 *   mesh_motion_nonlinear_system.current_increment,
3265 *   mesh_motion_value_increments);
3266 *  
3267 *   [[maybe_unused]] const auto mesh_motion_gradient = get_deformation_gradient(
3268 *   -mesh_motion_gradient_increments[reference_point.q_point],
3269 *   -mesh_motion_value_increments[reference_point.q_point][0]/mesh_motion_fe_values.quadrature_point(reference_point.q_point)[0]);
3270 *  
3271 *   const point_index_t quadrature_point_index = reference_point.mesh_motion_cell->user_index() + reference_point.q_point;
3272 *   material.set_state_parameters(quadrature_point_index, remapped_state_parameters, /*previous_deformation_gradient **/ /*mesh_motion_gradient*/unit_symmetric_tensor<dim+1, Number>());
3273 *   remapped_deformation_gradients[quadrature_point_index] = previous_deformation_gradient;
3274 *  
3275 *   ++next_to_process.at(group);
3276 *   }
3277 *  
3278 *   }
3279 *   }
3280 *  
3281 *   template<int dim, typename Number>
3282 *   void PlasticityLabProg<dim, Number>::remap_thermal_field(
3283 *   NewtonStepSystem &thermal_nonlinear_system,
3284 *   const DoFSystem<dim, Number> &thermal_dof_system,
3285 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
3286 *   const DoFSystem<dim, Number> &mesh_motion_dof_system) {
3287 *  
3288 *   const Quadrature<dim> thermal_fe_support_point_quadrature(therm_fe.get_unit_support_points());
3289 *  
3290 *   const unsigned int n_q_points = thermal_fe_support_point_quadrature.size();
3291 *   [[maybe_unused]] const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
3292 *   const unsigned int thermal_dofs_per_cell = therm_fe.dofs_per_cell;
3293 *  
3294 *   FEValues<dim> mesh_motion_fe_values(
3295 *   mapping,
3296 *   mesh_motion_fe,
3297 *   thermal_fe_support_point_quadrature,
3299 *  
3300 *   FEValues<dim> thermal_fe_values(
3301 *   mapping,
3302 *   therm_fe,
3303 *   thermal_fe_support_point_quadrature,
3305 *  
3306 *   std::vector< Number > previous_temperatures(1);
3307 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
3308 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
3309 *  
3310 *   const FEValuesExtractors::Vector displacements(0);
3312 *  
3313 *   std::vector<ReferencePoint<dim, Number>> reference_points;
3314 *   std::vector<Point<dim, Number>> remapped_point_positions;
3315 *  
3316 *   auto cell = mesh_motion_dof_system.dof_handler.begin_active();
3317 *   auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
3318 *   for (; cell != mesh_motion_dof_system.dof_handler.end(); ++cell, ++thermal_cell) {
3319 *   if (cell->is_locally_owned()) {
3320 *   mesh_motion_fe_values.reinit(cell);
3321 *  
3322 *   mesh_motion_fe_values[displacements].get_function_values(
3323 *   mesh_motion_nonlinear_system.current_increment,
3324 *   mesh_motion_value_increments);
3325 *  
3326 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
3327 *   const Point<dim, Number> reference_point_position = mesh_motion_fe_values.quadrature_point(q_point);
3328 *   const Point<dim, Number> remapped_point_position = reference_point_position - mesh_motion_value_increments[q_point];
3329 *  
3330 *   ReferencePoint<dim, Number> reference_point;
3331 *   reference_point.mesh_motion_cell = cell;
3332 *   reference_point.field_cell = thermal_cell;
3333 *   reference_point.q_point = q_point;
3334 *   reference_point.reference_point = reference_point_position;
3335 *   reference_point.remapped_point = remapped_point_position;
3336 *  
3337 *   reference_points.push_back(reference_point);
3338 *   remapped_point_positions.push_back(remapped_point_position);
3339 *  
3340 *   }
3341 *  
3342 *   }
3343 *   }
3344 *  
3345 *   MPI_Datatype PointType;
3346 *   MPI_Type_contiguous(dim, MPI_DOUBLE, &PointType);
3347 *   MPI_Type_commit(&PointType);
3348 *   std::vector<int> displs;
3349 *   std::vector< Point<dim, Number>> received_remapped_positions;
3350 *   std::vector<RemappedPoint<dim, Number>> thermal_points;
3351 *   int nprocesses, this_process;
3352 *   int num_reference_points = reference_points.size();
3353 *   MPI_Comm_size(mpi_communicator, &nprocesses);
3354 *   std::vector<int> reference_point_counts(nprocesses);
3355 *   MPI_Allgather(
3356 *   &num_reference_points,
3357 *   1, MPI_INT,
3358 *   &reference_point_counts[0],
3359 *   1, MPI_INT,
3360 *   mpi_communicator);
3361 *   MPI_Comm_rank(mpi_communicator, &this_process);
3362 *   displs.resize(nprocesses);
3363 *   displs[0] = 0;
3364 *   for (int i = 1; i < nprocesses; ++i) {
3365 *   displs[i] = displs[i - 1] + reference_point_counts[i - 1];
3366 *   }
3367 *  
3368 *   const unsigned int count_received_reference_points = displs[nprocesses - 1] + reference_point_counts[nprocesses - 1];
3369 *   received_remapped_positions.resize(count_received_reference_points);
3370 *   thermal_points.resize(count_received_reference_points);
3371 *   std::vector<char> this_process_owns_remapped_point(count_received_reference_points);
3372 *   std::vector<char> this_process_owns_thermal_point(count_received_reference_points);
3373 *  
3374 *   MPI_Allgatherv(
3375 *   &remapped_point_positions[0],
3376 *   num_reference_points,
3377 *   PointType,
3378 *   &received_remapped_positions[0],
3379 *   &reference_point_counts[0],
3380 *   &displs[0],
3381 *   PointType,
3382 *   mpi_communicator);
3383 *  
3384 *  
3385 *   for(unsigned int received_point_id=0; received_point_id < count_received_reference_points; received_point_id++) {
3386 *   auto point = received_remapped_positions[received_point_id];
3387 *   auto thermal_cell_and_point = GridTools::find_active_cell_around_point(
3388 *   mapping,
3389 *   thermal_dof_system.dof_handler,
3390 *   point);
3391 *   auto thermal_cell = thermal_cell_and_point.first;
3392 *   auto thermal_unit_cell_point = thermal_cell_and_point.second;
3393 *   thermal_points[received_point_id].field_cell = thermal_cell;
3394 *   thermal_points[received_point_id].unit_cell_point = thermal_unit_cell_point;
3395 *   thermal_points[received_point_id].remapped_point = point;
3396 *   this_process_owns_thermal_point[received_point_id] = thermal_cell.state() == IteratorState::valid && thermal_cell->is_locally_owned()? 1 : 0;
3397 *   }
3398 *  
3399 *   std::vector<char> thermal_point_candidates(num_reference_points * nprocesses);
3400 *   for (int process = 0; process < nprocesses; ++process) {
3401 *   if (reference_point_counts[process] > 0)
3402 *   MPI_Gather(
3403 *   &this_process_owns_thermal_point[displs[process]],
3404 *   reference_point_counts[process],
3405 *   MPI_C_BOOL,
3406 *   &thermal_point_candidates[0],
3407 *   reference_point_counts[process],
3408 *   MPI_C_BOOL,
3409 *   process,
3410 *   mpi_communicator);
3411 *   }
3412 *  
3413 *   std::vector<unsigned int> thermal_point_owning_process(num_reference_points);
3414 *   for (int i = 0; i < num_reference_points; ++i) {
3415 *   thermal_point_owning_process[i] = 0;
3416 *   for (int j = 1; j < nprocesses; ++j) {
3417 *   if (thermal_point_candidates[j * num_reference_points + i] == 1) {
3418 *   thermal_point_owning_process[i] = j;
3419 *   continue;
3420 *   }
3421 *   }
3422 *   }
3423 *  
3424 *   std::vector<RemappedPoint<dim, Number>> mapping_thermal_points;
3425 *   std::vector<unsigned int> thermal_reference_point_owning_process;
3426 *   std::vector<unsigned int> thermal_reference_point_index_at_remote_process;
3427 *  
3428 * @endcode
3429 *
3430 * This should really be a vector<bool>, but addresses of individual elements of
3431 * vector<bool> cannot be taken. It's a template specialization to save space
3432 *
3433 * @code
3434 *   std::vector<char> remote_thermal_point_is_accepted(num_reference_points * nprocesses);
3435 *   std::vector<char> local_thermal_point_is_accepted(count_received_reference_points);
3436 *   for (int i = 0; i < num_reference_points; ++i) {
3437 *   for (unsigned int j = 0; j < static_cast<unsigned int>(nprocesses); ++j) {
3438 *   remote_thermal_point_is_accepted[j * num_reference_points + i] = (thermal_point_owning_process[i] == j) ? 1 : 0;
3439 *   }
3440 *   }
3441 *  
3442 *   for (int process = 0; process < nprocesses; ++process) {
3443 *   if (reference_point_counts[process] > 0) {
3444 *   MPI_Scatter(
3445 *   &remote_thermal_point_is_accepted[0],
3446 *   reference_point_counts[process],
3447 *   MPI_C_BOOL,
3448 *   &local_thermal_point_is_accepted[displs[process]],
3449 *   reference_point_counts[process],
3450 *   MPI_C_BOOL,
3451 *   process,
3452 *   mpi_communicator);
3453 *   }
3454 *   }
3455 *  
3456 *   std::vector<unsigned int> thermal_remote_reference_point_counts(nprocesses, 0);
3457 *   for (int process = 0; process < nprocesses; ++process) {
3458 *   for (int i = 0; i < reference_point_counts[process]; ++i) {
3459 *   if (local_thermal_point_is_accepted[displs[process] + i]) {
3460 *   RemappedPoint<dim, Number> accepted_thermal_point = thermal_points[displs[process] + i];
3461 *  
3462 *   mapping_thermal_points.push_back(accepted_thermal_point);
3463 *   thermal_reference_point_owning_process.push_back(process);
3464 *   thermal_reference_point_index_at_remote_process.push_back(i);
3465 *   ++thermal_remote_reference_point_counts[process];
3466 *   }
3467 *   }
3468 *   }
3469 *  
3470 *   MPI_Barrier(mpi_communicator);
3471 *  
3472 *   std::vector<unsigned int> thermal_remote_remapped_point_counts(nprocesses);
3473 *   for (int i = 0; i < nprocesses; ++i) {
3474 *   MPI_Scatter(
3475 *   &thermal_remote_reference_point_counts[0],
3476 *   1, MPI_UNSIGNED,
3477 *   &thermal_remote_remapped_point_counts[i],
3478 *   1, MPI_UNSIGNED,
3479 *   i, mpi_communicator);
3480 *   }
3481 *  
3482 *  
3483 *  
3484 *   {
3485 *   std::vector<std::vector<Number> > local_previous_temperature_groups(nprocesses);
3486 *   std::vector<std::vector<Number> > remote_previous_temperature_groups(nprocesses);
3487 *  
3488 *   for (int i = 0; i < nprocesses; ++i) {
3489 *   local_previous_temperature_groups.at(i).resize(thermal_remote_reference_point_counts.at(i));
3490 *   remote_previous_temperature_groups.at(i).resize(thermal_remote_remapped_point_counts.at(i));
3491 *   }
3492 *  
3493 *   std::vector<unsigned int> next_to_process(nprocesses, 0);
3494 *   for (unsigned int i = 0; i < mapping_thermal_points.size(); ++i) {
3495 *   const unsigned int group = thermal_reference_point_owning_process.at(i);
3496 *   const RemappedPoint<dim, Number> thermal_point = mapping_thermal_points.at(i);
3497 *  
3498 *   Quadrature<dim> thermal_point_quadrature(
3499 *   std::vector<Point<dim, Number>> (1, thermal_point.unit_cell_point));
3500 *  
3501 *   FEValues<dim> thermal_point_fe_values(
3502 *   mapping,
3503 *   therm_fe,
3504 *   thermal_point_quadrature,
3505 *   update_values);
3506 *  
3507 *   thermal_point_fe_values.reinit(thermal_point.field_cell);
3508 *  
3509 *   thermal_point_fe_values[temperature].get_function_values(
3510 *   thermal_nonlinear_system.previous_deformation,
3511 *   previous_temperatures);
3512 *  
3513 *   local_previous_temperature_groups.at(group).at(next_to_process.at(group)) = previous_temperatures[0];
3514 *  
3515 *   ++next_to_process.at(group);
3516 *   }
3517 *  
3518 *  
3519 *  
3520 *   enum MessageFlag {
3521 *   PREVIOUS_TEMPERATURE
3522 *   };
3523 *  
3524 *   const unsigned int
3525 *   previous_temperature_requests_offset = 0,
3526 *   request_array_size = 1;
3527 *  
3528 *   std::vector<MPI_Request> requests_vector(2 * nprocesses * request_array_size);
3529 *  
3530 *   for (int i = 0; i < nprocesses; ++i) {
3531 *   MPI_Isend(
3532 *   local_previous_temperature_groups.at(i).data(),
3533 *   thermal_remote_reference_point_counts.at(i),
3534 *   MPI_DOUBLE, i, PREVIOUS_TEMPERATURE,
3535 *   mpi_communicator,
3536 *   &requests_vector[i + nprocesses * previous_temperature_requests_offset]);
3537 *   }
3538 *  
3539 *   for (int i = 0; i < nprocesses; ++i) {
3540 *   const unsigned int row_start = i + nprocesses * request_array_size;
3541 *  
3542 *   MPI_Irecv(
3543 *   remote_previous_temperature_groups.at(i).data(),
3544 *   thermal_remote_remapped_point_counts.at(i),
3545 *   MPI_DOUBLE, i, PREVIOUS_TEMPERATURE,
3546 *   mpi_communicator,
3547 *   &requests_vector[row_start + nprocesses * previous_temperature_requests_offset]);
3548 *  
3549 *   }
3550 *  
3551 *   std::vector<MPI_Status> statuses_vector(2 * request_array_size * nprocesses);
3552 *   MPI_Waitall(
3553 *   2 * request_array_size * nprocesses,
3554 *   &requests_vector[0],
3555 *   &statuses_vector[0]);
3556 *  
3557 *   TrilinosWrappers::SparsityPattern sparsity_pattern(
3558 *   thermal_dof_system.locally_owned_dofs,
3559 *   mpi_communicator);
3560 *  
3561 *   DoFTools::make_sparsity_pattern(
3562 *   thermal_dof_system.dof_handler, sparsity_pattern,
3563 *   AffineConstraints<Number>(),
3564 *   false,
3565 *   Utilities::MPI::this_mpi_process(mpi_communicator));
3566 *   sparsity_pattern.compress();
3567 *  
3568 *   TrilinosWrappers::SparseMatrix projection_matrix(sparsity_pattern);
3569 *   TrilinosWrappers::MPI::Vector projection_residual(thermal_dof_system.locally_owned_dofs, mpi_communicator);
3570 *  
3571 *   projection_matrix = 0;
3572 *   projection_residual = 0;
3573 *  
3574 *   projection_matrix = 0;
3575 *   projection_residual = 0;
3576 *   FullMatrix<Number> cell_matrix(thermal_dofs_per_cell, thermal_dofs_per_cell);
3577 *   Vector<Number> cell_residual(thermal_dofs_per_cell);
3578 *   next_to_process.clear();
3579 *   next_to_process.resize(nprocesses, 0);
3580 *   for (unsigned int i = 0; i < reference_points.size(); ++i) {
3581 *   unsigned int group = thermal_point_owning_process.at(i);
3582 *  
3583 *   cell_matrix = 0;
3584 *   cell_residual = 0;
3585 *  
3586 *   ReferencePoint<dim, Number> &reference_point = reference_points[i];
3587 *  
3588 *   thermal_fe_values.reinit(reference_point.field_cell);
3589 *  
3590 *   const Number remapped_previous_temperature = remote_previous_temperature_groups.at(group).at(next_to_process.at(group));
3591 *   for(unsigned int dof_i=0; dof_i<thermal_dofs_per_cell; dof_i++) {
3592 *   cell_residual(dof_i) +=
3593 *   remapped_previous_temperature
3594 *   * thermal_fe_values[temperature].value(dof_i, reference_point.q_point);
3595 *   for(unsigned int dof_j=0; dof_j<thermal_dofs_per_cell; dof_j++) {
3596 *   cell_matrix(dof_i, dof_j) +=
3597 *   thermal_fe_values[temperature].value(dof_i, reference_point.q_point)
3598 *   * thermal_fe_values[temperature].value(dof_j, reference_point.q_point);
3599 *   }
3600 *   }
3601 *  
3602 *   std::vector<types::global_dof_index> local_dof_indices(thermal_dofs_per_cell);
3603 *   reference_point.field_cell->get_dof_indices(local_dof_indices);
3604 *  
3605 *   projection_residual.add(local_dof_indices, cell_residual);
3606 *   for(unsigned int dof_i=0; dof_i<thermal_dofs_per_cell; dof_i++) {
3607 *   for(unsigned int dof_j=0; dof_j<thermal_dofs_per_cell; dof_j++) {
3608 *   projection_matrix.add(local_dof_indices[dof_i], local_dof_indices[dof_j], cell_matrix(dof_i, dof_j));
3609 *   }
3610 *   }
3611 *  
3612 *   ++next_to_process.at(group);
3613 *   }
3614 *  
3615 *   projection_matrix.compress(
3616 *   VectorOperation::add);
3617 *   projection_residual.compress(
3618 *   VectorOperation::add);
3619 *  
3620 * @endcode
3621 *
3622 * solve the thermal projection system
3623 *
3624 * @code
3625 *   TrilinosWrappers::PreconditionAMG preconditioner;
3626 *  
3627 *   #if DEAL_II_VERSION_GTE(9,7,0)
3628 *   const std::vector<std::vector<bool> > constant_modes
3629 *   = DoFTools::extract_constant_modes(thermal_dof_system.dof_handler,
3630 *   ComponentMask());
3631 *   #else
3632 *   std::vector<std::vector<bool> > constant_modes;
3633 *   DoFTools::extract_constant_modes(thermal_dof_system.dof_handler, ComponentMask(), constant_modes);
3634 *   #endif
3635 *  
3636 *   TrilinosWrappers::PreconditionAMG::AdditionalData additional_data;
3637 *   additional_data.constant_modes = constant_modes;
3638 *   additional_data.elliptic = true;
3639 *   additional_data.n_cycles = 1;
3640 *   additional_data.w_cycle = false;
3641 *   additional_data.output_details = false;
3642 *   additional_data.smoother_sweeps = 2;
3643 *   additional_data.aggregation_threshold = 1e-2;
3644 *   preconditioner.initialize(projection_matrix, additional_data);
3645 *  
3646 *   TrilinosWrappers::MPI::Vector tmp(thermal_dof_system.locally_owned_dofs, mpi_communicator);
3647 *   const Number relative_accuracy = 1e-08;
3648 *   const Number solver_tolerance = relative_accuracy
3649 *   * projection_matrix.residual(tmp, thermal_nonlinear_system.Newton_step_solution,
3650 *   projection_residual);
3651 *   SolverControl solver_control(projection_matrix.m(),
3652 *   solver_tolerance);
3653 *  
3654 *   SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
3655 *  
3656 *   thermal_nonlinear_system.Newton_step_solution = 0;
3657 *  
3658 *   solver.solve(projection_matrix, thermal_nonlinear_system.Newton_step_solution,
3659 *   projection_residual, preconditioner);
3660 *  
3661 *   thermal_nonlinear_system.previous_deformation = thermal_nonlinear_system.Newton_step_solution;
3662 *  
3663 *   }
3664 *  
3665 *   }
3666 *  
3667 *  
3668 *   template<int dim, typename Number>
3669 *   void PlasticityLabProg<dim, Number>::remap_mechanical_fields(
3670 *   NewtonStepSystem &mechanical_nonlinear_system,
3671 *   const DoFSystem<dim, Number> &mechanical_dof_system,
3672 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
3673 *   const DoFSystem<dim, Number> &mesh_motion_dof_system) {
3674 *  
3675 *   const Quadrature<dim> mechanical_fe_support_point_quadrature(mech_fe.base_element(0).get_unit_support_points());
3676 *  
3677 *   const unsigned int n_q_points = mechanical_fe_support_point_quadrature.size();
3678 *   [[maybe_unused]] const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
3679 *   const unsigned int mechanical_dofs_per_cell = mech_fe.dofs_per_cell;
3680 *  
3681 *   FEValues<dim> mesh_motion_fe_values(
3682 *   mapping,
3683 *   mesh_motion_fe,
3684 *   mechanical_fe_support_point_quadrature,
3685 *   update_values | update_quadrature_points);
3686 *  
3687 *   FEValues<dim> mechanical_fe_values(
3688 *   mapping,
3689 *   mech_fe,
3690 *   mechanical_fe_support_point_quadrature,
3691 *   update_values | update_quadrature_points);
3692 *  
3693 *   std::vector< Tensor<1, dim, Number> > previous_remapped_deformations(1);
3694 *   std::vector< Tensor<1, dim, Number> > previous_remapped_velocity(1);
3695 *   std::vector< Tensor<1, dim, Number> > previous_remapped_second_time_rate(1);
3696 *   std::vector< Number > previous_remapped_twist_deformations(1);
3697 *   std::vector< Number > previous_remapped_twist_velocity(1);
3698 *   std::vector< Number > previous_remapped_twist_second_time_rate(1);
3699 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
3700 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
3701 *  
3702 *   const FEValuesExtractors::Vector displacements(0);
3703 *   const FEValuesExtractors::Scalar angular_velocities(dim);
3704 *  
3705 *   std::vector<ReferencePoint<dim, Number>> reference_points;
3706 *   std::vector<Point<dim, Number>> remapped_point_positions;
3707 *   std::unordered_map<point_index_t, unsigned int> quadrature_point_reference_point_id;
3708 *   auto cell = mesh_motion_dof_system.dof_handler.begin_active();
3709 *   auto mechanical_cell = mechanical_dof_system.dof_handler.begin_active();
3710 *   for (; cell != mesh_motion_dof_system.dof_handler.end(); ++cell, ++mechanical_cell) {
3711 *   if (cell->is_locally_owned()) {
3712 *   mesh_motion_fe_values.reinit(cell);
3713 *  
3714 *   mesh_motion_fe_values[displacements].get_function_values(
3715 *   mesh_motion_nonlinear_system.current_increment,
3716 *   mesh_motion_value_increments);
3717 *  
3718 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
3719 *   const Point<dim, Number> reference_point_position = mesh_motion_fe_values.quadrature_point(q_point);
3720 *   const Point<dim, Number> remapped_point_position = reference_point_position - mesh_motion_value_increments[q_point];
3721 *  
3722 *   ReferencePoint<dim, Number> reference_point;
3723 *   reference_point.mesh_motion_cell = cell;
3724 *   reference_point.field_cell = mechanical_cell;
3725 *   reference_point.q_point = q_point;
3726 *   reference_point.reference_point = reference_point_position;
3727 *   reference_point.remapped_point = remapped_point_position;
3728 *  
3729 *   reference_points.push_back(reference_point);
3730 *   remapped_point_positions.push_back(remapped_point_position);
3731 *  
3732 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
3733 *   quadrature_point_reference_point_id[quadrature_point_index] = reference_points.size() - 1;
3734 *  
3735 *   }
3736 *  
3737 *   }
3738 *   }
3739 *  
3740 *   MPI_Datatype PointType;
3741 *   MPI_Type_contiguous(dim, MPI_DOUBLE, &PointType);
3742 *   MPI_Type_commit(&PointType);
3743 *   std::vector<int> displs;
3744 *   std::vector< Point<dim, Number>> received_remapped_positions;
3745 *   std::vector<RemappedPoint<dim, Number>> remapped_points;
3746 *   int nprocesses, this_process;
3747 *   int num_reference_points = reference_points.size();
3748 *   MPI_Comm_size(mpi_communicator, &nprocesses);
3749 *   std::vector<int> reference_point_counts(nprocesses);
3750 *   MPI_Allgather(
3751 *   &num_reference_points,
3752 *   1, MPI_INT,
3753 *   &reference_point_counts[0],
3754 *   1, MPI_INT,
3755 *   mpi_communicator);
3756 *   MPI_Comm_rank(mpi_communicator, &this_process);
3757 *   displs.resize(nprocesses);
3758 *   displs[0] = 0;
3759 *   for (int i = 1; i < nprocesses; ++i) {
3760 *   displs[i] = displs[i - 1] + reference_point_counts[i - 1];
3761 *   }
3762 *  
3763 *   const unsigned int count_received_reference_points = displs[nprocesses - 1] + reference_point_counts[nprocesses - 1];
3764 *   received_remapped_positions.resize(count_received_reference_points);
3765 *   remapped_points.resize(count_received_reference_points);
3766 *   std::vector<char> this_process_owns_remapped_point(count_received_reference_points);
3767 *  
3768 *   MPI_Allgatherv(
3769 *   &remapped_point_positions[0],
3770 *   num_reference_points,
3771 *   PointType,
3772 *   &received_remapped_positions[0],
3773 *   &reference_point_counts[0],
3774 *   &displs[0],
3775 *   PointType,
3776 *   mpi_communicator);
3777 *  
3778 *  
3779 *   for(unsigned int received_point_id=0; received_point_id < count_received_reference_points; received_point_id++) {
3780 *   auto point = received_remapped_positions[received_point_id];
3781 *   auto remapped_cell_and_point = GridTools::find_active_cell_around_point(
3782 *   mapping,
3783 *   mechanical_dof_system.dof_handler,
3784 *   point);
3785 *   auto mechanical_cell = remapped_cell_and_point.first;
3786 *   auto mechanical_unit_cell_point = remapped_cell_and_point.second;
3787 *   remapped_points[received_point_id].field_cell = mechanical_cell;
3788 *   remapped_points[received_point_id].unit_cell_point = mechanical_unit_cell_point;
3789 *   remapped_points[received_point_id].remapped_point = point;
3790 *   this_process_owns_remapped_point[received_point_id] = mechanical_cell.state() == IteratorState::valid && mechanical_cell->is_locally_owned()? 1 : 0;
3791 *   }
3792 *  
3793 *   std::vector<char> remapped_point_candidates(num_reference_points * nprocesses);
3794 *   for (int process = 0; process < nprocesses; ++process) {
3795 *   if (reference_point_counts[process] > 0)
3796 *   MPI_Gather(
3797 *   &this_process_owns_remapped_point[displs[process]],
3798 *   reference_point_counts[process],
3799 *   MPI_C_BOOL,
3800 *   &remapped_point_candidates[0],
3801 *   reference_point_counts[process],
3802 *   MPI_C_BOOL,
3803 *   process,
3804 *   mpi_communicator);
3805 *   }
3806 *  
3807 *   std::vector<unsigned int> remapped_point_owning_process(num_reference_points);
3808 *   for (int i = 0; i < num_reference_points; ++i) {
3809 *   remapped_point_owning_process[i] = 0;
3810 *   for (int j = 1; j < nprocesses; ++j) {
3811 *   if (remapped_point_candidates[j * num_reference_points + i] == 1) {
3812 *   remapped_point_owning_process[i] = j;
3813 *   continue;
3814 *   }
3815 *   }
3816 *   }
3817 *  
3818 *   std::vector<RemappedPoint<dim, Number>> mapping_remapped_points;
3819 *   std::vector<unsigned int> reference_point_owning_process;
3820 *   std::vector<unsigned int> reference_point_index_at_remote_process;
3821 *  
3822 * @endcode
3823 *
3824 * This should really be a vector<bool>, but addresses of individual elements of
3825 * vector<bool> cannot be taken. It's a template specialization to save space
3826 *
3827 * @code
3828 *   std::vector<char> remote_remapped_point_is_accepted(num_reference_points * nprocesses);
3829 *   std::vector<char> local_remapped_point_is_accepted(count_received_reference_points);
3830 *   for (int i = 0; i < num_reference_points; ++i) {
3831 *   for (unsigned int j = 0; j < static_cast<unsigned int>(nprocesses); ++j) {
3832 *   remote_remapped_point_is_accepted[j * num_reference_points + i] = (remapped_point_owning_process[i] == j) ? 1 : 0;
3833 *   }
3834 *   }
3835 *  
3836 *   for (int process = 0; process < nprocesses; ++process) {
3837 *   if (reference_point_counts[process] > 0) {
3838 *   MPI_Scatter(
3839 *   &remote_remapped_point_is_accepted[0],
3840 *   reference_point_counts[process],
3841 *   MPI_C_BOOL,
3842 *   &local_remapped_point_is_accepted[displs[process]],
3843 *   reference_point_counts[process],
3844 *   MPI_C_BOOL,
3845 *   process,
3846 *   mpi_communicator);
3847 *   }
3848 *   }
3849 *  
3850 *   std::vector<unsigned int> remote_reference_point_counts(nprocesses, 0);
3851 *   for (int process = 0; process < nprocesses; ++process) {
3852 *   for (int i = 0; i < reference_point_counts[process]; ++i) {
3853 *   if (local_remapped_point_is_accepted[displs[process] + i]) {
3854 *   RemappedPoint<dim, Number> accepted_remapped_point = remapped_points[displs[process] + i];
3855 *  
3856 *   mapping_remapped_points.push_back(accepted_remapped_point);
3857 *   reference_point_owning_process.push_back(process);
3858 *   reference_point_index_at_remote_process.push_back(i);
3859 *   ++remote_reference_point_counts[process];
3860 *   }
3861 *   }
3862 *   }
3863 *  
3864 *   MPI_Barrier(mpi_communicator);
3865 *  
3866 *   std::vector<unsigned int> remote_remapped_point_counts(nprocesses);
3867 *   for (int i = 0; i < nprocesses; ++i) {
3868 *   MPI_Scatter(
3869 *   &remote_reference_point_counts[0],
3870 *   1, MPI_UNSIGNED,
3871 *   &remote_remapped_point_counts[i],
3872 *   1, MPI_UNSIGNED,
3873 *   i, mpi_communicator);
3874 *   }
3875 *  
3876 *   std::vector<std::vector<Number> > local_previous_deformation_groups(nprocesses);
3877 *   std::vector<std::vector<Number> > local_previous_velocity_groups(nprocesses);
3878 *   std::vector<std::vector<Number> > local_previous_second_time_rate_groups(nprocesses);
3879 *   std::vector<std::vector<Number> > remote_previous_deformation_groups(nprocesses);
3880 *   std::vector<std::vector<Number> > remote_previous_velocity_groups(nprocesses);
3881 *   std::vector<std::vector<Number> > remote_previous_second_time_rate_groups(nprocesses);
3882 *  
3883 *   for (int i = 0; i < nprocesses; ++i) {
3884 *   local_previous_deformation_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3885 *   local_previous_velocity_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3886 *   local_previous_second_time_rate_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3887 *   remote_previous_deformation_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3888 *   remote_previous_velocity_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3889 *   remote_previous_second_time_rate_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3890 *   }
3891 *  
3892 *   std::vector<unsigned int> next_to_process(nprocesses, 0);
3893 *   for (unsigned int i = 0; i < mapping_remapped_points.size(); ++i) {
3894 *   const unsigned int group = reference_point_owning_process.at(i);
3895 *   const RemappedPoint<dim, Number> remapped_point = mapping_remapped_points.at(i);
3896 *  
3897 *   Quadrature<dim> remapped_point_quadrature(
3898 *   std::vector<Point<dim, Number>> (1, remapped_point.unit_cell_point));
3899 *  
3900 *   FEValues<dim> remapped_point_fe_values(
3901 *   mapping,
3902 *   mech_fe,
3903 *   remapped_point_quadrature,
3904 *   update_values);
3905 *  
3906 *   remapped_point_fe_values.reinit(remapped_point.field_cell);
3907 *  
3908 *   remapped_point_fe_values[displacements].get_function_values(
3909 *   mechanical_nonlinear_system.previous_deformation,
3910 *   previous_remapped_deformations);
3911 *  
3912 *   remapped_point_fe_values[displacements].get_function_values(
3913 *   mechanical_nonlinear_system.previous_time_derivative,
3914 *   previous_remapped_velocity);
3915 *  
3916 *   remapped_point_fe_values[displacements].get_function_values(
3917 *   mechanical_nonlinear_system.previous_second_time_derivative,
3918 *   previous_remapped_second_time_rate);
3919 *  
3920 *   remapped_point_fe_values[angular_velocities].get_function_values(
3921 *   mechanical_nonlinear_system.previous_deformation,
3922 *   previous_remapped_twist_deformations);
3923 *  
3924 *   remapped_point_fe_values[angular_velocities].get_function_values(
3925 *   mechanical_nonlinear_system.previous_time_derivative,
3926 *   previous_remapped_twist_velocity);
3927 *  
3928 *   remapped_point_fe_values[angular_velocities].get_function_values(
3929 *   mechanical_nonlinear_system.previous_second_time_derivative,
3930 *   previous_remapped_twist_second_time_rate);
3931 *  
3932 *   for(unsigned int dim_i=0; dim_i<dim; dim_i++) {
3933 *   local_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3934 *   previous_remapped_deformations[0][dim_i];
3935 *   local_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3936 *   previous_remapped_velocity[0][dim_i];
3937 *   local_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3938 *   previous_remapped_second_time_rate[0][dim_i];
3939 *   }
3940 *  
3941 *   local_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3942 *   previous_remapped_twist_deformations[0];
3943 *   local_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3944 *   previous_remapped_twist_velocity[0];
3945 *   local_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3946 *   previous_remapped_twist_second_time_rate[0];
3947 *  
3948 *   ++next_to_process.at(group);
3949 *   }
3950 *  
3951 *   enum MessageFlag {
3952 *   PREVIOUS_DEFORMATION,
3953 *   PREVIOUS_VELOCITY,
3954 *   PREVIOUS_SECOND_TIME_RATE
3955 *   };
3956 *  
3957 *   const unsigned int
3958 *   previous_deformation_requests_offset = 0,
3959 *   previous_velocity_requests_offset = 1,
3960 *   previous_second_time_rate_requests_offset = 2,
3961 *   request_array_size = 3;
3962 *  
3963 *   std::vector<MPI_Request> requests_vector(2 * nprocesses * request_array_size);
3964 *  
3965 *   for (int i = 0; i < nprocesses; ++i) {
3966 *   MPI_Isend(
3967 *   local_previous_deformation_groups.at(i).data(),
3968 *   (dim+1) * remote_reference_point_counts.at(i),
3969 *   MPI_DOUBLE, i, PREVIOUS_DEFORMATION,
3970 *   mpi_communicator,
3971 *   &requests_vector[i + nprocesses * previous_deformation_requests_offset]);
3972 *  
3973 *   MPI_Isend(
3974 *   local_previous_velocity_groups.at(i).data(),
3975 *   (dim+1) * remote_reference_point_counts.at(i),
3976 *   MPI_DOUBLE, i, PREVIOUS_VELOCITY,
3977 *   mpi_communicator,
3978 *   &requests_vector[i + nprocesses * previous_velocity_requests_offset]);
3979 *  
3980 *   MPI_Isend(
3981 *   local_previous_second_time_rate_groups.at(i).data(),
3982 *   (dim+1) * remote_reference_point_counts.at(i),
3983 *   MPI_DOUBLE, i, PREVIOUS_SECOND_TIME_RATE,
3984 *   mpi_communicator,
3985 *   &requests_vector[i + nprocesses * previous_second_time_rate_requests_offset]);
3986 *   }
3987 *  
3988 *   for (int i = 0; i < nprocesses; ++i) {
3989 *   const unsigned int row_start = i + nprocesses * request_array_size;
3990 *  
3991 *   MPI_Irecv(
3992 *   remote_previous_deformation_groups.at(i).data(),
3993 *   (dim+1) * remote_remapped_point_counts.at(i),
3994 *   MPI_DOUBLE, i, PREVIOUS_DEFORMATION,
3995 *   mpi_communicator,
3996 *   &requests_vector[row_start + nprocesses * previous_deformation_requests_offset]);
3997 *  
3998 *   MPI_Irecv(
3999 *   remote_previous_velocity_groups.at(i).data(),
4000 *   (dim+1) * remote_remapped_point_counts.at(i),
4001 *   MPI_DOUBLE, i, PREVIOUS_VELOCITY,
4002 *   mpi_communicator,
4003 *   &requests_vector[row_start + nprocesses * previous_velocity_requests_offset]);
4004 *  
4005 *   MPI_Irecv(
4006 *   remote_previous_second_time_rate_groups.at(i).data(),
4007 *   (dim+1) * remote_remapped_point_counts.at(i),
4008 *   MPI_DOUBLE, i, PREVIOUS_SECOND_TIME_RATE,
4009 *   mpi_communicator,
4010 *   &requests_vector[row_start + nprocesses * previous_second_time_rate_requests_offset]);
4011 *  
4012 *   }
4013 *  
4014 *   std::vector<MPI_Status> statuses_vector(2 * request_array_size * nprocesses);
4015 *   MPI_Waitall(
4016 *   2 * request_array_size * nprocesses,
4017 *   &requests_vector[0],
4018 *   &statuses_vector[0]);
4019 *  
4020 *   TrilinosWrappers::SparsityPattern sparsity_pattern(
4021 *   mechanical_dof_system.locally_owned_dofs,
4022 *   mpi_communicator);
4023 *  
4025 *   mechanical_dof_system.dof_handler, sparsity_pattern,
4027 *   false,
4028 *   Utilities::MPI::this_mpi_process(mpi_communicator));
4029 *   sparsity_pattern.compress();
4030 *  
4031 *   TrilinosWrappers::SparseMatrix projection_matrix(sparsity_pattern);
4032 *   TrilinosWrappers::MPI::Vector projection_residual(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4033 *   TrilinosWrappers::MPI::Vector projection_velocity_residual(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4034 *   TrilinosWrappers::MPI::Vector projection_second_time_rate_residual(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4035 *   TrilinosWrappers::MPI::Vector projection_solution(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4036 *  
4037 *   projection_matrix = 0;
4038 *   projection_residual = 0;
4039 *   projection_velocity_residual = 0;
4040 *   projection_second_time_rate_residual = 0;
4041 *  
4042 *   FullMatrix<Number> cell_matrix(mechanical_dofs_per_cell, mechanical_dofs_per_cell);
4043 *   Vector<Number> cell_residual(mechanical_dofs_per_cell);
4044 *   Vector<Number> cell_velocity_residual(mechanical_dofs_per_cell);
4045 *   Vector<Number> cell_second_time_rate_residual(mechanical_dofs_per_cell);
4046 *  
4047 *   next_to_process.clear();
4048 *   next_to_process.resize(nprocesses, 0);
4049 *   for (unsigned int i = 0; i < reference_points.size(); ++i) {
4050 *   unsigned int group = remapped_point_owning_process.at(i);
4051 *  
4052 *   cell_matrix = 0;
4053 *   cell_residual = 0;
4054 *   cell_velocity_residual = 0;
4055 *   cell_second_time_rate_residual = 0;
4056 *  
4057 *   ReferencePoint<dim, Number> &reference_point = reference_points[i];
4058 *  
4059 *   mechanical_fe_values.reinit(reference_point.field_cell);
4060 *  
4061 *   Tensor<1, dim, Number> remapped_previous_deformation;
4062 *   Tensor<1, dim, Number> remapped_previous_velocity;
4063 *   Tensor<1, dim, Number> remapped_previous_second_time_rate;
4064 *  
4065 *   for(unsigned int dim_i=0; dim_i<dim; dim_i++) {
4066 *   remapped_previous_deformation[dim_i] =
4067 *   reference_point.remapped_point[dim_i]
4068 *   - reference_point.reference_point[dim_i]
4069 *   + remote_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4070 *   remapped_previous_velocity[dim_i] = remote_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4071 *   remapped_previous_second_time_rate[dim_i] = remote_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4072 *   }
4073 *  
4074 *   const Number remapped_previous_twist_deformation = remote_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4075 *   const Number remapped_previous_twist_velocity = remote_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4076 *   const Number remapped_previous_twist_second_time_rate = remote_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4077 *  
4078 *   for(unsigned int dof_i=0; dof_i<mechanical_dofs_per_cell; dof_i++) {
4079 *   const auto shape_value_i = postprocess_tensor_dimension(
4080 *   mechanical_fe_values[displacements].value(dof_i, reference_point.q_point),
4081 *   mechanical_fe_values[angular_velocities].value(dof_i, reference_point.q_point));
4082 *  
4083 *   cell_residual(dof_i) +=
4084 *   shape_value_i * postprocess_tensor_dimension(remapped_previous_deformation, remapped_previous_twist_deformation);
4085 *  
4086 *   cell_velocity_residual(dof_i) +=
4087 *   shape_value_i * postprocess_tensor_dimension(remapped_previous_velocity, remapped_previous_twist_velocity);
4088 *  
4089 *   cell_second_time_rate_residual(dof_i) +=
4090 *   shape_value_i * postprocess_tensor_dimension(remapped_previous_second_time_rate, remapped_previous_twist_second_time_rate);
4091 *  
4092 *   for(unsigned int dof_j=0; dof_j<mechanical_dofs_per_cell; dof_j++) {
4093 *   const auto shape_value_j = postprocess_tensor_dimension(
4094 *   mechanical_fe_values[displacements].value(dof_j, reference_point.q_point),
4095 *   mechanical_fe_values[angular_velocities].value(dof_j, reference_point.q_point));
4096 *  
4097 *   cell_matrix(dof_i, dof_j) += shape_value_i * shape_value_j;
4098 *  
4099 *   }
4100 *   }
4101 *  
4102 *   std::vector<types::global_dof_index> local_dof_indices(mechanical_dofs_per_cell);
4103 *   reference_point.field_cell->get_dof_indices(local_dof_indices);
4104 *   projection_residual.add(local_dof_indices, cell_residual);
4105 *   projection_velocity_residual.add(local_dof_indices, cell_velocity_residual);
4106 *   projection_second_time_rate_residual.add(local_dof_indices, cell_second_time_rate_residual);
4107 *   for(unsigned int dof_i=0; dof_i<mechanical_dofs_per_cell; dof_i++) {
4108 *   for(unsigned int dof_j=0; dof_j<mechanical_dofs_per_cell; dof_j++) {
4109 *   projection_matrix.add(local_dof_indices[dof_i], local_dof_indices[dof_j], cell_matrix(dof_i, dof_j));
4110 *   }
4111 *   }
4112 *  
4113 *   ++next_to_process.at(group);
4114 *   }
4115 *  
4116 *   projection_matrix.compress(VectorOperation::add);
4117 *   projection_residual.compress(VectorOperation::add);
4118 *   projection_velocity_residual.compress(VectorOperation::add);
4119 *   projection_second_time_rate_residual.compress(VectorOperation::add);
4120 *  
4121 * @endcode
4122 *
4123 * solve the projection system
4124 *
4125 * @code
4126 *   TrilinosWrappers::PreconditionAMG preconditioner;
4127 *  
4128 *   #if DEAL_II_VERSION_GTE(9,7,0)
4129 *   const std::vector<std::vector<bool> > constant_modes
4130 *   = DoFTools::extract_constant_modes(mechanical_dof_system.dof_handler,
4131 *   ComponentMask());
4132 *   #else
4133 *   std::vector<std::vector<bool> > constant_modes;
4134 *   DoFTools::extract_constant_modes(mechanical_dof_system.dof_handler, ComponentMask(), constant_modes);
4135 *   #endif
4136 *  
4138 *   additional_data.constant_modes = constant_modes;
4139 *   additional_data.elliptic = true;
4140 *   additional_data.n_cycles = 1;
4141 *   additional_data.w_cycle = false;
4142 *   additional_data.output_details = false;
4143 *   additional_data.smoother_sweeps = 2;
4144 *   additional_data.aggregation_threshold = 1e-2;
4145 *   preconditioner.initialize(projection_matrix, additional_data);
4146 *  
4147 *   TrilinosWrappers::MPI::Vector tmp(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4148 *   const Number relative_accuracy = 1e-08;
4149 *   const Number solver_tolerance = relative_accuracy
4150 *   * projection_matrix.residual(tmp, projection_solution,
4151 *   projection_residual);
4152 *   SolverControl solver_control(projection_matrix.m(),
4153 *   solver_tolerance);
4154 *  
4155 *   SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
4156 *  
4157 *   projection_solution = 0;
4158 *  
4159 *   solver.solve(projection_matrix, projection_solution,
4160 *   projection_residual, preconditioner);
4161 *  
4162 *   mechanical_nonlinear_system.previous_deformation = projection_solution;
4163 *  
4164 *   projection_solution = 0;
4165 *   solver.solve(projection_matrix, projection_solution,
4166 *   projection_velocity_residual, preconditioner);
4167 *   mechanical_nonlinear_system.previous_time_derivative = projection_solution;
4168 *  
4169 *   projection_solution = 0;
4170 *   solver.solve(projection_matrix, projection_solution,
4171 *   projection_second_time_rate_residual, preconditioner);
4172 *   mechanical_nonlinear_system.previous_second_time_derivative = projection_solution;
4173 *  
4174 *   }
4175 *  
4176 *  
4177 *   template <int dim, typename Number>
4178 *   void PlasticityLabProg<dim, Number>::assemble_mechanical_system(
4179 *   NewtonStepSystem &Newton_system,
4180 *   const DoFSystem<dim, Number> &mechanical_dof_system,
4181 *   const LBCSystem<dim, Number, dim+1> &mechanical_lbc_system,
4182 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
4183 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
4184 *   const NewtonStepSystem &thermal_Newton_system,
4185 *   const DoFSystem<dim, Number> &thermal_dof_system,
4186 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
4187 *   Material<dim+1, Number> &material,
4188 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
4189 *   const bool fill_system_matrix,
4190 *   const bool update_material_state) {
4191 *   FEValues<dim> fe_values(
4192 *   mapping,
4193 *   mech_fe,
4194 *   quadrature_formula,
4196 *  
4198 *   mapping,
4199 *   mech_fe,
4200 *   face_quadrature_formula,
4202 *  
4203 *   FEValues<dim> fe_therm_values(
4204 *   mapping,
4205 *   therm_fe,
4206 *   quadrature_formula,
4207 *   update_values);
4208 *  
4209 *   FEValues<dim> mesh_motion_fe_values(
4210 *   mapping,
4211 *   mesh_motion_fe,
4212 *   quadrature_formula,
4214 *  
4215 *   FEValues<dim> mixed_fe_values(
4216 *   mapping,
4217 *   mixed_var_fe,
4218 *   quadrature_formula,
4219 *   update_values);
4220 *  
4221 *   const unsigned int dofs_per_cell = mech_fe.dofs_per_cell;
4222 *   const unsigned int n_q_points = quadrature_formula.size();
4223 *   const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
4224 *   const unsigned int n_face_q_points = face_quadrature_formula.size();
4225 *  
4226 *   std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points);
4227 *   std::vector< Tensor<2, dim, Number> > displacement_gradient_increments(n_q_points);
4228 *  
4229 *   std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points);
4230 *   std::vector< Tensor<1, dim, Number> > displacement_value_increments(n_q_points);
4231 *  
4232 *   std::vector< Tensor<2, dim, Number> > displacement_gradient_previous_time_rates(n_q_points);
4233 *   std::vector< Tensor<2, dim, Number> > displacement_gradient_previous_second_time_rates(n_q_points);
4234 *  
4235 *   std::vector< Tensor<1, dim, Number> > displacement_increments(n_q_points);
4236 *   std::vector< Tensor<1, dim, Number> > displacement_previous_time_rates(n_q_points);
4237 *   std::vector< Tensor<1, dim, Number> > displacement_previous_second_time_rates(n_q_points);
4238 *  
4239 *   std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_increments(n_q_points);
4240 *   std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_previous_time_rates(n_q_points);
4241 *   std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_previous_second_time_rates(n_q_points);
4242 *  
4243 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
4244 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
4245 *  
4246 *   std::vector< Number > angular_velocity_increments(n_q_points);
4247 *   std::vector< Number > angular_velocity_previous_time_rates(n_q_points);
4248 *   std::vector< Number > angular_velocity_previous_second_time_rates(n_q_points);
4249 *  
4250 *   std::vector< Number > current_temperature_values(n_q_points);
4251 *   std::vector< Number > updated_temperature_increments(n_q_points);
4252 *   std::vector< Number > updated_temperature_values(n_q_points);
4253 *  
4254 *   std::vector< Tensor<1, dim, Number> > face_displacement_value_increments(n_face_q_points);
4255 *  
4256 *   std::vector< Number > deformation_jacobians(n_q_points);
4257 *   std::vector< Number > previous_deformation_jacobian(n_q_points);
4258 *   std::vector< std::vector<Number> > strain_divergences(
4259 *   dofs_per_cell,
4260 *   std::vector<Number>(n_q_points));
4261 *   std::vector< std::vector<Number> > jacobian_tangents(
4262 *   dofs_per_cell,
4263 *   std::vector<Number>(n_q_points));
4264 *  
4265 *   std::vector< std::vector< std::vector < Number> > > strain_divergence_tangents(
4266 *   dofs_per_cell,
4267 *   std::vector< std::vector< Number> >(
4268 *   dofs_per_cell,
4269 *   std::vector<Number>(n_q_points)));
4270 *  
4271 *   std::vector<Number> projected_temperature_coefficients(mixed_dofs_per_cell);
4272 *   std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
4273 *   std::vector<Number> projected_previous_temperature_coefficients(mixed_dofs_per_cell);
4274 *   std::vector<Number> projected_previous_Jacobian_coefficients(mixed_dofs_per_cell);
4275 *   std::vector<std::vector<Number> > projected_strain_divergence_coefficients(
4276 *   dofs_per_cell,
4277 *   std::vector<Number>(mixed_dofs_per_cell));
4278 *   std::vector<std::vector<Number> > projected_jacobian_tangent_coefficients(
4279 *   dofs_per_cell,
4280 *   std::vector<Number>(mixed_dofs_per_cell));
4281 *   std::vector<std::vector<std::vector<Number> > > projected_strain_divergence_tangent_coefficients(
4282 *   dofs_per_cell, std::vector< std::vector< Number> >(
4283 *   dofs_per_cell,
4284 *   std::vector<Number>(mixed_dofs_per_cell)));
4285 *  
4286 *   std::vector<Number> projected_strain_divergence(dofs_per_cell);
4287 *   std::vector<Number> projected_jacobian_tangent(dofs_per_cell);
4288 *   std::vector<std::vector<Number> > projected_strain_divergence_tangent(
4289 *   dofs_per_cell,
4290 *   std::vector<Number>(dofs_per_cell));
4291 *  
4294 *  
4295 *   Vector<Number> mixed_values (mixed_dofs_per_cell);
4296 *  
4297 *   const FEValuesExtractors::Vector displacements (0);
4298 *   const FEValuesExtractors::Scalar angular_velocity(dim);
4300 *  
4301 *   Newton_system.Newton_step_matrix = 0;
4302 *   Newton_system.Newton_step_residual = 0;
4303 *  
4304 *   double alpha_m, alpha_f, gamma, beta;
4305 *   get_generalized_alpha_method_params(
4306 *   &alpha_m, &alpha_f, &gamma, &beta, rho_infty);
4307 *  
4308 *   const Number d_second_time_rate_d_increment = (1./(beta*time_increment*time_increment));
4309 *   const Number d_time_rate_d_increment = gamma/(beta*time_increment);
4310 *  
4311 *   bool kinematic_domains_are_valid = true; // innocent until proven guilty
4312 *  
4313 *   auto cell = mechanical_dof_system.dof_handler.begin_active();
4314 *   auto endc = mechanical_dof_system.dof_handler.end();
4315 *   auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
4316 *   auto mesh_motion_cell = mesh_motion_dof_system.dof_handler.begin_active();
4317 *   auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
4318 *   for (; cell != endc; ++cell, ++thermal_cell, ++mesh_motion_cell, ++mixed_fe_cell) {
4319 *   if (cell->is_locally_owned()) {
4320 *   cell_matrix = 0;
4321 *   cell_residual = 0;
4322 *  
4323 *   fe_values.reinit (cell);
4324 *   fe_therm_values.reinit (thermal_cell);
4325 *   mixed_fe_values.reinit (mixed_fe_cell);
4326 *   mesh_motion_fe_values.reinit (mesh_motion_cell);
4327 *  
4328 *   fe_values[displacements].get_function_gradients(
4329 *   Newton_system.current_increment,
4330 *   displacement_gradient_increments);
4331 *  
4332 *   fe_values[displacements].get_function_gradients(
4333 *   Newton_system.previous_deformation,
4334 *   current_displacement_gradients);
4335 *  
4336 *   fe_values[displacements].get_function_values(
4337 *   Newton_system.current_increment,
4338 *   displacement_value_increments);
4339 *  
4340 *   fe_values[displacements].get_function_values(
4341 *   Newton_system.previous_deformation,
4342 *   current_displacement_values);
4343 *  
4344 *   fe_values[displacements].get_function_gradients(
4345 *   Newton_system.previous_time_derivative,
4346 *   displacement_gradient_previous_time_rates);
4347 *  
4348 *   fe_values[displacements].get_function_gradients(
4349 *   Newton_system.previous_second_time_derivative,
4350 *   displacement_gradient_previous_second_time_rates);
4351 *  
4352 *   fe_values[displacements].get_function_values(
4353 *   Newton_system.current_increment,
4354 *   displacement_increments);
4355 *  
4356 *   fe_values[displacements].get_function_values(
4357 *   Newton_system.previous_time_derivative,
4358 *   displacement_previous_time_rates);
4359 *  
4360 *   fe_values[displacements].get_function_values(
4361 *   Newton_system.previous_second_time_derivative,
4362 *   displacement_previous_second_time_rates);
4363 *  
4364 * @endcode
4365 *
4366 * Angular velocity
4367 *
4368 * @code
4369 *   fe_values[angular_velocity].get_function_gradients(
4370 *   Newton_system.current_increment,
4371 *   angular_velocity_gradient_increments);
4372 *  
4373 *   fe_values[angular_velocity].get_function_gradients(
4374 *   Newton_system.previous_time_derivative,
4375 *   angular_velocity_gradient_previous_time_rates);
4376 *  
4377 *   fe_values[angular_velocity].get_function_gradients(
4378 *   Newton_system.previous_second_time_derivative,
4379 *   angular_velocity_gradient_previous_second_time_rates);
4380 *  
4381 *   fe_values[angular_velocity].get_function_values(
4382 *   Newton_system.current_increment,
4383 *   angular_velocity_increments);
4384 *  
4385 *   fe_values[angular_velocity].get_function_values(
4386 *   Newton_system.previous_time_derivative,
4387 *   angular_velocity_previous_time_rates);
4388 *  
4389 *   fe_values[angular_velocity].get_function_values(
4390 *   Newton_system.previous_second_time_derivative,
4391 *   angular_velocity_previous_second_time_rates);
4392 *  
4393 * @endcode
4394 *
4395 * mesh motion
4396 *
4397 * @code
4398 *   mesh_motion_fe_values[displacements].get_function_gradients(
4399 *   mesh_motion_nonlinear_system.current_increment,
4400 *   mesh_motion_gradient_increments);
4401 *  
4402 *   mesh_motion_fe_values[displacements].get_function_gradients(
4403 *   mesh_motion_nonlinear_system.current_increment,
4404 *   mesh_motion_gradient_increments);
4405 *  
4406 * @endcode
4407 *
4408 * temperature
4409 *
4410 * @code
4411 *   fe_therm_values[temperature].get_function_values (
4412 *   thermal_Newton_system.previous_deformation,
4413 *   current_temperature_values);
4414 *   fe_therm_values[temperature].get_function_values (
4415 *   thermal_Newton_system.current_increment,
4416 *   updated_temperature_increments);
4417 *  
4418 * @endcode
4419 *
4420 * get vectors for projection onto mixed fe values
4421 *
4422 * @code
4423 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
4424 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
4425 *   updated_temperature_values.at(q_point) =
4426 *   current_temperature_values.at(q_point)
4427 *   + updated_temperature_increments.at(q_point);
4428 *  
4429 *   const auto current_F = get_deformation_gradient(
4430 *   current_displacement_gradients[q_point],
4431 *   current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
4432 *   );
4433 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(current_F);
4434 *  
4435 *   [[maybe_unused]] const auto mesh_motion_gradient = get_deformation_gradient(
4436 *   -mesh_motion_gradient_increments[q_point],
4437 *   -mesh_motion_value_increments[q_point][0]/fe_values.quadrature_point(q_point)[0]);
4438 *  
4439 *   const Tensor<2, dim+1, Number> updated_F = get_deformation_gradient(
4440 *   current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
4441 *   (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])
4442 *   /fe_values.quadrature_point(q_point)[0]
4443 *   );
4444 *  
4445 *  
4446 *   const Number Jacobian = material_Jacobian * determinant(updated_F);
4447 *   deformation_jacobians.at(q_point) = Jacobian;
4448 *   previous_deformation_jacobian.at(q_point) = material_Jacobian * determinant(current_F);
4449 *  
4450 *   const auto inv_updated_F = invert(updated_F);
4451 *   std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
4452 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4453 *   rate_gradients[i] = postprocess_tensor_dimension(
4454 *   fe_values[displacements].gradient(i, q_point),
4455 *   fe_values[displacements].value(i, q_point)[0]/fe_values.quadrature_point(q_point)[0]) * inv_updated_F;
4456 *   }
4457 *  
4458 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4459 *   const Number strain_divergence_i = trace(rate_gradients[i]);
4460 *   strain_divergences[i].at(q_point) = Jacobian * strain_divergence_i;
4461 *   if (fill_system_matrix) {
4462 *   jacobian_tangents[i].at(q_point) = Jacobian * strain_divergence_i;
4463 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4464 *   strain_divergence_tangents[i][j].at(q_point) =
4465 *   Jacobian
4466 *   * (trace(rate_gradients[i]) * trace(rate_gradients[j])
4467 *   - trace(rate_gradients[i] * rate_gradients[j]));
4468 *   }
4469 *   }
4470 *   }
4471 *   }
4472 *  
4473 *   const unsigned int cell_index = cell->user_index() / n_q_points;
4474 *  
4475 *   mixed_fe_projector[cell_index].project(
4476 *   &projected_temperature_coefficients,
4477 *   updated_temperature_values);
4478 *   mixed_fe_projector[cell_index].project(
4479 *   &projected_Jacobian_coefficients,
4480 *   deformation_jacobians);
4481 *   mixed_fe_projector[cell_index].project(
4482 *   &projected_previous_Jacobian_coefficients,
4483 *   previous_deformation_jacobian);
4484 *   mixed_fe_projector[cell_index].project(
4485 *   &projected_previous_temperature_coefficients,
4486 *   current_temperature_values);
4487 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4488 *   mixed_fe_projector[cell_index].project(
4489 *   &projected_strain_divergence_coefficients[i],
4490 *   strain_divergences[i]);
4491 *   if (fill_system_matrix) {
4492 *   mixed_fe_projector[cell_index].project(
4493 *   &projected_jacobian_tangent_coefficients[i],
4494 *   jacobian_tangents[i]);
4495 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4496 *   mixed_fe_projector[cell_index].project(
4497 *   &projected_strain_divergence_tangent_coefficients[i][j],
4498 *   strain_divergence_tangents[i][j]);
4499 *   }
4500 *   }
4501 *   }
4502 *  
4503 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
4504 *   ConstitutiveModelUpdateFlags materialUpdateFlags =
4505 *   (update_pressure | update_stress_deviator);
4506 *  
4507 *   if (fill_system_matrix) {
4508 *   materialUpdateFlags |=
4509 *   (update_pressure_tangent | update_stress_deviator_tangent);
4510 *   }
4511 *  
4512 *   ConstitutiveModelRequest<dim+1, Number> previous_constitutive_request(materialUpdateFlags);
4513 *  
4514 *   if (update_material_state) {
4515 *   materialUpdateFlags |= update_material_point_history;
4516 *   }
4517 *  
4518 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
4519 *   ConstitutiveModelRequest<dim+1, Number> constitutive_request(materialUpdateFlags);
4520 *  
4521 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
4522 *   mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
4523 *   }
4524 *  
4525 *   const Number radius = fe_values.quadrature_point(q_point)[0];
4526 *   const auto current_F = get_deformation_gradient(
4527 *   current_displacement_gradients[q_point],
4528 *   current_displacement_values[q_point][0]/radius
4529 *   );
4530 *  
4531 *   const auto mesh_motion_gradient = get_deformation_gradient(
4532 *   -mesh_motion_gradient_increments[q_point],
4533 *   -mesh_motion_value_increments[q_point][0]/radius);
4534 *  
4535 *   const Tensor<2, dim+1, Number> updated_F = get_deformation_gradient(
4536 *   current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
4537 *   (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/radius);
4538 *  
4539 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(current_F);
4540 *   [[maybe_unused]] const Number mesh_motion_Jacobian = determinant(mesh_motion_gradient);
4541 *  
4542 *   const auto inv_updated_F = invert(updated_F);
4543 *   const Number Jacobian = determinant(updated_F) * material_Jacobian;
4544 *   const Number previous_Jacobian = determinant(current_F) * material_Jacobian;
4545 *  
4546 *  
4547 *   const Number DENSITY = 8.96e-9;
4548 *  
4549 *   const Tensor<1, dim+1, Number> displacement_increment = postprocess_tensor_dimension(displacement_increments[q_point]);
4550 *   const Tensor<1, dim+1, Number> displacement_previous_time_rate = postprocess_tensor_dimension(displacement_previous_time_rates[q_point]);
4551 *   const Tensor<1, dim+1, Number> displacement_previous_second_time_rate = postprocess_tensor_dimension(displacement_previous_second_time_rates[q_point]);
4552 *   const Tensor<2, dim+1, Number> displacement_gradient_previous_time_rate = postprocess_tensor_dimension(
4553 *   displacement_gradient_previous_time_rates[q_point], displacement_previous_time_rates[q_point][0]/radius);
4554 *   const Tensor<2, dim+1, Number> displacement_gradient_previous_second_time_rate = postprocess_tensor_dimension(
4555 *   displacement_gradient_previous_second_time_rates[q_point], displacement_previous_second_time_rates[q_point][0]/radius);
4556 *  
4557 *   const Tensor<1, dim+1, Number> uc_increment = scalar_to_angular_tensor(angular_velocity_increments[q_point]);
4558 *   const Tensor<1, dim+1, Number> vc_n = scalar_to_angular_tensor(angular_velocity_previous_time_rates[q_point]);
4559 *   const Tensor<1, dim+1, Number> d_vc_d_t_n = scalar_to_angular_tensor(angular_velocity_previous_second_time_rates[q_point]);
4560 *  
4561 *   const Tensor<1, dim+1, Number> d2_x_dt_2_n_plus_1 =
4562 *   (1./(beta*time_increment*time_increment))
4563 *   * (displacement_increment
4564 *   - time_increment * displacement_previous_time_rate
4565 *   - time_increment * time_increment * (0.5-beta) * displacement_previous_second_time_rate);
4566 *  
4567 *   const Tensor<1, dim+1, Number> d_x_dt_n_plus_1 =
4568 *   displacement_previous_time_rate + time_increment * ((1-gamma) * displacement_previous_second_time_rate + gamma * d2_x_dt_2_n_plus_1);
4569 *  
4570 *   const Tensor<2, dim+1, Number> Grad_d_2_x_d_t_2_n_plus_1 =
4571 *   (1./(beta*time_increment*time_increment))
4572 *   * (postprocess_tensor_dimension(
4573 *   displacement_gradient_increments[q_point],
4574 *   displacement_value_increments[q_point][0]/radius)
4575 *   - time_increment * displacement_gradient_previous_time_rate
4576 *   - time_increment * time_increment * (0.5-beta) * displacement_gradient_previous_second_time_rate);
4577 *  
4578 *   const Tensor<2, dim+1, Number> Grad_d_x_d_t_n_plus_1 =
4579 *   displacement_gradient_previous_time_rate
4580 *   + time_increment * (
4581 *   (1.-gamma) * displacement_gradient_previous_second_time_rate
4582 *   + gamma * Grad_d_2_x_d_t_2_n_plus_1);
4583 *  
4584 *   const Tensor<1, dim+1, Number> d_vc_d_t_n_plus_1 =
4585 *   (1./(beta*time_increment*time_increment))
4586 *   * (uc_increment
4587 *   - time_increment * vc_n
4588 *   - time_increment * time_increment * (0.5-beta) * d_vc_d_t_n);
4589 *  
4590 *   const Tensor<1, dim+1, Number> vc_n_plus_1 =
4591 *   vc_n + time_increment * ((1-gamma) * d_vc_d_t_n + gamma * d_vc_d_t_n_plus_1);
4592 *  
4593 *   const Number thR_increment = angular_velocity_increments[q_point];
4594 *   const Number d_thR_d_t_n = angular_velocity_previous_time_rates[q_point];
4595 *   const Number d2_thR_d_t2_n = angular_velocity_previous_second_time_rates[q_point];
4596 *  
4597 *   const Number d2_thR_d_t2_n_plus_1 =
4598 *   (1./(beta*time_increment*time_increment))
4599 *   * (thR_increment
4600 *   - time_increment * d_thR_d_t_n
4601 *   - time_increment * time_increment * (0.5-beta) * d2_thR_d_t2_n);
4602 *  
4603 *   const Number d_thR_d_t_n_plus_1 =
4604 *   d_thR_d_t_n + time_increment * ((1-gamma) * d2_thR_d_t2_n + gamma * d2_thR_d_t2_n_plus_1);
4605 *  
4606 *   const Number one_plus_r_over_R_n = 1.0 + current_displacement_values[q_point][0]/radius;
4607 *   const Number one_plus_r_over_R_n_plus_1 = 1.0 + (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/radius;
4608 *   const Number d_r_d_t_n_over_R = displacement_previous_time_rate[0] / radius;
4609 *   const Number d_r_d_t_n_plus_one_over_R = d_x_dt_n_plus_1[0] / radius;
4610 *  
4611 *   Tensor<1, dim+1, Number> e_hat_R;
4612 *   e_hat_R[0] = 1;
4613 *  
4614 *   const Tensor<1, dim+1, Number> acceleration_n_plus_1 =
4615 *   d2_x_dt_2_n_plus_1
4616 *   + scalar_to_angular_tensor(
4617 *   d_r_d_t_n_plus_one_over_R * d_thR_d_t_n_plus_1
4618 *   + one_plus_r_over_R_n_plus_1 * d2_thR_d_t2_n_plus_1)
4619 *   - (1.0/radius) * one_plus_r_over_R_n_plus_1 * std::pow(d_thR_d_t_n_plus_1, 2) * e_hat_R;
4620 *  
4621 *   const Tensor<1, dim+1, Number> acceleration_n =
4622 *   displacement_previous_second_time_rate
4623 *   + scalar_to_angular_tensor(
4624 *   d_r_d_t_n_over_R * d_thR_d_t_n
4625 *   + one_plus_r_over_R_n * d2_thR_d_t2_n)
4626 *   - (1.0/radius) * one_plus_r_over_R_n * std::pow(d_thR_d_t_n, 2) * e_hat_R;
4627 *  
4628 *   const Tensor<1, dim+1, Number> acceleration_n_plus_1_minus_alpha_m =
4629 *   alpha_m * acceleration_n + (1-alpha_m) * acceleration_n_plus_1;
4630 *  
4631 *   Tensor<2, dim+1, Number> acceleration_n_plus_1_minus_alpha_m_tangent_modulus;
4632 *   for(unsigned int i=0; i<dim; i++) {
4633 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[i][i] += (1-alpha_m) * d_second_time_rate_d_increment;
4634 *   }
4635 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[dim][0] +=
4636 *   (1-alpha_m) * (d_time_rate_d_increment/radius * d_thR_d_t_n_plus_1 + 1.0/radius * d2_thR_d_t2_n_plus_1);
4637 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[0][0] +=
4638 *   (1-alpha_m) * (-(1.0/radius) * (1.0/radius) * std::pow(d_thR_d_t_n_plus_1, 2));
4639 *  
4640 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[dim][dim] +=
4641 *   (1-alpha_m)
4642 *   * (d_r_d_t_n_plus_one_over_R * d_time_rate_d_increment
4643 *   + one_plus_r_over_R_n_plus_1 * d_second_time_rate_d_increment);
4644 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[0][dim] +=
4645 *   (1-alpha_m)
4646 *   * (-(1.0/radius) * one_plus_r_over_R_n * 2 * d_thR_d_t_n * d_time_rate_d_increment);
4647 *  
4648 *  
4649 *   [[maybe_unused]] const auto d2_x_dt_2_n_plus_1_minus_alpha_m =
4650 *   alpha_m * displacement_previous_second_time_rate + (1-alpha_m)*d2_x_dt_2_n_plus_1;
4651 *   [[maybe_unused]] const Number d2_x_dt_2_tangent_1_minus_alpha_m = (1-alpha_m)*d_second_time_rate_d_increment;
4652 *  
4653 *   [[maybe_unused]] const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f =
4654 *   alpha_m * displacement_gradient_previous_time_rate * vc_n
4655 *   + (1-alpha_m) * Grad_d_x_d_t_n_plus_1 * vc_n_plus_1;
4656 *  
4657 *   [[maybe_unused]] const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f_F_tangent = (1-alpha_m) * d_time_rate_d_increment * vc_n_plus_1;
4658 *   [[maybe_unused]] const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f_v_tangent = (1-alpha_m) * Grad_d_x_d_t_n_plus_1;
4659 *  
4660 *   [[maybe_unused]] const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m =
4661 *   alpha_m * current_F * d_vc_d_t_n
4662 *   + (1-alpha_m) * updated_F * d_vc_d_t_n_plus_1;
4663 *  
4664 *   [[maybe_unused]] const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m_F_tangent = (1-alpha_m) * d_vc_d_t_n_plus_1;
4665 *   [[maybe_unused]] const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m_V_tangent = (1-alpha_m) * updated_F * d_second_time_rate_d_increment;
4666 *  
4667 *   std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
4668 *   std::vector<Tensor<2, dim+1, Number>> angular_rate_gradients(dofs_per_cell);
4669 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4670 *   rate_gradients[i] =
4671 *   postprocess_tensor_dimension(
4672 *   fe_values[displacements].gradient(i, q_point),
4673 *   fe_values[displacements].value(i, q_point)[0]/radius) * inv_updated_F;
4674 *   angular_rate_gradients[i] =
4675 *   order_1_tensor_to_angular_gradient(
4676 *   fe_values[angular_velocity].gradient(i, q_point),
4677 *   -fe_values[angular_velocity].value(i, q_point)/radius);
4678 *   }
4679 *  
4680 *   const Tensor<2, dim+1, Number> d_X_prime_d_X = deformation_gradient_from_angular_displacement_gradient(
4681 *   -angular_velocity_increments[q_point],
4682 *   -angular_velocity_gradient_increments[q_point],
4683 *   radius
4684 *   );
4685 *  
4686 *   const Tensor<2, dim+1, Number> rotation_to_X_prime_frame = rotation_tensor_to_transform_B_e(
4687 *   -angular_velocity_increments[q_point],
4688 *   radius
4689 *   );
4690 *  
4691 *   const Tensor<2, dim+1, Number> inv_d_X_prime_d_X = invert(d_X_prime_d_X);
4692 *  
4693 *   const auto f_m_n_plus_1 = inv_d_X_prime_d_X * rotation_to_X_prime_frame;
4694 *  
4695 * @endcode
4696 *
4697 * std::cout << "f_r: " << inv_d_X_prime_d_X << std::endl;
4698 * std::cout << "R: " << previous_elastic_deformation_transformation_tensor << std::endl;
4699 * std::cout << "f_m_n+1: " << f_m_n_plus_1 << std::endl;
4700 *
4701
4702 *
4703 *
4704 * @code
4705 *   Number projected_jacobian = 0;
4706 *   Number projected_previous_jacobian = 0;
4707 *   Number projected_temperature = 0;
4708 *   Number projected_previous_temperature = 0;
4709 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
4710 *   projected_jacobian +=
4711 *   mixed_values(i) * projected_Jacobian_coefficients.at(i);
4712 *   projected_previous_jacobian +=
4713 *   mixed_values(i) * projected_previous_Jacobian_coefficients.at(i);
4714 *   projected_temperature +=
4715 *   mixed_values(i) * projected_temperature_coefficients.at(i);
4716 *   projected_previous_temperature +=
4717 *   mixed_values(i) * projected_previous_temperature_coefficients.at(i);
4718 *   }
4719 *  
4720 *   const auto unnormalized_deformation_gradient_increment = updated_F * f_m_n_plus_1 * invert(current_F);
4721 *  
4722 *   const auto deformation_gradient_increment =
4723 *   std::pow(determinant(unnormalized_deformation_gradient_increment),
4724 *   -Constants<dim, Number>::one_third()) * unnormalized_deformation_gradient_increment;
4725 *  
4726 *   if(std::abs(determinant(deformation_gradient_increment)-1.0) > 1e-8)
4727 *   std::cout << "determinant(deformation_gradient_increment): " << determinant(deformation_gradient_increment) << std::endl;
4728 *  
4729 *   if(false && std::isnan(deformation_gradient_increment.norm())) {
4730 *   std::cout << "deformation_gradient_increment is nan: " << deformation_gradient_increment << std::endl;
4731 *   std::cout << "Jacobian: " << Jacobian
4732 *   << "\nf_m_n_plus_1: " << f_m_n_plus_1
4733 *   << "\ndet(f_m_n_plus_1): " << determinant(f_m_n_plus_1)
4734 *   << "\nprevious_Jacobian: " << previous_Jacobian
4735 *   << "\nupdated_F: " << updated_F
4736 *   << "\ncurrent_F: " << current_F
4737 *   << "\ninvert(current_F): " << invert(current_F)
4738 *   << std::endl;
4739 *   }
4740 *  
4741 *   constitutive_request.set_deformation_Jacobian(projected_jacobian);
4742 *   constitutive_request.set_unprojected_deformation_Jacobian(determinant(updated_F) * material_Jacobian);
4743 *   constitutive_request.set_temperature(projected_temperature);
4744 *   constitutive_request.set_deformation_gradient(deformation_gradient_increment);
4745 *   constitutive_request.set_time_increment(time_increment);
4746 *  
4747 *   try {
4748 *   material.compute_constitutive_request(constitutive_request,
4749 *   quadrature_point_index);
4750 *   } catch (const MaterialDomainException &exc) {
4751 * @endcode
4752 *
4753 * std::cerr << "projected_jacobian: " << projected_jacobian
4754 * << "\ndeformation_gradient_increment: " << deformation_gradient_increment
4755 * << "\nupdated_F: " << updated_F
4756 * << "\nf_m_n_plus_1: " << f_m_n_plus_1
4757 * << "\ncurrent_F: " << current_F
4758 * << "\ninvert(current_F): " << invert(current_F)
4759 * << "\nJacobian: " << Jacobian
4760 * << "\ndeterminant(f_m_n_plus_1): " << determinant(f_m_n_plus_1)
4761 * << "\nprevious_Jacobian: " << previous_Jacobian
4762 * << "\n-------------------\n"
4763 * << std::endl;
4764 * std::cerr << exc.what() << std::endl;
4765 *
4766 * @code
4767 *   kinematic_domains_are_valid = false;
4768 *   continue;
4769 *   }
4770 *  
4771 *   previous_constitutive_request.set_deformation_Jacobian(projected_previous_jacobian);
4772 *   previous_constitutive_request.set_temperature(projected_previous_temperature);
4773 *   previous_constitutive_request.set_deformation_gradient(unit_symmetric_tensor<dim+1, Number>());
4774 *   previous_constitutive_request.set_time_increment(time_increment);
4775 *   previous_constitutive_request.set_is_plastic(false); // the elastic strain is known, no need for predictor-corrector procedure
4776 *  
4777 *   material.compute_constitutive_request(previous_constitutive_request,
4778 *   quadrature_point_index);
4779 *  
4780 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4781 *   projected_strain_divergence[j] =
4782 *   mixed_values(0) * projected_strain_divergence_coefficients[j][0];
4783 *   if (fill_system_matrix) {
4784 *   projected_jacobian_tangent[j] =
4785 *   mixed_values(0) * projected_jacobian_tangent_coefficients[j][0];
4786 *   for (unsigned int k = 0; k < dofs_per_cell; ++k) {
4787 *   projected_strain_divergence_tangent[j][k] =
4788 *   mixed_values(0)
4789 *   * projected_strain_divergence_tangent_coefficients[j][k][0];
4790 *   }
4791 *   }
4792 *   }
4793 *  
4794 *   for (unsigned int i = 1; i < mixed_dofs_per_cell; ++i) {
4795 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4796 *   projected_strain_divergence[j] +=
4797 *   mixed_values(i) * projected_strain_divergence_coefficients[j][i];
4798 *   if (fill_system_matrix) {
4799 *   projected_jacobian_tangent[j] +=
4800 *   mixed_values(i) * projected_jacobian_tangent_coefficients[j][i];
4801 *   for (unsigned int k = 0; k < dofs_per_cell; ++k) {
4802 *   projected_strain_divergence_tangent[j][k] +=
4803 *   mixed_values(i)
4804 *   * projected_strain_divergence_tangent_coefficients[j][k][i];
4805 *   }
4806 *   }
4807 *   }
4808 *   }
4809 *  
4810 *   const Number RJxW = radius / material_Jacobian * fe_values.JxW(q_point);
4811 *  
4812 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4813 *   const auto strain_i = symmetrize(rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F);
4814 *  
4815 * @endcode
4816 *
4817 * stress deviator term
4818 *
4819 * @code
4820 *   const SymmetricTensor<2, dim+1, Number> stress_deviator =
4821 *   alpha_f * previous_constitutive_request.get_stress_deviator()
4822 *   + (1-alpha_f) * constitutive_request.get_stress_deviator();
4823 *   const Number pressure =
4824 *   alpha_f * previous_constitutive_request.get_pressure()
4825 *   + (1-alpha_f) * constitutive_request.get_pressure();
4826 *   cell_residual(i) += strain_i * stress_deviator * RJxW;
4827 *  
4828 * @endcode
4829 *
4830 * pressure term
4831 *
4832 * @code
4833 *   cell_residual(i) +=
4834 *   (projected_strain_divergence.at(i)) * pressure * RJxW;
4835 *  
4836 * @endcode
4837 *
4838 * body force term
4839 *
4840 * @code
4841 *   const unsigned int
4842 *   component_i = mech_fe.system_to_component_index(i).first;
4843 *   for ( typename std::vector<BodyForceApplier<dim, Number> >::const_iterator
4844 *   bodyForceApplier = mechanical_lbc_system.bodyLoadAppliers.begin();
4845 *   bodyForceApplier != mechanical_lbc_system.bodyLoadAppliers.end();
4846 *   ++bodyForceApplier) {
4847 *   cell_residual(i) +=
4848 *   bodyForceApplier->apply(
4849 *   component_i,
4850 *   fe_values.shape_value (i, q_point),
4851 *   RJxW);
4852 *   }
4853 *  
4854 * @endcode
4855 *
4856 * inertial term
4857 *
4858 * @code
4859 *   cell_residual(i) +=
4860 *   (postprocess_tensor_dimension(fe_values[displacements].value(i, q_point)) + scalar_to_angular_tensor(fe_values[angular_velocity].value(i, q_point)))
4861 *   * DENSITY
4862 *   * acceleration_n_plus_1_minus_alpha_m * RJxW;
4863 *   }
4864 *  
4865 *   if (fill_system_matrix) {
4866 *   std::vector<SymmetricTensor<2, dim+1, Number> > stress_deviator_tangents(dofs_per_cell);
4867 *   std::vector<Number> pressure_tangents(dofs_per_cell);
4868 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4869 *  
4870 *   const Tensor<2, dim+1, Number> d_X_prime_d_X_variation =
4871 *   deformation_gradient_from_angular_displacement_gradient_variations(
4872 *   -angular_velocity_increments[q_point],
4873 *   -angular_velocity_gradient_increments[q_point],
4874 *   radius,
4875 *   -fe_values[angular_velocity].value(i, q_point),
4876 *   -fe_values[angular_velocity].gradient(i, q_point)
4877 *   );
4878 *  
4879 *   const Tensor<2, dim+1, Number> rotation_to_X_prime_frame_variation = rotation_tensor_variation_to_transform_B_e(
4880 *   -angular_velocity_increments[q_point],
4881 *   -fe_values[angular_velocity].value(i, q_point),
4882 *   radius
4883 *   );
4884 *  
4885 *   const auto f_m_n_plus_1_variation_inv_f_m_n_plus_1 =
4886 *   (- inv_d_X_prime_d_X * d_X_prime_d_X_variation * inv_d_X_prime_d_X * rotation_to_X_prime_frame
4887 *   + inv_d_X_prime_d_X * rotation_to_X_prime_frame_variation) * invert(f_m_n_plus_1);
4888 *  
4889 *   stress_deviator_tangents[i] = (1-alpha_f) * constitutive_request.get_stress_deviator_tangent(
4890 *   rate_gradients[i]
4891 *   - Constants<dim+1, Number>::one_third()
4892 *   * trace(rate_gradients[i])
4894 *   + updated_F * f_m_n_plus_1_variation_inv_f_m_n_plus_1 * inv_updated_F
4895 *   - Constants<dim+1, Number>::one_third()
4896 *   * trace(f_m_n_plus_1_variation_inv_f_m_n_plus_1)
4898 *  
4899 *   pressure_tangents[i] = (1-alpha_f) * constitutive_request.get_pressure_tangent(
4900 *   projected_jacobian_tangent[i]);
4901 *   }
4902 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4903 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4904 * @endcode
4905 *
4906 * stress tangent
4907 *
4908 * @code
4909 *   const Number f_int_dev_tau = symmetrize(rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F) * stress_deviator_tangents[j];
4910 *   cell_matrix(i, j) += (f_int_dev_tau) * RJxW;
4911 * @endcode
4912 *
4913 * pressure_tangent
4914 *
4915 * @code
4916 *   const Number f_int_pressure =
4917 *   projected_strain_divergence.at(i)
4918 *   * pressure_tangents[j];
4919 *   cell_matrix(i, j) += (f_int_pressure) * RJxW;
4920 * @endcode
4921 *
4922 * geometric_tangent
4923 *
4924 * @code
4925 *   const Tensor<2, dim+1, Number> grad_ui_grad_uj = (rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F) * rate_gradients[j];
4926 *   const SymmetricTensor<2, dim+1, Number> sym_grad_ui_grad_uj = symmetrize(grad_ui_grad_uj);
4927 *   const Number f_int_geom =
4928 *   projected_strain_divergence_tangent[i][j]
4929 *   * constitutive_request.get_pressure()
4930 *   - sym_grad_ui_grad_uj
4931 *   * constitutive_request.get_stress_deviator();
4932 *   cell_matrix(i, j) += (f_int_geom) * RJxW;
4933 *  
4934 * @endcode
4935 *
4936 * inertial tangent
4937 *
4938 * @code
4939 *   cell_matrix(i, j) +=
4940 *   (postprocess_tensor_dimension(fe_values[displacements].value(i, q_point))
4941 *   + scalar_to_angular_tensor(fe_values[angular_velocity].value(i, q_point)))
4942 *   * DENSITY
4943 *   * (acceleration_n_plus_1_minus_alpha_m_tangent_modulus
4944 *   * (postprocess_tensor_dimension(fe_values[displacements].value(j, q_point))
4945 *   + scalar_to_angular_tensor(fe_values[angular_velocity].value(j, q_point))))
4946 *   * RJxW;
4947 *   }
4948 *   }
4949 *   }
4950 *   }
4951 *  
4952 *   for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
4953 *   for (auto boundaryForceSpec: mechanical_lbc_system.boundaryLoadAppliers) {
4954 *   if (cell->face(face)->boundary_id() == static_cast<types::boundary_id>(boundaryForceSpec.first)) {
4955 *   fe_face_values.reinit(cell, face);
4956 *   for (unsigned int q_point = 0; q_point < n_face_q_points; ++q_point) {
4957 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4958 *   const unsigned int component_i = mech_fe.system_to_component_index(i).first;
4959 *   cell_residual(i) +=
4960 *   boundaryForceSpec.second.apply(
4961 *   component_i,
4962 *   fe_face_values.shape_value(i, q_point),
4963 *   fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point));
4964 *   }
4965 *   }
4966 *   }
4967 *   }
4968 *  
4969 *   for(const auto boundary_unidirectional_penalty_spec: mechanical_lbc_system.boundary_unidirectional_penalty_specs) {
4970 *   if (cell->face(face)->boundary_id() == boundary_unidirectional_penalty_spec->get_boundary_id()) {
4971 *   const Number reference_displacement_increment = boundary_unidirectional_penalty_spec->get_reference_displacement_increment();
4972 *   const Number residual_force = boundary_unidirectional_penalty_spec->get_residual_force();
4973 *   const Number quadratic_spring_factor = boundary_unidirectional_penalty_spec->get_quadratic_spring_factor();
4974 *  
4975 *   fe_face_values.reinit(cell, face);
4976 *   fe_face_values[displacements].get_function_values(
4977 *   Newton_system.current_increment,
4978 *   face_displacement_value_increments);
4979 *   for (unsigned int q_point = 0; q_point < n_face_q_points; ++q_point) {
4980 *   const Tensor<1, dim, Number> surface_normal = fe_face_values.normal_vector(q_point);
4981 *   const Number surface_displacement = face_displacement_value_increments[q_point] * surface_normal;
4982 *   const Number surface_force =
4983 *   -residual_force
4984 *   + surface_displacement < -reference_displacement_increment?
4985 *   0 :
4986 *   -0.5 * quadratic_spring_factor * std::pow(surface_displacement + reference_displacement_increment, 2);
4987 *   const Number surface_force_tangent_modulus =
4988 *   surface_displacement < -reference_displacement_increment?
4989 *   0 :
4990 *   -quadratic_spring_factor * (surface_displacement + reference_displacement_increment);
4991 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4992 *   cell_residual(i) -=
4993 *   fe_face_values[displacements].value(i, q_point)
4994 *   * surface_force * surface_normal
4995 *   * fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point);
4996 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4997 *   cell_matrix(i, j) -=
4998 *   fe_face_values[displacements].value(i, q_point)
4999 *   * surface_force_tangent_modulus * (fe_face_values[displacements].value(j, q_point) * surface_normal) * surface_normal
5000 *   * fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point);
5001 *   }
5002 *   }
5003 *   }
5004 *   }
5005 *   }
5006 *   }
5007 *  
5008 * @endcode
5009 *
5010 * const Number relative_symmetry_norm2 = cell_matrix.relative_symmetry_norm2();
5011 * if(relative_symmetry_norm2 > 1e-8)
5012 * std::cout << "relative_symmetry_norm2: " << cell_matrix.relative_symmetry_norm2() << std::endl;
5013 *
5014
5015 *
5016 *
5017 * @code
5018 *   std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5019 *   cell->get_dof_indices (local_dof_indices);
5020 *   if (fill_system_matrix) {
5021 *   mechanical_dof_system.nodal_constraints.distribute_local_to_global(
5022 *   cell_matrix,
5023 *   cell_residual,
5024 *   local_dof_indices,
5025 *   Newton_system.Newton_step_matrix,
5026 *   Newton_system.Newton_step_residual,
5027 *   true);
5028 *   } else {
5029 *   mechanical_dof_system.nodal_constraints.distribute_local_to_global(
5030 *   cell_residual, local_dof_indices,
5031 *   Newton_system.Newton_step_residual);
5032 *   }
5033 *   } /* if cell is locally owned */
5034 *   } /*for (; cell!=endc; ++cell)*/
5035 *  
5036 *   const unsigned short local_domain_is_valid = kinematic_domains_are_valid ? 1 : 0;
5037 *   unsigned short all_kinematic_domains_are_valid;
5038 *  
5039 * @endcode
5040 *
5041 * did any of the processes fail to assemble?
5042 *
5043 * @code
5044 *   MPI_Allreduce(
5045 *   &local_domain_is_valid,
5046 *   &all_kinematic_domains_are_valid, 1, MPI_UNSIGNED_SHORT,
5047 *   MPI_MIN, mpi_communicator);
5048 *  
5049 *   if (all_kinematic_domains_are_valid < 1) {
5050 *   throw std::runtime_error("The domain is not valid...");
5051 *   }
5052 *  
5053 *   if (fill_system_matrix) {
5054 *   Newton_system.Newton_step_matrix.compress(VectorOperation::add);
5055 *   }
5056 *   Newton_system.Newton_step_residual.compress(VectorOperation::add);
5057 *  
5058 *   } /*PlasticityLabProg<dim,Number>::assemble_mechanical_system()*/
5059 *  
5060 *  
5061 *   template <int dim, typename Number>
5062 *   void PlasticityLabProg<dim, Number>::assemble_thermal_system(
5063 *   NewtonStepSystem &Newton_system,
5064 *   NewtonStepSystem &mechanical_nonlinear_system,
5065 *   const DoFSystem<dim, Number> &thermal_dof_system,
5066 *   const LBCSystem<dim, Number, 1> &thermal_lbc_system,
5067 *   const DoFSystem<dim, Number> &mechanical_dof_system,
5068 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
5069 *   Material<dim+1, Number> &material,
5070 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
5071 *   const std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors,
5072 *   const bool fill_system_matrix) {
5073 *  
5074 *   FEValues<dim> fe_values(
5075 *   mapping,
5076 *   therm_fe,
5077 *   quadrature_formula,
5079 *  
5081 *   mapping,
5082 *   therm_fe,
5083 *   face_quadrature_formula,
5086 *   | update_JxW_values);
5087 *  
5088 *   FEValues<dim> fe_mech_values(
5089 *   mapping,
5090 *   mech_fe,
5091 *   quadrature_formula,
5093 *  
5094 *   FEFaceValues<dim> mech_fe_face_values(
5095 *   mapping,
5096 *   mech_fe,
5097 *   face_quadrature_formula,
5102 *   | update_JxW_values);
5103 *  
5104 *   FEValues<dim> mixed_fe_values(
5105 *   mapping,
5106 *   mixed_var_fe,
5107 *   quadrature_formula,
5108 *   update_values);
5109 *  
5110 *   const unsigned int dofs_per_cell = therm_fe.dofs_per_cell;
5111 *   const unsigned int n_q_points = quadrature_formula.size();
5112 *   const unsigned int n_face_q_points = face_quadrature_formula.size();
5113 *   const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
5114 *  
5117 *  
5118 *   Vector<Number> mixed_values (mixed_dofs_per_cell);
5119 *   std::vector<Number> weighted_updated_J_vec(mixed_dofs_per_cell),
5120 *   weighted_current_J_vec(mixed_dofs_per_cell),
5121 *   weighted_previous_J_vec(mixed_dofs_per_cell),
5122 *   weighted_updated_theta_vec(mixed_dofs_per_cell),
5123 *   weighted_previous_theta_vec(mixed_dofs_per_cell),
5124 *   weighted_J_time_rate_vec(mixed_dofs_per_cell);
5125 *   std::vector< std::vector<Number> > weighted_shape_values(
5126 *   dofs_per_cell,
5127 *   std::vector<Number>(mixed_dofs_per_cell) );
5128 *  
5129 *   std::vector<Number> qp_updated_J_values(n_q_points),
5130 *   qp_previous_J_values(n_q_points),
5131 *   qp_updated_theta_values(n_q_points),
5132 *   qp_previous_theta_values(n_q_points),
5133 *   qp_J_time_rates(n_q_points);
5134 *   std::vector<std::vector<Number> > qp_shape_values(
5135 *   dofs_per_cell,
5136 *   std::vector<Number>(n_q_points));
5137 *  
5138 *   std::vector< Tensor<1, dim, Number> > thermal_gradient_increment(n_q_points),
5139 *   current_thermal_gradient(n_q_points);
5140 *  
5141 *   std::vector< Number > current_temperature_values(n_q_points),
5142 *   temperature_values_increment(n_q_points);
5143 *  
5144 *   std::vector< Number > current_face_temperature_values(n_face_q_points),
5145 *   face_temperature_values_increment(n_face_q_points);
5146 *  
5147 *   std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points),
5148 *   displacement_gradient_increments(n_q_points);
5149 *   std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points),
5150 *   displacement_value_increments(n_q_points);
5151 *  
5152 *   std::vector< Tensor<1, dim, Number> > current_angular_velocity_gradients(n_q_points),
5153 *   angular_velocity_gradient_increments(n_q_points),
5154 *   angular_velocity_gradient_previous_time_rates(n_q_points);
5155 *  
5156 *   std::vector< Number > angular_velocity_increments(n_q_points),
5157 *   current_angular_velocities(n_q_points),
5158 *   angular_velocity_previous_time_rates(n_q_points);
5159 *  
5160 *   std::vector< Tensor<2, dim, Number> > current_face_displacement_gradients(n_face_q_points);
5161 *   std::vector< Tensor<2, dim, Number> > face_displacement_gradient_increments(n_face_q_points);
5162 *  
5163 *   std::vector< Tensor<1, dim, Number> > current_face_displacement_values(n_face_q_points);
5164 *   std::vector< Tensor<1, dim, Number> > face_displacement_value_increments(n_face_q_points);
5165 *  
5167 *   const FEValuesExtractors::Vector displacements (0);
5168 *   const FEValuesExtractors::Scalar angular_velocity(dim);
5169 *   Newton_system.Newton_step_matrix = 0;
5170 *   Newton_system.Newton_step_residual = 0;
5171 *   Newton_system.Newton_step_matrix.compress(VectorOperation::insert);
5172 *   Newton_system.Newton_step_residual.compress(VectorOperation::insert);
5173 *  
5174 *   auto cell = thermal_dof_system.dof_handler.begin_active();
5175 *   auto endc = thermal_dof_system.dof_handler.end();
5176 *   auto mechanical_cell = mechanical_dof_system.dof_handler.begin_active();
5177 *   auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
5178 *   for (; cell != endc; ++cell, ++mechanical_cell, ++mixed_fe_cell) {
5179 *   if (cell->is_locally_owned()) {
5180 *   cell_matrix = 0;
5181 *   cell_residual = 0;
5182 *  
5183 *   fe_values.reinit (cell);
5184 *   fe_mech_values.reinit (mechanical_cell);
5185 *   mixed_fe_values.reinit (mixed_fe_cell);
5186 *  
5187 *   fe_values[temperature].get_function_gradients(
5188 *   Newton_system.current_increment,
5189 *   thermal_gradient_increment);
5190 *  
5191 *   fe_values[temperature].get_function_gradients(
5192 *   Newton_system.previous_deformation,
5193 *   current_thermal_gradient);
5194 *  
5195 *   fe_values[temperature].get_function_values(
5196 *   Newton_system.current_increment,
5197 *   temperature_values_increment);
5198 *  
5199 *   fe_values[temperature].get_function_values(
5200 *   Newton_system.previous_deformation,
5201 *   current_temperature_values);
5202 *  
5203 *   fe_mech_values[displacements].get_function_gradients(
5204 *   mechanical_nonlinear_system.current_increment,
5205 *   displacement_gradient_increments);
5206 *  
5207 *   fe_mech_values[displacements].get_function_gradients(
5208 *   mechanical_nonlinear_system.previous_deformation,
5209 *   current_displacement_gradients);
5210 *  
5211 *   fe_mech_values[displacements].get_function_values(
5212 *   mechanical_nonlinear_system.current_increment,
5213 *   displacement_value_increments);
5214 *  
5215 *   fe_mech_values[displacements].get_function_values(
5216 *   mechanical_nonlinear_system.previous_deformation,
5217 *   current_displacement_values);
5218 *  
5219 * @endcode
5220 *
5221 * Angular velocity
5222 *
5223 * @code
5224 *   fe_mech_values[angular_velocity].get_function_gradients(
5225 *   mechanical_nonlinear_system.current_increment,
5226 *   angular_velocity_gradient_increments);
5227 *  
5228 *   fe_mech_values[angular_velocity].get_function_values(
5229 *   mechanical_nonlinear_system.current_increment,
5230 *   angular_velocity_increments);
5231 *  
5232 * @endcode
5233 *
5234 * get vectors for projection onto mixed fe values
5235 *
5236 * @code
5237 *   for (unsigned int q_point = 0; q_point < n_q_points;
5238 *   ++q_point) {
5239 *  
5240 *   const Number radius = fe_mech_values.quadrature_point(q_point)[0];
5241 *  
5242 *   const auto previous_F = get_deformation_gradient(
5243 *   current_displacement_gradients[q_point],
5244 *   current_displacement_values[q_point][0]/radius);
5245 *  
5246 *   const auto updated_F = get_deformation_gradient(
5247 *   current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
5248 *   (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/radius);
5249 *  
5250 *   const auto deformation_gradient_increment = postprocess_tensor_dimension(
5251 *   displacement_gradient_increments[q_point],
5252 *   displacement_value_increments[q_point][0]/radius);
5253 *  
5254 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
5255 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(previous_F);
5256 *  
5257 *   const Number Jacobian = material_Jacobian * determinant(updated_F);
5258 *   const Number previous_Jacobian = material_Jacobian * determinant(previous_F);
5259 *  
5260 *   qp_previous_J_values.at(q_point) = previous_Jacobian;
5261 *   qp_updated_J_values.at(q_point) = Jacobian;
5262 *   qp_J_time_rates.at(q_point) = Jacobian * trace(deformation_gradient_increment * invert(updated_F)) / time_increment;
5263 *  
5264 *   qp_previous_theta_values.at(q_point) = current_temperature_values.at(q_point);
5265 *   qp_updated_theta_values.at(q_point) = current_temperature_values.at(q_point) + temperature_values_increment.at(q_point);
5266 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5267 *   qp_shape_values.at(i).at(q_point) = fe_values[temperature].value(i, q_point);
5268 *   }
5269 *   }
5270 *  
5271 *   const unsigned int cell_index = cell->user_index() / n_q_points;
5272 *  
5273 *   mixed_fe_projector[cell_index].project(
5274 *   &weighted_updated_J_vec,
5275 *   qp_updated_J_values);
5276 *   mixed_fe_projector[cell_index].project(
5277 *   &weighted_J_time_rate_vec,
5278 *   qp_J_time_rates);
5279 *   mixed_fe_projector[cell_index].project(
5280 *   &weighted_updated_theta_vec,
5281 *   qp_updated_theta_values);
5282 *   mixed_fe_projector[cell_index].project(
5283 *   &weighted_previous_J_vec,
5284 *   qp_previous_J_values);
5285 *   mixed_fe_projector[cell_index].project(
5286 *   &weighted_previous_theta_vec,
5287 *   qp_previous_theta_values);
5288 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5289 *   mixed_fe_projector[cell_index].project(
5290 *   &weighted_shape_values.at(i),
5291 *   qp_shape_values.at(i));
5292 *   }
5293 *  
5294 *   for (unsigned int q_point = 0; q_point < n_q_points;
5295 *   ++q_point) {
5296 *   const ConstitutiveModelUpdateFlags material_update_flags =
5297 *   fill_system_matrix ?
5298 *   (update_heat_flux | update_heat_flux_tangent
5299 *   | update_mechanical_dissipation
5300 *   | update_mechanical_dissipation_tangent
5301 *   | update_stored_heat | update_stored_heat_tangent)
5302 *   :
5303 *   (update_heat_flux | update_mechanical_dissipation
5304 *   | update_stored_heat);
5305 *  
5306 *   const ConstitutiveModelUpdateFlags heating_update_flags =
5307 *   fill_system_matrix ?
5308 *   (update_thermoelastic_heating
5309 *   | update_thermoelastic_heating_tangent)
5310 *   :
5311 *   (update_thermoelastic_heating);
5312 *  
5313 *   point_index_t quadrature_point_index = cell->user_index() + q_point;
5314 *   ConstitutiveModelRequest<dim+1, Number> constitutive_request(material_update_flags);
5315 *   ConstitutiveModelRequest<dim+1, Number> heating_request(heating_update_flags);
5316 *  
5317 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5318 *   mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
5319 *   }
5320 *  
5321 *   Number projected_updated_J = 0;
5322 *   Number projected_previous_J = 0;
5323 *   Number projected_updated_theta = 0;
5324 *   Number projected_previous_theta = 0;
5325 *   Number projected_J_time_rate = 0;
5326 *   Vector<Number> projected_shape_values(dofs_per_cell);
5327 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5328 *   projected_updated_J +=
5329 *   mixed_values(i) * weighted_updated_J_vec.at(i);
5330 *   projected_J_time_rate +=
5331 *   mixed_values(i) * weighted_J_time_rate_vec.at(i);
5332 *   projected_updated_theta +=
5333 *   mixed_values(i) * weighted_updated_theta_vec.at(i);
5334 *   projected_previous_J +=
5335 *   mixed_values(i) * weighted_previous_J_vec.at(i);
5336 *   projected_previous_theta +=
5337 *   mixed_values(i) * weighted_previous_theta_vec.at(i);
5338 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5339 *   projected_shape_values(j) +=
5340 *   mixed_values(i) * weighted_shape_values.at(j).at(i);
5341 *   }
5342 *   }
5343 *  
5344 *   const Number d_theta_dt_n_plus_1 = temperature_values_increment[q_point] / time_increment;
5345 *  
5346 *   const Number d_theta_dt_tangent = 1.0 / time_increment;
5347 *  
5348 *   heating_request.set_deformation_Jacobian(projected_updated_J);
5349 *   heating_request.set_deformation_Jacobian_time_rate(projected_J_time_rate);
5350 *   heating_request.set_temperature(projected_updated_theta);
5351 *   heating_request.set_previous_deformation_Jacobian(projected_previous_J);
5352 *   heating_request.set_previous_temperature(projected_previous_theta);
5353 *   heating_request.set_time_increment(time_increment);
5354 *  
5355 *   const auto current_F = get_deformation_gradient(
5356 *   current_displacement_gradients[q_point],
5357 *   current_displacement_values[q_point][0]/fe_mech_values.quadrature_point(q_point)[0]
5358 *   );
5359 *   const auto updated_F = get_deformation_gradient(
5360 *   current_displacement_gradients[q_point]
5361 *   + displacement_gradient_increments[q_point],
5362 *   (current_displacement_values[q_point][0]
5363 *   + displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5364 *  
5365 *   const auto inv_updated_F = invert(updated_F);
5366 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(current_F);
5367 *   [[maybe_unused]] const Number previous_Jacobian = determinant(current_F) * material_Jacobian;
5368 *   [[maybe_unused]] const Number Jacobian = determinant(updated_F) * material_Jacobian;
5369 *  
5370 *   const Number radius = fe_values.quadrature_point(q_point)[0];
5371 *  
5372 *   const Tensor<2, dim+1, Number> d_X_prime_d_X = deformation_gradient_from_angular_displacement_gradient(
5373 *   -angular_velocity_increments[q_point],
5374 *   -angular_velocity_gradient_increments[q_point],
5375 *   radius
5376 *   );
5377 *  
5378 *   const Tensor<2, dim+1, Number> rotation_to_X_prime_frame = rotation_tensor_to_transform_B_e(
5379 *   -angular_velocity_increments[q_point],
5380 *   radius
5381 *   );
5382 *  
5383 *   const Tensor<2, dim+1, Number> inv_d_X_prime_d_X = invert(d_X_prime_d_X);
5384 *  
5385 *   const auto f_m_n_plus_1 = inv_d_X_prime_d_X * rotation_to_X_prime_frame;
5386 *  
5387 * @endcode
5388 *
5389 * std::cout << "f_r: " << inv_d_X_prime_d_X << std::endl;
5390 * std::cout << "R: " << previous_elastic_deformation_transformation_tensor << std::endl;
5391 * std::cout << "f_m_n+1: " << f_m_n_plus_1 << std::endl;
5392 *
5393
5394 *
5395 *
5396 * @code
5397 *   const auto unnormalized_deformation_gradient_increment = updated_F * f_m_n_plus_1 * invert(current_F);
5398 *  
5399 *   const auto deformation_gradient_increment =
5400 *   std::pow(determinant(unnormalized_deformation_gradient_increment),
5401 *   -Constants<dim, Number>::one_third()) * unnormalized_deformation_gradient_increment;
5402 *  
5403 *   const Number previous_temperature = current_temperature_values[q_point];
5404 *   const Number updated_temperature = previous_temperature + temperature_values_increment[q_point];
5405 *   const auto thermal_gradient =
5406 *   postprocess_tensor_dimension(current_thermal_gradient[q_point] + thermal_gradient_increment[q_point]) * inv_updated_F;
5407 *  
5408 *   constitutive_request.set_deformation_gradient(deformation_gradient_increment);
5409 *   constitutive_request.set_temperature_time_rate(d_theta_dt_n_plus_1);
5410 *   constitutive_request.set_temperature(updated_temperature);
5411 *   constitutive_request.set_thermal_gradient(thermal_gradient);
5412 *   constitutive_request.set_time_increment(time_increment);
5413 *  
5414 *   material.compute_constitutive_request(
5415 *   constitutive_request,
5416 *   quadrature_point_index);
5417 *   material.compute_constitutive_request(
5418 *   heating_request,
5419 *   quadrature_point_index);
5420 *  
5421 *   std::vector<Tensor<1, dim+1, Number>> rate_gradients(dofs_per_cell);
5422 *   std::vector<Number> rate_temperatures(dofs_per_cell);
5423 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5424 *   rate_gradients[i] = postprocess_tensor_dimension(fe_values[temperature].gradient(i, q_point)) * inv_updated_F;
5425 *   rate_temperatures[i] =fe_values[temperature].value(i, q_point);
5426 *   }
5427 *  
5428 *   const Number RJxW = fe_values.quadrature_point(q_point)[0] / material_Jacobian * fe_values.JxW(q_point);
5429 *  
5430 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5431 *  
5432 * @endcode
5433 *
5434 * heat flux term
5435 *
5436 * @code
5437 *   const auto heat_flux = constitutive_request.get_heat_flux();
5438 *   cell_residual(i) += rate_gradients[i]
5439 *   * heat_flux
5440 *   * RJxW;
5441 *  
5442 * @endcode
5443 *
5444 * stored heat term
5445 *
5446 * @code
5447 *   cell_residual(i) += rate_temperatures[i]
5448 *   * constitutive_request.get_stored_heat_rate()
5449 *   * RJxW;
5450 *  
5451 * @endcode
5452 *
5453 * mechanical dissipation term
5454 *
5455 * @code
5456 *   cell_residual(i) -= rate_temperatures[i]
5457 *   * constitutive_request.get_mechanical_dissipation()
5458 *   * RJxW;
5459 *  
5460 * @endcode
5461 *
5462 * elastoplastic heating term
5463 *
5464 * @code
5465 *   cell_residual(i) += (projected_shape_values(i))
5466 *   * heating_request.get_thermo_elastic_heating()
5467 *   * RJxW;
5468 *  
5469 *   for ( typename std::vector<BodyForceApplier<dim, Number> >::const_iterator
5470 *   bodyHeatSourceApplier = thermal_lbc_system.bodyLoadAppliers.cbegin();
5471 *   bodyHeatSourceApplier != thermal_lbc_system.bodyLoadAppliers.cend();
5472 *   ++bodyHeatSourceApplier) {
5473 *   cell_residual(i) += bodyHeatSourceApplier->apply(
5474 *   0, rate_temperatures[i],
5475 *   fe_values.quadrature_point(q_point)[0] * fe_values.JxW(q_point));
5476 *   }
5477 *   }
5478 *  
5479 *   if (fill_system_matrix) {
5480 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5481 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5482 *  
5483 * @endcode
5484 *
5485 * heat flux tangent
5486 *
5487 * @code
5488 *   const Number f_int_q =
5489 *   rate_gradients[i]
5490 *   * constitutive_request.get_heat_flux_tangent(rate_gradients[j]);
5491 *   cell_matrix(i, j) += f_int_q * RJxW;
5492 *  
5493 * @endcode
5494 *
5495 * stored heat rate tangent
5496 *
5497 * @code
5498 *   const Number f_int_cThetaDot =
5499 *   rate_temperatures[i]
5500 *   * constitutive_request.get_stored_heat_rate_tangent(d_theta_dt_tangent*rate_temperatures[j]);
5501 *   cell_matrix(i, j) += f_int_cThetaDot * RJxW;
5502 *  
5503 * @endcode
5504 *
5505 * mechanical dissipation tangent
5506 *
5507 * @code
5508 *   const Number f_int_mech_dissipation =
5509 *   rate_temperatures[i]
5510 *   * constitutive_request.get_mechanical_dissipation_tangent(rate_temperatures[j]);
5511 *   cell_matrix(i, j) -= f_int_mech_dissipation * RJxW;
5512 *  
5513 * @endcode
5514 *
5515 * elastoplastic heating tangent
5516 *
5517 * @code
5518 *   const Number f_int_elastoplastic_heating =
5519 *   (projected_shape_values(i))
5520 *   * heating_request.get_thermo_elastic_heating_tangent(projected_shape_values(j));
5521 *   cell_matrix(i, j) += f_int_elastoplastic_heating * RJxW;
5522 *   }
5523 *   }
5524 *   }
5525 *   }
5526 *  
5527 *   for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
5528 *   fe_face_values.reinit(cell, face);
5529 *   mech_fe_face_values.reinit(mechanical_cell, face);
5530 *  
5531 *   fe_face_values[temperature].get_function_values(
5532 *   Newton_system.previous_deformation,
5533 *   current_face_temperature_values);
5534 *   fe_face_values[temperature].get_function_values(
5535 *   Newton_system.current_increment,
5536 *   face_temperature_values_increment);
5537 *  
5538 *   mech_fe_face_values[displacements].get_function_gradients(
5539 *   mechanical_nonlinear_system.previous_deformation,
5540 *   current_face_displacement_gradients);
5541 *   mech_fe_face_values[displacements].get_function_gradients(
5542 *   mechanical_nonlinear_system.current_increment,
5543 *   face_displacement_gradient_increments);
5544 *  
5545 *   mech_fe_face_values[displacements].get_function_values(
5546 *   mechanical_nonlinear_system.previous_deformation,
5547 *   current_face_displacement_values);
5548 *   mech_fe_face_values[displacements].get_function_values(
5549 *   mechanical_nonlinear_system.current_increment,
5550 *   face_displacement_value_increments);
5551 *  
5552 *  
5553 *   for ( typename std::vector<std::pair<int, BodyForceApplier<dim, Number> > >::const_iterator
5554 *   boundaryHeatSource = thermal_lbc_system.boundaryLoadAppliers.cbegin();
5555 *   boundaryHeatSource != thermal_lbc_system.boundaryLoadAppliers.cend();
5556 *   ++boundaryHeatSource) {
5557 *   if (cell->face(face)->boundary_id() == static_cast<types::boundary_id>(boundaryHeatSource->first)) {
5558 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5559 *   for (unsigned int q_point = 0;
5560 *   q_point < face_quadrature_formula.size();
5561 *   ++q_point) {
5562 *  
5563 *  
5564 *   const auto updated_F = get_deformation_gradient(
5565 *   current_face_displacement_gradients[q_point]
5566 *   + face_displacement_gradient_increments[q_point],
5567 *   (current_face_displacement_values[q_point][0]
5568 *   + face_displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5569 *  
5570 *  
5571 *   const Number J = determinant(updated_F);
5572 *   const Tensor<2, dim+1, Number> inv_deformation_gradient = invert(updated_F);
5573 *   const Tensor<1, dim+1, Number> reference_normal = postprocess_tensor_dimension(mech_fe_face_values.normal_vector(q_point), 0);
5574 *   const Tensor<1, dim+1, Number> F_inv_transpose_N = transpose(inv_deformation_gradient) * reference_normal;
5575 *   const Number norm_F_inv_transpose_N = (F_inv_transpose_N).norm();
5576 *  
5577 *   cell_residual(i) +=
5578 *   boundaryHeatSource->second.apply(
5579 *   0,
5580 *   fe_face_values.shape_value(i, q_point),
5581 *   norm_F_inv_transpose_N * J *
5582 *   fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point));
5583 *   }
5584 *   }
5585 *   }
5586 *   }
5587 *  
5588 *   for ( typename std::vector<std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> > >::const_iterator
5589 *   convectionBC = thermal_lbc_system.convection_BC_appliers.cbegin();
5590 *   convectionBC != thermal_lbc_system.convection_BC_appliers.cend();
5591 *   ++convectionBC) {
5592 *   if (cell->face(face)->boundary_id() == static_cast<types::boundary_id>(convectionBC->first)) {
5593 *   for (unsigned int q_point = 0;
5594 *   q_point < face_quadrature_formula.size();
5595 *   ++q_point) {
5596 *  
5597 *   const unsigned int cell_index = cell->user_index() / quadrature_formula.size();
5598 *   const unsigned int surface_point_key =
5599 *   cell_index * GeometryInfo<dim>::faces_per_cell * n_face_q_points
5600 *   + face * n_face_q_points
5601 *   + q_point;
5602 *  
5603 *   const auto updated_F = get_deformation_gradient(
5604 *   current_face_displacement_gradients[q_point]
5605 *   + face_displacement_gradient_increments[q_point],
5606 *   (current_face_displacement_values[q_point][0]
5607 *   + face_displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5608 *  
5609 *   [[maybe_unused]] const Number J = determinant(updated_F);
5610 *   const Tensor<2, dim+1, Number> inv_deformation_gradient = invert(updated_F);
5611 *   const Tensor<1, dim+1, Number> reference_normal = postprocess_tensor_dimension(mech_fe_face_values.normal_vector(q_point), 0);
5612 *   const Tensor<1, dim+1, Number> F_inv_transpose_N = transpose(inv_deformation_gradient) * reference_normal;
5613 *   [[maybe_unused]] const Number norm_F_inv_transpose_N = (F_inv_transpose_N).norm();
5614 *  
5615 *   const Number RJxW = fe_face_values.quadrature_point(q_point)[0] / material_area_factors.at(surface_point_key).norm() * fe_face_values.JxW(q_point);
5616 *  
5617 *   const Number updated_face_temperature_value =
5618 *   current_face_temperature_values[q_point] +
5619 *   face_temperature_values_increment[q_point];
5620 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5621 *   cell_residual(i) +=
5622 *   convectionBC->second.apply(
5623 *   0,
5624 *   fe_face_values.shape_value(i, q_point),
5625 *   updated_face_temperature_value,
5626 *   RJxW);
5627 *   if (fill_system_matrix) {
5628 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5629 *   cell_matrix(i, j) +=
5630 *   convectionBC->second.apply_gradient(
5631 *   0,
5632 *   fe_face_values.shape_value(i, q_point),
5633 *   fe_face_values.shape_value(j, q_point),
5634 *   RJxW);
5635 *   }
5636 *   }
5637 *   }
5638 *   }
5639 *   }
5640 *   }
5641 *   }
5642 *  
5643 *  
5644 *   std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5645 *   cell->get_dof_indices (local_dof_indices);
5646 *   if (fill_system_matrix) {
5647 *   thermal_dof_system.nodal_constraints.distribute_local_to_global(
5648 *   cell_matrix,
5649 *   cell_residual,
5650 *   local_dof_indices,
5651 *   Newton_system.Newton_step_matrix,
5652 *   Newton_system.Newton_step_residual,
5653 *   true);
5654 *   } else {
5655 *   thermal_dof_system.nodal_constraints.distribute_local_to_global(
5656 *   cell_residual, local_dof_indices,
5657 *   Newton_system.Newton_step_residual);
5658 *   }
5659 *   } /*for (; cell!=endc; ++cell) if(cell->is_locally_owned())*/
5660 *   }
5661 *  
5662 *   if (fill_system_matrix) Newton_system.Newton_step_matrix.compress(VectorOperation::add);
5663 *   Newton_system.Newton_step_residual.compress(VectorOperation::add);
5664 *   }
5665 *  
5666 *   template <int dim, typename Number>
5667 *   void PlasticityLabProg<dim, Number>::assemble_mesh_motion_system(
5668 *   NewtonStepSystem &mesh_motion_nonlinear_system,
5669 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
5670 *   const LBCSystem<dim, Number, dim> &,
5671 *   const NewtonStepSystem &deformation_nonlinear_system,
5672 *   const DoFSystem<dim, Number> &deformation_dof_system,
5673 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
5674 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
5675 *   const bool fill_system_matrix) {
5676 *  
5677 *  
5678 *   const Number mesh_motion_mu = 1.0;
5679 *   const Number mesh_motion_kappa = 5.0;
5680 *   const Number cell_jacobian_exponent = -0.0;
5681 *  
5682 *  
5683 *   FEValues<dim> deformation_fe_values(
5684 *   mapping,
5685 *   mech_fe,
5686 *   quadrature_formula,
5688 *  
5689 *   FEValues<dim> mesh_motion_fe_values(
5690 *   mapping,
5691 *   mesh_motion_fe,
5692 *   quadrature_formula,
5695 *  
5696 *   FEValues<dim> mixed_fe_values(
5697 *   mapping,
5698 *   mixed_var_fe,
5699 *   quadrature_formula,
5700 *   update_values);
5701 *  
5702 *   const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
5703 *   const unsigned int n_q_points = quadrature_formula.size();
5704 *   const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
5705 *  
5706 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
5707 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
5708 *  
5709 *   std::vector< Tensor<2, dim, Number> > current_deformation_gradients(n_q_points);
5710 *   std::vector< Tensor<2, dim, Number> > deformation_gradient_increments(n_q_points);
5711 *  
5712 *   std::vector< Tensor<1, dim, Number> > current_deformation_values(n_q_points);
5713 *   std::vector< Tensor<1, dim, Number> > deformation_value_increments(n_q_points);
5714 *  
5715 *   std::vector< Number > mesh_motion_jacobians(n_q_points);
5716 *   std::vector< std::vector<Number> > strain_divergences(dofs_per_cell, std::vector<Number>(n_q_points));
5717 *   std::vector< std::vector<Number> > jacobian_tangents(dofs_per_cell, std::vector<Number>(n_q_points));
5718 *  
5719 *   std::vector< std::vector< std::vector < Number> > > strain_divergence_tangents(
5720 *   dofs_per_cell,
5721 *   std::vector< std::vector< Number> >(dofs_per_cell,std::vector<Number>(n_q_points)));
5722 *  
5723 *   std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
5724 *   std::vector<std::vector<Number> > projected_strain_divergence_coefficients(
5725 *   dofs_per_cell,
5726 *   std::vector<Number>(mixed_dofs_per_cell));
5727 *   std::vector<std::vector<Number> > projected_jacobian_tangent_coefficients(
5728 *   dofs_per_cell,
5729 *   std::vector<Number>(mixed_dofs_per_cell));
5730 *   std::vector<std::vector<std::vector<Number> > > projected_strain_divergence_tangent_coefficients(
5731 *   dofs_per_cell, std::vector< std::vector< Number> >(
5732 *   dofs_per_cell,
5733 *   std::vector<Number>(mixed_dofs_per_cell)));
5734 *  
5735 *   std::vector<Number> projected_strain_divergence(dofs_per_cell);
5736 *   std::vector<Number> projected_jacobian_tangent(dofs_per_cell);
5737 *   std::vector<std::vector<Number> > projected_strain_divergence_tangent(dofs_per_cell, std::vector<Number>(dofs_per_cell));
5738 *  
5741 *  
5742 *   Vector<Number> mixed_values (mixed_dofs_per_cell);
5743 *  
5744 *   const FEValuesExtractors::Vector displacements (0);
5745 *   const FEValuesExtractors::Scalar angular_velocity(dim);
5747 *  
5748 *   mesh_motion_nonlinear_system.Newton_step_matrix = 0;
5749 *   mesh_motion_nonlinear_system.Newton_step_residual = 0;
5750 *  
5751 *   bool kinematic_domains_are_valid = true; // innocent until proven guilty
5752 *  
5753 *   auto cell = mesh_motion_dof_system.dof_handler.begin_active();
5754 *   auto endc = mesh_motion_dof_system.dof_handler.end();
5755 *   auto deformation_cell = deformation_dof_system.dof_handler.begin_active();
5756 *   auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
5757 *  
5758 *   for (; cell != endc; ++cell, ++deformation_cell, ++mixed_fe_cell) {
5759 *   if (cell->is_locally_owned()) {
5760 *  
5761 *   cell_matrix = 0;
5762 *   cell_residual = 0;
5763 *  
5764 *   mesh_motion_fe_values.reinit (cell);
5765 *   deformation_fe_values.reinit (deformation_cell);
5766 *   mixed_fe_values.reinit (mixed_fe_cell);
5767 *  
5768 *   deformation_fe_values[displacements].get_function_gradients(
5769 *   deformation_nonlinear_system.previous_deformation,
5770 *   current_deformation_gradients);
5771 *  
5772 *   deformation_fe_values[displacements].get_function_gradients(
5773 *   deformation_nonlinear_system.current_increment,
5774 *   deformation_gradient_increments);
5775 *  
5776 *   deformation_fe_values[displacements].get_function_values(
5777 *   deformation_nonlinear_system.previous_deformation,
5778 *   current_deformation_values);
5779 *  
5780 *   deformation_fe_values[displacements].get_function_values(
5781 *   deformation_nonlinear_system.current_increment,
5782 *   deformation_value_increments);
5783 *  
5784 *   mesh_motion_fe_values[displacements].get_function_gradients(
5785 *   mesh_motion_nonlinear_system.current_increment,
5786 *   mesh_motion_gradient_increments);
5787 *  
5788 *   mesh_motion_fe_values[displacements].get_function_values(
5789 *   mesh_motion_nonlinear_system.current_increment,
5790 *   mesh_motion_value_increments);
5791 *  
5792 * @endcode
5793 *
5794 * get vectors for projection onto mixed fe values
5795 *
5796 * @code
5797 *   for (unsigned int q_point = 0; q_point < n_q_points;
5798 *   ++q_point) {
5799 *  
5800 *   const auto mesh_motion_gradient = get_deformation_gradient(
5801 *   -mesh_motion_gradient_increments[q_point],
5802 *   -mesh_motion_value_increments[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
5803 *  
5804 *   const Number Jacobian = determinant(mesh_motion_gradient);
5805 *   mesh_motion_jacobians.at(q_point) = Jacobian;
5806 *  
5807 *   const auto inv_mesh_motion_gradient = invert(mesh_motion_gradient);
5808 *   std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
5809 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5810 *   rate_gradients[i] = postprocess_tensor_dimension(
5811 *   -mesh_motion_fe_values[displacements].gradient(i, q_point),
5812 *   -mesh_motion_fe_values[displacements].value(i, q_point)[0]
5813 *   /mesh_motion_fe_values.quadrature_point(q_point)[0]) * inv_mesh_motion_gradient;
5814 *   }
5815 *  
5816 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5817 *   const Number strain_divergence_i = trace(rate_gradients[i]);
5818 *   strain_divergences[i].at(q_point) = Jacobian * strain_divergence_i;
5819 *   if (fill_system_matrix) {
5820 *   jacobian_tangents[i].at(q_point) = Jacobian * strain_divergence_i;
5821 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5822 *   strain_divergence_tangents[i][j].at(q_point) = Jacobian * (trace(rate_gradients[i]) * trace(rate_gradients[j]) - trace(rate_gradients[i] * rate_gradients[j]));
5823 *   }
5824 *   }
5825 *   }
5826 *   }
5827 *  
5828 *   const unsigned int cell_index = cell->user_index() / n_q_points;
5829 *  
5830 *   mixed_fe_projector[cell_index].project(
5831 *   &projected_Jacobian_coefficients,
5832 *   mesh_motion_jacobians);
5833 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5834 *   mixed_fe_projector[cell_index].project(
5835 *   &projected_strain_divergence_coefficients[i],
5836 *   strain_divergences[i]);
5837 *   if (fill_system_matrix) {
5838 *   mixed_fe_projector[cell_index].project(
5839 *   &projected_jacobian_tangent_coefficients[i],
5840 *   jacobian_tangents[i]);
5841 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5842 *   mixed_fe_projector[cell_index].project(
5843 *   &projected_strain_divergence_tangent_coefficients[i][j],
5844 *   strain_divergence_tangents[i][j]);
5845 *   }
5846 *   }
5847 *   }
5848 *  
5849 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
5850 *  
5851 *   [[maybe_unused]] const point_index_t quadrature_point_index = cell->user_index() + q_point;
5852 *  
5853 *   const Number cell_jacobian = determinant(static_cast<Tensor <2, dim, Number>>(mesh_motion_fe_values.jacobian(q_point)));
5854 *  
5855 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5856 *   mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
5857 *   }
5858 *  
5859 *   const auto mesh_motion_gradient = get_deformation_gradient(
5860 *   -mesh_motion_gradient_increments[q_point],
5861 *   -mesh_motion_value_increments[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
5862 *  
5863 *   const auto deformation_gradient = get_deformation_gradient(
5864 *   current_deformation_gradients[q_point] + deformation_gradient_increments[q_point],
5865 *   (current_deformation_values[q_point][0] + deformation_value_increments[q_point][0])
5866 *   / mesh_motion_fe_values.quadrature_point(q_point)[0]);
5867 *  
5868 *   const auto inv_mesh_motion_gradient = invert(mesh_motion_gradient);
5869 *   const auto inv_deformation_gradient = invert(deformation_gradient);
5870 *  
5871 *   [[maybe_unused]] const Number deformation_Jacobian = determinant(deformation_gradient);
5872 *   const Number mesh_motion_Jacobian = determinant(mesh_motion_gradient);
5873 *  
5874 *   Number projected_jacobian = 0;
5875 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5876 *   projected_jacobian +=
5877 *   mixed_values(i) * projected_Jacobian_coefficients.at(i);
5878 *   }
5879 *  
5880 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5881 *   projected_strain_divergence[j] =
5882 *   mixed_values(0) * projected_strain_divergence_coefficients[j][0];
5883 *   if (fill_system_matrix) {
5884 *   projected_jacobian_tangent[j] =
5885 *   mixed_values(0) * projected_jacobian_tangent_coefficients[j][0];
5886 *   for (unsigned int k = 0; k < dofs_per_cell; ++k) {
5887 *   projected_strain_divergence_tangent[j][k] =
5888 *   mixed_values(0)
5889 *   * projected_strain_divergence_tangent_coefficients[j][k][0];
5890 *   }
5891 *   }
5892 *   }
5893 *  
5894 *   for (unsigned int i = 1; i < mixed_dofs_per_cell; ++i) {
5895 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5896 *   projected_strain_divergence[j] +=
5897 *   mixed_values(i) * projected_strain_divergence_coefficients[j][i];
5898 *   if (fill_system_matrix) {
5899 *   projected_jacobian_tangent[j] +=
5900 *   mixed_values(i) * projected_jacobian_tangent_coefficients[j][i];
5901 *   for (unsigned int k = 0; k < dofs_per_cell; ++k) {
5902 *   projected_strain_divergence_tangent[j][k] +=
5903 *   mixed_values(i)
5904 *   * projected_strain_divergence_tangent_coefficients[j][k][i];
5905 *   }
5906 *   }
5907 *   }
5908 *   }
5909 *  
5910 *   std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
5911 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5912 *   rate_gradients[i] = postprocess_tensor_dimension(
5913 *   -mesh_motion_fe_values[displacements].gradient(i, q_point),
5914 *   -mesh_motion_fe_values[displacements].value(i, q_point)[0]
5915 *   /mesh_motion_fe_values.quadrature_point(q_point)[0]) * inv_mesh_motion_gradient;
5916 *   }
5917 *  
5918 *   const SymmetricTensor<2, dim+1, Number> stress_deviator =
5919 *   std::pow(cell_jacobian, cell_jacobian_exponent) * mesh_motion_mu
5920 *   * std::pow(mesh_motion_Jacobian, -Constants<dim, Number>::two_thirds())
5921 *   * deviator(
5922 *   symmetrize(
5923 *   (deformation_gradient * mesh_motion_gradient)
5924 *   * transpose(deformation_gradient * mesh_motion_gradient)));
5925 *  
5926 *   const Number pressure = mesh_motion_kappa * std::log(projected_jacobian);
5927 *  
5928 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5929 *   const auto strain_i = deformation_gradient * rate_gradients[i] * inv_deformation_gradient;
5930 *  
5931 * @endcode
5932 *
5933 * stress deviator term
5934 *
5935 * @code
5936 *   cell_residual(i) += symmetrize(strain_i) * stress_deviator
5937 *   * mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5938 *  
5939 * @endcode
5940 *
5941 * pressure term
5942 *
5943 * @code
5944 *   cell_residual(i) += (projected_strain_divergence.at(i) * pressure)
5945 *   * mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5946 *  
5947 *   if (fill_system_matrix) {
5948 *  
5949 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5950 *   const auto strain_j = deformation_gradient * rate_gradients[j] * inv_deformation_gradient;
5951 *  
5952 * @endcode
5953 *
5954 * stress tangent
5955 *
5956 * @code
5957 *   const SymmetricTensor<2, dim+1, Number> stress_deviator_tangent_j =
5958 *   std::pow(cell_jacobian, cell_jacobian_exponent) * mesh_motion_mu
5959 *   * std::pow(mesh_motion_Jacobian, -Constants<dim, Number>::two_thirds())
5960 *   * deviator(
5961 *   symmetrize(
5962 *   2 * (strain_j - Constants<dim, Number>::one_third() * trace(strain_j) * unit_symmetric_tensor<dim+1, Number>())
5963 *   * (deformation_gradient * mesh_motion_gradient)
5964 *   * transpose(deformation_gradient * mesh_motion_gradient)));
5965 *  
5966 *   cell_matrix(i, j) += (symmetrize(strain_i) * stress_deviator_tangent_j - symmetrize(strain_i * strain_j) * stress_deviator)
5967 *   * mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5968 *  
5969 * @endcode
5970 *
5971 * pressure_tangent
5972 *
5973 * @code
5974 *   const Number pressure_tangent_j = mesh_motion_kappa * (1.0 / projected_jacobian) * projected_jacobian_tangent[j];
5975 *   cell_matrix(i, j) += (projected_strain_divergence.at(i) * pressure_tangent_j + projected_strain_divergence_tangent[i][j] * pressure)
5976 *   * mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5977 *  
5978 *   }
5979 *   }
5980 *   }
5981 *   }
5982 *  
5983 * @endcode
5984 *
5985 * const Number relative_symmetry_norm2 = cell_matrix.relative_symmetry_norm2();
5986 * if(relative_symmetry_norm2 > 1e-8)
5987 * std::cout << "relative_symmetry_norm2: " << cell_matrix.relative_symmetry_norm2() << std::endl;
5988 *
5989
5990 *
5991 *
5992 * @code
5993 *   std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5994 *   cell->get_dof_indices (local_dof_indices);
5995 *   if (fill_system_matrix) {
5996 *   mesh_motion_dof_system.nodal_constraints.distribute_local_to_global(
5997 *   cell_matrix,
5998 *   cell_residual,
5999 *   local_dof_indices,
6000 *   mesh_motion_nonlinear_system.Newton_step_matrix,
6001 *   mesh_motion_nonlinear_system.Newton_step_residual,
6002 *   true);
6003 *   } else {
6004 *   mesh_motion_dof_system.nodal_constraints.distribute_local_to_global(
6005 *   cell_residual, local_dof_indices,
6006 *   mesh_motion_nonlinear_system.Newton_step_residual);
6007 *   }
6008 *   } /* if cell is locally owned */
6009 *   } /*for (; cell!=endc; ++cell)*/
6010 *  
6011 *   const unsigned short local_domain_is_valid = kinematic_domains_are_valid ? 1 : 0;
6012 *   unsigned short all_kinematic_domains_are_valid;
6013 *  
6014 * @endcode
6015 *
6016 * did any of the processes fail to assemble?
6017 *
6018 * @code
6019 *   MPI_Allreduce(
6020 *   &local_domain_is_valid,
6021 *   &all_kinematic_domains_are_valid, 1, MPI_UNSIGNED_SHORT,
6022 *   MPI_MIN, mpi_communicator);
6023 *  
6024 *   if (all_kinematic_domains_are_valid < 1) {
6025 *   throw std::runtime_error("The domain is not valid...");
6026 *   }
6027 *  
6028 *   if (fill_system_matrix) {
6029 *   mesh_motion_nonlinear_system.Newton_step_matrix.compress(VectorOperation::add);
6030 *   }
6031 *   mesh_motion_nonlinear_system.Newton_step_residual.compress(VectorOperation::add);
6032 *  
6033 *   }
6034 *  
6035 *   template<typename BlockType>
6036 *   class SumOfMatrices : public Subscriptor {
6037 *   public:
6038 *   SumOfMatrices(
6039 *   const BlockType &m1,
6040 *   const BlockType &m2):
6041 *   m1(m1),
6042 *   m2(m2) {
6043 *   }
6044 *  
6045 *   template<typename VectorType>
6046 *   void vmult(VectorType &dst, const VectorType &src) const {
6047 *   m1.vmult(dst, src);
6048 *   m2.vmult_add(dst, src);
6049 *   }
6050 *  
6051 *   private:
6052 *   const BlockType &m1;
6053 *   const BlockType &m2;
6054 *   };
6055 *  
6056 * @endcode
6057 *
6058 * TODO encorporate mechanical and thermal subsystems into structs and include functions in them
6059 *
6060 * @code
6061 *   template <int dim, typename Number>
6062 *   void PlasticityLabProg<dim, Number>::solve_system(
6063 *   const DoFSystem<dim, Number> &dof_system,
6064 *   NewtonStepSystem &nonlinear_system,
6065 *   const bool reset_solution) {
6066 *   TrilinosWrappers::PreconditionAMG preconditioner;
6067 *  
6068 *   #if DEAL_II_VERSION_GTE(9,7,0)
6069 *   const std::vector<std::vector<bool> > constant_modes
6070 *   = DoFTools::extract_constant_modes(dof_system.dof_handler,
6071 *   ComponentMask());
6072 *   #else
6073 *   std::vector<std::vector<bool> > constant_modes;
6074 *   DoFTools::extract_constant_modes(dof_system.dof_handler, ComponentMask(),
6075 *   constant_modes);
6076 *   #endif
6077 *  
6079 *   additional_data.constant_modes = constant_modes;
6080 *   additional_data.elliptic = true;
6081 *   additional_data.n_cycles = 1;
6082 *   additional_data.w_cycle = false;
6083 *   additional_data.output_details = false;
6084 *   additional_data.smoother_sweeps = 2;
6085 *   additional_data.aggregation_threshold = 1e-2;
6086 *   preconditioner.initialize(nonlinear_system.Newton_step_matrix, additional_data);
6087 *  
6088 *   TrilinosWrappers::MPI::Vector tmp(dof_system.locally_owned_dofs, mpi_communicator);
6089 *   const Number relative_accuracy = 1e-08;
6090 *   const Number solver_tolerance = relative_accuracy
6091 *   * nonlinear_system.Newton_step_matrix.residual(tmp, nonlinear_system.Newton_step_solution,
6092 *   nonlinear_system.Newton_step_residual);
6093 *   SolverControl solver_control(nonlinear_system.Newton_step_matrix.m(),
6094 *   solver_tolerance);
6095 *  
6096 *   SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
6097 *  
6098 *   if (reset_solution) {
6099 *   nonlinear_system.Newton_step_solution = 0;
6100 *   nonlinear_system.Newton_step_solution.compress(VectorOperation::insert);
6101 *   }
6102 *  
6103 *   solver.solve(nonlinear_system.Newton_step_matrix, nonlinear_system.Newton_step_solution,
6104 *   nonlinear_system.Newton_step_residual, preconditioner);
6105 *  
6106 *   pcout << "solved in " << solver_control.last_step() << " steps to residual value of " << solver_control.last_value() << endl;
6107 *   pcout << "solution norm is: " << nonlinear_system.Newton_step_solution.l2_norm() << endl;
6108 *  
6109 *   dof_system.nodal_constraints.distribute (nonlinear_system.Newton_step_solution);
6110 *   } /*ElasticProblem<dim,Number>::solve_system*/
6111 *  
6112 *  
6113 *   template <int dim, typename Number>
6114 *   void PlasticityLabProg<dim, Number>::get_plastic_strain(
6115 *   TrilinosWrappers::MPI::Vector &plastic_strain,
6116 *   const DoFHandler<dim> &discontinuous_dof_handler,
6117 *   const Material<dim+1, Number> &material,
6118 *   const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors) {
6119 *  
6120 *   const FiniteElement<dim> &fe = discontinuous_dof_handler.get_fe();
6121 *  
6122 *   const unsigned int n_q_points = quadrature_formula.size();
6123 *   const unsigned int disc_dofs_per_cell = fe.dofs_per_cell;
6124 *  
6125 *   std::vector<Number> plastic_strain_qp_values(n_q_points);
6126 *   std::vector<Number> projected_plastic_strains(disc_dofs_per_cell);
6127 *  
6128 *   auto cell = discontinuous_dof_handler.begin_active();
6129 *   auto endc = discontinuous_dof_handler.end();
6130 *   for (; cell != endc; ++cell) {
6131 *   if (cell->is_locally_owned()) {
6132 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
6133 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
6134 *   plastic_strain_qp_values[q_point] = std::exp(material.get_state_parameters(quadrature_point_index).at(0)) - 1;
6135 *   }
6136 *  
6137 *   const unsigned int cell_index = cell->user_index() / n_q_points;
6138 *   qp_values_projectors[cell_index].project(
6139 *   &projected_plastic_strains,
6140 *   plastic_strain_qp_values);
6141 *  
6142 *   std::vector<types::global_dof_index> local_dof_indices (disc_dofs_per_cell);
6143 *   cell->get_dof_indices (local_dof_indices);
6144 *   for (unsigned int dof_i = 0; dof_i < disc_dofs_per_cell; ++dof_i) {
6145 *   plastic_strain(local_dof_indices[dof_i]) = projected_plastic_strains.at(dof_i);
6146 *   }
6147 *   }
6148 *   }
6149 *   }
6150 *  
6151 *  
6152 *   template <int dim, typename Number>
6153 *   void PlasticityLabProg<dim, Number>::get_pressure(
6155 *   const DoFHandler<dim> &mixed_fe_dof_handler,
6156 *   TrilinosWrappers::MPI::Vector &von_mises_stress,
6157 *   const DoFHandler<dim> &discontinuous_dof_handler,
6158 *   NewtonStepSystem &Newton_system,
6159 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6160 *   const NewtonStepSystem &thermal_Newton_system,
6161 *   const DoFSystem<dim, Number> &thermal_dof_system,
6162 *   Material<dim+1, Number> &material,
6163 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6164 *   const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors) {
6165 *  
6166 *   FEValues<dim> fe_values(
6167 *   mapping,
6168 *   mech_fe,
6169 *   quadrature_formula,
6171 *  
6172 *   FEValues<dim> fe_therm_values(
6173 *   mapping,
6174 *   therm_fe,
6175 *   quadrature_formula,
6176 *   update_values);
6177 *  
6178 *   FEValues<dim> mixed_fe_values(
6179 *   mapping,
6180 *   mixed_var_fe,
6181 *   quadrature_formula,
6182 *   update_values);
6183 *  
6184 *   const unsigned int n_q_points = quadrature_formula.size();
6185 *   const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
6186 *   const unsigned int disc_dofs_per_cell = discontinuous_dof_handler.get_fe().dofs_per_cell;
6187 *  
6188 *  
6189 *   std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points);
6190 *   std::vector< Tensor<2, dim, Number> > displacement_gradient_increments(n_q_points);
6191 *   std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points);
6192 *   std::vector< Tensor<1, dim, Number> > displacement_value_increments(n_q_points);
6193 *  
6194 *   std::vector< Number > current_temperature_values(n_q_points);
6195 *   std::vector< Number > updated_temperature_increments(n_q_points);
6196 *   std::vector< Number > deformation_jacobians(n_q_points);
6197 *   std::vector< Number > pressure_values(n_q_points);
6198 *   std::vector< Number > von_mises_stress_values(n_q_points);
6199 *  
6200 *   std::vector<Number> projected_temperature_coefficients(mixed_dofs_per_cell);
6201 *   std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
6202 *   std::vector<Number> projected_pressure_coefficients(mixed_dofs_per_cell);
6203 *   std::vector<Number> projected_von_mises_stress_coefficients(disc_dofs_per_cell);
6204 *  
6205 *   Vector<Number> mixed_values(mixed_dofs_per_cell);
6206 *  
6207 *   const FEValuesExtractors::Vector displacements (0);
6209 *  
6210 *   auto cell = mechanical_dof_system.dof_handler.begin_active();
6211 *   auto endc = mechanical_dof_system.dof_handler.end();
6212 *   auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
6213 *   auto mixed_fe_cell = mixed_fe_dof_handler.begin_active();
6214 *   auto discontinuous_fe_cell = discontinuous_dof_handler.begin_active();
6215 *   for (; cell != endc; ++cell, ++thermal_cell, ++mixed_fe_cell, ++discontinuous_fe_cell) {
6216 *   if (cell->is_locally_owned()) {
6217 *  
6218 *   fe_values.reinit (cell);
6219 *   fe_therm_values.reinit (thermal_cell);
6220 *   mixed_fe_values.reinit (mixed_fe_cell);
6221 *  
6222 *   fe_values[displacements].get_function_gradients(
6223 *   Newton_system.current_increment,
6224 *   displacement_gradient_increments);
6225 *  
6226 *   fe_values[displacements].get_function_gradients(
6227 *   Newton_system.previous_deformation,
6228 *   current_displacement_gradients);
6229 *  
6230 *   fe_values[displacements].get_function_values(
6231 *   Newton_system.current_increment,
6232 *   displacement_value_increments);
6233 *  
6234 *   fe_values[displacements].get_function_values(
6235 *   Newton_system.previous_deformation,
6236 *   current_displacement_values);
6237 *  
6238 *   fe_therm_values[temperature].get_function_values (
6239 *   thermal_Newton_system.previous_deformation,
6240 *   current_temperature_values);
6241 *  
6242 *   fe_therm_values[temperature].get_function_values (
6243 *   thermal_Newton_system.current_increment,
6244 *   updated_temperature_increments);
6245 *  
6246 * @endcode
6247 *
6248 * get vectors for projection onto mixed fe values
6249 *
6250 * @code
6251 *   for (unsigned int q_point = 0; q_point < n_q_points;
6252 *   ++q_point) {
6253 *   updated_temperature_increments.at(q_point) += current_temperature_values.at(q_point);
6254 *  
6255 *   const auto current_F = get_deformation_gradient(
6256 *   current_displacement_gradients[q_point],
6257 *   current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
6258 *   );
6259 *   const auto updated_F = get_deformation_gradient(
6260 *   current_displacement_gradients[q_point]
6261 *   + displacement_gradient_increments[q_point],
6262 *   (current_displacement_values[q_point][0]
6263 *   + displacement_value_increments[q_point][0])/fe_values.quadrature_point(q_point)[0]);
6264 *  
6265 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
6266 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(current_F);
6267 *  
6268 *   deformation_jacobians.at(q_point) = material_Jacobian * determinant(updated_F);
6269 *   }
6270 *  
6271 *   const unsigned int cell_index = cell->user_index() / n_q_points;
6272 *  
6273 *   mixed_fe_projector[cell_index].project(
6274 *   &projected_temperature_coefficients,
6275 *   updated_temperature_increments);
6276 *   mixed_fe_projector[cell_index].project(
6277 *   &projected_Jacobian_coefficients,
6278 *   deformation_jacobians);
6279 *  
6280 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
6281 *  
6282 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
6283 *   ConstitutiveModelRequest<dim+1, Number> constitutive_request(update_pressure | update_stress_deviator);
6284 *  
6285 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
6286 *   mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
6287 *   }
6288 *  
6289 *   const auto current_F = get_deformation_gradient(
6290 *   current_displacement_gradients[q_point],
6291 *   current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
6292 *   );
6293 *   const auto updated_F = get_deformation_gradient(
6294 *   current_displacement_gradients[q_point]
6295 *   + displacement_gradient_increments[q_point],
6296 *   (current_displacement_values[q_point][0]
6297 *   + displacement_value_increments[q_point][0])/fe_values.quadrature_point(q_point)[0]);
6298 *  
6299 *   [[maybe_unused]] const auto inv_updated_F = invert(updated_F);
6300 *   const Number Jacobian = determinant(updated_F);
6301 *   const Number previous_Jacobian = determinant(current_F);
6302 *  
6303 *   const auto deformation_gradient_increment = std::pow(Jacobian / previous_Jacobian, -Constants<dim, Number>::one_third()) * updated_F * invert(current_F);
6304 *  
6305 *   Number projected_jacobian = 0;
6306 *   Number projected_temperature = 0;
6307 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
6308 *   projected_jacobian +=
6309 *   mixed_values(i) * projected_Jacobian_coefficients.at(i);
6310 *   projected_temperature +=
6311 *   mixed_values(i) * projected_temperature_coefficients.at(i);
6312 *   }
6313 *  
6314 *   constitutive_request.set_deformation_Jacobian(projected_jacobian);
6315 *   constitutive_request.set_temperature(projected_temperature);
6316 *   constitutive_request.set_deformation_gradient(deformation_gradient_increment);
6317 *   constitutive_request.set_time_increment(time_increment);
6318 *  
6319 *   material.compute_constitutive_request(constitutive_request,
6320 *   quadrature_point_index);
6321 *  
6322 * @endcode
6323 *
6324 * pressure term
6325 *
6326 * @code
6327 *   pressure_values.at(q_point) = constitutive_request.get_pressure();
6328 *   von_mises_stress_values.at(q_point) =
6329 *   constitutive_request.get_stress_deviator().norm() / Constants<dim, Number>::sqrt2thirds();
6330 *   }
6331 *  
6332 *   mixed_fe_projector[cell_index].project(
6333 *   &projected_pressure_coefficients,
6334 *   pressure_values);
6335 *  
6336 *   qp_values_projectors[cell_index].project(
6337 *   &projected_von_mises_stress_coefficients,
6338 *   von_mises_stress_values);
6339 *  
6340 *   std::vector<types::global_dof_index> local_dof_indices (mixed_dofs_per_cell);
6341 *   mixed_fe_cell->get_dof_indices (local_dof_indices);
6342 *   for (unsigned int dof_i = 0; dof_i < mixed_dofs_per_cell; ++dof_i) {
6343 *   pressure(local_dof_indices[dof_i]) = projected_pressure_coefficients.at(dof_i);
6344 *   }
6345 *  
6346 *   std::vector<types::global_dof_index> local_discontinuous_dof_indices(disc_dofs_per_cell);
6347 *   discontinuous_fe_cell->get_dof_indices (local_discontinuous_dof_indices);
6348 *   for (unsigned int dof_i = 0; dof_i < disc_dofs_per_cell; ++dof_i) {
6349 *   von_mises_stress(local_discontinuous_dof_indices[dof_i]) =
6350 *   projected_von_mises_stress_coefficients.at(dof_i);
6351 *   }
6352 *  
6353 *   } /* if cell is locally owned */
6354 *   } /*for (; cell!=endc; ++cell)*/
6355 *   }
6356 *  
6357 *   template <int dim, typename Number>
6358 *   void PlasticityLabProg<dim, Number>::prepare_output_results(
6359 *   DataOut<dim> &data_out,
6360 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6361 *   const NewtonStepSystem &mechanical_nonlinear_system,
6362 *   const DoFSystem<dim, Number> &thermal_dof_system,
6363 *   const NewtonStepSystem &thermal_nonlinear_system,
6364 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6365 *   const NewtonStepSystem &mesh_motion_nonlinear_system) const {
6366 *  
6367 *   std::vector<std::string> displacement_names(dim, "displacement");
6368 *   displacement_names.emplace_back("angular_displacement");
6369 *   std::vector<std::string> velocity_names(dim, "displacement_time_rate");
6370 *   velocity_names.emplace_back("angular_velocity");
6371 *   std::vector<DataComponentInterpretation::DataComponentInterpretation>
6372 *   data_component_interpretation(
6374 *   data_component_interpretation.push_back(
6376 *  
6377 *   std::vector<DataComponentInterpretation::DataComponentInterpretation>
6378 *   mesh_motion_data_component_interpretation(
6380 *  
6381 *   data_out.add_data_vector(mechanical_dof_system.dof_handler,
6382 *   mechanical_nonlinear_system.previous_deformation,
6383 *   displacement_names,
6384 *   data_component_interpretation);
6385 *   data_out.add_data_vector(mechanical_dof_system.dof_handler,
6386 *   mechanical_nonlinear_system.previous_time_derivative,
6387 *   velocity_names,
6388 *   data_component_interpretation);
6389 *   data_out.add_data_vector(thermal_dof_system.dof_handler,
6390 *   thermal_nonlinear_system.previous_deformation,
6391 *   "Temperature");
6392 *   data_out.add_data_vector(mesh_motion_dof_system.dof_handler,
6393 *   mesh_motion_nonlinear_system.previous_deformation,
6394 *   std::vector<std::string>(dim, "mesh_motion"),
6395 *   mesh_motion_data_component_interpretation);
6396 *   data_out.add_data_vector(mesh_motion_dof_system.dof_handler,
6397 *   mesh_motion_nonlinear_system.previous_time_derivative,
6398 *   std::vector<std::string>(dim, "mesh_velocity"),
6399 *   mesh_motion_data_component_interpretation);
6400 *   data_out.build_patches(mapping, 2);
6401 *   }
6402 *  
6403 *   template <int dim, typename Number>
6404 *   template <typename TriangulationType>
6405 *   void PlasticityLabProg<dim, Number>::write_output_results(
6406 *   DataOut<dim> &data_out,
6407 *   const TriangulationType &tria,
6408 *   const std::string &filename_base) const {
6409 *  
6410 *   const std::string filename =
6411 *   (filename_base + "-"
6412 *   + Utilities::int_to_string(tria.locally_owned_subdomain(), 4));
6413 *  
6414 *   std::ofstream output_vtu((filename + ".vtu").c_str());
6415 *   data_out.write_vtu(output_vtu);
6416 *  
6417 *   if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0) {
6418 *   std::vector<std::string> filenames;
6419 *   for (unsigned int i = 0;
6420 *   i < Utilities::MPI::n_mpi_processes(mpi_communicator); ++i)
6421 *   filenames.push_back(filename_base + "-"
6423 *   + ".vtu");
6424 *   std::ofstream pvtu_master_output((filename_base + ".pvtu").c_str());
6425 *   data_out.write_pvtu_record(pvtu_master_output, filenames);
6426 *   std::ofstream visit_master_output((filename_base + ".visit").c_str());
6427 *   DataOutBase::write_visit_record(visit_master_output, filenames);
6428 *   }
6429 *   } /* output_results */
6430 *  
6431 *   template class PlasticityLabProg<2, double>;
6432 *  
6433 *   } /*namespace PlasticityLab*/
6434 * @endcode
6435
6436
6437<a name="ann-src/PlasticityLabProg.h"></a>
6438<h1>Annotated version of src/PlasticityLabProg.h</h1>
6439 *
6440 *
6441 *
6442 *
6443 * @code
6444 *   /*
6445 *   * PlasticityLabProg.h
6446 *   *
6447 *   * Created on: 09 Jul 2014
6448 *   * Author: cerecam
6449 *   */
6450 *  
6451 *   #ifndef PLASTICITYLABPROG_H_
6452 *   #define PLASTICITYLABPROG_H_
6453 *  
6454 *   #include <deal.II/fe/fe_q.h>
6455 *   #include <deal.II/fe/fe_dgp.h>
6456 *   #include <deal.II/fe/fe_system.h>
6457 *   #include <deal.II/fe/mapping_q.h>
6458 *  
6459 *   #include <deal.II/distributed/tria.h>
6460 *  
6461 *   #include <deal.II/numerics/data_out.h>
6462 *   #include <deal.II/base/function.h>
6463 *   #include <stdexcept>
6464 *  
6465 *   #include "DoFSystem.h"
6466 *   #include "LBCSystem.h"
6467 *   #include "MixedFEProjector.h"
6468 *   #include "Material.h"
6469 *   #include "NewtonStepSystem.h"
6470 *  
6471 *   namespace PlasticityLab {
6472 *   using namespace dealii;
6473 *  
6474 *   template <int dim, typename Number = double>
6475 *   class PlasticityLabProg {
6476 *   public:
6477 *   PlasticityLabProg(Material<dim+1, Number> &);
6478 *   virtual ~PlasticityLabProg();
6479 *   void run();
6480 *  
6481 *   private:
6482 *   void make_grid (int);
6483 *   void make_cylindrical_grid(
6484 *   Triangulation<dim> &triangulation,
6485 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6486 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6487 *   int n_initial_global_refinements);
6488 *   void make_grid_();
6489 *   void make_necking_grid(
6490 *   Triangulation<dim> &triangulation,
6491 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6492 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6493 *   int n_initial_global_refinements);
6494 *   void make_interference_cylinder_grid(
6495 *   Triangulation<dim> &triangulation,
6496 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6497 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6498 *   int n_initial_global_refinements);
6499 *   void make_cylindrical_impact_grid(
6500 *   Triangulation<dim> &triangulation,
6501 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6502 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6503 *   int n_initial_global_refinements);
6504 *   void make_ball_in_hypershell_grid(
6505 *   Triangulation<dim> &triangulation,
6506 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6507 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6508 *   int n_initial_global_refinements);
6509 *   void make_hook_membrane_grid(int);
6510 *  
6511 *   void set_mesh_motion_LBCs(
6512 *   Triangulation<dim> &triangulation,
6513 *   LBCSystem<dim, Number, dim> &mesh_motion_lbc_system);
6514 *  
6515 *  
6516 *   Tensor<2, dim+1, Number> get_rotation_tensor(const Tensor<2, dim+1, Number> &skew_symmetric_rotation) const;
6517 *   Tensor<2, dim+1, Number> get_rotation_tensor_variation(
6518 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation,
6519 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation_variation) const;
6520 *  
6521 *  
6522 *   void remap_material_state_variables(
6523 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6524 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6525 *   const NewtonStepSystem &mechanical_nonlinear_system,
6526 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6527 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6528 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6529 *   Material<dim+1, Number> &material,
6530 *   std::unordered_map<point_index_t, Tensor<2, dim+1, Number>> &remapped_deformation_gradients);
6531 *  
6532 *  
6533 *   void remap_thermal_field(
6534 *   NewtonStepSystem &thermal_nonlinear_system,
6535 *   const DoFSystem<dim, Number> &thermal_dof_system,
6536 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6537 *   const DoFSystem<dim, Number> &mesh_motion_dof_system);
6538 *  
6539 *  
6540 *   void remap_mechanical_fields(
6541 *   NewtonStepSystem &mechanical_nonlinear_system,
6542 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6543 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6544 *   const DoFSystem<dim, Number> &mesh_motion_dof_system);
6545 *  
6546 *  
6547 *   template <typename TriangulationType, typename MaterialType>
6548 *   void setup_material_data(TriangulationType &triangulation,
6549 *   MaterialType &material);
6550 *  
6551 *   void setup_material_area_factors(
6552 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6553 *   std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors);
6554 *  
6555 *   void update_material_area_factors(
6556 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6557 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6558 *   std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors);
6559 *  
6560 *   template <typename TriangulationType>
6561 *   void setup_mixed_fe_projection_data(
6562 *   const TriangulationType &triangulation,
6563 *   std::vector< MixedFEProjector<dim, Number> > &MixedFeProjectors,
6564 *   const FiniteElement<dim> &MixedFE,
6565 *   const Quadrature<dim> &quadrature_formula);
6566 *  
6567 *   void assemble_mechanical_system(
6568 *   NewtonStepSystem &Newton_system,
6569 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6570 *   const LBCSystem<dim, Number, dim+1> &mechanical_lbc_system,
6571 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6572 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6573 *   const NewtonStepSystem &thermal_Newton_system,
6574 *   const DoFSystem<dim, Number> &thermal_dof_system,
6575 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6576 *   Material<dim+1, Number> &material,
6577 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6578 *   const bool fill_system_matrix = true,
6579 *   const bool update_material_state = false);
6580 *  
6581 *   void assemble_thermal_system(
6582 *   NewtonStepSystem &Newton_system,
6583 *   NewtonStepSystem &mechanical_nonlinear_system,
6584 *   const DoFSystem<dim, Number> &thermal_dof_system,
6585 *   const LBCSystem<dim, Number, 1> &thermal_lbc_system,
6586 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6587 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6588 *   Material<dim+1, Number> &material,
6589 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6590 *   const std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors,
6591 *   const bool fill_system_matrix = true);
6592 *  
6593 *   void assemble_mesh_motion_system(
6594 *   NewtonStepSystem &mesh_motion_nonlinear_system,
6595 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6596 *   const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
6597 *   const NewtonStepSystem &deformation_nonlinear_system,
6598 *   const DoFSystem<dim, Number> &deformation_dof_system,
6599 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6600 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6601 *   const bool fill_system_matrix = true);
6602 *  
6603 *   void solve_system(const DoFSystem<dim, Number> &dof_system,
6604 *   NewtonStepSystem &nonlinear_system,
6605 *   const bool reset_solution=true);
6606 *  
6607 *   void prepare_output_results(DataOut<dim> &data_out,
6608 *   const DoFSystem<dim, Number> &dof_system,
6609 *   const NewtonStepSystem &nonlinear_system,
6610 *   const DoFSystem<dim, Number> &thermal_dof_system,
6611 *   const NewtonStepSystem &thermal_nonlinear_system,
6612 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6613 *   const NewtonStepSystem &mesh_motion_nonlinear_system) const;
6614 *  
6615 *   template <typename TriangulationType>
6616 *   void write_output_results(DataOut<dim> &data_out,
6617 *   const TriangulationType &tria,
6618 *   const std::string &filename_base) const;
6619 *  
6620 *   void get_plastic_strain(
6621 *   TrilinosWrappers::MPI::Vector &plastic_strain,
6622 *   const DoFHandler<dim> &discontinuous_dof_handler,
6623 *   const Material<dim+1, Number> &material,
6624 *   const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors);
6625 *  
6626 *   void get_pressure(
6627 *   TrilinosWrappers::MPI::Vector &pressure,
6628 *   const DoFHandler<dim> &mixed_fe_dof_handler,
6629 *   TrilinosWrappers::MPI::Vector &von_mises_stress,
6630 *   const DoFHandler<dim> &discontinuous_dof_handler,
6631 *   NewtonStepSystem &Newton_system,
6632 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6633 *   const NewtonStepSystem &thermal_Newton_system,
6634 *   const DoFSystem<dim, Number> &thermal_dof_system,
6635 *   Material<dim+1, Number> &material,
6636 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6637 *   const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors);
6638 *  
6639 *   void solve_mechanical_step(int time_step);
6640 *   void solve_thermal_step(int time_step);
6641 *  
6642 *   void solve_mesh_motion_step(
6643 *   NewtonStepSystem &mesh_motion_nonlinear_system,
6644 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6645 *   const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
6646 *   const NewtonStepSystem &deformation_nonlinear_system,
6647 *   const DoFSystem<dim, Number> &deformation_dof_system,
6648 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6649 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6650 *   const int time_step);
6651 *  
6652 *   Tensor<2, dim+1, Number> get_deformation_gradient(
6653 *   const Tensor<2, dim, Number> &increment_gradient,
6654 *   const Number increment_0_over_rho) {
6655 *   Tensor<2, dim+1, Number> deformation_gradient = unit_symmetric_tensor<dim+1, Number>();
6656 *   for(unsigned int i=0; i<dim; ++i){
6657 *   for(unsigned int j=0; j<dim; ++j) {
6658 *   deformation_gradient[i][j] += increment_gradient[i][j];
6659 *   }
6660 *   }
6661 *   deformation_gradient[dim][dim] += increment_0_over_rho;
6662 *   return deformation_gradient;
6663 *   }
6664 *  
6665 *   Tensor<2, dim+1, Number> postprocess_tensor_dimension(
6666 *   const Tensor<2, dim, Number> &dimension_short_tensor,
6667 *   const Number entry_0_over_rho) {
6668 *   Tensor<2, dim+1, Number> postprocessed_tensor;
6669 *   for(unsigned int i=0; i<dim; ++i){
6670 *   for(unsigned int j=0; j<dim; ++j) {
6671 *   postprocessed_tensor[i][j] = dimension_short_tensor[i][j];
6672 *   }
6673 *   }
6674 *   postprocessed_tensor[dim][dim] = entry_0_over_rho;
6675 *   return postprocessed_tensor;
6676 *   }
6677 *  
6678 *   Tensor<1, dim+1, Number> postprocess_tensor_dimension(
6679 *   const Tensor<1, dim, Number> &dimension_short_tensor,
6680 *   const Number entry_at_dim=static_cast<Number>(0.0)) {
6681 *   Tensor<1, dim+1, Number> postprocessed_tensor;
6682 *   for(unsigned int i=0; i<dim; ++i){
6683 *   postprocessed_tensor[i] += dimension_short_tensor[i];
6684 *   }
6685 *   postprocessed_tensor[dim] = entry_at_dim;
6686 *   return postprocessed_tensor;
6687 *   }
6688 *  
6689 *   Tensor<1, dim+1, Number> scalar_to_angular_tensor(const Number angular_value) {
6690 *   Tensor<1, dim+1, Number> postprocessed_tensor = Tensor<1, dim+1, Number>();
6691 *   postprocessed_tensor[dim] = angular_value;
6692 *   return postprocessed_tensor;
6693 *   }
6694 *  
6695 *   Tensor<2, dim+1, Number> order_1_tensor_to_angular_gradient(
6696 *   const Tensor<1, dim, Number> &in_plane_gradient,
6697 *   const Number minus_entry_over_rho) {
6698 *   Tensor<2, dim+1, Number> postprocessed_tensor;
6699 *   for(unsigned int i=0; i<dim; ++i) {
6700 *   postprocessed_tensor[dim][i] = in_plane_gradient[i];
6701 *   }
6702 *   postprocessed_tensor[0][dim] = minus_entry_over_rho;
6703 *   return postprocessed_tensor;
6704 *   }
6705 *  
6706 *   Tensor<2, dim+1, Number> deformation_gradient_from_angular_displacement_gradient(
6707 *   const Number angular_displacement,
6708 *   const Tensor<1, dim, Number> &angular_displacement_gradient,
6709 *   const Number radius
6710 *   ) {
6711 *   if(2 != dim) {
6712 *   throw std::logic_error("Radial deformation gradient not implemented for dim!=2");
6713 *   }
6714 *  
6715 *   Tensor<2, dim+1, Number> result;
6716 *   const Number theta = angular_displacement / radius;
6717 *   Tensor<1, dim, Number> angular_displacmenet_over_r_squared;
6718 *   angular_displacmenet_over_r_squared[0] = angular_displacement / (radius * radius);
6719 *   const Tensor<1, dim, Number> theta_gradient = angular_displacement_gradient / radius - angular_displacmenet_over_r_squared;
6720 *  
6721 *   result[0][0] = std::cos(theta) - radius * std::sin(theta) * theta_gradient[0];
6722 *   result[0][1] = - radius * std::sin(theta) * theta_gradient[1];
6723 *   result[0][2] = -std::sin(theta);
6724 *  
6725 *   result[1][0] = 0;
6726 *   result[1][1] = 1;
6727 *   result[1][2] = 0;
6728 *  
6729 *   result[2][0] = std::sin(theta) + radius * std::cos(theta) * theta_gradient[0];
6730 *   result[2][1] = radius * std::cos(theta) * theta_gradient[1];
6731 *   result[2][2] = std::cos(theta);
6732 *  
6733 *   return result;
6734 *   }
6735 *  
6736 *   Tensor<2, dim+1, Number> deformation_gradient_from_angular_displacement_gradient_variations(
6737 *   const Number angular_displacement,
6738 *   const Tensor<1, dim, Number> &angular_displacement_gradient,
6739 *   const Number radius,
6740 *   const Number angular_displacement_variation,
6741 *   const Tensor<1, dim, Number> &angular_displacement_gradient_variation
6742 *   ) {
6743 *   if(2 != dim) {
6744 *   throw std::logic_error("Radial deformation gradient not implemented for dim!=2");
6745 *   }
6746 *  
6747 *   Tensor<2, dim+1, Number> result;
6748 *   const Number theta = angular_displacement / radius;
6749 *   const Number theta_variation = angular_displacement_variation / radius;
6750 *  
6751 *   Tensor<1, dim, Number> angular_displacmenet_over_r_squared;
6752 *   angular_displacmenet_over_r_squared[0] = angular_displacement / (radius * radius);
6753 *   const Tensor<1, dim, Number> theta_gradient = angular_displacement_gradient / radius - angular_displacmenet_over_r_squared;
6754 *  
6755 *   Tensor<1, dim, Number> angular_displacmenet_variation_over_r_squared;
6756 *   angular_displacmenet_variation_over_r_squared[0] = angular_displacement_variation / (radius * radius);
6757 *   const Tensor<1, dim, Number> theta_gradient_variation = angular_displacement_gradient_variation / radius - angular_displacmenet_variation_over_r_squared;
6758 *  
6759 *   result[0][0] = - std::sin(theta) * theta_variation
6760 *   - radius * std::cos(theta) * theta_variation * theta_gradient[0]
6761 *   - radius * std::sin(theta) * theta_gradient_variation[0];
6762 *  
6763 *   result[0][1] = - radius * std::cos(theta) * theta_variation * theta_gradient[1]
6764 *   - radius * std::sin(theta) * theta_gradient_variation[1];
6765 *  
6766 *   result[0][2] = -std::cos(theta) * theta_variation;
6767 *  
6768 *   result[1][0] = 0;
6769 *   result[1][1] = 0;
6770 *   result[1][2] = 0;
6771 *  
6772 *   result[2][0] = std::cos(theta) * theta_variation
6773 *   - radius * std::sin(theta) * theta_variation * theta_gradient[0]
6774 *   + radius * std::cos(theta) * theta_gradient_variation[0];
6775 *  
6776 *   result[2][1] = - radius * std::sin(theta) * theta_variation * theta_gradient[1]
6777 *   + radius * std::cos(theta) * theta_gradient_variation[1];
6778 *  
6779 *   result[2][2] = - std::sin(theta) * theta_variation;
6780 *  
6781 *   return result;
6782 *   }
6783 *  
6784 *   Tensor<2, dim+1, Number> rotation_tensor_to_transform_B_e(
6785 *   const Number angular_displacement,
6786 *   const Number radius
6787 *   ) {
6788 *   if(2 != dim) {
6789 *   throw std::logic_error("Radial deformation gradient not implemented for dim!=2");
6790 *   }
6791 *  
6792 *   Tensor<2, dim+1, Number> result;
6793 *   const Number theta = angular_displacement / radius;
6794 *  
6795 *   result[0][0] = std::cos(theta);
6796 *   result[0][1] = 0;
6797 *   result[0][2] = -std::sin(theta);
6798 *  
6799 *   result[1][0] = 0;
6800 *   result[1][1] = 1;
6801 *   result[1][2] = 0;
6802 *  
6803 *   result[2][0] = std::sin(theta);
6804 *   result[2][1] = 0;
6805 *   result[2][2] = std::cos(theta);
6806 *  
6807 *   return result;
6808 *   }
6809 *  
6810 *   Tensor<2, dim+1, Number> rotation_tensor_variation_to_transform_B_e(
6811 *   const Number angular_displacement,
6812 *   const Number angular_displacement_variation,
6813 *   const Number radius
6814 *   ) {
6815 *   if(2 != dim) {
6816 *   throw std::logic_error("Radial deformation gradient not implemented for dim!=2");
6817 *   }
6818 *  
6819 *   Tensor<2, dim+1, Number> result;
6820 *   const Number theta = angular_displacement / radius;
6821 *   const Number theta_variation = angular_displacement_variation / radius;
6822 *  
6823 *   result[0][0] = -std::sin(theta) * theta_variation;
6824 *   result[0][1] = 0;
6825 *   result[0][2] = -std::cos(theta) * theta_variation;
6826 *  
6827 *   result[1][0] = 0;
6828 *   result[1][1] = 0;
6829 *   result[1][2] = 0;
6830 *  
6831 *   result[2][0] = std::cos(theta) * theta_variation;
6832 *   result[2][1] = 0;
6833 *   result[2][2] = -std::sin(theta) * theta_variation;
6834 *  
6835 *   return result;
6836 *   }
6837 *  
6838 *   MPI_Comm mpi_communicator;
6839 *   ConditionalOStream pcout;
6840 *  
6841 *   const Number order;
6842 *   FESystem<dim> mech_fe;
6843 *   FE_Q<dim> therm_fe;
6844 *   FE_DGP<dim> mixed_var_fe;
6845 *   FESystem<dim> mesh_motion_fe;
6846 *   MappingQ<dim> mapping;
6847 *  
6848 *   parallel::distributed::Triangulation<dim> triangulation;
6849 *  
6850 *   DoFSystem<dim, Number> mech_dof_system;
6851 *   DoFSystem<dim, Number> therm_dof_system;
6852 *   DoFSystem<dim, Number> mixed_fe_dof_system;
6853 *  
6854 *   LBCSystem<dim, Number, dim+1> mech_lbc_system;
6855 *   LBCSystem<dim, Number, 1> therm_lbc_system;
6856 *  
6857 *   NewtonStepSystem mech_nonlinear_system;
6858 *   NewtonStepSystem therm_nonlinear_system;
6859 *  
6860 *   NewtonStepSystem mesh_motion_nonlinear_system;
6861 *   DoFSystem<dim, Number> mesh_motion_dof_system;
6862 *   LBCSystem<dim, Number, dim> mesh_motion_lbc_system;
6863 *  
6864 *   NewtonStepSystem deformation_remapping_nonlinear_system;
6865 *  
6866 *   QGauss<dim> quadrature_formula;
6867 *   QGauss<dim-1> face_quadrature_formula;
6868 *  
6869 *   Material<dim+1, Number> &material;
6870 *  
6871 *   std::vector< MixedFEProjector<dim, Number> > mixed_FE_projectors;
6872 *  
6873 *   std::unordered_map<size_t, Tensor<1, dim+1, Number>> material_area_factors;
6874 *  
6875 *   Number time_increment = 1.0e-01; /*0.5e-6;*/ // [s]
6876 *   unsigned int output_rate = 1;
6877 *   Number time_since_start = 0;
6878 *  
6879 *   const Number ambient_temperature = 293.0; // [K]
6880 *   const Number rho_infty = 0.0;
6881 *  
6882 *   const unsigned int surface_boundary_id = 2;
6883 *  
6884 *   const bool COMPUTE_FORCES_PER_UNIT_AREA_IN_CURRENT_CONFIGURATION = false;
6885 *   const bool use_sigmoid_friction_law = true;
6886 *  
6887 *   Number global_lagrangian_penalty_factor = 1.0;
6888 *  
6889 *   };
6890 *  
6891 *   struct NewtonIterationDivergenceException : std::exception {
6892 *   const char *what() const _GLIBCXX_USE_NOEXCEPT override {
6893 *   return "Newton step solution diverged!\n";
6894 *   }
6895 *   };
6896 *  
6897 *   } /*namespace PlasticityLab*/
6898 *  
6899 *   #endif /* PLASTICITYLABPROG_H_ */
6900 * @endcode
6901
6902
6903<a name="ann-src/PlasticityLabProgDrivers.cpp"></a>
6904<h1>Annotated version of src/PlasticityLabProgDrivers.cpp</h1>
6905 *
6906 *
6907 *
6908 *
6909 * @code
6910 *   #include <sstream>
6911 *  
6912 *   #include <deal.II/grid/tria.h>
6913 *   #include <deal.II/grid/grid_generator.h>
6914 *   #include <deal.II/grid/grid_in.h>
6915 *   #include <deal.II/grid/manifold_lib.h>
6916 *   #include <deal.II/grid/grid_tools.h>
6917 *  
6918 *  
6919 *   #include <deal.II/fe/fe_dgq.h>
6920 *  
6921 *   #include "RotationFunction.h"
6922 *   #include "ScaleZFunction.h"
6923 *   #include "ScaleComponentFunction.h"
6924 *   #include "PlasticityLabProg.h"
6925 *  
6926 *   using namespace dealii;
6927 *   using std::endl;
6928 *  
6929 *   namespace PlasticityLab {
6930 *  
6931 *   template <int dim, typename Number>
6932 *   void PlasticityLabProg<dim, Number>::run() {
6933 * @endcode
6934 *
6935 * make_grid_();
6936 * make_ball_in_hypershell_grid(
6937 * make_cylindrical_grid(
6938 * make_cylindrical_impact_grid(
6939 *
6940 * @code
6941 *   make_necking_grid(
6942 *   triangulation,
6943 *   mech_lbc_system,
6944 *   therm_lbc_system,
6945 *   3);
6946 * @endcode
6947 *
6948 * triangulation,
6949 * mech_lbc_system,
6950 * therm_lbc_system,
6951 * 3);
6952 * make_hook_membrane_grid(1);
6953 *
6954
6955 *
6956 *
6957 * @code
6958 *   set_mesh_motion_LBCs(triangulation, mesh_motion_lbc_system);
6959 *  
6960 *   const Number total_elongation = 8.0; // mm
6961 *   const Number elongation_rate = 1.0; // [mm/s]
6963 *  
6964 *   mech_dof_system.setup_dof_system(mech_fe);
6965 *   mech_lbc_system.apply_constraints(mech_dof_system);
6966 *   mech_nonlinear_system.setup(mech_dof_system);
6967 *  
6968 *   therm_dof_system.setup_dof_system(therm_fe);
6969 *   therm_lbc_system.apply_constraints(therm_dof_system);
6970 *   therm_nonlinear_system.setup(therm_dof_system);
6971 *  
6972 * @endcode
6973 *
6974 * Initialize the temperature solution vector. Because we are
6975 * initializing with a possibly non-zero value, we can't just
6976 * assign that value to the vector in a parallel setting because
6977 * the solution vector has ghost entries and so is
6978 * read-only. Rather, we create a completely distributed vector,
6979 * assign the value to it, and then copy that into the solution
6980 * vector.
6981 *
6982 * @code
6983 *   {
6984 *   TrilinosWrappers::MPI::Vector tmp (therm_dof_system.locally_owned_dofs,
6985 *   mpi_communicator);
6986 *   tmp = ambient_temperature;
6987 *   therm_nonlinear_system.previous_deformation = tmp;
6988 *   }
6989 *  
6990 *   mixed_fe_dof_system.setup_dof_system(mixed_var_fe);
6991 *  
6992 *   mesh_motion_dof_system.setup_dof_system(mesh_motion_fe);
6993 *   mesh_motion_lbc_system.apply_constraints(mesh_motion_dof_system);
6994 *   mesh_motion_nonlinear_system.setup(mesh_motion_dof_system);
6995 *  
6996 *   deformation_remapping_nonlinear_system.setup(mech_dof_system);
6997 *  
6998 *   setup_material_data(triangulation, material);
6999 *   setup_material_area_factors(mesh_motion_dof_system, material_area_factors);
7000 *  
7001 *   setup_mixed_fe_projection_data(
7002 *   triangulation, mixed_FE_projectors,
7003 *   mixed_var_fe, quadrature_formula);
7004 *  
7005 *   std::vector< MixedFEProjector<dim, Number> > discontinuous_projectors;
7006 *   FE_DGQ<dim> discontinuous_fe(1);
7007 *  
7008 *   setup_mixed_fe_projection_data(
7009 *   triangulation, discontinuous_projectors,
7010 *   discontinuous_fe, quadrature_formula);
7011 *  
7012 *   TrilinosWrappers::MPI::Vector pressure(
7013 *   mixed_fe_dof_system.locally_owned_dofs,
7014 *   mpi_communicator);
7015 *  
7016 *   DoFSystem<dim, Number> discontinuous_dof_system(triangulation, mapping);
7017 *   discontinuous_dof_system.setup_dof_system(discontinuous_fe);
7018 *   TrilinosWrappers::MPI::Vector plastic_strain(
7019 *   discontinuous_dof_system.locally_owned_dofs,
7020 *   mpi_communicator);
7021 *   TrilinosWrappers::MPI::Vector von_mises_stress(
7022 *   discontinuous_dof_system.locally_owned_dofs,
7023 *   mpi_communicator);
7024 *  
7025 *   {
7026 *   TrilinosWrappers::MPI::Vector initial_velocity(
7027 *   mech_dof_system.locally_owned_dofs,
7028 *   mpi_communicator);
7029 *  
7030 *   MPI_Barrier(mpi_communicator);
7031 *  
7032 *   for(const auto initial_velocity_interpolation_handler: mech_lbc_system.initial_velocity_interpolation_handlers) {
7033 *   initial_velocity_interpolation_handler->interpolate(initial_velocity, mech_dof_system);
7034 *   }
7035 *  
7036 * @endcode
7037 *
7038 * Assigning the locally-owned vector into the ghosted vector performs
7039 * the necessary ghost import; compress() must not be called on a
7040 * vector that has ghost elements (it is read-only).
7041 *
7042 * @code
7043 *   mech_nonlinear_system.previous_time_derivative = initial_velocity;
7044 *   }
7045 *  
7046 *  
7047 *   {
7048 *   TrilinosWrappers::MPI::Vector initial_deformation(
7049 *   mech_dof_system.locally_owned_dofs,
7050 *   mpi_communicator);
7051 *  
7052 *   MPI_Barrier(mpi_communicator);
7053 *  
7054 *   for(const auto initial_deformation_interpolation_handler: mech_lbc_system.initial_deformation_interpolation_handlers) {
7055 *   initial_deformation_interpolation_handler->interpolate(initial_deformation, mech_dof_system);
7056 *   }
7057 *  
7058 *   mech_nonlinear_system.previous_deformation = initial_deformation;
7059 *   }
7060 *  
7061 *  
7062 *   for (unsigned int timeStep = 0; timeStep < n_steps + 1; ++timeStep) {
7063 *   for(const auto increment_interpolation_handler: mech_lbc_system.increment_interpolation_handlers) {
7064 *   increment_interpolation_handler->advance_time(time_increment);
7065 *   }
7066 *  
7067 *   get_plastic_strain(
7068 *   plastic_strain,
7069 *   discontinuous_dof_system.dof_handler,
7070 *   material,
7071 *   discontinuous_projectors);
7072 *  
7073 *   get_pressure(
7074 *   pressure,
7075 *   mixed_fe_dof_system.dof_handler,
7076 *   von_mises_stress,
7077 *   discontinuous_dof_system.dof_handler,
7078 *   mech_nonlinear_system,
7079 *   mech_dof_system,
7080 *   therm_nonlinear_system,
7081 *   therm_dof_system,
7082 *   material,
7083 *   mixed_FE_projectors,
7084 *   discontinuous_projectors);
7085 *  
7086 *   if(0==timeStep % output_rate) {
7087 *   pcout << "\nOutputting results..." << endl;
7088 *   DataOut<dim> data_out;
7089 *  
7090 *   data_out.add_data_vector(
7091 *   discontinuous_dof_system.dof_handler,
7092 *   plastic_strain,
7093 *   "plastic_strain");
7094 *   data_out.build_patches();
7095 *  
7096 *   data_out.add_data_vector(
7097 *   mixed_fe_dof_system.dof_handler,
7098 *   pressure,
7099 *   "pressure");
7100 *   data_out.build_patches();
7101 *  
7102 *   data_out.add_data_vector(
7103 *   discontinuous_dof_system.dof_handler,
7104 *   von_mises_stress,
7105 *   "von_mises_stress");
7106 *  
7107 *   prepare_output_results(
7108 *   data_out,
7109 *   mech_dof_system,
7110 *   mech_nonlinear_system,
7111 *   therm_dof_system,
7112 *   therm_nonlinear_system,
7113 *   mesh_motion_dof_system,
7114 *   mesh_motion_nonlinear_system);
7115 *  
7116 *   std::ostringstream oss;
7117 *   oss << "step_" << timeStep;
7118 *   const std::string output_name = oss.str();
7119 *   write_output_results(data_out, triangulation, output_name);
7120 *   }
7121 *  
7122 *   if (timeStep == n_steps) break;
7123 *  
7124 *   pcout << "\n\nStarting time step " << timeStep << ":\n\n" << endl;
7125 *  
7126 *   {
7127 *   TrilinosWrappers::MPI::Vector step_increment(
7128 *   mech_dof_system.locally_owned_dofs,
7129 *   mpi_communicator);
7130 *  
7131 *   MPI_Barrier(mpi_communicator);
7132 *  
7133 *   for(const auto increment_interpolation_handler: mech_lbc_system.increment_interpolation_handlers) {
7134 *   increment_interpolation_handler->interpolate(step_increment, mech_dof_system);
7135 *   }
7136 *  
7137 *   mech_nonlinear_system.current_increment = step_increment;
7138 *   }
7139 *  
7140 *   solve_mesh_motion_step(
7141 *   mesh_motion_nonlinear_system,
7142 *   mesh_motion_dof_system,
7143 *   mesh_motion_lbc_system,
7144 *   mech_nonlinear_system,
7145 *   mech_dof_system,
7146 *   mixed_fe_dof_system,
7147 *   mixed_FE_projectors,
7148 *   timeStep);
7149 *  
7150 *   mesh_motion_nonlinear_system.advance_time(time_increment, rho_infty, false);
7151 * @endcode
7152 *
7153 * The mesh-motion deformation is the negative of the just-computed
7154 * increment. 'previous_deformation' is a ghosted (read-only) vector, so
7155 * this negation is delegated to the nonlinear system, which performs the
7156 * arithmetic in fully-distributed temporaries.
7157 *
7158 * @code
7159 *   mesh_motion_nonlinear_system.set_previous_deformation_to_negative_current_increment();
7160 *  
7161 *   std::unordered_map<point_index_t, Tensor<2, dim+1, Number>> remapped_deformation_gradients;
7162 *   remap_material_state_variables(
7163 *   mesh_motion_nonlinear_system,
7164 *   mesh_motion_dof_system,
7165 *   mech_nonlinear_system,
7166 *   mech_dof_system,
7167 *   mixed_fe_dof_system,
7168 *   mixed_FE_projectors,
7169 *   material,
7170 *   remapped_deformation_gradients);
7171 *  
7172 *   remap_thermal_field(
7173 *   therm_nonlinear_system,
7174 *   therm_dof_system,
7175 *   mesh_motion_nonlinear_system,
7176 *   mesh_motion_dof_system);
7177 *  
7178 *   remap_mechanical_fields(
7179 *   mech_nonlinear_system,
7180 *   mech_dof_system,
7181 *   mesh_motion_nonlinear_system,
7182 *   mesh_motion_dof_system);
7183 *  
7184 *   update_material_area_factors(
7185 *   mesh_motion_nonlinear_system,
7186 *   mesh_motion_dof_system,
7187 *   material_area_factors);
7188 *  
7189 *   solve_mechanical_step(timeStep);
7190 *  
7191 *   solve_thermal_step(timeStep);
7192 *  
7193 *   solve_mechanical_step(timeStep);
7194 *  
7195 * @endcode
7196 *
7197 * udpate material state
7198 *
7199 * @code
7200 *   pcout << "\n\t\tassembling mechanical system updating material state..." << endl;
7201 *   assemble_mechanical_system(
7202 *   mech_nonlinear_system,
7203 *   mech_dof_system,
7204 *   mech_lbc_system,
7205 *   mesh_motion_nonlinear_system,
7206 *   mesh_motion_dof_system,
7207 *   therm_nonlinear_system,
7208 *   therm_dof_system,
7209 *   mixed_fe_dof_system,
7210 *   material,
7211 *   mixed_FE_projectors,
7212 *   false,
7213 *   true);
7214 *  
7215 *   mech_nonlinear_system.advance_time(time_increment, rho_infty, true);
7216 * @endcode
7217 *
7218 * Accumulate the thermal increment into the (ghosted, read-only)
7219 * temperature field. The nonlinear system performs the addition in
7220 * fully-distributed temporaries and assigns the result back.
7221 *
7222 * @code
7223 *   therm_nonlinear_system.add_current_increment_to_previous_deformation();
7224 *  
7225 *   therm_nonlinear_system.current_increment = 0;
7226 *  
7227 *   pcout << "Next timestep..." << std::endl;
7228 *  
7229 *   } /*for(timeStep)*/
7230 *   }
7231 *  
7232 *   template<int dim, typename Number>
7233 *   void PlasticityLabProg<dim, Number>::solve_mechanical_step(int time_step) {
7234 *  
7235 *   TrilinosWrappers::MPI::Vector total_residual;
7236 *  
7237 *   for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7238 *  
7239 *   pcout << "\n\ttime step " << time_step
7240 *   << ", Newton step " << NewtonStep << "..."
7241 *   << "\n\t\tassembling mechanical system with tangents..." << endl;
7242 *  
7243 *   assemble_mechanical_system(
7244 *   mech_nonlinear_system,
7245 *   mech_dof_system,
7246 *   mech_lbc_system,
7247 *   mesh_motion_nonlinear_system,
7248 *   mesh_motion_dof_system,
7249 *   therm_nonlinear_system,
7250 *   therm_dof_system,
7251 *   mixed_fe_dof_system,
7252 *   material,
7253 *   mixed_FE_projectors,
7254 *   true);
7255 *  
7256 *   total_residual = mech_nonlinear_system.Newton_step_residual;
7257 *   total_residual.compress(VectorOperation::insert);
7258 *  
7259 *   pcout << "-------------------------------------------------------------------" << endl;
7260 *  
7261 *   pcout << "Normalized system residual: "
7262 *   << std::sqrt(total_residual.norm_sqr())
7263 *   << " ..." << endl;
7264 *   pcout << "-------------------------------------------------------------------" << endl;
7265 *  
7266 *   if (std::sqrt(total_residual.norm_sqr()) <= 1e-5) {
7267 *   break;
7268 *   }
7269 *  
7270 *   const Number old_residual = total_residual.norm_sqr();
7271 *   Number previous_residual = old_residual;
7272 *  
7273 *   pcout << "solving system..." << endl;
7274 *   try {
7275 *   solve_system(mech_dof_system, mech_nonlinear_system);
7276 *   } catch (...) {
7277 *   if (std::isnan(mech_nonlinear_system.Newton_step_solution.norm_sqr())) {
7278 *   throw;
7279 *   }
7280 *   pcout << "System solution falied. Continuing with partial solution..." << endl;
7281 *   }
7282 *   mech_dof_system.nodal_constraints.distribute(
7283 *   mech_nonlinear_system.Newton_step_solution);
7284 *   const Number solution_norm = std::sqrt(
7285 *   mech_nonlinear_system.Newton_step_solution.norm_sqr());
7286 *   TrilinosWrappers::MPI::Vector full_step_increment(mech_nonlinear_system.current_increment);
7287 *   TrilinosWrappers::MPI::Vector temp_locally_owned_increment(mech_dof_system.locally_owned_dofs);
7288 *  
7289 *   Number clip_factor =
7290 *   (solution_norm <= std::sqrt(old_residual)) ?
7291 *   1.0 : sqrt(old_residual) / solution_norm;
7292 *   if (clip_factor < 1.0) pcout << "clip factor: " << clip_factor << endl;
7293 *  
7294 *   pcout << "doing line search..." << endl;
7295 *   [[maybe_unused]] bool hit_line_search_limit = false;
7296 *   for (unsigned int i = 0; true/*i < 18*/; ++i) {
7297 *   const Number alpha = std::pow(0.5, static_cast<Number>(i));
7298 *   if (i > 5 && clip_factor * alpha * solution_norm < 1e-1) {
7299 *   hit_line_search_limit = true;
7300 *   break;
7301 *   }
7302 *   if (i > 0) pcout << "\tline search step " << i << "..." << endl;
7303 *  
7304 *   while (true) {
7305 *   temp_locally_owned_increment = full_step_increment;
7306 *   temp_locally_owned_increment.sadd(1, -alpha * clip_factor, mech_nonlinear_system.Newton_step_solution);
7307 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7308 *   mech_nonlinear_system.current_increment = temp_locally_owned_increment;
7309 *  
7310 *   try {
7311 *   assemble_mechanical_system(
7312 *   mech_nonlinear_system,
7313 *   mech_dof_system,
7314 *   mech_lbc_system,
7315 *   mesh_motion_nonlinear_system,
7316 *   mesh_motion_dof_system,
7317 *   therm_nonlinear_system,
7318 *   therm_dof_system,
7319 *   mixed_fe_dof_system,
7320 *   material,
7321 *   mixed_FE_projectors,
7322 *   false);
7323 *   } catch (const std::runtime_error &) {
7324 *   clip_factor *= 0.125; // using a power of 0.5; better for binary arithmetic
7325 *   pcout << "\t-------------------------------------------------------------------" << endl;
7326 *   pcout << "\tDeformation too large, causing degenerate mesh..." << endl;
7327 *   pcout << "\tupdated clip factor: " << clip_factor << endl;
7328 *   pcout << "\t-------------------------------------------------------------------" << endl;
7329 *   continue;
7330 *   }
7331 *   break;
7332 *   }
7333 *  
7334 *   total_residual = mech_nonlinear_system.Newton_step_residual;
7335 *   total_residual.compress(VectorOperation::insert);
7336 *  
7337 *   const Number current_residual = total_residual.norm_sqr();
7338 *  
7339 *   pcout << "\t-------------------------------------------------------------------" << endl;
7340 *  
7341 *   pcout << "\tNormalized system residual: "
7342 *   << std::sqrt(current_residual)
7343 *   << " ..." << endl;
7344 *   pcout << "\t-------------------------------------------------------------------" << endl;
7345 *  
7346 *   if (previous_residual < old_residual and current_residual >= previous_residual) {
7347 *   pcout << "\t---Accepting previous residual: " << std::sqrt(previous_residual)
7348 *   << " ..." << endl;
7349 *  
7350 *   temp_locally_owned_increment = full_step_increment;
7351 *   temp_locally_owned_increment.sadd(1, -2 * alpha * clip_factor, mech_nonlinear_system.Newton_step_solution);
7352 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7353 *   mech_nonlinear_system.current_increment = temp_locally_owned_increment;
7354 *   break;
7355 *   }
7356 *   previous_residual = current_residual;
7357 *   }
7358 *  
7359 *   }
7360 *   }
7361 *  
7362 *  
7363 *   template<int dim, typename Number>
7364 *   void PlasticityLabProg<dim, Number>::solve_thermal_step(int time_step) {
7365 *  
7366 *   TrilinosWrappers::MPI::Vector total_therm_residual;
7367 *   const Number starting_thermal_residual_squared_norm = 1.0;
7368 *  
7369 *   for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7370 *  
7371 *   pcout << "\n\ttime step " << time_step
7372 *   << ", Newton step " << NewtonStep << "..."
7373 *   << "\n\t\tassembling thermal system with tangents..." << endl;
7374 *  
7375 *   assemble_thermal_system(
7376 *   therm_nonlinear_system,
7377 *   mech_nonlinear_system,
7378 *   therm_dof_system,
7379 *   therm_lbc_system,
7380 *   mech_dof_system,
7381 *   mixed_fe_dof_system,
7382 *   material,
7383 *   mixed_FE_projectors,
7384 *   material_area_factors,
7385 *   true);
7386 *  
7387 *   total_therm_residual = therm_nonlinear_system.Newton_step_residual;
7388 *   total_therm_residual.compress(VectorOperation::insert);
7389 *  
7390 *   pcout << "-------------------------------------------------------------------" << endl;
7391 *   pcout << "Normalized system residual (contactor): "
7392 *   << std::sqrt(total_therm_residual.norm_sqr()
7393 *   / starting_thermal_residual_squared_norm)
7394 *   << " ..." << endl;
7395 *   pcout << "-------------------------------------------------------------------" << endl;
7396 *  
7397 *   if (std::sqrt(total_therm_residual.norm_sqr()
7398 *   / starting_thermal_residual_squared_norm) <= 1e-6) {
7399 *   break;
7400 *   }
7401 *  
7402 *   const Number old_residual = total_therm_residual.norm_sqr();
7403 *  
7404 *   pcout << "solving system..." << endl;
7405 *  
7406 *   solve_system(therm_dof_system, therm_nonlinear_system);
7407 *  
7408 *   therm_dof_system.nodal_constraints.distribute(therm_nonlinear_system.Newton_step_solution);
7409 *   TrilinosWrappers::MPI::Vector full_step_increment(therm_nonlinear_system.current_increment);
7410 *  
7411 *   TrilinosWrappers::MPI::Vector temp_locally_owned_increment(therm_dof_system.locally_owned_dofs);
7412 *  
7413 *  
7414 *   pcout << "doing line search..." << endl;
7415 *   for (unsigned int i = 0; i < (NewtonStep > 0 ? 6 : 1); ++i) {
7416 *   const Number alpha = std::pow(0.5, static_cast<Number>(i));
7417 *  
7418 *   temp_locally_owned_increment = full_step_increment;
7419 *   temp_locally_owned_increment.sadd(1, -alpha, therm_nonlinear_system.Newton_step_solution);
7420 *   therm_dof_system.nodal_constraints.distribute(temp_locally_owned_increment);
7421 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7422 *   therm_nonlinear_system.current_increment = temp_locally_owned_increment;
7423 *  
7424 *   assemble_thermal_system(
7425 *   therm_nonlinear_system,
7426 *   mech_nonlinear_system,
7427 *   therm_dof_system,
7428 *   therm_lbc_system,
7429 *   mech_dof_system,
7430 *   mixed_fe_dof_system,
7431 *   material,
7432 *   mixed_FE_projectors,
7433 *   material_area_factors,
7434 *   false);
7435 *  
7436 *   total_therm_residual = therm_nonlinear_system.Newton_step_residual;
7437 *   total_therm_residual.compress(VectorOperation::insert);
7438 *  
7439 *   const Number current_residual = total_therm_residual.norm_sqr();
7440 *   if (current_residual < old_residual)
7441 *   break;
7442 *   }
7443 *   }
7444 *   pcout << endl;
7445 *   }
7446 *  
7447 *  
7448 *   template<int dim, typename Number>
7449 *   void PlasticityLabProg<dim, Number>::solve_mesh_motion_step(
7450 *   NewtonStepSystem &mesh_motion_nonlinear_system,
7451 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
7452 *   const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
7453 *   const NewtonStepSystem &deformation_nonlinear_system,
7454 *   const DoFSystem<dim, Number> &deformation_dof_system,
7455 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
7456 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
7457 *   const int time_step) {
7458 *  
7459 *   TrilinosWrappers::MPI::Vector total_residual;
7460 *  
7461 *   for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7462 *  
7463 *   pcout << "\n\ttime step " << time_step
7464 *   << ", Newton step " << NewtonStep << "..."
7465 *   << "\n\t\tassembling mesh motion system with tangents..." << endl;
7466 *  
7467 *   assemble_mesh_motion_system(
7468 *   mesh_motion_nonlinear_system,
7469 *   mesh_motion_dof_system,
7470 *   mesh_motion_lbc_system,
7471 *   deformation_nonlinear_system,
7472 *   deformation_dof_system,
7473 *   mixed_fe_dof_system,
7474 *   mixed_fe_projector,
7475 *   true);
7476 *  
7477 *   total_residual = mesh_motion_nonlinear_system.Newton_step_residual;
7478 *   total_residual.compress(VectorOperation::insert);
7479 *  
7480 *   pcout << "-------------------------------------------------------------------" << endl;
7481 *  
7482 *   pcout << "Normalized system residual: "
7483 *   << std::sqrt(total_residual.norm_sqr())
7484 *   << " ..." << endl;
7485 *   pcout << "-------------------------------------------------------------------" << endl;
7486 *  
7487 *   if (std::sqrt(total_residual.norm_sqr()) <= 1e-4) {
7488 *   break;
7489 *   }
7490 *  
7491 *   const Number old_residual = total_residual.norm_sqr();
7492 *   Number previous_residual = old_residual;
7493 *  
7494 *   pcout << "solving system..." << endl;
7495 *   try {
7496 *   solve_system(mesh_motion_dof_system, mesh_motion_nonlinear_system);
7497 *   } catch (...) {
7498 *   if (std::isnan(mesh_motion_nonlinear_system.Newton_step_solution.norm_sqr())) {
7499 *   throw;
7500 *   }
7501 *   pcout << "System solution falied. Continuing with partial solution..." << endl;
7502 *   }
7503 *   mesh_motion_dof_system.nodal_constraints.distribute(mesh_motion_nonlinear_system.Newton_step_solution);
7504 *   const Number solution_norm = std::sqrt(mesh_motion_nonlinear_system.Newton_step_solution.norm_sqr());
7505 *   TrilinosWrappers::MPI::Vector full_step_increment(mesh_motion_nonlinear_system.current_increment);
7506 *   TrilinosWrappers::MPI::Vector temp_locally_owned_increment(mesh_motion_dof_system.locally_owned_dofs);
7507 *  
7508 *   Number clip_factor =
7509 *   (solution_norm <= std::sqrt(old_residual)) ? 1.0 : sqrt(old_residual) / solution_norm;
7510 *   if (clip_factor < 1.0) pcout << "clip factor: " << clip_factor << endl;
7511 *  
7512 *   pcout << "doing line search..." << endl;
7513 *   [[maybe_unused]] bool hit_line_search_limit = false;
7514 *   for (unsigned int i = 0; true/*i < 18*/; ++i) {
7515 *   const Number alpha = std::pow(0.5, static_cast<Number>(i));
7516 *   if (i > 5 && clip_factor * alpha * solution_norm < 1e-1) {
7517 *   hit_line_search_limit = true;
7518 *   break;
7519 *   }
7520 *   if (i > 0) pcout << "\tline search step " << i << "..." << endl;
7521 *  
7522 *   while (true) {
7523 *   temp_locally_owned_increment = full_step_increment;
7524 *   temp_locally_owned_increment.sadd(1, -alpha * clip_factor, mesh_motion_nonlinear_system.Newton_step_solution);
7525 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7526 *   mesh_motion_nonlinear_system.current_increment = temp_locally_owned_increment;
7527 *  
7528 *   try {
7529 *   assemble_mesh_motion_system(
7530 *   mesh_motion_nonlinear_system,
7531 *   mesh_motion_dof_system,
7532 *   mesh_motion_lbc_system,
7533 *   deformation_nonlinear_system,
7534 *   deformation_dof_system,
7535 *   mixed_fe_dof_system,
7536 *   mixed_fe_projector,
7537 *   false);
7538 *   } catch (const std::runtime_error &) {
7539 *   clip_factor *= 0.125; // using a power of 0.5; better for binary arithmetic
7540 *   pcout << "\t-------------------------------------------------------------------" << endl;
7541 *   pcout << "\tDeformation too large, causing degenerate mesh..." << endl;
7542 *   pcout << "\tupdated clip factor: " << clip_factor << endl;
7543 *   pcout << "\t-------------------------------------------------------------------" << endl;
7544 *   continue;
7545 *   }
7546 *   break;
7547 *   }
7548 *  
7549 *   total_residual = mesh_motion_nonlinear_system.Newton_step_residual;
7550 *   total_residual.compress(VectorOperation::insert);
7551 *  
7552 *   const Number current_residual = total_residual.norm_sqr();
7553 *  
7554 *   pcout << "\t-------------------------------------------------------------------" << endl;
7555 *  
7556 *   pcout << "\tNormalized system residual: "
7557 *   << std::sqrt(current_residual)
7558 *   << " ..." << endl;
7559 *   pcout << "\t-------------------------------------------------------------------" << endl;
7560 *  
7561 *   if (previous_residual < old_residual and current_residual >= previous_residual) {
7562 *   pcout << "\t---Accepting previous residual: " << std::sqrt(previous_residual)
7563 *   << " ..." << endl;
7564 *  
7565 *   temp_locally_owned_increment = full_step_increment;
7566 *   temp_locally_owned_increment.sadd(1, -2 * alpha * clip_factor, mesh_motion_nonlinear_system.Newton_step_solution);
7567 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7568 *   mesh_motion_nonlinear_system.current_increment = temp_locally_owned_increment;
7569 *   break;
7570 *   }
7571 *   previous_residual = current_residual;
7572 *   }
7573 *   }
7574 *   }
7575 *  
7576 *  
7577 *   template <int dim>
7578 *   struct RefiningTransform
7579 *   {
7580 *   RefiningTransform(
7581 *   double height,
7582 *   double refining_fraction,
7583 *   double base=0,
7584 *   size_t dimension=1) :
7585 *   height(height),
7586 *   refining_fraction(refining_fraction),
7587 *   base(base),
7588 *   dimension(dimension) {}
7589 *  
7590 *   Point<dim> operator()(const Point<dim> &p) const
7591 *   {
7592 *   Point<dim> q = p;
7593 *   if ((p[dimension]-base)/(height-base) <= 0.5) {
7594 *   q[dimension] = base + refining_fraction/0.5 * (p[dimension]-base);
7595 *   } else if ((p[dimension]-base)/(height-base) > 0.5) {
7596 *   q[dimension] = base + refining_fraction * (height - base) + (1.0 - refining_fraction) / 0.5 * (p[dimension] - 0.5 * (height + base));
7597 *   }
7598 *   return q;
7599 *   }
7600 *  
7601 *   double height;
7602 *   double refining_fraction;
7603 *   double base;
7604 *   size_t dimension;
7605 *   };
7606 *  
7607 *  
7608 *   template <int dim, typename Number>
7609 *   void PlasticityLabProg<dim, Number>::set_mesh_motion_LBCs(
7610 *   Triangulation<dim> &triangulation,
7611 *   LBCSystem<dim, Number, dim> &mesh_motion_lbc_system) {
7612 *  
7613 *   std::set<types::boundary_id> all_boundary_ids;
7614 *   for(types::boundary_id id: triangulation.get_boundary_ids()) {
7615 *   all_boundary_ids.insert(id);
7616 *   }
7617 *  
7618 *   mesh_motion_lbc_system.no_normal_flux_constraints.push_back(std::make_pair(0, all_boundary_ids));
7619 *   }
7620 *  
7621 *  
7622 *   template <int dim, typename Number>
7623 *   void PlasticityLabProg<dim, Number>::make_cylindrical_grid(
7624 *   Triangulation<dim> &triangulation,
7625 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
7626 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
7627 *   int n_initial_global_refinements) {
7628 *  
7629 *   [[maybe_unused]] const Number initial_velocity = 1.9e5; // [mm/s]
7630 *   const Number height = 2.5*25.4; // [mm]
7631 *   const Number inner_radius = 12.5; // [mm]
7632 *   const Number radius = 12.5; // [mm]
7633 *  
7634 *   const Number top_coordinate = height/2;
7635 *   const Number base_coordinate = 0.0;
7636 *  
7637 *   const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
7638 *   const unsigned int aspect_ratio = std::ceil(0.25 * height / radius);
7639 *  
7640 *   GridGenerator::subdivided_hyper_rectangle(
7641 *   triangulation,
7642 *   std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
7643 *   Point<dim>(inner_radius, base_coordinate),
7644 *   Point<dim>(inner_radius + radius, top_coordinate),
7645 *   true
7646 *   );
7647 *  
7648 *   for (auto &cell: triangulation.active_cell_iterators()) {
7649 *   for (const auto &face : cell->face_iterators()) {
7650 *   if(face->boundary_id() == 0 || face->boundary_id() == 1) {
7651 *   if(face->center()[1] > 0.95 * height/2) {
7652 *   face->set_boundary_id(4);
7653 *   }
7654 *   }
7655 *   }
7656 *   }
7657 *  
7658 * @endcode
7659 *
7660 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.3, base_coordinate), triangulation);
7661 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.4, base_coordinate), triangulation);
7662 * GridTools::transform(RefiningTransform<dim>/(inner_radius, 0.35, inner_radius + radius, 0), triangulation);
7663 *
7664
7665 *
7666 * for(unsigned int i=0; i<2; i++) {
7667 * for (auto &cell : triangulation.active_cell_iterators()) {
7668 * for (const auto &face : cell->face_iterators()) {
7669 * if (face->boundary_id() == 2) {
7670 * cell->set_refine_flag();
7671 * break;
7672 * }
7673 * }
7674 * }
7675 * triangulation.execute_coarsening_and_refinement();
7676 * }
7677 *
7678
7679 *
7680 *
7681 * @code
7682 *   ComponentMask x_component_mask(dim+1, false);
7683 *   x_component_mask.set(0, true);
7684 *   ComponentMask y_component_mask(dim+1, false);
7685 *   y_component_mask.set(1, true);
7686 *   ComponentMask x_and_y_component_mask(dim+1, false);
7687 *   x_and_y_component_mask.set(0, true);
7688 *   x_and_y_component_mask.set(1, true);
7689 *   ComponentMask z_component_mask(dim+1, false);
7690 *   z_component_mask.set(dim-1, true);
7691 *   ComponentMask rho_component_mask(dim+1, false);
7692 *   rho_component_mask.set(dim, true);
7693 *  
7694 * @endcode
7695 *
7696 * std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
7697 * base_constraint_function_map.insert(
7698 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7699 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7700 * InterpolatoryConstraintApplier<dim, Number>(
7701 * base_constraint_function_map,
7702 * y_component_mask));
7703 *
7704
7705 *
7706 *
7707 * @code
7708 *   std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7709 *   top_constraint_function_map.insert(
7710 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7711 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7712 *   InterpolatoryConstraintApplier<dim, Number>(
7713 *   top_constraint_function_map,
7714 *   x_component_mask));
7715 *  
7716 *   std::map< types::boundary_id, const Function< dim, Number > * > clamp_constraint_function_map;
7717 *   clamp_constraint_function_map.insert(
7718 *   std::pair<types::boundary_id, Function<dim, Number>*>(4, &mech_lbc_system.zero_function));
7719 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7720 *   InterpolatoryConstraintApplier<dim, Number>(
7721 *   clamp_constraint_function_map,
7722 *   x_component_mask));
7723 *  
7724 *   if(std::abs(inner_radius) < 1e-16) {
7725 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_constraint_function_map;
7726 *   axial_constraint_function_map.insert(
7727 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7728 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7729 *   InterpolatoryConstraintApplier<dim, Number>(
7730 *   axial_constraint_function_map,
7731 *   x_component_mask));
7732 *  
7733 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
7734 *   axial_rotation_constraint_function_map.insert(
7735 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7736 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7737 *   InterpolatoryConstraintApplier<dim, Number>(
7738 *   axial_rotation_constraint_function_map,
7739 *   rho_component_mask));
7740 *   }
7741 *  
7742 * @endcode
7743 *
7744 * therm_lbc_system.boundaryLoadAppliers.push_back(
7745 * std::pair<int,BodyForceApplier<dim,Number> >(
7746 * 2, BodyForceApplier<dim,Number>(0, 22e0)));
7747 *
7748
7749 *
7750 *
7751 * @code
7752 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
7753 *   top_rotation_constraint_function_map.insert(
7754 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7755 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7756 *   InterpolatoryConstraintApplier<dim, Number>(
7757 *   top_rotation_constraint_function_map,
7758 *   rho_component_mask));
7759 *  
7760 * @endcode
7761 *
7762 * std::map< types::boundary_id, const Function< dim, Number > * > base_rotation_constraint_function_map;
7763 * base_rotation_constraint_function_map.insert(
7764 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7765 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7766 * InterpolatoryConstraintApplier<dim, Number>(
7767 * base_rotation_constraint_function_map,
7768 * rho_component_mask));
7769 *
7770
7771 *
7772 * Thermal constraints
7773 *
7774 * @code
7775 *   const Number convection_coefficient = /*17.5e-6*/ 100e-6; // [J.mm^-2.s^-1.K^-1]
7776 *   therm_lbc_system.convection_BC_appliers.push_back(
7777 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7778 *   0,
7779 *   ConvectionBoundaryConditionApplier<dim, Number>(
7780 *   0, convection_coefficient, ambient_temperature)));
7781 *   therm_lbc_system.convection_BC_appliers.push_back(
7782 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7783 *   1,
7784 *   ConvectionBoundaryConditionApplier<dim, Number>(
7785 *   0, convection_coefficient, ambient_temperature)));
7786 *   therm_lbc_system.convection_BC_appliers.push_back(
7787 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7788 *   2,
7789 *   ConvectionBoundaryConditionApplier<dim, Number>(
7790 *   0, convection_coefficient, ambient_temperature)));
7791 *   therm_lbc_system.convection_BC_appliers.push_back(
7792 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7793 *   3,
7794 *   ConvectionBoundaryConditionApplier<dim, Number>(
7795 *   0, convection_coefficient, ambient_temperature)));
7796 *  
7797 * @endcode
7798 *
7799 * therm_lbc_system.convection_BC_appliers.push_back(
7800 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7801 * 2,
7802 * ConvectionBoundaryConditionApplier<dim, Number>(
7803 * 0, 3000*convection_coefficient, 1350.0 /*a little less than melting*/)));
7804 *
7805
7806 *
7807 * const Number total_elongation = 2 * 80.0; // mm
7808 * const Number elongation_rate = time_since_start < 6.0? 0.05 : 1.75; // [mm/s]
7809 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
7810 * auto scale_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7811 * new ConstantFunction<dim, Number>({0, -total_elongation/(static_cast<Number>(n_steps)/**height*/), 0}),
7812 * true,
7813 * y_component_mask,
7814 * false,
7815 * ComponentMask(dim+1, false),
7816 * 3,
7817 * mapping);
7818 *
7819
7820 *
7821 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_z_handler);
7822 *
7823
7824 *
7825 *
7826 * @code
7827 *   mech_lbc_system.boundaryLoadAppliers.push_back(
7828 *   std::pair<int,BodyForceApplier<dim,Number> >(
7829 *   3, BodyForceApplier<dim,Number>(dim-1, -40)));
7830 *  
7831 *   auto top_surface_unidirectional_penalty_spec = new BoundaryUnidirectionalPenaltySpec<Number>(3, 1e-2, 0, 1e4 / (time_increment * time_increment) );
7832 *   mech_lbc_system.boundary_unidirectional_penalty_specs.push_back(top_surface_unidirectional_penalty_spec);
7833 *  
7834 * @endcode
7835 *
7836 * auto constant_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7837 * new ScaleZFunction<dim, Number, dim+1>(-total_elongation/(static_cast<Number>(n_steps)*time_increment/**height*/), dim-1),
7838 * true,
7839 * y_component_mask,
7840 * false,
7841 * ComponentMask(dim+1, false),
7842 * 0,
7843 * mapping);
7844 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_velocity_handler);
7845 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7846 * top_constraint_function_map.insert(
7847 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7848 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7849 * InterpolatoryConstraintApplier<dim, Number>(
7850 * top_constraint_function_map,
7851 * y_component_mask));
7852 *
7853
7854 *
7855 *
7856 * @code
7857 *   const Number drive_speed = 0.8*314.159/3.0; // [rad/s]
7858 *  
7859 *   auto scale_rotation_increment = new IncrementInterpolationHandler<dim, Number, dim+1>(
7860 *   new ScaleComponentFunction<dim, Number, dim+1>(drive_speed * time_increment, 0, dim),
7861 *   true,
7862 *   rho_component_mask,
7863 *   false,
7864 *   ComponentMask(dim+1, false),
7865 *   3,
7866 *   mapping);
7867 *   mech_lbc_system.increment_interpolation_handlers.push_back(scale_rotation_increment);
7868 *  
7869 *   auto constant_angular_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7870 *   new ScaleComponentFunction<dim, Number, dim+1>(drive_speed, 0, dim),
7871 *   true,
7872 *   rho_component_mask,
7873 *   false,
7874 *   ComponentMask(dim+1, false),
7875 *   3,
7876 *   mapping);
7877 *   mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_angular_velocity_handler);
7878 *  
7879 * @endcode
7880 *
7881 * mech_lbc_system.boundaryLoadAppliers.push_back(
7882 * std::pair<int,BodyForceApplier<dim,Number> >(
7883 * 1, BodyForceApplier<dim,Number>(dim, 3.750e0)));
7884 *
7885
7886 *
7887 *
7888 * @code
7889 *   } /* make_cylindrical_grid() */
7890 *  
7891 *  
7892 *   template <int dim, typename Number>
7893 *   void PlasticityLabProg<dim, Number>::make_grid_() {
7894 *  
7895 *   } /*make_grid_()*/
7896 *  
7897 *   template <int dim>
7898 *   struct InterferenceTaperTransform
7899 *   {
7900 *   Point<dim> operator()(const Point<dim> &p) const
7901 *   {
7902 *   Point<dim> q = p;
7903 *   if (p[0]>=35 && p[0]<=300 && p[1]<=0 && p[1]>=-150)
7904 *   {
7905 *   q[0] += 5 * ((p[1] + 150) / 150) * ((p[0]-300) / (35-300));
7906 *   }
7907 *   return q;
7908 *   }
7909 *   };
7910 *  
7911 *   template <int dim>
7912 *   struct NeckingTaperTransform
7913 *   {
7914 *   double factor;
7915 *   NeckingTaperTransform(double factor) : factor(factor) {}
7916 *  
7917 *   Point<dim> operator()(const Point<dim> &p) const
7918 *   {
7919 *   Point<dim> q = p;
7920 *   q[0] += factor * q[0] * q[1];
7921 *   return q;
7922 *   }
7923 *   };
7924 *  
7925 *  
7926 *   template <int dim, typename Number>
7927 *   void PlasticityLabProg<dim, Number>::make_necking_grid(
7928 *   Triangulation<dim> &triangulation,
7929 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
7930 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
7931 *   int n_initial_global_refinements) {
7932 *  
7933 *   const Number height = 53.334; // [mm]
7934 *   const Number radius = 6.413; // [mm]
7935 *  
7936 *   const Number top_coordinate = height/2;
7937 *   const Number base_coordinate = 0.0;
7938 *   const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
7939 *   const unsigned int aspect_ratio = std::ceil(0.5 * height / radius);
7940 *  
7941 *   GridGenerator::subdivided_hyper_rectangle(
7942 *   triangulation,
7943 *   std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
7944 *   Point<dim>(0, base_coordinate),
7945 *   Point<dim>(radius, top_coordinate),
7946 *   true
7947 *   );
7948 *  
7949 * @endcode
7950 *
7951 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.15, base_coordinate), triangulation);
7952 *
7953
7954 *
7955 *
7956 * @code
7957 *   ComponentMask x_component_mask(dim+1, false);
7958 *   x_component_mask.set(0, true);
7959 *   ComponentMask y_component_mask(dim+1, false);
7960 *   y_component_mask.set(1, true);
7961 *   ComponentMask z_component_mask(dim+1, false);
7962 *   z_component_mask.set(dim-1, true);
7963 *   ComponentMask rho_component_mask(dim+1, false);
7964 *   rho_component_mask.set(dim, true);
7965 *  
7966 *   std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
7967 *   base_constraint_function_map.insert(
7968 *   std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7969 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7970 *   InterpolatoryConstraintApplier<dim, Number>(
7971 *   base_constraint_function_map,
7972 *   y_component_mask));
7973 *  
7974 *   std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7975 *   top_constraint_function_map.insert(
7976 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7977 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7978 *   InterpolatoryConstraintApplier<dim, Number>(
7979 *   top_constraint_function_map,
7980 *   y_component_mask));
7981 *  
7982 *   std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
7983 *   yz_constraint_function_map.insert(
7984 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7985 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7986 *   InterpolatoryConstraintApplier<dim, Number>(
7987 *   yz_constraint_function_map,
7988 *   x_component_mask));
7989 *  
7990 *  
7991 *   const Number total_elongation = 2*8.0; // mm
7992 *   const Number elongation_rate = 2*1.0; // [mm/s]
7993 *   const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
7994 *  
7995 *   auto scale_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7996 *   new ScaleZFunction<dim, Number, dim+1>(total_elongation/(static_cast<Number>(n_steps)*height), dim-1),
7997 *   true,
7998 *   y_component_mask,
7999 *   false,
8000 *   ComponentMask(dim+1, false),
8001 *   0,
8002 *   mapping);
8003 *  
8004 *   mech_lbc_system.increment_interpolation_handlers.push_back(scale_z_handler);
8005 *  
8006 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8007 *   top_rotation_constraint_function_map.insert(
8008 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8009 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8010 *   InterpolatoryConstraintApplier<dim, Number>(
8011 *   top_rotation_constraint_function_map,
8012 *   rho_component_mask));
8013 *  
8014 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8015 *   axial_rotation_constraint_function_map.insert(
8016 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8017 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8018 *   InterpolatoryConstraintApplier<dim, Number>(
8019 *   axial_rotation_constraint_function_map,
8020 *   rho_component_mask));
8021 *  
8022 * @endcode
8023 *
8024 * Thermal constraints
8025 *
8026 * @code
8027 *   const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8028 *   therm_lbc_system.convection_BC_appliers.push_back(
8029 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8030 *   1,
8031 *   ConvectionBoundaryConditionApplier<dim, Number>(
8032 *   0, convection_coefficient, ambient_temperature)));
8033 *   therm_lbc_system.convection_BC_appliers.push_back(
8034 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8035 *   3,
8036 *   ConvectionBoundaryConditionApplier<dim, Number>(
8037 *   0, convection_coefficient, ambient_temperature)));
8038 *   } /* make_necking_grid() */
8039 *  
8040 *  
8041 *   template <int dim, typename Number>
8042 *   void PlasticityLabProg<dim, Number>::make_interference_cylinder_grid(
8043 *   Triangulation<dim> &triangulation,
8044 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8045 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
8046 *   int n_initial_global_refinements) {
8047 *  
8048 *   const Number height = 300.0; // [mm]
8049 *   const Number radius = 40.0; // [mm]
8050 *  
8051 *   const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
8052 *   const unsigned int aspect_ratio = std::ceil(0.5 * height / radius);
8053 *  
8054 *   GridGenerator::subdivided_hyper_rectangle(
8055 *   triangulation,
8056 *   std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
8057 *   Point<dim>(0, 0),
8058 *   Point<dim>(radius, height),
8059 *   true
8060 *   );
8061 *  
8062 * @endcode
8063 *
8064 * mech_lbc_system.boundaryLoadAppliers.push_back(
8065 * std::pair<int,BodyForceApplier<dim,Number> >(
8066 * 1, BodyForceApplier<dim,Number>(dim, 0.8*4.50e1)));
8067 *
8068
8069 *
8070 *
8071 * @code
8072 *   ComponentMask x_component_mask(dim+1, false);
8073 *   x_component_mask.set(0, true);
8074 *   ComponentMask y_component_mask(dim+1, false);
8075 *   y_component_mask.set(1, true);
8076 *   ComponentMask z_component_mask(dim+1, false);
8077 *   z_component_mask.set(dim-1, true);
8078 *   ComponentMask rho_component_mask(dim+1, false);
8079 *   rho_component_mask.set(dim, true);
8080 *  
8081 *   std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
8082 *   top_constraint_function_map.insert(
8083 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8084 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8085 *   InterpolatoryConstraintApplier<dim, Number>(
8086 *   top_constraint_function_map,
8087 *   y_component_mask));
8088 *  
8089 *   std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
8090 *   yz_constraint_function_map.insert(
8091 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8092 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8093 *   InterpolatoryConstraintApplier<dim, Number>(
8094 *   yz_constraint_function_map,
8095 *   x_component_mask));
8096 *  
8097 *  
8098 *   const Number total_elongation = 300.0; // mm
8099 *   const Number elongation_rate = 1.0; // [mm/s]
8100 *   const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
8101 *  
8102 *   auto push_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8103 *   new ConstantFunction<dim, Number>(std::vector< Number >{0, -total_elongation/static_cast<Number>(n_steps), 0}),
8104 *   true,
8105 *   y_component_mask,
8106 *   false,
8107 *   ComponentMask(dim+1, false),
8108 *   0,
8109 *   mapping);
8110 *  
8111 *   mech_lbc_system.increment_interpolation_handlers.push_back(push_z_handler);
8112 *  
8113 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8114 *   top_rotation_constraint_function_map.insert(
8115 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8116 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8117 *   InterpolatoryConstraintApplier<dim, Number>(
8118 *   top_rotation_constraint_function_map,
8119 *   rho_component_mask));
8120 *  
8121 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8122 *   axial_rotation_constraint_function_map.insert(
8123 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8124 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8125 *   InterpolatoryConstraintApplier<dim, Number>(
8126 *   axial_rotation_constraint_function_map,
8127 *   rho_component_mask));
8128 *  
8129 *   const Number drive_speed = 0.2; // [rad/s]
8130 *  
8131 *   auto scale_rotation_increment = new IncrementInterpolationHandler<dim, Number, dim+1>(
8132 *   new ScaleComponentFunction<dim, Number, dim+1>(drive_speed * time_increment, 0, dim),
8133 *   true,
8134 *   rho_component_mask,
8135 *   false,
8136 *   ComponentMask(dim+1, false),
8137 *   3,
8138 *   mapping);
8139 *   mech_lbc_system.increment_interpolation_handlers.push_back(scale_rotation_increment);
8140 *   auto constant_angular_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8141 *   new ScaleComponentFunction<dim, Number, dim+1>(drive_speed, 0, dim),
8142 *   true,
8143 *   rho_component_mask,
8144 *   false,
8145 *   ComponentMask(dim+1, false),
8146 *   3,
8147 *   mapping);
8148 *   mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_angular_velocity_handler);
8149 *  
8150 * @endcode
8151 *
8152 * auto constant_velocity_angular_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8153 * new ScaleComponentFunction<dim, Number, dim+1>(0.0e-3, 0, dim),
8154 * true,
8155 * rho_component_mask,
8156 * false,
8157 * ComponentMask(dim+1, false),
8158 * 0,
8159 * mapping);
8160 *
8161
8162 *
8163 * mech_lbc_system.initial_deformation_interpolation_handlers.push_back(constant_velocity_angular_handler);
8164 *
8165
8166 *
8167 * Thermal constraints
8168 *
8169 * @code
8170 *   const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8171 *   therm_lbc_system.convection_BC_appliers.push_back(
8172 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8173 *   1,
8174 *   ConvectionBoundaryConditionApplier<dim, Number>(
8175 *   0, convection_coefficient, ambient_temperature)));
8176 *   therm_lbc_system.convection_BC_appliers.push_back(
8177 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8178 *   2,
8179 *   ConvectionBoundaryConditionApplier<dim, Number>(
8180 *   0, convection_coefficient, ambient_temperature)));
8181 *   therm_lbc_system.convection_BC_appliers.push_back(
8182 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8183 *   3,
8184 *   ConvectionBoundaryConditionApplier<dim, Number>(
8185 *   0, convection_coefficient, ambient_temperature)));
8186 *  
8187 * @endcode
8188 *
8189 * std::map< types::boundary_id, const Function< dim, Number > * > thermal_constraint_function_map;
8190 * thermal_constraint_function_map.insert(
8191 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &therm_lbc_system.zero_function));
8192 * thermal_constraint_function_map.insert(
8193 * std::pair<types::boundary_id, Function<dim, Number>*>(8, &therm_lbc_system.zero_function));
8194 * therm_dof_system.interpolatoryConstraintAppliers.push_back(
8195 * InterpolatoryConstraintApplier<dim,Number>(
8196 * thermal_constraint_function_map,ComponentMask(1, true)));
8197 *
8198 * @code
8199 *   } /* make_interference_cylinder_grid() */
8200 *  
8201 *  
8202 *   template <int dim, typename Number>
8203 *   void PlasticityLabProg<dim, Number>::make_ball_in_hypershell_grid(
8204 *   Triangulation<dim> &triangulation,
8205 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8206 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
8207 *   int n_initial_global_refinements) {
8208 *  
8209 *   const unsigned int INNER_BOUNDARY_ID = 0;
8210 *  
8211 *   const Number outer_radius = 60.0; // [mm]
8212 *  
8213 *   GridGenerator::half_hyper_ball(
8214 *   triangulation,
8215 *   Point<dim>(0, -10),
8216 *   outer_radius
8217 *   );
8218 *  
8219 *   for (const auto &cell : triangulation.active_cell_iterators()) {
8220 *   cell->set_boundary_id(INNER_BOUNDARY_ID);
8221 *   }
8222 *  
8223 *   triangulation.refine_global(n_initial_global_refinements);
8224 *  
8225 *   mech_lbc_system.boundaryLoadAppliers.push_back(
8226 *   std::pair<int,BodyForceApplier<dim,Number> >(
8227 *   1, BodyForceApplier<dim,Number>(dim, 0.8*4.50e1)));
8228 *  
8229 *   ComponentMask x_component_mask(dim+1, false);
8230 *   x_component_mask.set(0, true);
8231 *   ComponentMask y_component_mask(dim+1, false);
8232 *   y_component_mask.set(1, true);
8233 *   ComponentMask z_component_mask(dim+1, false);
8234 *   z_component_mask.set(dim-1, true);
8235 *   ComponentMask rho_component_mask(dim+1, false);
8236 *   rho_component_mask.set(dim, true);
8237 *   ComponentMask all_component_mask(dim+1, true);
8238 *  
8239 *   std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
8240 *   yz_constraint_function_map.insert(
8241 *   std::pair<types::boundary_id, Function<dim, Number>*>(1, &mech_lbc_system.zero_function));
8242 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8243 *   InterpolatoryConstraintApplier<dim, Number>(
8244 *   yz_constraint_function_map,
8245 *   x_component_mask));
8246 *  
8247 *   std::map< types::boundary_id, const Function< dim, Number > * > down_constraint_function_map;
8248 *   down_constraint_function_map.insert(
8249 *   std::pair<types::boundary_id, Function<dim, Number>*>(INNER_BOUNDARY_ID, &mech_lbc_system.zero_function));
8250 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8251 *   InterpolatoryConstraintApplier<dim, Number>(
8252 *   down_constraint_function_map,
8253 *   y_component_mask));
8254 *  
8255 *   const Number total_elongation = 300.0; // mm
8256 *   const Number elongation_rate = 225.0e-2; // [mm/s]
8257 *   const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
8258 *  
8259 *   auto push_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8260 *   new ConstantFunction<dim, Number>(std::vector< Number >{0, -total_elongation/static_cast<Number>(n_steps), 0}),
8261 *   true,
8262 *   y_component_mask,
8263 *   false,
8264 *   ComponentMask(dim+1, false),
8265 *   INNER_BOUNDARY_ID,
8266 *   mapping);
8267 *  
8268 *   mech_lbc_system.increment_interpolation_handlers.push_back(push_z_handler);
8269 *  
8270 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8271 *   top_rotation_constraint_function_map.insert(
8272 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8273 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8274 *   InterpolatoryConstraintApplier<dim, Number>(
8275 *   top_rotation_constraint_function_map,
8276 *   rho_component_mask));
8277 *  
8278 * @endcode
8279 *
8280 * Thermal constraints
8281 *
8282 * @code
8283 *   const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8284 *   therm_lbc_system.convection_BC_appliers.push_back(
8285 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8286 *   1,
8287 *   ConvectionBoundaryConditionApplier<dim, Number>(
8288 *   0, convection_coefficient, ambient_temperature)));
8289 *   therm_lbc_system.convection_BC_appliers.push_back(
8290 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8291 *   2,
8292 *   ConvectionBoundaryConditionApplier<dim, Number>(
8293 *   0, convection_coefficient, ambient_temperature)));
8294 *   therm_lbc_system.convection_BC_appliers.push_back(
8295 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8296 *   3,
8297 *   ConvectionBoundaryConditionApplier<dim, Number>(
8298 *   0, convection_coefficient, ambient_temperature)));
8299 *   } /* make_ball_in_hypershell_grid() */
8300 *  
8301 *  
8302 *  
8303 *  
8304 *  
8305 *   template <int dim, typename Number>
8306 *   void PlasticityLabProg<dim, Number>::make_cylindrical_impact_grid(
8307 *   Triangulation<dim> &triangulation,
8308 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8309 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
8310 *   int n_initial_global_refinements) {
8311 *  
8312 *   const Number initial_velocity = 1.9e5; // [mm/s]
8313 *   const Number height = 25.4; // [mm]
8314 *   const Number radius = 3.81; // [mm]
8315 *  
8316 *   const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
8317 *   const unsigned int aspect_ratio = std::ceil(0.25 * height / radius);
8318 *  
8319 *   GridGenerator::subdivided_hyper_rectangle(
8320 *   triangulation,
8321 *   std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
8322 *   Point<dim>(0, 0),
8323 *   Point<dim>(radius, height),
8324 *   true
8325 *   );
8326 *  
8327 * @endcode
8328 *
8329 * mech_lbc_system.boundaryLoadAppliers.push_back(
8330 * std::pair<int,BodyForceApplier<dim,Number> >(
8331 * 6, BodyForceApplier<dim,Number>(2, -4.50)));
8332 *
8333
8334 *
8335 *
8336 * @code
8337 *   ComponentMask x_component_mask(dim, false);
8338 *   x_component_mask.set(0, true);
8339 *   ComponentMask y_component_mask(3, false);
8340 *   y_component_mask.set(1, true);
8341 *   ComponentMask z_component_mask(dim, false);
8342 *   z_component_mask.set(dim-1, true);
8343 *   ComponentMask rho_component_mask(dim+1, false);
8344 *   rho_component_mask.set(dim, true);
8345 *  
8346 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_constraint_function_map;
8347 *   axial_constraint_function_map.insert(
8348 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8349 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8350 *   InterpolatoryConstraintApplier<dim, Number>(
8351 *   axial_constraint_function_map,
8352 *   x_component_mask));
8353 *  
8354 *   std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
8355 *   base_constraint_function_map.insert(
8356 *   std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
8357 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8358 *   InterpolatoryConstraintApplier<dim, Number>(
8359 *   base_constraint_function_map,
8360 *   y_component_mask));
8361 *  
8362 *   auto constant_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8363 *   new ConstantFunction<dim, Number>(std::vector< Number >{0, -initial_velocity, 0}),
8364 *   true,
8365 *   y_component_mask,
8366 *   false,
8367 *   ComponentMask(dim, false),
8368 *   0,
8369 *   mapping);
8370 *  
8371 *   mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_velocity_handler);
8372 *  
8373 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8374 *   top_rotation_constraint_function_map.insert(
8375 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8376 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8377 *   InterpolatoryConstraintApplier<dim, Number>(
8378 *   top_rotation_constraint_function_map,
8379 *   rho_component_mask));
8380 *  
8381 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8382 *   axial_rotation_constraint_function_map.insert(
8383 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8384 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8385 *   InterpolatoryConstraintApplier<dim, Number>(
8386 *   axial_rotation_constraint_function_map,
8387 *   rho_component_mask));
8388 *  
8389 *   auto constant_velocity_angular_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8390 *   new ScaleComponentFunction<dim, Number, dim+1>(0.0e2, 0, dim),
8391 *   true,
8392 *   rho_component_mask,
8393 *   false,
8394 *   ComponentMask(dim+1, false),
8395 *   0,
8396 *   mapping);
8397 *  
8398 *   mech_lbc_system.initial_deformation_interpolation_handlers.push_back(constant_velocity_angular_handler);
8399 *  
8400 * @endcode
8401 *
8402 * Thermal constraints
8403 *
8404 * @code
8405 *   const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8406 *   therm_lbc_system.convection_BC_appliers.push_back(
8407 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8408 *   1,
8409 *   ConvectionBoundaryConditionApplier<dim, Number>(
8410 *   0, convection_coefficient, ambient_temperature)));
8411 *   therm_lbc_system.convection_BC_appliers.push_back(
8412 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8413 *   3,
8414 *   ConvectionBoundaryConditionApplier<dim, Number>(
8415 *   0, convection_coefficient, ambient_temperature)));
8416 *  
8417 * @endcode
8418 *
8419 * std::map< types::boundary_id, const Function< dim, Number > * > thermal_constraint_function_map;
8420 * thermal_constraint_function_map.insert(
8421 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &therm_lbc_system.zero_function));
8422 * thermal_constraint_function_map.insert(
8423 * std::pair<types::boundary_id, Function<dim, Number>*>(8, &therm_lbc_system.zero_function));
8424 * therm_dof_system.interpolatoryConstraintAppliers.push_back(
8425 * InterpolatoryConstraintApplier<dim,Number>(
8426 * thermal_constraint_function_map,ComponentMask(1, true)));
8427 *
8428
8429 *
8430 *
8431 * @code
8432 *   } /* make_cylindrical_impact_grid() */
8433 *  
8434 *  
8435 *   template <int dim, typename Number>
8436 *   void PlasticityLabProg<dim, Number>::make_hook_membrane_grid(
8437 *   int /*n_initial_global_refinements*/) {
8438 *  
8439 *   } /* make_necking_grid() */
8440 *  
8441 *  
8442 *  
8443 *   template <int dim, typename Number>
8444 *   Tensor<2, dim+1, Number> PlasticityLabProg<dim, Number>::get_rotation_tensor(
8445 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation) const {
8446 *   const Number theta = Constants<dim, Number>::sqrt_half() * skew_symmetric_rotation.norm();
8447 *   if (theta > 1e-8) {
8448 *   const Number h1 = (1./(theta*theta)*(1.-std::cos(theta)));
8449 *   const Number h2 = (1./theta*std::sin(theta));
8450 *   return static_cast<Tensor<2, dim+1, Number>>(unit_symmetric_tensor<dim+1, Number>())
8451 *   + h1 * skew_symmetric_rotation * skew_symmetric_rotation
8452 *   + h2 * skew_symmetric_rotation;
8453 *   } else {
8454 *   return static_cast<Tensor<2, dim+1, Number>>(unit_symmetric_tensor<dim+1, Number>());
8455 *   }
8456 *   }
8457 *  
8458 *  
8459 *   template <int dim, typename Number>
8460 *   Tensor<2, dim+1, Number> PlasticityLabProg<dim, Number>::get_rotation_tensor_variation(
8461 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation,
8462 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation_variation) const {
8463 *  
8464 *   const Number theta = Constants<dim, Number>::sqrt_half() * skew_symmetric_rotation.norm();
8465 *   if (theta > 1e-8) {
8466 *   const Number h1 = (1./(theta*theta)*(1.-std::cos(theta)));
8467 *   const Number h2 = (1./theta*std::sin(theta));
8468 *   const Number delta_theta = 1./(2.*theta) * scalar_product(skew_symmetric_rotation, skew_symmetric_rotation_variation);
8469 *   const Number delta_h1 = (-2./theta * (h1 - 0.5 * h2)) * delta_theta;
8470 *   const Number delta_h2 = (-1./theta * h2 + 1./theta * std::cos(theta)) * delta_theta;
8471 *   const Tensor<2, dim+1, Number> rotation_tensor_variation = delta_h1 * skew_symmetric_rotation * skew_symmetric_rotation
8472 *   + h1 * skew_symmetric_rotation_variation * skew_symmetric_rotation
8473 *   + h1 * skew_symmetric_rotation * skew_symmetric_rotation_variation
8474 *   + delta_h2 * skew_symmetric_rotation
8475 *   + h2 * skew_symmetric_rotation_variation;
8476 *   return rotation_tensor_variation;
8477 *   } else {
8478 *   return Tensor<2, dim+1, Number>();
8479 *   }
8480 *   }
8481 *  
8482 *   }
8483 *  
8484 * @endcode
8485
8486
8487<a name="ann-src/PointHistory.h"></a>
8488<h1>Annotated version of src/PointHistory.h</h1>
8489 *
8490 *
8491 *
8492 *
8493 * @code
8494 *   /*
8495 *   * PointHistory.h
8496 *   *
8497 *   * Created on: 21 Jul 2014
8498 *   * Author: cerecam
8499 *   */
8500 *  
8501 *   #ifndef POINTHISTORY_H_
8502 *   #define POINTHISTORY_H_
8503 *  
8504 *   #include <deal.II/base/utilities.h>
8505 *   #include <deal.II/base/function.h>
8506 *  
8507 *   #include <deal.II/numerics/vector_tools.h>
8508 *   #include <deal.II/numerics/matrix_tools.h>
8509 *   #include <deal.II/numerics/data_out.h>
8510 *  
8511 *   #include <deal.II/lac/trilinos_vector.h>
8512 *  
8513 *   namespace PlasticityLab {
8514 *  
8515 *   template <int dim, typename Number = double>
8516 *   class PointHistory {
8517 *   public:
8518 *   PointHistory();
8519 *   virtual ~PointHistory();
8520 *  
8521 *   struct HardeningParameters {
8522 *   HardeningParameters(
8523 *   Number equivalent_plastic_strain,
8524 *   ::SymmetricTensor<2, dim, Number> kinematic_hardening):
8525 *   equivalent_plastic_strain(equivalent_plastic_strain),
8526 *   kinematic_hardening(kinematic_hardening) { }
8527 *   HardeningParameters() {}
8528 *  
8529 *   Number equivalent_plastic_strain;
8530 *   ::SymmetricTensor<2, dim, Number> kinematic_hardening;
8531 *   };
8532 *  
8533 *   PointHistory(const ::SymmetricTensor<2, dim, Number> &,
8534 *   const HardeningParameters &,
8535 *   Number plastic_entropy,
8536 *   Number material_Jacobian);
8537 *  
8538 *   ::SymmetricTensor<2, dim, Number> plastic_strain;
8539 *   HardeningParameters hardening_parameters;
8540 *   Number plastic_entropy;
8541 *   Number material_Jacobian;
8542 *   };
8543 *  
8544 *  
8545 *   template <int dim, typename Number>
8546 *   PointHistory<dim, Number>::PointHistory()
8547 *   :
8548 *   plastic_strain (::unit_symmetric_tensor<dim, Number>()),
8549 *   hardening_parameters(Number(0.0), Number(0.0) * ::unit_symmetric_tensor<dim, Number>()),
8550 *   plastic_entropy(Number(0.0)),
8551 *   material_Jacobian(1.0) {
8552 *   }
8553 *  
8554 *   template <int dim, typename Number>
8555 *   PointHistory<dim, Number>::
8556 *   PointHistory(const ::SymmetricTensor<2, dim, Number> &plastic_strain,
8557 *   const HardeningParameters &hardening_parameters,
8558 *   const Number plastic_entropy,
8559 *   const Number material_Jacobian):
8560 *   plastic_strain(plastic_strain),
8561 *   hardening_parameters(hardening_parameters),
8562 *   plastic_entropy(plastic_entropy),
8563 *   material_Jacobian(material_Jacobian) {
8564 *   }
8565 *  
8566 *   template <int dim, typename Number>
8567 *   PointHistory<dim, Number>::~PointHistory() {
8568 *   }
8569 *  
8570 *   } /* namespace PlasticityLab */
8571 *  
8572 *   #endif /* POINTHISTORY_H_ */
8573 * @endcode
8574
8575
8576<a name="ann-src/ReferencePoint.h"></a>
8577<h1>Annotated version of src/ReferencePoint.h</h1>
8578 *
8579 *
8580 *
8581 *
8582 * @code
8583 *   /*
8584 *   * ReferencePoint.h
8585 *   *
8586 *   * Created on: 29 Nov 2020
8587 *   * Author: maien
8588 *   */
8589 *  
8590 *   #ifndef REFERENCEPOINT_H_
8591 *   #define REFERENCEPOINT_H_
8592 *  
8593 *   #include <memory>
8594 *   #include <deal.II/dofs/dof_handler.h>
8595 *   #include <deal.II/base/point.h>
8596 *  
8597 *   using namespace dealii;
8598 *  
8599 *   namespace PlasticityLab {
8600 *   template <int dim, typename Number>
8601 *   class ReferencePoint {
8602 *   public:
8603 *   ReferencePoint();
8604 *   virtual ~ReferencePoint();
8605 *  
8606 *   typename DoFHandler<dim>::active_cell_iterator mesh_motion_cell;
8607 *   typename DoFHandler<dim>::active_cell_iterator field_cell;
8608 *   unsigned int q_point;
8609 *   Point<dim, Number> reference_point;
8610 *   Point<dim, Number> remapped_point;
8611 *   };
8612 *  
8613 *   template <int dim, typename Number>
8614 *   ReferencePoint<dim, Number>::ReferencePoint() {
8615 *   }
8616 *  
8617 *   template <int dim, typename Number>
8618 *   ReferencePoint<dim, Number>::~ReferencePoint() {}
8619 *  
8620 *   } /* namespace PlasticityLab */
8621 *  
8622 *   #endif /* REFERENCEPOINT_H_ */
8623 * @endcode
8624
8625
8626<a name="ann-src/RemappedPoint.h"></a>
8627<h1>Annotated version of src/RemappedPoint.h</h1>
8628 *
8629 *
8630 *
8631 *
8632 * @code
8633 *   /*
8634 *   * RemappedPoint.h
8635 *   *
8636 *   * Created on: 29 Nov 2020
8637 *   * Author: maien
8638 *   */
8639 *  
8640 *   #ifndef REMAPPEDPOINT_H_
8641 *   #define REMAPPEDPOINT_H_
8642 *  
8643 *   #include <memory>
8644 *   #include <deal.II/dofs/dof_handler.h>
8645 *   #include <deal.II/base/point.h>
8646 *  
8647 *   using namespace dealii;
8648 *  
8649 *   namespace PlasticityLab {
8650 *   template <int dim, typename Number>
8651 *   class RemappedPoint {
8652 *   public:
8653 *   RemappedPoint();
8654 *   virtual ~RemappedPoint();
8655 *  
8656 *   typename DoFHandler<dim>::active_cell_iterator mesh_motion_cell;
8657 *   typename DoFHandler<dim>::active_cell_iterator field_cell;
8658 *   typename DoFHandler<dim>::active_cell_iterator mixed_fe_cell;
8659 *   Point<dim, Number> unit_cell_point;
8660 *   Point<dim, Number> remapped_point;
8661 *   };
8662 *  
8663 *   template <int dim, typename Number>
8664 *   RemappedPoint<dim, Number>::RemappedPoint() {
8665 *   }
8666 *  
8667 *   template <int dim, typename Number>
8668 *   RemappedPoint<dim, Number>::~RemappedPoint() {}
8669 *  
8670 *   } /* namespace PlasticityLab */
8671 *  
8672 *   #endif /* REMAPPEDPOINT_H_ */
8673 * @endcode
8674
8675
8676<a name="ann-src/RotationFunction.h"></a>
8677<h1>Annotated version of src/RotationFunction.h</h1>
8678 *
8679 *
8680 *
8681 *
8682 * @code
8683 *   /*
8684 *   * RotationFunction.h
8685 *   *
8686 *   * Created on: 06 Dec 2016
8687 *   * Author: maien
8688 *   */
8689 *  
8690 *   #ifndef ROTATIONFUNCTION_H_
8691 *   #define ROTATIONFUNCTION_H_
8692 *  
8693 *   #include <math.h>
8694 *   #include <deal.II/base/function.h>
8695 *   #include <deal.II/base/utilities.h>
8696 *  
8697 *   using namespace dealii;
8698 *  
8699 *   namespace PlasticityLab {
8700 *  
8701 *   template<int dim, typename Number = double>
8702 *   class RotationFunction: public Function<dim, Number> {
8703 *   public:
8704 *   RotationFunction(
8705 *   const Number angular_frequency,
8706 *   const Number axial_velocity,
8707 *   const Number current_angle = 0.0);
8708 *   virtual ~RotationFunction();
8709 *  
8710 *   virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const;
8711 *   virtual void set_time (const Number new_time);
8712 *  
8713 *   private:
8714 *   void update_rotation_matrix();
8715 *   Tensor<2, dim, Number> previousRotationMatrix, currentRotationMatrix;
8716 *   Number current_angle;
8717 *   Number previous_displacement, current_displacement;
8718 *   Number angular_frequency;
8719 *   Number axial_velocity;
8720 *   };
8721 *  
8722 *   template<int dim, typename Number = double>
8723 *   class AngularVelocityFunction: public Function<dim, Number> {
8724 *   public:
8725 *   AngularVelocityFunction(const Number angular_frequency) : Function<dim, Number>(dim) {
8726 *   this->angular_frequency = angular_frequency;
8727 *   }
8728 *   virtual ~AngularVelocityFunction() {}
8729 *  
8730 *   virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const {
8731 *   values[0] = - 2 * 3.14159 * angular_frequency * p[1];
8732 *   values[1] = 2 * 3.14159 * angular_frequency * p[0];
8733 *   if(3==dim) {
8734 *   values[2] = 0;
8735 *   }
8736 *   }
8737 *  
8738 *   private:
8739 *   Number angular_frequency;
8740 *   };
8741 *  
8742 *   template<int dim, typename Number>
8743 *   RotationFunction<dim, Number>::~RotationFunction() {}
8744 *  
8745 *   template<int dim, typename Number>
8746 *   RotationFunction<dim, Number>::RotationFunction(
8747 *   const Number angular_frequency,
8748 *   const Number axial_velocity,
8749 *   const Number current_angle) : Function<dim, Number>(dim) {
8750 *   this->angular_frequency = angular_frequency;
8751 *   this->axial_velocity = axial_velocity;
8752 *   this->current_angle = current_angle;
8753 *   this->set_time(0.0);
8754 *   current_displacement = 0.0;
8755 *   }
8756 *  
8757 *   template<int dim, typename Number>
8758 *   void RotationFunction<dim, Number>::vector_value (const Point< dim > &p, Vector< Number > &values) const {
8759 *   const auto p_prev = previousRotationMatrix * p;
8760 *   const auto res = currentRotationMatrix * p;
8761 *   for (unsigned int i = 0; i < dim; ++i)
8762 *   values[i] = res[i] - p_prev[i] + (i == 2 ? current_displacement - previous_displacement : 0.0);
8763 *   }
8764 *  
8765 *   template<int dim, typename Number>
8766 *   void RotationFunction<dim, Number>::update_rotation_matrix () {
8767 *   previousRotationMatrix = currentRotationMatrix;
8768 *   const Number c_theta = std::cos(current_angle);
8769 *   const Number s_theta = std::sin(current_angle);
8770 *   currentRotationMatrix[0][0] = c_theta;
8771 *   currentRotationMatrix[0][1] = -s_theta;
8772 *   currentRotationMatrix[1][0] = s_theta;
8773 *   currentRotationMatrix[1][1] = c_theta;
8774 *   if (dim == 3)
8775 *   currentRotationMatrix[2][2] = 1.0;
8776 *   }
8777 *  
8778 *   template<int dim, typename Number>
8779 *   void RotationFunction<dim, Number>::set_time (const Number new_time) {
8780 *   Function<dim, Number>::set_time(new_time);
8781 *   current_angle = angular_frequency * Function<dim, Number>::get_time();
8782 *   update_rotation_matrix();
8783 *   previous_displacement = current_displacement;
8784 *   current_displacement = axial_velocity * Function<dim, Number>::get_time();
8785 *   }
8786 *  
8787 *   } /* namespace PlasticityLab */
8788 *  
8789 *   #endif /* ROTATIONFUNCTION_H_ */
8790 * @endcode
8791
8792
8793<a name="ann-src/ScaleComponentFunction.h"></a>
8794<h1>Annotated version of src/ScaleComponentFunction.h</h1>
8795 *
8796 *
8797 *
8798 *
8799 * @code
8800 *   /*
8801 *   * ScaleComponentFunction.h
8802 *   *
8803 *   * Created on: 28 Dec 2019
8804 *   * Author: maien
8805 *   */
8806 *  
8807 *   #ifndef SCALECOMPONENTFUNCTION_H_
8808 *   #define SCALECOMPONENTFUNCTION_H_
8809 *  
8810 *   #include <math.h>
8811 *   #include <deal.II/base/function.h>
8812 *   #include <deal.II/base/utilities.h>
8813 *  
8814 *   using namespace dealii;
8815 *  
8816 *   namespace PlasticityLab {
8817 *  
8818 *   template<int dim, typename Number = double, int components=dim>
8819 *   class ScaleComponentFunction: public Function<dim, Number> {
8820 *   public:
8821 *   ScaleComponentFunction(
8822 *   const Number scale_factor,
8823 *   const unsigned int in_component=2,
8824 *   const unsigned int out_component=2);
8825 *   virtual ~ScaleComponentFunction();
8826 *   virtual void vector_value(const Point<dim> &p, Vector<Number> &values) const override;
8827 *  
8828 *   private:
8829 *   Number scale_factor;
8830 *   const unsigned int in_component;
8831 *   const unsigned int out_component;
8832 *   };
8833 *  
8834 *   template<int dim, typename Number, int components>
8835 *   ScaleComponentFunction<dim, Number, components>::ScaleComponentFunction(
8836 *   const Number scale_factor,
8837 *   const unsigned int in_component,
8838 *   const unsigned int out_component) :
8839 *   Function<dim, Number>(components),
8840 *   scale_factor(scale_factor),
8841 *   in_component(in_component),
8842 *   out_component(out_component) { }
8843 *  
8844 *   template<int dim, typename Number, int components>
8845 *   ScaleComponentFunction<dim, Number, components>::~ScaleComponentFunction() {}
8846 *  
8847 *   template<int dim, typename Number, int components>
8848 *   void ScaleComponentFunction<dim, Number, components>::vector_value(const Point<dim> &p, Vector<Number> &values) const {
8849 *   values *= 0.0;
8850 *   values[out_component] = scale_factor * p[in_component];
8851 *   }
8852 *  
8853 *   } /* namespace PlasticityLab */
8854 *  
8855 *   #endif /* SCALECOMPONENTFUNCTION_H_ */
8856 * @endcode
8857
8858
8859<a name="ann-src/ScaleZFunction.h"></a>
8860<h1>Annotated version of src/ScaleZFunction.h</h1>
8861 *
8862 *
8863 *
8864 *
8865 * @code
8866 *   /*
8867 *   * ScaleZFunction.h
8868 *   *
8869 *   * Created on: 06 Dec 2016
8870 *   * Author: maien
8871 *   */
8872 *  
8873 *   #ifndef SCALEZFUNCTION_H_
8874 *   #define SCALEZFUNCTION_H_
8875 *  
8876 *   #include <math.h>
8877 *   #include <deal.II/base/function.h>
8878 *   #include <deal.II/base/utilities.h>
8879 *  
8880 *   using namespace dealii;
8881 *  
8882 *   namespace PlasticityLab {
8883 *  
8884 *   template<int dim, typename Number = double, int components=dim>
8885 *   class ScaleZFunction: public Function<dim, Number> {
8886 *   public:
8887 *   ScaleZFunction(const Number scale_factor, const unsigned int component=2);
8888 *   virtual ~ScaleZFunction();
8889 *   virtual void vector_value(const Point<dim> &p, Vector<Number> &values) const override;
8890 *  
8891 *   private:
8892 *   Number scale_factor;
8893 *   const unsigned int component;
8894 *   };
8895 *  
8896 *   template<int dim, typename Number, int components>
8897 *   ScaleZFunction<dim, Number, components>::ScaleZFunction(
8898 *   const Number scale_factor,
8899 *   const unsigned int component) :
8900 *   Function<dim, Number>(components),
8901 *   component(component) {
8902 *   this->scale_factor = scale_factor;
8903 *   }
8904 *  
8905 *   template<int dim, typename Number, int components>
8906 *   ScaleZFunction<dim, Number, components>::~ScaleZFunction() {}
8907 *  
8908 *   template<int dim, typename Number, int components>
8909 *   void ScaleZFunction<dim, Number, components>::vector_value(const Point<dim> &p, Vector<Number> &values) const {
8910 *   values *= 0.0;
8911 *   values[component] = scale_factor * p[component];
8912 *   }
8913 *  
8914 *   } /* namespace PlasticityLab */
8915 *  
8916 *   #endif /* SCALEZFUNCTION_H_ */
8917 * @endcode
8918
8919
8920<a name="ann-src/TensorUtilities.h"></a>
8921<h1>Annotated version of src/TensorUtilities.h</h1>
8922 *
8923 *
8924 *
8925 *
8926 * @code
8927 *   /*
8928 *   * TensorUtilities.h
8929 *   *
8930 *   * Created on: 06 Nov 2020
8931 *   * Author: maien
8932 *   */
8933 *  
8934 *   #ifndef TENSOR_UTILITIES_H_
8935 *   #define TENSOR_UTILITIES_H_
8936 *  
8937 *   #include<exception>
8938 *  
8939 *   #include <deal.II/base/tensor.h>
8940 *   #include <deal.II/base/symmetric_tensor.h>
8941 *  
8942 *  
8943 *   using namespace dealii;
8944 *  
8945 *   namespace PlasticityLab {
8946 *   template <int dim, typename Number>
8947 *   SymmetricTensor<2, dim, Number> get_log_of_tensor(
8948 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate) {
8949 *   try{
8950 *   const auto eig_vals_vecs = eigenvectors(symmetric_stretch_rate);
8951 *   SymmetricTensor<2, dim, Number> result =
8952 *   std::log(eig_vals_vecs[0].first)
8953 *   * symmetrize(
8954 *   outer_product(
8955 *   eig_vals_vecs[0].second,
8956 *   eig_vals_vecs[0].second));
8957 *   for(unsigned int d=1; d<dim; ++d) {
8958 *   result +=
8959 *   std::log(eig_vals_vecs[d].first)
8960 *   * symmetrize(
8961 *   outer_product(
8962 *   eig_vals_vecs[d].second,
8963 *   eig_vals_vecs[d].second));
8964 *   }
8965 *   return result;
8966 *   } catch(std::exception& e) {
8967 *   std::cout << "Could not get log of tensor: " << symmetric_stretch_rate << std::endl;
8968 *   return symmetric_stretch_rate;
8969 *   }
8970 *  
8971 *   }
8972 *  
8973 *   template <int dim, typename Number>
8974 *   SymmetricTensor<2, dim, Number> get_log_of_tensor_variation(
8975 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate,
8976 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate_variation) {
8977 *   const double epsilon = 1e-10;
8978 *   return (1./epsilon) * (get_log_of_tensor(symmetric_stretch_rate + epsilon * symmetric_stretch_rate_variation) - get_log_of_tensor(symmetric_stretch_rate));
8979 *   }
8980 *  
8981 *   template <int dim, typename Number>
8982 *   SymmetricTensor<2, dim, Number> get_exp_of_tensor(
8983 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate) {
8984 *   try{
8985 *   const auto eig_vals_vecs = eigenvectors(symmetric_stretch_rate);
8986 *   SymmetricTensor<2, dim, Number> result =
8987 *   std::exp(eig_vals_vecs[0].first)
8988 *   * symmetrize(
8989 *   outer_product(
8990 *   eig_vals_vecs[0].second,
8991 *   eig_vals_vecs[0].second));
8992 *   for(unsigned int d=1; d<dim; ++d) {
8993 *   result +=
8994 *   std::exp(eig_vals_vecs[d].first)
8995 *   * symmetrize(
8996 *   outer_product(
8997 *   eig_vals_vecs[d].second,
8998 *   eig_vals_vecs[d].second));
8999 *   }
9000 *   return result;
9001 *   } catch(std::exception& e) {
9002 *   std::cout << "Could not get exp of tensor: " << symmetric_stretch_rate << std::endl;
9003 *   return symmetric_stretch_rate;
9004 *   }
9005 *   }
9006 *  
9007 *   template <int dim, typename Number>
9008 *   SymmetricTensor<2, dim, Number> get_exp_of_tensor_variation(
9009 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate,
9010 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate_variation) {
9011 *   const Number epsilon = 1e-10;
9012 *   return (1./epsilon) * (get_exp_of_tensor(symmetric_stretch_rate + epsilon * symmetric_stretch_rate_variation) - get_exp_of_tensor(symmetric_stretch_rate));
9013 *   }
9014 *   }
9015 *  
9016 *   #endif // TENSOR_UTILITIES_H_ * @endcode
9017
9018
9019<a name="ann-src/ThermoPlasticMaterial.cpp"></a>
9020<h1>Annotated version of src/ThermoPlasticMaterial.cpp</h1>
9021 *
9022 *
9023 *
9024 *
9025 * @code
9026 *   /*
9027 *   * ThermoPlasticMaterial.cpp
9028 *   *
9029 *   * Created on: 05 Jan 2015
9030 *   * Author: maien
9031 *   */
9032 *  
9033 *   #include <math.h>
9034 *   #include <sstream>
9035 *  
9036 *   #include <deal.II/base/tensor.h>
9037 *   #include <deal.II/base/symmetric_tensor.h>
9038 *  
9039 *   #include "symmetric_tensor_entries.h"
9040 *  
9041 *   #include "ExponentialHardeningThermoviscoplasticYieldLaw.h"
9042 *   #include "JohnsonCookThermoviscoplasticYieldLaw.h"
9043 *  
9044 *   #include "ThermoPlasticMaterial.h"
9045 *   #include "Constants.h"
9046 *   #include "TensorUtilities.h"
9047 *  
9048 *   namespace PlasticityLab {
9049 *  
9050 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9051 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9052 *   ThermoPlasticMaterial(
9053 *   const Number kappa,
9054 *   const Number mu,
9055 *   const Number thermal_expansion_coefficient,
9056 *   const Number thermal_conductivity,
9057 *   const Number heat_capacity,
9058 *   const Number dissipation_factor,
9059 *   const ViscoplasticYieldLaw &viscoplastic_yield_law) :
9060 *   kappa (kappa),
9061 *   mu (mu),
9062 *   thermal_expansion_coefficient(thermal_expansion_coefficient),
9063 *   thermal_conductivity(thermal_conductivity),
9064 *   heat_capacity(heat_capacity),
9065 *   reference_temperature(293.15),
9066 *   dissipation_factor(dissipation_factor),
9067 *   viscoplastic_yield_law(viscoplastic_yield_law) { }
9068 *  
9069 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9070 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::~ThermoPlasticMaterial() {
9071 *   }
9072 *  
9073 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9074 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::compute_constitutive_request(
9075 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9076 *   const point_index_t &point_index) {
9077 *   const ConstitutiveModelUpdateFlags update_flags = constitutive_request.get_update_flags();
9078 *  
9079 *   if (update_pressure & update_flags)
9080 *   compute_pressure(constitutive_request, point_index);
9081 *  
9082 *   if ((update_stress_deviator | update_mechanical_dissipation) & update_flags)
9083 *   compute_stress_deviator_and_d_gamma(constitutive_request, point_index);
9084 *  
9085 *   if (update_heat_flux & update_flags)
9086 *   compute_heat_flux(constitutive_request, point_index);
9087 *  
9088 *   if (update_thermoelastic_heating & update_flags)
9089 *   compute_thermo_elastic_heating(constitutive_request, point_index);
9090 *  
9091 *   if (update_stored_heat & update_flags)
9092 *   compute_stored_heat_rate(constitutive_request, point_index);
9093 *   }
9094 *  
9095 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9096 *   std::vector<Number> ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_state_parameters(
9097 *   const point_index_t &point_index,
9098 *   const Tensor<2, dim, Number> &reference_transformation) const {
9099 *   std::vector<Number> state_parameters;
9100 *   state_parameters.reserve(get_material_parameter_count());
9101 *  
9102 *   const PointHistory<dim, Number> &point_history = material_point_history.at(point_index);
9103 *   state_parameters.push_back(std::log(1 + point_history.hardening_parameters.equivalent_plastic_strain));
9104 *  
9105 *   const Number reference_transformation_Jacobian = determinant(reference_transformation);
9106 *   const auto isochoric_reference_transformation =
9107 *   std::pow(reference_transformation_Jacobian, -Constants<dim, Number>::one_third()) * reference_transformation;
9108 *  
9109 *   const SymmetricTensor<2, dim, Number> log_of_b_e =
9110 *   get_log_of_tensor(
9111 *   symmetrize(
9112 *   isochoric_reference_transformation
9113 *   * static_cast<Tensor<2, dim, Number>>(point_history.plastic_strain)
9114 *   * transpose(isochoric_reference_transformation)));
9115 *  
9116 *   for (const auto &element :
9117 *   dealii_utils::symmetric_tensor_entries(log_of_b_e)) {
9118 *   state_parameters.push_back(element);
9119 *   }
9120 *  
9121 *   for (const auto &element :
9122 *   dealii_utils::symmetric_tensor_entries(
9123 *   point_history.hardening_parameters.kinematic_hardening)
9124 *   ) {
9125 *   state_parameters.push_back(element);
9126 *   }
9127 *  
9128 *   state_parameters.push_back(std::log(std::pow(reference_transformation_Jacobian, 1) * point_history.material_Jacobian));
9129 *  
9130 *   return state_parameters;
9131 *   }
9132 *  
9133 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9134 *   size_t ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>:: get_material_parameter_count() const {
9135 *   return 1 + 2 * (dim * (dim + 1) / 2) + 1; // one scalar and two symmetric tensors and one more scalar
9136 *   }
9137 *  
9138 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9139 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::set_state_parameters(
9140 *   const point_index_t &point_index,
9141 *   const std::vector<Number> &state_parameters,
9142 *   const Tensor<2, dim, Number> &reference_transformation) {
9143 *   PointHistory<dim, Number> &point_history = material_point_history.at(point_index);
9144 *   size_t cursor = 0;
9145 *  
9146 *   point_history.hardening_parameters.equivalent_plastic_strain = std::exp(state_parameters[cursor++]) - 1;
9147 *  
9148 *   SymmetricTensor<2, dim, Number> log_of_b_e;
9149 *  
9150 *   for (auto &element :
9151 *   dealii_utils::symmetric_tensor_entries(log_of_b_e)) {
9152 *   element = state_parameters[cursor++];
9153 *   }
9154 *  
9155 *   const Number reference_transformation_Jacobian = determinant(reference_transformation);
9156 *   const auto inverse_isochoric_reference_transformation =
9157 *   std::pow(reference_transformation_Jacobian, Constants<dim, Number>::one_third()) * invert(reference_transformation);
9158 *  
9159 *   point_history.plastic_strain = symmetrize(
9160 *   inverse_isochoric_reference_transformation
9161 *   * static_cast<Tensor<2, dim, Number>>(get_exp_of_tensor(log_of_b_e))
9162 *   * transpose(inverse_isochoric_reference_transformation));
9163 *  
9164 *   for (auto &element :
9165 *   dealii_utils::symmetric_tensor_entries(
9166 *   point_history.hardening_parameters.kinematic_hardening
9167 *   )) {
9168 *   element = state_parameters[cursor++];
9169 *   }
9170 *  
9171 *   point_history.material_Jacobian = std::pow(reference_transformation_Jacobian, -1) * std::exp(state_parameters[cursor++]);
9172 *   }
9173 *  
9174 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9175 *   Number ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_material_Jacobian(const point_index_t &point_index) const {
9176 *   return material_point_history.at(point_index).material_Jacobian;
9177 *   }
9178 *  
9179 *  
9180 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9181 *   ::SymmetricTensor<2, dim, Number> ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_plastic_strain(const point_index_t &point_index) const {
9182 *   return material_point_history.at(point_index).plastic_strain;
9183 *   }
9184 *  
9185 *  
9186 *  
9187 *  
9188 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9189 *   void
9190 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::setup_point_history (const point_index_t point_count) {
9191 *   {
9192 *   std::vector< PointHistory<dim, Number> > tmp;
9193 *   tmp.swap (material_point_history);
9194 *   }
9195 *   const typename PointHistory<dim, Number>::HardeningParameters hardening_parameters(
9196 *   Number(0.0),
9197 *   Number(0.0)*::unit_symmetric_tensor<dim, Number>());
9198 *   const PointHistory< dim, Number> point_history(unit_symmetric_tensor<dim, Number>(),
9199 *   hardening_parameters,
9200 *   Number(0.0),
9201 *   Number(1.0));
9202 *   material_point_history.resize (point_count, point_history);
9203 *   }
9204 *  
9205 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9206 *   inline void
9207 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9208 *   compute_pressure(ConstitutiveModelRequest<dim, Number> &constitutive_request,
9209 *   const point_index_t &) {
9210 *   const Number J = constitutive_request.get_deformation_Jacobian();
9211 *   const Number temperature = constitutive_request.get_temperature();
9212 *   if (J > 0) {
9213 *   const Number p = kappa * (J-1.0/J) - 3 * kappa * thermal_expansion_coefficient * (temperature - reference_temperature) * (1 + 1./(J*J));
9214 *   constitutive_request.set_pressure(p);
9215 * @endcode
9216 *
9217 * pressure tangent
9218 *
9219 * @code
9220 *   const Number dp = kappa * (1 + 1/(J*J)) - 3 * kappa * thermal_expansion_coefficient * (temperature - reference_temperature) * (-2 * 1./(J*J*J));
9221 *   constitutive_request.set_pressure_tangent_modulus(dp);
9222 *   } else {
9223 *   std::ostringstream convert;
9224 *   convert << "Encountered deformation gradient with non-positive determinant! " << J;
9225 *   throw MaterialDomainException(convert.str());
9226 *   }
9227 *   }
9228 *  
9229 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9230 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::compute_stress_deviator_and_d_gamma(
9231 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9232 *   const point_index_t &point_index) {
9233 *   const ConstitutiveModelUpdateFlags update_flags = constitutive_request.get_update_flags();
9234 *   const Tensor<2, dim, Number> b_e = material_point_history[point_index].plastic_strain;
9235 *   typename PointHistory<dim, Number>::HardeningParameters hardening_parameters =
9236 *   material_point_history[point_index].hardening_parameters;
9237 *   const Tensor<2, dim, Number> isochoric_deformation_gradient = constitutive_request.get_deformation_gradient();
9238 *   const Number temperature = constitutive_request.get_temperature();
9239 *   const auto b_e_bar_next = static_cast<SymmetricTensor<2, dim, Number> >(
9240 *   symmetrize(isochoric_deformation_gradient * b_e
9241 *   * transpose(isochoric_deformation_gradient)));
9242 *   if(std::isnan(b_e_bar_next.norm())) {
9243 *   std::cout << "b_e_bar_next is nan: " << b_e_bar_next << std::endl;
9244 *   std::cout << "b_e: " << b_e << std::endl;
9245 *   std::cout << "isochoric_deformation_gradient: " << isochoric_deformation_gradient << std::endl;
9246 *   std::ostringstream convert;
9247 *   convert << "Encountered an elastic deviatoric tensor with NaN values! ";
9248 *   throw MaterialDomainException(convert.str());
9249 *   }
9250 *   const auto epsilon_e_bar_next = get_log_of_tensor<>(b_e_bar_next);
9251 *   const SymmetricTensor<2, dim, Number> dev_stress_trial = deviator((0.5 * mu) * epsilon_e_bar_next);
9252 * @endcode
9253 *
9254 * const SymmetricTensor<2, dim, Number> dev_stress_trial = deviator((0.5 * mu) * b_e_bar_next);
9255 *
9256 * @code
9257 *   const SymmetricTensor<2, dim, Number> ksi_trial = dev_stress_trial
9258 *   - hardening_parameters.kinematic_hardening;
9259 *   const Number norm_ksi_trial = ksi_trial.norm();
9260 *   const Number mu_bar = (0.5 * mu);
9261 * @endcode
9262 *
9263 * const Number mu_bar = (0.5 * mu) * Constants<dim, Number>::one_third()
9264 * * trace(b_e_bar_next);
9265 *
9266 * @code
9267 *   const SymmetricTensor<2, dim, Number> stress_flow_direction = ksi_trial
9268 *   / norm_ksi_trial;
9269 *   constitutive_request.set_b_e_bar(b_e_bar_next);
9270 *   constitutive_request.set_mu((0.5 * mu));
9271 *   const Number time_increment = constitutive_request.get_time_increment();
9272 *  
9273 *   const Number trial_yield_criterion = viscoplastic_yield_law.trial_yield_criterion(norm_ksi_trial,
9274 *   hardening_parameters.equivalent_plastic_strain,
9275 *   0.0,
9276 *   time_increment,
9277 *   temperature);
9278 *  
9279 *   if (0 < trial_yield_criterion && constitutive_request.get_is_plastic()) {
9280 *   constitutive_request.set_is_plastic(true);
9281 *   Number delta_gamma, alpha_n_plus_1;
9282 *   try {
9283 *   determine_delta_gamma(delta_gamma, alpha_n_plus_1, norm_ksi_trial,
9284 *   mu_bar, hardening_parameters.equivalent_plastic_strain, temperature,
9285 *   time_increment, 1e-04, 300);
9286 *   } catch(const MaterialDomainException &exc) {
9287 *   std::cout << "isochoric_deformation_gradient: " << isochoric_deformation_gradient
9288 *   << "\nb_e: " << b_e
9289 *   << "\nb_e_bar_next: " << b_e_bar_next
9290 *   << "\nmu_bar: " << mu_bar
9291 *   << std::endl;
9292 *   std::cerr << exc.what() << std::endl;
9293 * @endcode
9294 *
9295 * throw exc;
9296 *
9297 * @code
9298 *   }
9299 *   constitutive_request.set_delta_gamma(delta_gamma);
9300 *  
9301 * @endcode
9302 *
9303 * 4. Update back stress, plastic strain and stress
9304 *
9305 * @code
9306 *   Number K_alpha_n_plus_1, K_alpha_n, H_alpha_n_plus_1, H_alpha_n;
9307 *   Number DK_alpha_n_plus_1, DH_alpha_n_plus_1;
9308 *   viscoplastic_yield_law.hardening_values(H_alpha_n,
9309 *   K_alpha_n,
9310 *   hardening_parameters.equivalent_plastic_strain,
9311 *   0.0,
9312 *   time_increment,
9313 *   temperature);
9314 *   const Number y_alpha = viscoplastic_yield_law.hardening_values(
9315 *   H_alpha_n_plus_1,
9316 *   K_alpha_n_plus_1,
9317 *   alpha_n_plus_1,
9318 *   delta_gamma,
9319 *   time_increment,
9320 *   temperature);
9321 *   [[maybe_unused]] const Number d_y_alpha_d_alpha = viscoplastic_yield_law.hardening_alpha_derivatives(
9322 *   DH_alpha_n_plus_1,
9323 *   DK_alpha_n_plus_1,
9324 *   alpha_n_plus_1,
9325 *   delta_gamma,
9326 *   time_increment,
9327 *   temperature);
9328 *  
9329 *   if (update_stress_deviator & update_flags) {
9330 *   const SymmetricTensor<2, dim, Number> stress = deviator(dev_stress_trial
9331 *   - 2 * mu_bar * delta_gamma
9332 *   * stress_flow_direction);
9333 *   constitutive_request.set_stress_deviator(stress);
9334 *   constitutive_request.set_dH(DH_alpha_n_plus_1);
9335 *   constitutive_request.set_dK(DK_alpha_n_plus_1);
9336 *   if (update_material_point_history & update_flags) {
9337 *   material_point_history[point_index].hardening_parameters.equivalent_plastic_strain =
9338 *   alpha_n_plus_1;
9339 *   material_point_history[point_index].hardening_parameters.kinematic_hardening =
9340 *   hardening_parameters.kinematic_hardening
9341 *   + Constants<dim, Number>::sqrt2thirds()
9342 *   * (K_alpha_n_plus_1 - K_alpha_n)
9343 *   * stress_flow_direction;
9344 *  
9345 * @endcode
9346 *
9347 * // compute one_third_I_bar_e (c.f. Simo, Miehe 1992 pp 64)
9348 * const auto stress_over_mu = stress / (0.5 * mu);
9349 * const Number norm_stress_over_mu = stress_over_mu.norm();
9350 * const Number J_e2 = 0.5 * norm_stress_over_mu * norm_stress_over_mu;
9351 * const Number J_e3 = determinant(stress_over_mu);
9352 * const Number q = 0.5*(1-J_e3);
9353 * const Number sqrt_d = std::sqrt(-std::pow(Constants<dim, Number>::one_third()*J_e2, 3) + q*q);
9354 * const Number one_third_I_bar_e = std::pow(q + sqrt_d, Constants<dim, Number>::one_third())
9355 * + std::pow(q - sqrt_d, Constants<dim, Number>::one_third());
9356 *
9357
9358 *
9359 * auto b_e_bar = stress / (0.5 * mu)
9360 * + Constants<dim, Number>::one_third() * trace(b_e_bar_next)
9361 * * unit_symmetric_tensor<dim, Number>();
9362 *
9363 * @code
9364 *   auto b_e_bar = get_exp_of_tensor(stress / (0.5 * mu));
9365 *  
9366 * @endcode
9367 *
9368 * correct volumetric component so that return mapping does not change volume
9369 *
9370 * @code
9371 *   const Number det_b_e_bar_trial = determinant(b_e_bar_next);
9372 *   Number det_plastic_strain = determinant(b_e_bar);
9373 *   if(std::abs(det_plastic_strain - 1) > 1e-7) {
9374 *   std::cout << "det_plastic_strain: " << det_plastic_strain << std::endl;
9375 *   }
9376 *   while (std::abs(det_plastic_strain-det_b_e_bar_trial) > 1e-10) {
9377 *   const Number u = (det_b_e_bar_trial - det_plastic_strain) / (det_plastic_strain * trace(invert(b_e_bar)));
9378 *   b_e_bar += u*unit_symmetric_tensor<dim, Number>();
9379 *   det_plastic_strain = determinant(b_e_bar);
9380 *   }
9381 *  
9382 *   [[maybe_unused]] const Tensor<2, dim, Number> inverse_isochoric_deformation_gradient = invert(isochoric_deformation_gradient);
9383 *   material_point_history[point_index].plastic_strain = b_e_bar;
9384 *   }
9385 *   } /*if(update_stress_deviator & update_flags)*/
9386 *   if (update_mechanical_dissipation & update_flags) {
9387 *   const Number time_increment = constitutive_request.get_time_increment();
9388 *   const Number mechanical_dissipation =
9389 *   dissipation_factor
9390 *   * Constants<dim, Number>::sqrt2thirds()
9391 *   * y_alpha * delta_gamma
9392 *   / (1000. * time_increment); // [J.mm^-3.s^-1]
9393 *   constitutive_request.set_mechanical_dissipation(mechanical_dissipation);
9394 *   Number DH_theta, DK_theta;
9395 *   const Number d_y_alpha_d_theta =
9396 *   viscoplastic_yield_law.hardening_temperature_derivatives(DH_theta, DK_theta,
9397 *   alpha_n_plus_1,
9398 *   delta_gamma,
9399 *   time_increment,
9400 *   temperature);
9401 *   const Number mechanical_dissipation_temperature_tangent =
9402 *   dissipation_factor
9403 *   * d_y_alpha_d_theta
9404 *   * (Constants<dim, Number>::sqrt2thirds() * delta_gamma
9405 *   - y_alpha / (3 * mu_bar))
9406 *   / (1000. * time_increment); // [J.mm^-3.s^-3.K^-1]
9407 *   constitutive_request.set_mechanical_dissipation_tangent_modulus(
9408 *   mechanical_dissipation_temperature_tangent);
9409 *   } /*if (update_mechanical_dissipation & updateFlags)*/
9410 *   } /*if ( trial yield criterion test )*/
9411 *   else {
9412 *   constitutive_request.set_delta_gamma(0.0);
9413 *   constitutive_request.set_is_plastic(false);
9414 *   if (update_stress_deviator & update_flags) {
9415 *   constitutive_request.set_stress_deviator(dev_stress_trial);
9416 *   constitutive_request.set_dK(0.0);
9417 *   constitutive_request.set_dH(0.0);
9418 *   }
9419 *   if (update_mechanical_dissipation & update_flags) {
9420 *   constitutive_request.set_mechanical_dissipation(0.0);
9421 *   constitutive_request.set_mechanical_dissipation_tangent_modulus(0.0);
9422 *   }
9423 * @endcode
9424 *
9425 * The following is only necessary for the elastic case when b_e is tracked instead of G_p
9426 *
9427 * @code
9428 *   if (update_stress_deviator & update_flags) {
9429 *   if (update_material_point_history & update_flags) {
9430 *   material_point_history[point_index].plastic_strain = b_e_bar_next;
9431 *   }
9432 *   }
9433 *   } /*else*/
9434 * @endcode
9435 *
9436 * The following is only necessary if the total Jacobian is tracked (J_c * J_m), rather than just J_m
9437 *
9438 * @code
9439 *   if (update_material_point_history & update_flags) {
9440 *   material_point_history.at(point_index).material_Jacobian = constitutive_request.get_unprojected_deformation_Jacobian();
9441 *   }
9442 *   } /*computeStressDeviatorAndDGamma()*/
9443 *  
9444 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9445 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9446 *   compute_heat_flux(
9447 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9448 *   const point_index_t &) {
9449 *   const Tensor<1, dim, Number> thermal_gradient = constitutive_request.get_thermal_gradient();
9450 *   constitutive_request.set_heat_flux(thermal_conductivity * thermal_gradient);
9451 *   constitutive_request.set_heat_flux_tangent_moduli(thermal_conductivity * unit_symmetric_tensor<dim, Number>());
9452 *   }
9453 *  
9454 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9455 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9456 *   compute_thermo_elastic_heating(
9457 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9458 *   const point_index_t &point_index) {
9459 *   const auto point_history = material_point_history.at(point_index);
9460 *   const Number J = constitutive_request.get_deformation_Jacobian();
9461 *   const Number previous_J = constitutive_request.get_previous_deformation_Jacobian();
9462 *   [[maybe_unused]] const Number J_time_rate = constitutive_request.get_deformation_Jacobian_time_rate();
9463 *   const Number theta = constitutive_request.get_temperature();
9464 *   [[maybe_unused]] const Number previous_theta = constitutive_request.get_previous_temperature();
9465 *   const Number time_increment = constitutive_request.get_time_increment();
9466 *   if (J != 0 and previous_J != 0) {
9467 *   const Number eta = (3.0/1000.0) * kappa * thermal_expansion_coefficient * (J - 1.0/J);
9468 *   const Number previous_eta = (3.0/1000.0) * kappa * thermal_expansion_coefficient * (previous_J - 1.0/previous_J);
9469 *   constitutive_request.set_thermo_elastic_heating(-theta * (eta - previous_eta) / time_increment);
9470 *   constitutive_request.set_thermo_elastic_heating_tangent_modulus(-(eta - previous_eta) / time_increment);
9471 *   } else {
9472 * @endcode
9473 *
9474 * TODO define and throw appropriate exception: bad deformation gradient!
9475 *
9476 * @code
9477 *   constitutive_request.set_thermo_elastic_heating(0);
9478 *   constitutive_request.set_thermo_elastic_heating_tangent_modulus(0);
9479 *   }
9480 *   }
9481 *  
9482 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9483 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9484 *   compute_stored_heat_rate(
9485 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9486 *   const point_index_t &) {
9487 *   const Number stored_heat_rate = heat_capacity * constitutive_request.get_temperature_time_rate();
9488 *   constitutive_request.set_stored_heat_rate(stored_heat_rate);
9489 *   constitutive_request.set_stored_heat_rate_tangent_modulus(heat_capacity);
9490 *   }
9491 *  
9492 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9493 *   inline void
9494 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9495 *   determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
9496 *   const Number norm_ksi_trial,
9497 *   const Number mu_bar,
9498 *   const Number alpha_n,
9499 *   const Number temperature,
9500 *   const Number time_increment,
9501 *   const Number tol,
9502 *   const unsigned int max_iter) const {
9503 *   unsigned int k = 0;
9504 *   const Number sqrt2thirds = Constants<dim, Number>::sqrt2thirds();
9505 *   const Number two_thirds = Constants<dim, Number>::two_thirds();
9506 *   Number g_of_gamma_k, Dg_of_gamma_k;
9507 *   Number H_alpha_n, H_alpha_n_plus_1, K_alpha_n, K_alpha_n_plus_1;
9508 *   Number DK_alpha_n_plus_1, DH_alpha_n_plus_1;
9509 *  
9510 *   delta_gamma = 0;
9511 *   alpha_n_plus_1 = alpha_n;
9512 *  
9513 *   viscoplastic_yield_law.hardening_values(H_alpha_n, K_alpha_n, alpha_n, 0.0, time_increment, temperature);
9514 *  
9515 *   viscoplastic_yield_law.hardening_values(H_alpha_n_plus_1, K_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9516 *   g_of_gamma_k = norm_ksi_trial
9517 *   - 2 * mu_bar * delta_gamma
9518 *   - sqrt2thirds * H_alpha_n_plus_1
9519 *   - sqrt2thirds * (K_alpha_n_plus_1 - K_alpha_n);
9520 *   do {
9521 *   viscoplastic_yield_law.hardening_alpha_derivatives(DH_alpha_n_plus_1, DK_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9522 *   Dg_of_gamma_k = -2 * mu_bar - two_thirds * (DK_alpha_n_plus_1 + DH_alpha_n_plus_1);
9523 *  
9524 *   delta_gamma = delta_gamma - g_of_gamma_k / Dg_of_gamma_k;
9525 *   alpha_n_plus_1 = alpha_n + sqrt2thirds * delta_gamma;
9526 *  
9527 *   viscoplastic_yield_law.hardening_values(H_alpha_n_plus_1, K_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9528 *   g_of_gamma_k = norm_ksi_trial
9529 *   - 2 * mu_bar * delta_gamma
9530 *   - sqrt2thirds * H_alpha_n_plus_1
9531 *   - sqrt2thirds * (K_alpha_n_plus_1 - K_alpha_n);
9532 *   } while (std::fabs(g_of_gamma_k) > tol && ++k < max_iter);
9533 *   if (std::fabs(g_of_gamma_k) > tol) {
9534 *   std::ostringstream convert;
9535 *   convert << "Did not converge after " << k << " iterations. g: " << g_of_gamma_k
9536 *   << ", norm_ksi_trial: " << norm_ksi_trial
9537 *   << ", mu_bar: " << mu_bar
9538 *   << ", H_alpha_n_plus_1: " << H_alpha_n_plus_1
9539 *   << ", alpha: " << alpha_n_plus_1
9540 *   << ", delta_gamma: " << delta_gamma
9541 *   << ", temperature: " << temperature
9542 *   << ", gradient: " << Dg_of_gamma_k;
9543 *   throw MaterialDomainException(convert.str());
9544 *   }
9545 *   }
9546 *  
9547 *   template class ThermoPlasticMaterial<3, ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>;
9548 *   template class ThermoPlasticMaterial<2, ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>;
9549 *  
9550 *   template class ThermoPlasticMaterial<3, JohnsonCookThermoviscoplasticYieldLaw<double>, double>;
9551 *   template class ThermoPlasticMaterial<2, JohnsonCookThermoviscoplasticYieldLaw<double>, double>;
9552 *  
9553 *   } /* namespace PlasticityLab */
9554 * @endcode
9555
9556
9557<a name="ann-src/ThermoPlasticMaterial.h"></a>
9558<h1>Annotated version of src/ThermoPlasticMaterial.h</h1>
9559 *
9560 *
9561 *
9562 *
9563 * @code
9564 *   /*
9565 *   * ThermoPlasticMaterial.h
9566 *   *
9567 *   * Created on: 05 Jan 2015
9568 *   * Author: maien
9569 *   */
9570 *  
9571 *   #ifndef THERMOPLASTICMATERIAL_H_
9572 *   #define THERMOPLASTICMATERIAL_H_
9573 *  
9574 *   #include "PointHistory.h"
9575 *   #include "Material.h"
9576 *   #include "ConstitutiveModelRequest.h"
9577 *  
9578 *   using namespace dealii;
9579 *  
9580 *   namespace PlasticityLab {
9581 *  
9582 *   template <int dim, typename ViscoplasticYieldLaw, typename Number = double>
9583 *   class ThermoPlasticMaterial : public Material<dim, Number> {
9584 *   public:
9585 *   ThermoPlasticMaterial(const Number kappa,
9586 *   const Number mu,
9587 *   const Number thermal_expansion_coefficient,
9588 *   const Number thermal_conductivity,
9589 *   const Number heat_capacity,
9590 *   const Number dissipation_factor,
9591 *   const ViscoplasticYieldLaw &viscoplastic_yield_law);
9592 *  
9593 *   virtual ~ThermoPlasticMaterial();
9594 *  
9595 *   void compute_constitutive_request(
9596 *   ConstitutiveModelRequest <dim, Number> &constitutive_request,
9597 *   const point_index_t &point_index) override;
9598 *  
9599 *   Number get_material_Jacobian(const point_index_t &point_index) const override;
9600 *   ::SymmetricTensor<2, dim, Number> get_plastic_strain(const point_index_t &point_index) const override;
9601 *  
9602 *   std::vector<Number> get_state_parameters(
9603 *   const point_index_t &point_index,
9604 *   const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) const override;
9605 *  
9606 *   void set_state_parameters(
9607 *   const point_index_t &point_index,
9608 *   const std::vector<Number> &state_parameters,
9609 *   const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) override;
9610 *   size_t get_material_parameter_count() const override;
9611 *  
9612 *  
9613 *   void setup_point_history (const point_index_t point_count) override;
9614 *  
9615 *   private:
9616 *   const Number kappa;
9617 *   const Number mu;
9618 *  
9619 *   const Number thermal_expansion_coefficient;
9620 *   const Number thermal_conductivity;
9621 *   const Number heat_capacity;
9622 *   const Number reference_temperature;
9623 *  
9624 *   const Number dissipation_factor;
9625 *   const ViscoplasticYieldLaw viscoplastic_yield_law;
9626 *  
9627 *   std::vector< PointHistory<dim, Number> > material_point_history;
9628 *  
9629 *   inline void
9630 *   compute_pressure(
9631 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9632 *   const point_index_t &point_index);
9633 *  
9634 *   inline void
9635 *   determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
9636 *   const Number norm_ksi_trial,
9637 *   const Number mu_bar,
9638 *   const Number alpha_n,
9639 *   const Number temperature,
9640 *   const Number time_increment,
9641 *   const Number tol, unsigned int max_iter) const;
9642 *  
9643 *   void compute_stress_deviator_and_d_gamma(
9644 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9645 *   const point_index_t &point_index);
9646 *  
9647 *   void compute_heat_flux(
9648 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9649 *   const point_index_t &point_index);
9650 *  
9651 *   void compute_thermo_elastic_heating(
9652 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9653 *   const point_index_t &point_index);
9654 *  
9655 *   void compute_stored_heat_rate(
9656 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9657 *   const point_index_t &point_index);
9658 *  
9659 *   };
9660 *  
9661 *   } /* namespace PlasticityLab */
9662 *  
9663 *   #endif /* THERMOPLASTICMATERIAL_H_ */
9664 * @endcode
9665
9666
9667<a name="ann-src/TimeRateRequest.h"></a>
9668<h1>Annotated version of src/TimeRateRequest.h</h1>
9669 *
9670 *
9671 *
9672 *
9673 * @code
9674 *   /*
9675 *   * TimeRateRequest.h
9676 *   *
9677 *   * Created on: 27 Nov 2019
9678 *   * Author: maien
9679 *   */
9680 *  
9681 *   #ifndef TIMERATEREQUEST_H_
9682 *   #define TIMERATEREQUEST_H_
9683 *  
9684 *   #include <deal.II/base/tensor.h>
9685 *  
9686 *   #include "Constants.h"
9687 *   #include "TimeRateUpdateFlags.h"
9688 *  
9689 *   namespace PlasticityLab {
9690 *  
9691 *   template <typename ValueType, int dim, typename Number=double>
9692 *   class TimeRateRequest {
9693 *   public:
9694 *   TimeRateRequest(TimeRateUpdateFlags);
9695 *   virtual ~TimeRateRequest();
9696 *  
9697 * @endcode
9698 *
9699 * Interface to be used by request client (FE system assembler)
9700 * --request configuration stage--
9701 *
9702 * @code
9703 *   void set_value(const ValueType &value);
9704 *   void set_previous_value(const ValueType &previous_value);
9705 *   void set_second_previous_value(const ValueType &second_previous_value);
9706 *  
9707 *   void set_time_increment(const Number time_increment);
9708 *   void set_previous_time_increment(const Number previous_time_increment);
9709 *  
9710 *   void set_previous_partial_time_rate(const ValueType &previous_partial_time_rate);
9711 *   void set_previous_total_time_rate(const ValueType &previous_total_time_rate);
9712 *  
9713 *   void set_velocity(const ::Tensor<1, dim, Number> &velocity);
9714 *  
9715 * @endcode
9716 *
9717 * Interface to be used by request client (FE system assembler)
9718 * --request response retrieval and interrogation stage--
9719 *
9720 * @code
9721 *   ValueType get_partial_time_rate() const;
9722 *   ValueType get_total_time_rate() const;
9723 *   ValueType get_partial_second_time_rate() const;
9724 *   ValueType get_total_second_time_rate() const;
9725 *  
9726 *   ValueType get_partial_time_rate_tangent(const ValueType &value_increment) const;
9727 *   ValueType get_partial_second_time_rate_tangent(const ValueType &value_increment) const;
9728 *  
9729 *   template<typename GradientType>
9730 *   ValueType get_total_time_rate_tangent(
9731 *   const ValueType &value_increment,
9732 *   const ValueType &gradient_increment) const;
9733 *  
9734 *   template<typename GradientType>
9735 *   ValueType get_total_second_time_rate_tangent(
9736 *   const ValueType &value_increment,
9737 *   const ValueType &gradient_increment) const;
9738 *  
9739 * @endcode
9740 *
9741 * interface used by constitutive model object to perform computation
9742 * TODO consider hiding this interface and exposing it through adapter
9743 *
9744 * @code
9745 *   TimeRateUpdateFlags get_update_flags() const;
9746 *   ValueType get_value() const;
9747 *   ValueType get_previous_value() const;
9748 *   ValueType get_second_previous_value() const;
9749 *  
9750 *   Number get_time_increment() const;
9751 *   Number get_previous_time_increment() const;
9752 *  
9753 *   ValueType get_previous_partial_time_rate() const;
9754 *   ValueType get_previous_total_time_rate() const;
9755 *  
9756 *   ::Tensor<1, dim, Number> get_velocity() const;
9757 *  
9758 * @endcode
9759 *
9760 * set the results
9761 *
9762 * @code
9763 *   void set_partial_time_rate(const ValueType &partial_time_rate);
9764 *   void set_total_time_rate(const ValueType &total_time_rate);
9765 *   void set_partial_second_time_rate(const ValueType &partial_second_time_rate);
9766 *   void set_total_second_time_rate(const ValueType &total_second_time_rate);
9767 *  
9768 *   void set_partial_time_rate_tangent(const ValueType &partial_time_rate_tangent);
9769 *   void set_total_time_rate_tangent(const ValueType &total_time_rate_tangent);
9770 *   void set_partial_second_time_rate_tangent(const ValueType &partial_second_time_rate_tangent);
9771 *   void set_total_second_time_rate_tangent(const ValueType &total_second_time_rate_tangent);
9772 *  
9773 *   protected:
9774 * @endcode
9775 *
9776 * inputs
9777 *
9778 * @code
9779 *   TimeRateUpdateFlags update_flags;
9780 *  
9781 *   ValueType value;
9782 *   ValueType previous_value;
9783 *   ValueType second_previous_value;
9784 *  
9785 *   Number time_increment;
9786 *   Number previous_time_increment;
9787 *  
9788 *   ValueType previous_partial_time_rate;
9789 *   ValueType previous_total_time_rate;
9790 *  
9791 *   ::Tensor<1, dim, Number> velocity;
9792 *  
9793 * @endcode
9794 *
9795 * outputs
9796 *
9797 * @code
9798 *   ValueType partial_time_rate;
9799 *   ValueType total_time_rate;
9800 *   ValueType partial_second_time_rate;
9801 *   ValueType total_second_time_rate;
9802 *  
9803 *   ValueType partial_time_rate_tangent;
9804 *   ValueType total_time_rate_tangent;
9805 *   ValueType partial_second_time_rate_tangent;
9806 *   ValueType total_second_time_rate_tangent;
9807 *   };
9808 *  
9809 *  
9810 *   template <typename ValueType, int dim, typename Number>
9811 *   TimeRateRequest<ValueType, dim, Number>::
9812 *   TimeRateRequest(TimeRateUpdateFlags update_flags):
9813 *   update_flags(update_flags) {
9814 *   }
9815 *  
9816 *   template <typename ValueType, int dim, typename Number>
9817 *   TimeRateRequest<ValueType, dim, Number>::~TimeRateRequest() { }
9818 *  
9819 *  
9820 *   template <typename ValueType, int dim, typename Number>
9821 *   void TimeRateRequest<ValueType, dim, Number>::
9822 *   set_value(const ValueType &value) {
9823 *   this->value = value;
9824 *   }
9825 *  
9826 *  
9827 *   template <typename ValueType, int dim, typename Number>
9828 *   void TimeRateRequest<ValueType, dim, Number>::
9829 *   set_previous_value(const ValueType &previous_value) {
9830 *   this->previous_value = previous_value;
9831 *   }
9832 *  
9833 *  
9834 *   template <typename ValueType, int dim, typename Number>
9835 *   void TimeRateRequest<ValueType, dim, Number>::
9836 *   set_second_previous_value(const ValueType &second_previous_value) {
9837 *   this->second_previous_value = second_previous_value;
9838 *   }
9839 *  
9840 *  
9841 *   template <typename ValueType, int dim, typename Number>
9842 *   void TimeRateRequest<ValueType, dim, Number>::
9843 *   set_time_increment(const Number time_increment) {
9844 *   this->time_increment = time_increment;
9845 *   }
9846 *  
9847 *  
9848 *   template <typename ValueType, int dim, typename Number>
9849 *   void TimeRateRequest<ValueType, dim, Number>::
9850 *   set_previous_time_increment(const Number previous_time_increment) {
9851 *   this->previous_time_increment = previous_time_increment;
9852 *   }
9853 *  
9854 *  
9855 *   template <typename ValueType, int dim, typename Number>
9856 *   void TimeRateRequest<ValueType, dim, Number>::
9857 *   set_previous_partial_time_rate(const ValueType &previous_partial_time_rate) {
9858 *   this->previous_partial_time_rate = previous_partial_time_rate;
9859 *   }
9860 *  
9861 *  
9862 *   template <typename ValueType, int dim, typename Number>
9863 *   void TimeRateRequest<ValueType, dim, Number>::
9864 *   set_previous_total_time_rate(const ValueType &previous_total_time_rate) {
9865 *   this->previous_total_time_rate = previous_total_time_rate;
9866 *   }
9867 *  
9868 *  
9869 *   template <typename ValueType, int dim, typename Number>
9870 *   void TimeRateRequest<ValueType, dim, Number>::
9871 *   set_velocity(const ::Tensor<1, dim, Number> &velocity) {
9872 *   this->velocity = velocity;
9873 *   }
9874 *  
9875 *  
9876 *  
9877 *  
9878 *   template <typename ValueType, int dim, typename Number>
9879 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9880 *   get_partial_time_rate() const {
9881 *   return partial_time_rate;
9882 *   }
9883 *  
9884 *  
9885 *   template <typename ValueType, int dim, typename Number>
9886 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9887 *   get_total_time_rate() const {
9888 *   return total_time_rate;
9889 *   }
9890 *  
9891 *  
9892 *   template <typename ValueType, int dim, typename Number>
9893 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9894 *   get_partial_second_time_rate() const {
9895 *   return partial_second_time_rate;
9896 *   }
9897 *  
9898 *  
9899 *   template <typename ValueType, int dim, typename Number>
9900 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9901 *   get_total_second_time_rate() const {
9902 *   return total_second_time_rate;
9903 *   }
9904 *  
9905 *  
9906 *   template <typename ValueType, int dim, typename Number>
9907 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9908 *   get_partial_time_rate_tangent(const ValueType &value_increment) const {
9909 *   return partial_time_rate_tangent;
9910 *   }
9911 *  
9912 *  
9913 *   template <typename ValueType, int dim, typename Number>
9914 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9915 *   get_partial_second_time_rate_tangent(const ValueType &value_increment) const {
9916 *   return partial_second_time_rate_tangent;
9917 *   }
9918 *  
9919 *  
9920 *   template <typename ValueType, int dim, typename Number>
9921 *   template<typename GradientType>
9922 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9923 *   get_total_time_rate_tangent(
9924 *   const ValueType &value_increment,
9925 *   const ValueType &gradient_increment) const {
9926 *   throw;
9927 *   }
9928 *  
9929 *  
9930 *   template <typename ValueType, int dim, typename Number>
9931 *   template<typename GradientType>
9932 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9933 *   get_total_second_time_rate_tangent(
9934 *   const ValueType &value_increment,
9935 *   const ValueType &gradient_increment) const {
9936 *   throw;
9937 *   }
9938 *  
9939 *  
9940 *   /*
9941 *  
9942 *   */
9943 *   template <typename ValueType, int dim, typename Number>
9944 *   TimeRateUpdateFlags TimeRateRequest<ValueType, dim, Number>::
9945 *   get_update_flags() const {
9946 *   return update_flags;
9947 *   }
9948 *  
9949 *  
9950 *   template <typename ValueType, int dim, typename Number>
9951 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9952 *   get_value() const {
9953 *   return value;
9954 *   }
9955 *  
9956 *  
9957 *   template <typename ValueType, int dim, typename Number>
9958 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9959 *   get_previous_value() const {
9960 *   return previous_value;
9961 *   }
9962 *  
9963 *  
9964 *   template <typename ValueType, int dim, typename Number>
9965 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9966 *   get_second_previous_value() const {
9967 *   return second_previous_value;
9968 *   }
9969 *  
9970 *  
9971 *   template <typename ValueType, int dim, typename Number>
9972 *   Number TimeRateRequest<ValueType, dim, Number>::
9973 *   get_time_increment() const {
9974 *   return time_increment;
9975 *   }
9976 *  
9977 *  
9978 *   template <typename ValueType, int dim, typename Number>
9979 *   Number TimeRateRequest<ValueType, dim, Number>::
9980 *   get_previous_time_increment() const {
9981 *   return previous_time_increment;
9982 *   }
9983 *  
9984 *  
9985 *   template <typename ValueType, int dim, typename Number>
9986 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9987 *   get_previous_partial_time_rate() const {
9988 *   return previous_partial_time_rate;
9989 *   }
9990 *  
9991 *  
9992 *   template <typename ValueType, int dim, typename Number>
9993 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9994 *   get_previous_total_time_rate() const {
9995 *   return previous_total_time_rate;
9996 *   }
9997 *  
9998 *  
9999 *   template <typename ValueType, int dim, typename Number>
10000 *   ::Tensor<1, dim, Number> TimeRateRequest<ValueType, dim, Number>::
10001 *   get_velocity() const {
10002 *   return velocity;
10003 *   }
10004 *  
10005 *  
10006 *   /*
10007 *  
10008 *   */
10009 *   template <typename ValueType, int dim, typename Number>
10010 *   void TimeRateRequest<ValueType, dim, Number>::
10011 *   set_partial_time_rate(const ValueType &partial_time_rate) {
10012 *   this->partial_time_rate = partial_time_rate;
10013 *   }
10014 *  
10015 *  
10016 *   template <typename ValueType, int dim, typename Number>
10017 *   void TimeRateRequest<ValueType, dim, Number>::
10018 *   set_total_time_rate(const ValueType &total_time_rate) {
10019 *   this->total_time_rate = total_time_rate;
10020 *   }
10021 *  
10022 *  
10023 *   template <typename ValueType, int dim, typename Number>
10024 *   void TimeRateRequest<ValueType, dim, Number>::
10025 *   set_partial_second_time_rate(const ValueType &partial_second_time_rate) {
10026 *   this->partial_second_time_rate = partial_second_time_rate;
10027 *   }
10028 *  
10029 *  
10030 *   template <typename ValueType, int dim, typename Number>
10031 *   void TimeRateRequest<ValueType, dim, Number>::
10032 *   set_total_second_time_rate(const ValueType &total_second_time_rate) {
10033 *   this->total_second_time_rate = total_second_time_rate;
10034 *   }
10035 *  
10036 *  
10037 *   template <typename ValueType, int dim, typename Number>
10038 *   void TimeRateRequest<ValueType, dim, Number>::
10039 *   set_partial_time_rate_tangent(const ValueType &partial_time_rate_tangent) {
10040 *   this->partial_time_rate_tangent = partial_time_rate_tangent;
10041 *   }
10042 *  
10043 *  
10044 *   template <typename ValueType, int dim, typename Number>
10045 *   void TimeRateRequest<ValueType, dim, Number>::
10046 *   set_total_time_rate_tangent(const ValueType &total_time_rate_tangent) {
10047 *   this->total_time_rate_tangent = total_time_rate_tangent;
10048 *   }
10049 *  
10050 *  
10051 *   template <typename ValueType, int dim, typename Number>
10052 *   void TimeRateRequest<ValueType, dim, Number>::
10053 *   set_partial_second_time_rate_tangent(const ValueType &partial_second_time_rate_tangent) {
10054 *   this->partial_second_time_rate_tangent = partial_second_time_rate_tangent;
10055 *   }
10056 *  
10057 *  
10058 *   template <typename ValueType, int dim, typename Number>
10059 *   void TimeRateRequest<ValueType, dim, Number>::
10060 *   set_total_second_time_rate_tangent(const ValueType &total_second_time_rate_tangent) {
10061 *   this->total_second_time_rate_tangent = total_second_time_rate_tangent;
10062 *   }
10063 *  
10064 *  
10065 *   } /* namespace PlasticityLab */
10066 *  
10067 *   #endif /* TIMERATEREQUEST_H_ */
10068 * @endcode
10069
10070
10071<a name="ann-src/TimeRateUpdateFlags.h"></a>
10072<h1>Annotated version of src/TimeRateUpdateFlags.h</h1>
10073 *
10074 *
10075 *
10076 *
10077 * @code
10078 *   /*
10079 *   * TimeRateUpdateFlags.h
10080 *   *
10081 *   * Created on: 27 Nov 2019
10082 *   * Author: maien
10083 *   */
10084 *  
10085 *   #ifndef TIMERATEUPDATEFLAGS_H_
10086 *   #define TIMERATEUPDATEFLAGS_H_
10087 *  
10088 *   namespace PlasticityLab {
10089 *  
10090 *   enum TimeRateUpdateFlags {
10091 *   default_timerate_update_flags = 0x0000,
10092 *   update_partial_time_rate = 0x0001,
10093 *   update_total_time_rate = 0x0002,
10094 *   update_partial_second_time_rate=0x0004,
10095 *   update_total_second_time_rate=0x0008,
10096 *   update_partial_time_rate_tangent=0x0010,
10097 *   update_total_time_rate_tangent=0x0020,
10098 *   update_partial_second_time_rate_tangent=0x0040,
10099 *   update_total_second_time_rate_tangent=0x0080
10100 *   };
10101 *  
10102 *   inline
10103 *   TimeRateUpdateFlags
10104 *   operator | (TimeRateUpdateFlags f1, TimeRateUpdateFlags f2) {
10105 *   return static_cast<TimeRateUpdateFlags> (
10106 *   static_cast<unsigned int> (f1) |
10107 *   static_cast<unsigned int> (f2));
10108 *   }
10109 *  
10110 *   inline
10111 *   const TimeRateUpdateFlags &
10112 *   operator |= (TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2) {
10113 *   f1 = f1 | f2;
10114 *   return f1;
10115 *   }
10116 *  
10117 *   inline
10118 *   TimeRateUpdateFlags
10119 *   operator & (TimeRateUpdateFlags f1, TimeRateUpdateFlags f2) {
10120 *   return static_cast<TimeRateUpdateFlags> (
10121 *   static_cast<unsigned int> (f1) &
10122 *   static_cast<unsigned int> (f2));
10123 *   }
10124 *  
10125 *   inline
10126 *   const TimeRateUpdateFlags &
10127 *   operator &= (TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2) {
10128 *   f1 = f1 & f2;
10129 *   return f1;
10130 *   }
10131 *  
10132 *   } /* namespace PlasticityLab */
10133 *  
10134 *   #endif /*TIMERATEUPDATEFLAGS_H_*/
10135 * @endcode
10136
10137
10138<a name="ann-src/main.cpp"></a>
10139<h1>Annotated version of src/main.cpp</h1>
10140 *
10141 *
10142 *
10143 * ============================================================================
10144 * Name : main.cpp
10145 * Author : Maien Hamed
10146 * Version :
10147 * Copyright :
10148 * Description : Hello World in C++, Ansi-style
10149 * ============================================================================
10150 *
10151
10152 *
10153 *
10154 * @code
10155 *   #include <iostream>
10156 *  
10157 *   #include "utilities.h"
10158 *   #include "ThermoPlasticMaterial.h"
10159 *   #include "ExponentialHardeningThermoviscoplasticYieldLaw.h"
10160 *   #include "JohnsonCookThermoviscoplasticYieldLaw.h"
10161 *   #include "ExponentialHardeningElastoplasticMaterial.h"
10162 *   #include "PlasticityLabProg.h"
10163 *  
10164 *   #define DIM 2
10165 *  
10166 *   PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10167 *   getExponentialHardeningThermoPlasticMaterial();
10168 *  
10169 *   PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10170 *   getJohnsonCookThermoPlasticMaterial();
10171 *  
10172 *   int main(int argc, char **argv) {
10173 *   try {
10174 *   Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv);
10175 *   {
10176 *   deallog.depth_console(0);
10177 *   auto material = getExponentialHardeningThermoPlasticMaterial();
10178 *   PlasticityLab::PlasticityLabProg<DIM> plasticityLab(material);
10179 *   plasticityLab.run();
10180 *   if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
10181 *   std::cout << "Finished." << std::endl; // prints
10182 *   }
10183 *   } catch (std::exception &exc) {
10184 *   std::cerr << std::endl << std::endl
10185 *   << "----------------------------------------------------"
10186 *   << std::endl;
10187 *   std::cerr << "Exception on processing: " << std::endl
10188 *   << exc.what() << std::endl
10189 *   << "Aborting!" << std::endl
10190 *   << "----------------------------------------------------"
10191 *   << std::endl;
10192 *   return 1;
10193 *   } catch (...) {
10194 *   std::cerr << std::endl << std::endl
10195 *   << "----------------------------------------------------"
10196 *   << std::endl;
10197 *   std::cerr << "Unknown exception!" << std::endl
10198 *   << "Aborting!" << std::endl
10199 *   << "----------------------------------------------------"
10200 *   << std::endl;
10201 *   return 1;
10202 *   }
10203 *   return 0;
10204 *   }
10205 *  
10206 *   PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10207 *   getExponentialHardeningThermoPlasticMaterial() {
10208 *   double kappa (164206.0), // [MPa]
10209 *   mu (801938.0), // [MPa]
10210 *   thermal_expansion_coefficient(1.0e-5), // [K^-1]
10211 *   thermal_conductivity(4.5e-2), // [J/mm.K.s]
10212 *   heat_capacity(3.588e-3), // cp*rho: [J.mm^-3.K^-1]
10213 *   K_0(450.0/*std::numeric_limits<double>::max()*/), // [MPa]
10214 *   K_infty(715.0/*std::numeric_limits<double>::max()*/), // [MPa]
10215 *   delta(16.93), // dimensionless
10216 *   H_bar(129.24), // [MPa]
10217 *   beta(1.0), // dimensionless (1.0 for isotropic hardening, 0.0 for kinematic hardening)
10218 *   flow_stress_softening(0.002), // [K^-1]
10219 *   hardening_softening(0.002), // [K^-1]
10220 *   dissipation_factor(0.9); // dimensionless
10221 *  
10222 *   PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double> thermo_viscoplastic_yield_law(
10223 *   K_0,
10224 *   K_infty,
10225 *   delta,
10226 *   H_bar,
10227 *   beta,
10228 *   flow_stress_softening,
10229 *   hardening_softening);
10230 *  
10231 *   return PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10232 *   (kappa,
10233 *   mu,
10234 *   thermal_expansion_coefficient,
10235 *   thermal_conductivity,
10236 *   heat_capacity,
10237 *   dissipation_factor,
10238 *   thermo_viscoplastic_yield_law);
10239 *   }
10240 *  
10241 *   PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10242 *   getJohnsonCookThermoPlasticMaterial() {
10243 *   double kappa (103300.0), // [MPa]
10244 *   mu (47690.0), // [MPa]
10245 *   A(89.7), // [MPa]
10246 *   B(291.87), // [MPa]
10247 *   C(0.025), // dimensionless
10248 *   m(1.09), // dimensionless
10249 *   n(0.31), // dimensionless
10250 *   melting_temperature(1356), // [K]
10251 *   reference_temperature(293.15), // [K]
10252 *   reference_strain_rate(1.0), // [s^-1]
10253 *   thermal_expansion_coefficient(1.0e-5), // [K^-1]
10254 *   thermal_conductivity(4.5e-2), // [J/mm.K.s] // http://www.matweb.com/search/datasheet_print.aspx?matguid=193434cf42e343fab880e1dabdb143ba
10255 *   heat_capacity(3.588e-3), // cp*rho: [J.mm^-3.K^-1]
10256 *   dissipation_factor(0.9); // dimensionless
10257 *  
10258 *   PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double> thermo_viscoplastic_yield_law(
10259 *   mu, A, B, C,
10260 *   m, n,
10261 *   melting_temperature,
10262 *   reference_strain_rate,
10263 *   reference_temperature);
10264 *  
10265 *   return PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10266 *   (kappa,
10267 *   mu,
10268 *   thermal_expansion_coefficient,
10269 *   thermal_conductivity,
10270 *   heat_capacity,
10271 *   dissipation_factor,
10272 *   thermo_viscoplastic_yield_law);
10273 *   }
10274 * @endcode
10275
10276
10277<a name="ann-src/symmetric_tensor_entries.h"></a>
10278<h1>Annotated version of src/symmetric_tensor_entries.h</h1>
10279 *
10280 *
10281 *
10282 *
10283 * @code
10284 *   #pragma once
10285 *  
10286 *   #include <deal.II/base/symmetric_tensor.h>
10287 *  
10288 *   #include <cstddef>
10289 *   #include <iterator>
10290 *  
10291 *   namespace dealii_utils
10292 *   {
10293 * @endcode
10294 *
10295 * ---------------- Const view ----------------
10296 *
10297 * @code
10298 *   template <int rank, int dim, typename Number>
10299 *   class SymmetricTensorConstEntriesView
10300 *   {
10301 *   public:
10302 *   using tensor_type = ::SymmetricTensor<rank, dim, Number>;
10303 *  
10304 *   explicit SymmetricTensorConstEntriesView(const tensor_type &t) : t_(&t) {}
10305 *  
10306 *   class const_iterator
10307 *   {
10308 *   public:
10309 *   using iterator_category = std::forward_iterator_tag;
10310 *   using value_type = Number;
10311 *   using difference_type = std::ptrdiff_t;
10312 *   using pointer = const Number *;
10313 *   using reference = const Number &;
10314 *  
10315 *   const_iterator() = default;
10316 *   const_iterator(const tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10317 *  
10318 *   reference operator*() const { return t_->access_raw_entry(i_); }
10319 *  
10320 *   const_iterator &operator++() { ++i_; return *this; }
10321 *   const_iterator operator++(int) { const_iterator tmp(*this); ++(*this); return tmp; }
10322 *  
10323 *   friend bool operator==(const const_iterator &a, const const_iterator &b)
10324 *   {
10325 *   return a.t_ == b.t_ && a.i_ == b.i_;
10326 *   }
10327 *   friend bool operator!=(const const_iterator &a, const const_iterator &b) { return !(a == b); }
10328 *  
10329 *   private:
10330 *   const tensor_type *t_ = nullptr;
10331 *   unsigned int i_ = 0;
10332 *   };
10333 *  
10334 *   const_iterator begin() const { return const_iterator(t_, 0u); }
10335 *   const_iterator end() const { return const_iterator(t_, tensor_type::n_independent_components); }
10336 *   const_iterator cbegin() const { return begin(); }
10337 *   const_iterator cend() const { return end(); }
10338 *  
10339 *   private:
10340 *   const tensor_type *t_;
10341 *   };
10342 *  
10343 *  
10344 * @endcode
10345 *
10346 * ---------------- Mutable view ----------------
10347 *
10348 * @code
10349 *   template <int rank, int dim, typename Number>
10350 *   class SymmetricTensorMutableEntriesView
10351 *   {
10352 *   public:
10353 *   using tensor_type = ::SymmetricTensor<rank, dim, Number>;
10354 *  
10355 *   explicit SymmetricTensorMutableEntriesView(tensor_type &t) : t_(&t) {}
10356 *  
10357 *   class iterator
10358 *   {
10359 *   public:
10360 *   using iterator_category = std::forward_iterator_tag;
10361 *   using value_type = Number;
10362 *   using difference_type = std::ptrdiff_t;
10363 *   using pointer = Number *;
10364 *   using reference = Number &;
10365 *  
10366 *   iterator() = default;
10367 *   iterator(tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10368 *  
10369 *   reference operator*() const { return t_->access_raw_entry(i_); }
10370 *  
10371 *   iterator &operator++() { ++i_; return *this; }
10372 *   iterator operator++(int) { iterator tmp(*this); ++(*this); return tmp; }
10373 *  
10374 *   friend bool operator==(const iterator &a, const iterator &b)
10375 *   {
10376 *   return a.t_ == b.t_ && a.i_ == b.i_;
10377 *   }
10378 *   friend bool operator!=(const iterator &a, const iterator &b) { return !(a == b); }
10379 *  
10380 *   private:
10381 *   tensor_type *t_ = nullptr;
10382 *   unsigned int i_ = 0;
10383 *   };
10384 *  
10385 *   class const_iterator
10386 *   {
10387 *   public:
10388 *   using iterator_category = std::forward_iterator_tag;
10389 *   using value_type = Number;
10390 *   using difference_type = std::ptrdiff_t;
10391 *   using pointer = const Number *;
10392 *   using reference = const Number &;
10393 *  
10394 *   const_iterator() = default;
10395 *   const_iterator(const tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10396 *  
10397 *   reference operator*() const { return t_->access_raw_entry(i_); }
10398 *  
10399 *   const_iterator &operator++() { ++i_; return *this; }
10400 *   const_iterator operator++(int) { const_iterator tmp(*this); ++(*this); return tmp; }
10401 *  
10402 *   friend bool operator==(const const_iterator &a, const const_iterator &b)
10403 *   {
10404 *   return a.t_ == b.t_ && a.i_ == b.i_;
10405 *   }
10406 *   friend bool operator!=(const const_iterator &a, const const_iterator &b) { return !(a == b); }
10407 *  
10408 *   private:
10409 *   const tensor_type *t_ = nullptr;
10410 *   unsigned int i_ = 0;
10411 *   };
10412 *  
10413 *   iterator begin() { return iterator(t_, 0u); }
10414 *   iterator end() { return iterator(t_, tensor_type::n_independent_components); }
10415 *  
10416 *   const_iterator begin() const { return const_iterator(t_, 0u); }
10417 *   const_iterator end() const { return const_iterator(t_, tensor_type::n_independent_components); }
10418 *   const_iterator cbegin() const { return begin(); }
10419 *   const_iterator cend() const { return end(); }
10420 *  
10421 *   private:
10422 *   tensor_type *t_;
10423 *   };
10424 *  
10425 *  
10426 * @endcode
10427 *
10428 * ---------------- Factories ----------------
10429 *
10430 * @code
10431 *   template <int rank, int dim, typename Number>
10432 *   SymmetricTensorConstEntriesView<rank, dim, Number>
10433 *   symmetric_tensor_entries(const ::SymmetricTensor<rank, dim, Number> &t)
10434 *   {
10435 *   return SymmetricTensorConstEntriesView<rank, dim, Number>(t);
10436 *   }
10437 *  
10438 *   template <int rank, int dim, typename Number>
10439 *   SymmetricTensorMutableEntriesView<rank, dim, Number>
10440 *   symmetric_tensor_entries(::SymmetricTensor<rank, dim, Number> &t)
10441 *   {
10442 *   return SymmetricTensorMutableEntriesView<rank, dim, Number>(t);
10443 *   }
10444 *   } // namespace dealii_utils
10445 * @endcode
10446
10447
10448<a name="ann-src/utilities.h"></a>
10449<h1>Annotated version of src/utilities.h</h1>
10450 *
10451 *
10452 *
10453 *
10454 * @code
10455 *   #ifndef _UTILITIES_H
10456 *   #define _UTILITIES_H
10457 *  
10458 *   #include <deal.II/base/utilities.h>
10459 *   #include <mpi.h>
10460 *  
10461 *   namespace PlasticityLab {
10462 *  
10463 *   [[maybe_unused]] static MPI_Comm mpi_communicator(MPI_COMM_WORLD);
10464 *  
10465 *   struct NotImplementedException : std::exception {
10466 *   const char *what() const _GLIBCXX_USE_NOEXCEPT override {
10467 *   return "Not Implemented.!\n";
10468 *   }
10469 *   };
10470 *  
10471 *   } /*namespace PlasticityLab*/
10472 *  
10473 *  
10474 *   #endif /*_UTILITIES_H*/
10475 * @endcode
10476
10477
10478*/
*const Number elongation_rate
*  iterator end()
*mech_lbc_system interpolatoryConstraintAppliers push_back * InterpolatoryConstraintApplier(*top_constraint_function_map, *y_component_mask)
*  *  const_iterator()=default
*  *  *  struct InterferenceTaperTransform *  
*  const Number radius
*const unsigned int n_steps
***const Number total_elongation
*  x_component_mask set(0, true)
*  *endcode **Thermal constraints **code *  const Number convection_coefficient
Definition point.h:111
#define DEAL_II_VERSION_GTE(major, minor, subminor)
Definition config.h:420
DerivativeForm< 1, spacedim, dim, Number > transpose(const DerivativeForm< 1, dim, spacedim, Number > &DF)
EnableObserverPointer Subscriptor
TriaActiveIterator< CellAccessor< dim, spacedim > > active_cell_iterator
Definition tria.h:1648
const bool IsBlockVector< VectorType >::value
void make_hanging_node_constraints(const DoFHandler< dim, spacedim > &dof_handler, AffineConstraints< number > &constraints)
void make_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternBase &sparsity_pattern, const AffineConstraints< number > &constraints={}, const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)
void compute_no_normal_flux_constraints(const DoFHandler< dim, spacedim > &dof_handler, const unsigned int first_vector_component, const std::set< types::boundary_id > &boundary_ids, AffineConstraints< number > &constraints, const Mapping< dim, spacedim > &mapping=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< spacedim >()), const bool use_manifold_for_normal=true)
@ update_values
Shape function values.
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_jacobians
Volume element.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
@ update_default
No update.
MappingQ< dim, spacedim > StaticMappingQ1< dim, spacedim >::mapping
Definition mapping_q1.h:101
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
Expression ceil(const Expression &x)
IndexSet extract_locally_relevant_dofs(const DoFHandler< dim, spacedim > &dof_handler)
std::vector< std::vector< bool > > extract_constant_modes(const DoFHandler< dim, spacedim > &dof_handler, const ComponentMask &component_mask={})
void interpolate(const DoFHandler< dim, spacedim > &dof1, const InVector &u1, const DoFHandler< dim, spacedim > &dof2, OutVector &u2)
std::pair< typename MeshType< dim, spacedim >::active_cell_iterator, Point< dim > > find_active_cell_around_point(const Mapping< dim, spacedim > &mapping, const MeshType< dim, spacedim > &mesh, const Point< spacedim > &p, const std::vector< bool > &marked_vertices={}, const double tolerance=1.e-10)
@ valid
Iterator points to a valid object.
constexpr types::blas_int zero
constexpr char A
void cell_matrix(FullMatrix< double > &M, const FEValuesBase< dim > &fe, const FEValuesBase< dim > &fetest, const ArrayView< const std::vector< double > > &velocity, const double factor=1.)
Definition advection.h:72
void cell_residual(Vector< double > &result, const FEValuesBase< dim > &fe, const std::vector< Tensor< 1, dim > > &input, const ArrayView< const std::vector< double > > &velocity, double factor=1.)
Definition advection.h:128
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
Definition divergence.h:469
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
Definition utilities.cc:210
SymmetricTensor< 2, dim, Number > C(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
*  PointHistory< dim, Number >::HardeningParameters hardening_parameters
*  *  const Number trial_yield_criterion
*  constitutive_request set_mu((0.5 *mu))
*  *  point_history plastic_strain
*  *  *  RotationFunction< dim, Number >::RotationFunction Number(dim)
*  *  *  ThermoPlasticMaterial< dim, ViscoplasticYieldLaw, Number >  ThermoPlasticMaterial *  *  *  *  *  reference_temperature(293.15)
*  *  *  *  *  *  TimeRateUpdateFlags TimeRateRequest< ValueType, dim, Number >  get_update_flags() const
*  *  *  RotationFunction< dim, Number >::RotationFunction  
*  *  *  *  void TimeRateRequest< ValueType, dim, Number >  set_time_increment(const Number time_increment)
*  *  *  const TimeRateUpdateFlags &*  operator|=(TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2)
*  *  *  *  void *  ThermoPlasticMaterial< dim, ViscoplasticYieldLaw, Number >  determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1, *  const Number norm_ksi_trial, *  const Number mu_bar, *  const Number alpha_n, *  const Number temperature, *  const Number time_increment, *  const Number tol, *  const unsigned int max_iter) const
*  *  *  *  Number TimeRateRequest< ValueType, dim, Number >  get_time_increment() const
*  *static   MPI_Comm mpi_communicator(MPI_COMM_WORLD)
*  constitutive_request set_b_e_bar(b_e_bar_next)
*  constitutive_request set_stored_heat_rate_tangent_modulus(heat_capacity)
*  constitutive_request set_heat_flux(thermal_conductivity *thermal_gradient)
*  constitutive_request set_is_plastic(false)
*  *  *  ThermoPlasticMaterial< dim, ViscoplasticYieldLaw, Number >  ThermoPlasticMaterial *  mu(mu)
*  constitutive_request set_heat_flux_tangent_moduli(thermal_conductivity *unit_symmetric_tensor< dim, Number >())
*  *  *  TimeRateUpdateFlags *  operator|(TimeRateUpdateFlags f1, TimeRateUpdateFlags f2)
*  constitutive_request set_stored_heat_rate(stored_heat_rate)
**code *  const SymmetricTensor< 2, dim, Number > stress_flow_direction
*  *  *  const TimeRateUpdateFlags &*  operator&=(TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2)
*  const SymmetricTensor< 2, dim, Number > dev_stress_trial
*  *  point_history material_Jacobian
*  *  *  TimeRateUpdateFlags *  operator&(TimeRateUpdateFlags f1, TimeRateUpdateFlags f2)
*  constitutive_request set_thermo_elastic_heating_tangent_modulus(0)
**code *  const SymmetricTensor< 2, dim, Number > ksi_trial
void apply(const Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type &team_member, const Kokkos::View< Number *, ShapeDataMemorySpace > shape_data, const ViewTypeIn in, ViewTypeOut out)
unsigned int n_mpi_processes(const MPI_Comm mpi_communicator)
Definition mpi.cc:103
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
Definition mpi.cc:118
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition utilities.cc:464
void interpolate(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Function< spacedim, typename VectorType::value_type > &function, VectorType &vec, const ComponentMask &component_mask={}, const unsigned int level=numbers::invalid_unsigned_int)
void project(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const AffineConstraints< typename VectorType::value_type > &constraints, const Quadrature< dim > &quadrature, const Function< spacedim, typename VectorType::value_type > &function, VectorType &vec, const bool enforce_zero_boundary=false, const Quadrature< dim - 1 > &q_boundary=(dim > 1 ? QGauss< dim - 1 >(2) :Quadrature< dim - 1 >()), const bool project_to_boundary_first=false)
void run(const Iterator &begin, const std_cxx20::type_identity_t< Iterator > &end, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length, const unsigned int chunk_size)
void save(Archive &ar, const ::std_cxx26::inplace_vector< T, N > &vec, const unsigned int)
long double gamma(const unsigned int n)
int(& functions)(const void *v1, const void *v2)
void assemble(const MeshWorker::DoFInfoBox< dim, DOFINFO > &dinfo, A *assembler)
Definition loop.h:68
::VectorizedArray< Number, width > log(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > exp(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
unsigned int boundary_id
Definition types.h:159
*  const unsigned int dofs_per_cell
*  *  FEFaceValues< 2 > fe_face_values(fe, face_quadrature_formula, update_values|update_quadrature_points| *  update_normal_vectors|update_JxW_values)
*  const unsigned int n_q_points
static constexpr unsigned int faces_per_cell
constexpr SymmetricTensor< 2, dim, Number > deviator(const SymmetricTensor< 2, dim, Number > &)
constexpr SymmetricTensor< 2, dim, Number > symmetrize(const Tensor< 2, dim, Number > &t)
constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)
constexpr SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
constexpr Number trace(const SymmetricTensor< 2, dim2, Number > &)
constexpr SymmetricTensor< 4, dim, Number > outer_product(const SymmetricTensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, Number > &t2)
constexpr SymmetricTensor< 4, dim, Number > identity_tensor()
constexpr SymmetricTensor< 2, dim, Number > unit_symmetric_tensor()