deal.II version GIT relicensing-6809-ge913b9bb34 2026-09-25 17:20:01+00:00
\(\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;
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>::
643 *   set_time_increment(const Number time_increment) {
644 *   this->time_increment = time_increment;
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>
710 *   ConstitutiveModelRequest<dim, Number>::get_heat_flux() const {
711 *   return heat_flux;
712 *   }
713 *  
714 *   template <int dim, typename 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>::
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,
1003 *   Number convection_coefficient,
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);
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);
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 *  
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 =
1262 *   outer_product(unit_symmetric_tensor<dim, Number>(), unit_symmetric_tensor<dim, Number>());
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>
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,
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 *  
2689 *   FEFaceValues<dim> fe_face_values (
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 *  
2724 *   FEFaceValues<dim> fe_face_values (
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 *   const std::vector<std::vector<bool> > constant_modes
3628 *   = DoFTools::extract_constant_modes(thermal_dof_system.dof_handler,
3629 *   ComponentMask());
3630 *  
3631 *   TrilinosWrappers::PreconditionAMG::AdditionalData additional_data;
3632 *   additional_data.constant_modes = constant_modes;
3633 *   additional_data.elliptic = true;
3634 *   additional_data.n_cycles = 1;
3635 *   additional_data.w_cycle = false;
3636 *   additional_data.output_details = false;
3637 *   additional_data.smoother_sweeps = 2;
3638 *   additional_data.aggregation_threshold = 1e-2;
3639 *   preconditioner.initialize(projection_matrix, additional_data);
3640 *  
3641 *   TrilinosWrappers::MPI::Vector tmp(thermal_dof_system.locally_owned_dofs, mpi_communicator);
3642 *   const Number relative_accuracy = 1e-08;
3643 *   const Number solver_tolerance = relative_accuracy
3644 *   * projection_matrix.residual(tmp, thermal_nonlinear_system.Newton_step_solution,
3645 *   projection_residual);
3646 *   SolverControl solver_control(projection_matrix.m(),
3647 *   solver_tolerance);
3648 *  
3649 *   SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
3650 *  
3651 *   thermal_nonlinear_system.Newton_step_solution = 0;
3652 *  
3653 *   solver.solve(projection_matrix, thermal_nonlinear_system.Newton_step_solution,
3654 *   projection_residual, preconditioner);
3655 *  
3656 *   thermal_nonlinear_system.previous_deformation = thermal_nonlinear_system.Newton_step_solution;
3657 *  
3658 *   }
3659 *  
3660 *   }
3661 *  
3662 *  
3663 *   template<int dim, typename Number>
3664 *   void PlasticityLabProg<dim, Number>::remap_mechanical_fields(
3665 *   NewtonStepSystem &mechanical_nonlinear_system,
3666 *   const DoFSystem<dim, Number> &mechanical_dof_system,
3667 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
3668 *   const DoFSystem<dim, Number> &mesh_motion_dof_system) {
3669 *  
3670 *   const Quadrature<dim> mechanical_fe_support_point_quadrature(mech_fe.base_element(0).get_unit_support_points());
3671 *  
3672 *   const unsigned int n_q_points = mechanical_fe_support_point_quadrature.size();
3673 *   [[maybe_unused]] const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
3674 *   const unsigned int mechanical_dofs_per_cell = mech_fe.dofs_per_cell;
3675 *  
3676 *   FEValues<dim> mesh_motion_fe_values(
3677 *   mapping,
3678 *   mesh_motion_fe,
3679 *   mechanical_fe_support_point_quadrature,
3680 *   update_values | update_quadrature_points);
3681 *  
3682 *   FEValues<dim> mechanical_fe_values(
3683 *   mapping,
3684 *   mech_fe,
3685 *   mechanical_fe_support_point_quadrature,
3686 *   update_values | update_quadrature_points);
3687 *  
3688 *   std::vector< Tensor<1, dim, Number> > previous_remapped_deformations(1);
3689 *   std::vector< Tensor<1, dim, Number> > previous_remapped_velocity(1);
3690 *   std::vector< Tensor<1, dim, Number> > previous_remapped_second_time_rate(1);
3691 *   std::vector< Number > previous_remapped_twist_deformations(1);
3692 *   std::vector< Number > previous_remapped_twist_velocity(1);
3693 *   std::vector< Number > previous_remapped_twist_second_time_rate(1);
3694 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
3695 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
3696 *  
3697 *   const FEValuesExtractors::Vector displacements(0);
3698 *   const FEValuesExtractors::Scalar angular_velocities(dim);
3699 *  
3700 *   std::vector<ReferencePoint<dim, Number>> reference_points;
3701 *   std::vector<Point<dim, Number>> remapped_point_positions;
3702 *   std::unordered_map<point_index_t, unsigned int> quadrature_point_reference_point_id;
3703 *   auto cell = mesh_motion_dof_system.dof_handler.begin_active();
3704 *   auto mechanical_cell = mechanical_dof_system.dof_handler.begin_active();
3705 *   for (; cell != mesh_motion_dof_system.dof_handler.end(); ++cell, ++mechanical_cell) {
3706 *   if (cell->is_locally_owned()) {
3707 *   mesh_motion_fe_values.reinit(cell);
3708 *  
3709 *   mesh_motion_fe_values[displacements].get_function_values(
3710 *   mesh_motion_nonlinear_system.current_increment,
3711 *   mesh_motion_value_increments);
3712 *  
3713 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
3714 *   const Point<dim, Number> reference_point_position = mesh_motion_fe_values.quadrature_point(q_point);
3715 *   const Point<dim, Number> remapped_point_position = reference_point_position - mesh_motion_value_increments[q_point];
3716 *  
3717 *   ReferencePoint<dim, Number> reference_point;
3718 *   reference_point.mesh_motion_cell = cell;
3719 *   reference_point.field_cell = mechanical_cell;
3720 *   reference_point.q_point = q_point;
3721 *   reference_point.reference_point = reference_point_position;
3722 *   reference_point.remapped_point = remapped_point_position;
3723 *  
3724 *   reference_points.push_back(reference_point);
3725 *   remapped_point_positions.push_back(remapped_point_position);
3726 *  
3727 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
3728 *   quadrature_point_reference_point_id[quadrature_point_index] = reference_points.size() - 1;
3729 *  
3730 *   }
3731 *  
3732 *   }
3733 *   }
3734 *  
3735 *   MPI_Datatype PointType;
3736 *   MPI_Type_contiguous(dim, MPI_DOUBLE, &PointType);
3737 *   MPI_Type_commit(&PointType);
3738 *   std::vector<int> displs;
3739 *   std::vector< Point<dim, Number>> received_remapped_positions;
3740 *   std::vector<RemappedPoint<dim, Number>> remapped_points;
3741 *   int nprocesses, this_process;
3742 *   int num_reference_points = reference_points.size();
3743 *   MPI_Comm_size(mpi_communicator, &nprocesses);
3744 *   std::vector<int> reference_point_counts(nprocesses);
3745 *   MPI_Allgather(
3746 *   &num_reference_points,
3747 *   1, MPI_INT,
3748 *   &reference_point_counts[0],
3749 *   1, MPI_INT,
3750 *   mpi_communicator);
3751 *   MPI_Comm_rank(mpi_communicator, &this_process);
3752 *   displs.resize(nprocesses);
3753 *   displs[0] = 0;
3754 *   for (int i = 1; i < nprocesses; ++i) {
3755 *   displs[i] = displs[i - 1] + reference_point_counts[i - 1];
3756 *   }
3757 *  
3758 *   const unsigned int count_received_reference_points = displs[nprocesses - 1] + reference_point_counts[nprocesses - 1];
3759 *   received_remapped_positions.resize(count_received_reference_points);
3760 *   remapped_points.resize(count_received_reference_points);
3761 *   std::vector<char> this_process_owns_remapped_point(count_received_reference_points);
3762 *  
3763 *   MPI_Allgatherv(
3764 *   &remapped_point_positions[0],
3765 *   num_reference_points,
3766 *   PointType,
3767 *   &received_remapped_positions[0],
3768 *   &reference_point_counts[0],
3769 *   &displs[0],
3770 *   PointType,
3771 *   mpi_communicator);
3772 *  
3773 *  
3774 *   for(unsigned int received_point_id=0; received_point_id < count_received_reference_points; received_point_id++) {
3775 *   auto point = received_remapped_positions[received_point_id];
3776 *   auto remapped_cell_and_point = GridTools::find_active_cell_around_point(
3777 *   mapping,
3778 *   mechanical_dof_system.dof_handler,
3779 *   point);
3780 *   auto mechanical_cell = remapped_cell_and_point.first;
3781 *   auto mechanical_unit_cell_point = remapped_cell_and_point.second;
3782 *   remapped_points[received_point_id].field_cell = mechanical_cell;
3783 *   remapped_points[received_point_id].unit_cell_point = mechanical_unit_cell_point;
3784 *   remapped_points[received_point_id].remapped_point = point;
3785 *   this_process_owns_remapped_point[received_point_id] = mechanical_cell.state() == IteratorState::valid && mechanical_cell->is_locally_owned()? 1 : 0;
3786 *   }
3787 *  
3788 *   std::vector<char> remapped_point_candidates(num_reference_points * nprocesses);
3789 *   for (int process = 0; process < nprocesses; ++process) {
3790 *   if (reference_point_counts[process] > 0)
3791 *   MPI_Gather(
3792 *   &this_process_owns_remapped_point[displs[process]],
3793 *   reference_point_counts[process],
3794 *   MPI_C_BOOL,
3795 *   &remapped_point_candidates[0],
3796 *   reference_point_counts[process],
3797 *   MPI_C_BOOL,
3798 *   process,
3799 *   mpi_communicator);
3800 *   }
3801 *  
3802 *   std::vector<unsigned int> remapped_point_owning_process(num_reference_points);
3803 *   for (int i = 0; i < num_reference_points; ++i) {
3804 *   remapped_point_owning_process[i] = 0;
3805 *   for (int j = 1; j < nprocesses; ++j) {
3806 *   if (remapped_point_candidates[j * num_reference_points + i] == 1) {
3807 *   remapped_point_owning_process[i] = j;
3808 *   continue;
3809 *   }
3810 *   }
3811 *   }
3812 *  
3813 *   std::vector<RemappedPoint<dim, Number>> mapping_remapped_points;
3814 *   std::vector<unsigned int> reference_point_owning_process;
3815 *   std::vector<unsigned int> reference_point_index_at_remote_process;
3816 *  
3817 * @endcode
3818 *
3819 * This should really be a vector<bool>, but addresses of individual elements of
3820 * vector<bool> cannot be taken. It's a template specialization to save space
3821 *
3822 * @code
3823 *   std::vector<char> remote_remapped_point_is_accepted(num_reference_points * nprocesses);
3824 *   std::vector<char> local_remapped_point_is_accepted(count_received_reference_points);
3825 *   for (int i = 0; i < num_reference_points; ++i) {
3826 *   for (unsigned int j = 0; j < static_cast<unsigned int>(nprocesses); ++j) {
3827 *   remote_remapped_point_is_accepted[j * num_reference_points + i] = (remapped_point_owning_process[i] == j) ? 1 : 0;
3828 *   }
3829 *   }
3830 *  
3831 *   for (int process = 0; process < nprocesses; ++process) {
3832 *   if (reference_point_counts[process] > 0) {
3833 *   MPI_Scatter(
3834 *   &remote_remapped_point_is_accepted[0],
3835 *   reference_point_counts[process],
3836 *   MPI_C_BOOL,
3837 *   &local_remapped_point_is_accepted[displs[process]],
3838 *   reference_point_counts[process],
3839 *   MPI_C_BOOL,
3840 *   process,
3841 *   mpi_communicator);
3842 *   }
3843 *   }
3844 *  
3845 *   std::vector<unsigned int> remote_reference_point_counts(nprocesses, 0);
3846 *   for (int process = 0; process < nprocesses; ++process) {
3847 *   for (int i = 0; i < reference_point_counts[process]; ++i) {
3848 *   if (local_remapped_point_is_accepted[displs[process] + i]) {
3849 *   RemappedPoint<dim, Number> accepted_remapped_point = remapped_points[displs[process] + i];
3850 *  
3851 *   mapping_remapped_points.push_back(accepted_remapped_point);
3852 *   reference_point_owning_process.push_back(process);
3853 *   reference_point_index_at_remote_process.push_back(i);
3854 *   ++remote_reference_point_counts[process];
3855 *   }
3856 *   }
3857 *   }
3858 *  
3859 *   MPI_Barrier(mpi_communicator);
3860 *  
3861 *   std::vector<unsigned int> remote_remapped_point_counts(nprocesses);
3862 *   for (int i = 0; i < nprocesses; ++i) {
3863 *   MPI_Scatter(
3864 *   &remote_reference_point_counts[0],
3865 *   1, MPI_UNSIGNED,
3866 *   &remote_remapped_point_counts[i],
3867 *   1, MPI_UNSIGNED,
3868 *   i, mpi_communicator);
3869 *   }
3870 *  
3871 *   std::vector<std::vector<Number> > local_previous_deformation_groups(nprocesses);
3872 *   std::vector<std::vector<Number> > local_previous_velocity_groups(nprocesses);
3873 *   std::vector<std::vector<Number> > local_previous_second_time_rate_groups(nprocesses);
3874 *   std::vector<std::vector<Number> > remote_previous_deformation_groups(nprocesses);
3875 *   std::vector<std::vector<Number> > remote_previous_velocity_groups(nprocesses);
3876 *   std::vector<std::vector<Number> > remote_previous_second_time_rate_groups(nprocesses);
3877 *  
3878 *   for (int i = 0; i < nprocesses; ++i) {
3879 *   local_previous_deformation_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3880 *   local_previous_velocity_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3881 *   local_previous_second_time_rate_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3882 *   remote_previous_deformation_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3883 *   remote_previous_velocity_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3884 *   remote_previous_second_time_rate_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3885 *   }
3886 *  
3887 *   std::vector<unsigned int> next_to_process(nprocesses, 0);
3888 *   for (unsigned int i = 0; i < mapping_remapped_points.size(); ++i) {
3889 *   const unsigned int group = reference_point_owning_process.at(i);
3890 *   const RemappedPoint<dim, Number> remapped_point = mapping_remapped_points.at(i);
3891 *  
3892 *   Quadrature<dim> remapped_point_quadrature(
3893 *   std::vector<Point<dim, Number>> (1, remapped_point.unit_cell_point));
3894 *  
3895 *   FEValues<dim> remapped_point_fe_values(
3896 *   mapping,
3897 *   mech_fe,
3898 *   remapped_point_quadrature,
3899 *   update_values);
3900 *  
3901 *   remapped_point_fe_values.reinit(remapped_point.field_cell);
3902 *  
3903 *   remapped_point_fe_values[displacements].get_function_values(
3904 *   mechanical_nonlinear_system.previous_deformation,
3905 *   previous_remapped_deformations);
3906 *  
3907 *   remapped_point_fe_values[displacements].get_function_values(
3908 *   mechanical_nonlinear_system.previous_time_derivative,
3909 *   previous_remapped_velocity);
3910 *  
3911 *   remapped_point_fe_values[displacements].get_function_values(
3912 *   mechanical_nonlinear_system.previous_second_time_derivative,
3913 *   previous_remapped_second_time_rate);
3914 *  
3915 *   remapped_point_fe_values[angular_velocities].get_function_values(
3916 *   mechanical_nonlinear_system.previous_deformation,
3917 *   previous_remapped_twist_deformations);
3918 *  
3919 *   remapped_point_fe_values[angular_velocities].get_function_values(
3920 *   mechanical_nonlinear_system.previous_time_derivative,
3921 *   previous_remapped_twist_velocity);
3922 *  
3923 *   remapped_point_fe_values[angular_velocities].get_function_values(
3924 *   mechanical_nonlinear_system.previous_second_time_derivative,
3925 *   previous_remapped_twist_second_time_rate);
3926 *  
3927 *   for(unsigned int dim_i=0; dim_i<dim; dim_i++) {
3928 *   local_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3929 *   previous_remapped_deformations[0][dim_i];
3930 *   local_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3931 *   previous_remapped_velocity[0][dim_i];
3932 *   local_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3933 *   previous_remapped_second_time_rate[0][dim_i];
3934 *   }
3935 *  
3936 *   local_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3937 *   previous_remapped_twist_deformations[0];
3938 *   local_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3939 *   previous_remapped_twist_velocity[0];
3940 *   local_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3941 *   previous_remapped_twist_second_time_rate[0];
3942 *  
3943 *   ++next_to_process.at(group);
3944 *   }
3945 *  
3946 *   enum MessageFlag {
3947 *   PREVIOUS_DEFORMATION,
3948 *   PREVIOUS_VELOCITY,
3949 *   PREVIOUS_SECOND_TIME_RATE
3950 *   };
3951 *  
3952 *   const unsigned int
3953 *   previous_deformation_requests_offset = 0,
3954 *   previous_velocity_requests_offset = 1,
3955 *   previous_second_time_rate_requests_offset = 2,
3956 *   request_array_size = 3;
3957 *  
3958 *   std::vector<MPI_Request> requests_vector(2 * nprocesses * request_array_size);
3959 *  
3960 *   for (int i = 0; i < nprocesses; ++i) {
3961 *   MPI_Isend(
3962 *   local_previous_deformation_groups.at(i).data(),
3963 *   (dim+1) * remote_reference_point_counts.at(i),
3964 *   MPI_DOUBLE, i, PREVIOUS_DEFORMATION,
3965 *   mpi_communicator,
3966 *   &requests_vector[i + nprocesses * previous_deformation_requests_offset]);
3967 *  
3968 *   MPI_Isend(
3969 *   local_previous_velocity_groups.at(i).data(),
3970 *   (dim+1) * remote_reference_point_counts.at(i),
3971 *   MPI_DOUBLE, i, PREVIOUS_VELOCITY,
3972 *   mpi_communicator,
3973 *   &requests_vector[i + nprocesses * previous_velocity_requests_offset]);
3974 *  
3975 *   MPI_Isend(
3976 *   local_previous_second_time_rate_groups.at(i).data(),
3977 *   (dim+1) * remote_reference_point_counts.at(i),
3978 *   MPI_DOUBLE, i, PREVIOUS_SECOND_TIME_RATE,
3979 *   mpi_communicator,
3980 *   &requests_vector[i + nprocesses * previous_second_time_rate_requests_offset]);
3981 *   }
3982 *  
3983 *   for (int i = 0; i < nprocesses; ++i) {
3984 *   const unsigned int row_start = i + nprocesses * request_array_size;
3985 *  
3986 *   MPI_Irecv(
3987 *   remote_previous_deformation_groups.at(i).data(),
3988 *   (dim+1) * remote_remapped_point_counts.at(i),
3989 *   MPI_DOUBLE, i, PREVIOUS_DEFORMATION,
3990 *   mpi_communicator,
3991 *   &requests_vector[row_start + nprocesses * previous_deformation_requests_offset]);
3992 *  
3993 *   MPI_Irecv(
3994 *   remote_previous_velocity_groups.at(i).data(),
3995 *   (dim+1) * remote_remapped_point_counts.at(i),
3996 *   MPI_DOUBLE, i, PREVIOUS_VELOCITY,
3997 *   mpi_communicator,
3998 *   &requests_vector[row_start + nprocesses * previous_velocity_requests_offset]);
3999 *  
4000 *   MPI_Irecv(
4001 *   remote_previous_second_time_rate_groups.at(i).data(),
4002 *   (dim+1) * remote_remapped_point_counts.at(i),
4003 *   MPI_DOUBLE, i, PREVIOUS_SECOND_TIME_RATE,
4004 *   mpi_communicator,
4005 *   &requests_vector[row_start + nprocesses * previous_second_time_rate_requests_offset]);
4006 *  
4007 *   }
4008 *  
4009 *   std::vector<MPI_Status> statuses_vector(2 * request_array_size * nprocesses);
4010 *   MPI_Waitall(
4011 *   2 * request_array_size * nprocesses,
4012 *   &requests_vector[0],
4013 *   &statuses_vector[0]);
4014 *  
4015 *   TrilinosWrappers::SparsityPattern sparsity_pattern(
4016 *   mechanical_dof_system.locally_owned_dofs,
4017 *   mpi_communicator);
4018 *  
4020 *   mechanical_dof_system.dof_handler, sparsity_pattern,
4022 *   false,
4023 *   Utilities::MPI::this_mpi_process(mpi_communicator));
4024 *   sparsity_pattern.compress();
4025 *  
4026 *   TrilinosWrappers::SparseMatrix projection_matrix(sparsity_pattern);
4027 *   TrilinosWrappers::MPI::Vector projection_residual(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4028 *   TrilinosWrappers::MPI::Vector projection_velocity_residual(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4029 *   TrilinosWrappers::MPI::Vector projection_second_time_rate_residual(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4030 *   TrilinosWrappers::MPI::Vector projection_solution(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4031 *  
4032 *   projection_matrix = 0;
4033 *   projection_residual = 0;
4034 *   projection_velocity_residual = 0;
4035 *   projection_second_time_rate_residual = 0;
4036 *  
4037 *   FullMatrix<Number> cell_matrix(mechanical_dofs_per_cell, mechanical_dofs_per_cell);
4038 *   Vector<Number> cell_residual(mechanical_dofs_per_cell);
4039 *   Vector<Number> cell_velocity_residual(mechanical_dofs_per_cell);
4040 *   Vector<Number> cell_second_time_rate_residual(mechanical_dofs_per_cell);
4041 *  
4042 *   next_to_process.clear();
4043 *   next_to_process.resize(nprocesses, 0);
4044 *   for (unsigned int i = 0; i < reference_points.size(); ++i) {
4045 *   unsigned int group = remapped_point_owning_process.at(i);
4046 *  
4047 *   cell_matrix = 0;
4048 *   cell_residual = 0;
4049 *   cell_velocity_residual = 0;
4050 *   cell_second_time_rate_residual = 0;
4051 *  
4052 *   ReferencePoint<dim, Number> &reference_point = reference_points[i];
4053 *  
4054 *   mechanical_fe_values.reinit(reference_point.field_cell);
4055 *  
4056 *   Tensor<1, dim, Number> remapped_previous_deformation;
4057 *   Tensor<1, dim, Number> remapped_previous_velocity;
4058 *   Tensor<1, dim, Number> remapped_previous_second_time_rate;
4059 *  
4060 *   for(unsigned int dim_i=0; dim_i<dim; dim_i++) {
4061 *   remapped_previous_deformation[dim_i] =
4062 *   reference_point.remapped_point[dim_i]
4063 *   - reference_point.reference_point[dim_i]
4064 *   + remote_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4065 *   remapped_previous_velocity[dim_i] = remote_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4066 *   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);
4067 *   }
4068 *  
4069 *   const Number remapped_previous_twist_deformation = remote_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4070 *   const Number remapped_previous_twist_velocity = remote_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4071 *   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);
4072 *  
4073 *   for(unsigned int dof_i=0; dof_i<mechanical_dofs_per_cell; dof_i++) {
4074 *   const auto shape_value_i = postprocess_tensor_dimension(
4075 *   mechanical_fe_values[displacements].value(dof_i, reference_point.q_point),
4076 *   mechanical_fe_values[angular_velocities].value(dof_i, reference_point.q_point));
4077 *  
4078 *   cell_residual(dof_i) +=
4079 *   shape_value_i * postprocess_tensor_dimension(remapped_previous_deformation, remapped_previous_twist_deformation);
4080 *  
4081 *   cell_velocity_residual(dof_i) +=
4082 *   shape_value_i * postprocess_tensor_dimension(remapped_previous_velocity, remapped_previous_twist_velocity);
4083 *  
4084 *   cell_second_time_rate_residual(dof_i) +=
4085 *   shape_value_i * postprocess_tensor_dimension(remapped_previous_second_time_rate, remapped_previous_twist_second_time_rate);
4086 *  
4087 *   for(unsigned int dof_j=0; dof_j<mechanical_dofs_per_cell; dof_j++) {
4088 *   const auto shape_value_j = postprocess_tensor_dimension(
4089 *   mechanical_fe_values[displacements].value(dof_j, reference_point.q_point),
4090 *   mechanical_fe_values[angular_velocities].value(dof_j, reference_point.q_point));
4091 *  
4092 *   cell_matrix(dof_i, dof_j) += shape_value_i * shape_value_j;
4093 *  
4094 *   }
4095 *   }
4096 *  
4097 *   std::vector<types::global_dof_index> local_dof_indices(mechanical_dofs_per_cell);
4098 *   reference_point.field_cell->get_dof_indices(local_dof_indices);
4099 *   projection_residual.add(local_dof_indices, cell_residual);
4100 *   projection_velocity_residual.add(local_dof_indices, cell_velocity_residual);
4101 *   projection_second_time_rate_residual.add(local_dof_indices, cell_second_time_rate_residual);
4102 *   for(unsigned int dof_i=0; dof_i<mechanical_dofs_per_cell; dof_i++) {
4103 *   for(unsigned int dof_j=0; dof_j<mechanical_dofs_per_cell; dof_j++) {
4104 *   projection_matrix.add(local_dof_indices[dof_i], local_dof_indices[dof_j], cell_matrix(dof_i, dof_j));
4105 *   }
4106 *   }
4107 *  
4108 *   ++next_to_process.at(group);
4109 *   }
4110 *  
4111 *   projection_matrix.compress(VectorOperation::add);
4112 *   projection_residual.compress(VectorOperation::add);
4113 *   projection_velocity_residual.compress(VectorOperation::add);
4114 *   projection_second_time_rate_residual.compress(VectorOperation::add);
4115 *  
4116 * @endcode
4117 *
4118 * solve the projection system
4119 *
4120 * @code
4121 *   TrilinosWrappers::PreconditionAMG preconditioner;
4122 *  
4123 *   const std::vector<std::vector<bool> > constant_modes
4124 *   = DoFTools::extract_constant_modes(mechanical_dof_system.dof_handler,
4125 *   ComponentMask());
4126 *  
4128 *   additional_data.constant_modes = constant_modes;
4129 *   additional_data.elliptic = true;
4130 *   additional_data.n_cycles = 1;
4131 *   additional_data.w_cycle = false;
4132 *   additional_data.output_details = false;
4133 *   additional_data.smoother_sweeps = 2;
4134 *   additional_data.aggregation_threshold = 1e-2;
4135 *   preconditioner.initialize(projection_matrix, additional_data);
4136 *  
4137 *   TrilinosWrappers::MPI::Vector tmp(mechanical_dof_system.locally_owned_dofs, mpi_communicator);
4138 *   const Number relative_accuracy = 1e-08;
4139 *   const Number solver_tolerance = relative_accuracy
4140 *   * projection_matrix.residual(tmp, projection_solution,
4141 *   projection_residual);
4142 *   SolverControl solver_control(projection_matrix.m(),
4143 *   solver_tolerance);
4144 *  
4145 *   SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
4146 *  
4147 *   projection_solution = 0;
4148 *  
4149 *   solver.solve(projection_matrix, projection_solution,
4150 *   projection_residual, preconditioner);
4151 *  
4152 *   mechanical_nonlinear_system.previous_deformation = projection_solution;
4153 *  
4154 *   projection_solution = 0;
4155 *   solver.solve(projection_matrix, projection_solution,
4156 *   projection_velocity_residual, preconditioner);
4157 *   mechanical_nonlinear_system.previous_time_derivative = projection_solution;
4158 *  
4159 *   projection_solution = 0;
4160 *   solver.solve(projection_matrix, projection_solution,
4161 *   projection_second_time_rate_residual, preconditioner);
4162 *   mechanical_nonlinear_system.previous_second_time_derivative = projection_solution;
4163 *  
4164 *   }
4165 *  
4166 *  
4167 *   template <int dim, typename Number>
4168 *   void PlasticityLabProg<dim, Number>::assemble_mechanical_system(
4169 *   NewtonStepSystem &Newton_system,
4170 *   const DoFSystem<dim, Number> &mechanical_dof_system,
4171 *   const LBCSystem<dim, Number, dim+1> &mechanical_lbc_system,
4172 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
4173 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
4174 *   const NewtonStepSystem &thermal_Newton_system,
4175 *   const DoFSystem<dim, Number> &thermal_dof_system,
4176 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
4177 *   Material<dim+1, Number> &material,
4178 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
4179 *   const bool fill_system_matrix,
4180 *   const bool update_material_state) {
4181 *   FEValues<dim> fe_values(
4182 *   mapping,
4183 *   mech_fe,
4184 *   quadrature_formula,
4186 *  
4187 *   FEFaceValues<dim> fe_face_values(
4188 *   mapping,
4189 *   mech_fe,
4190 *   face_quadrature_formula,
4192 *  
4193 *   FEValues<dim> fe_therm_values(
4194 *   mapping,
4195 *   therm_fe,
4196 *   quadrature_formula,
4197 *   update_values);
4198 *  
4199 *   FEValues<dim> mesh_motion_fe_values(
4200 *   mapping,
4201 *   mesh_motion_fe,
4202 *   quadrature_formula,
4204 *  
4205 *   FEValues<dim> mixed_fe_values(
4206 *   mapping,
4207 *   mixed_var_fe,
4208 *   quadrature_formula,
4209 *   update_values);
4210 *  
4211 *   const unsigned int dofs_per_cell = mech_fe.dofs_per_cell;
4212 *   const unsigned int n_q_points = quadrature_formula.size();
4213 *   const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
4214 *   const unsigned int n_face_q_points = face_quadrature_formula.size();
4215 *  
4216 *   std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points);
4217 *   std::vector< Tensor<2, dim, Number> > displacement_gradient_increments(n_q_points);
4218 *  
4219 *   std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points);
4220 *   std::vector< Tensor<1, dim, Number> > displacement_value_increments(n_q_points);
4221 *  
4222 *   std::vector< Tensor<2, dim, Number> > displacement_gradient_previous_time_rates(n_q_points);
4223 *   std::vector< Tensor<2, dim, Number> > displacement_gradient_previous_second_time_rates(n_q_points);
4224 *  
4225 *   std::vector< Tensor<1, dim, Number> > displacement_increments(n_q_points);
4226 *   std::vector< Tensor<1, dim, Number> > displacement_previous_time_rates(n_q_points);
4227 *   std::vector< Tensor<1, dim, Number> > displacement_previous_second_time_rates(n_q_points);
4228 *  
4229 *   std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_increments(n_q_points);
4230 *   std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_previous_time_rates(n_q_points);
4231 *   std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_previous_second_time_rates(n_q_points);
4232 *  
4233 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
4234 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
4235 *  
4236 *   std::vector< Number > angular_velocity_increments(n_q_points);
4237 *   std::vector< Number > angular_velocity_previous_time_rates(n_q_points);
4238 *   std::vector< Number > angular_velocity_previous_second_time_rates(n_q_points);
4239 *  
4240 *   std::vector< Number > current_temperature_values(n_q_points);
4241 *   std::vector< Number > updated_temperature_increments(n_q_points);
4242 *   std::vector< Number > updated_temperature_values(n_q_points);
4243 *  
4244 *   std::vector< Tensor<1, dim, Number> > face_displacement_value_increments(n_face_q_points);
4245 *  
4246 *   std::vector< Number > deformation_jacobians(n_q_points);
4247 *   std::vector< Number > previous_deformation_jacobian(n_q_points);
4248 *   std::vector< std::vector<Number> > strain_divergences(
4249 *   dofs_per_cell,
4250 *   std::vector<Number>(n_q_points));
4251 *   std::vector< std::vector<Number> > jacobian_tangents(
4252 *   dofs_per_cell,
4253 *   std::vector<Number>(n_q_points));
4254 *  
4255 *   std::vector< std::vector< std::vector < Number> > > strain_divergence_tangents(
4256 *   dofs_per_cell,
4257 *   std::vector< std::vector< Number> >(
4258 *   dofs_per_cell,
4259 *   std::vector<Number>(n_q_points)));
4260 *  
4261 *   std::vector<Number> projected_temperature_coefficients(mixed_dofs_per_cell);
4262 *   std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
4263 *   std::vector<Number> projected_previous_temperature_coefficients(mixed_dofs_per_cell);
4264 *   std::vector<Number> projected_previous_Jacobian_coefficients(mixed_dofs_per_cell);
4265 *   std::vector<std::vector<Number> > projected_strain_divergence_coefficients(
4266 *   dofs_per_cell,
4267 *   std::vector<Number>(mixed_dofs_per_cell));
4268 *   std::vector<std::vector<Number> > projected_jacobian_tangent_coefficients(
4269 *   dofs_per_cell,
4270 *   std::vector<Number>(mixed_dofs_per_cell));
4271 *   std::vector<std::vector<std::vector<Number> > > projected_strain_divergence_tangent_coefficients(
4272 *   dofs_per_cell, std::vector< std::vector< Number> >(
4273 *   dofs_per_cell,
4274 *   std::vector<Number>(mixed_dofs_per_cell)));
4275 *  
4276 *   std::vector<Number> projected_strain_divergence(dofs_per_cell);
4277 *   std::vector<Number> projected_jacobian_tangent(dofs_per_cell);
4278 *   std::vector<std::vector<Number> > projected_strain_divergence_tangent(
4279 *   dofs_per_cell,
4280 *   std::vector<Number>(dofs_per_cell));
4281 *  
4282 *   FullMatrix<Number> cell_matrix(dofs_per_cell, dofs_per_cell);
4283 *   Vector<Number> cell_residual(dofs_per_cell);
4284 *  
4285 *   Vector<Number> mixed_values (mixed_dofs_per_cell);
4286 *  
4287 *   const FEValuesExtractors::Vector displacements (0);
4288 *   const FEValuesExtractors::Scalar angular_velocity(dim);
4290 *  
4291 *   Newton_system.Newton_step_matrix = 0;
4292 *   Newton_system.Newton_step_residual = 0;
4293 *  
4294 *   double alpha_m, alpha_f, gamma, beta;
4295 *   get_generalized_alpha_method_params(
4296 *   &alpha_m, &alpha_f, &gamma, &beta, rho_infty);
4297 *  
4298 *   const Number d_second_time_rate_d_increment = (1./(beta*time_increment*time_increment));
4299 *   const Number d_time_rate_d_increment = gamma/(beta*time_increment);
4300 *  
4301 *   bool kinematic_domains_are_valid = true; // innocent until proven guilty
4302 *  
4303 *   auto cell = mechanical_dof_system.dof_handler.begin_active();
4304 *   auto endc = mechanical_dof_system.dof_handler.end();
4305 *   auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
4306 *   auto mesh_motion_cell = mesh_motion_dof_system.dof_handler.begin_active();
4307 *   auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
4308 *   for (; cell != endc; ++cell, ++thermal_cell, ++mesh_motion_cell, ++mixed_fe_cell) {
4309 *   if (cell->is_locally_owned()) {
4310 *   cell_matrix = 0;
4311 *   cell_residual = 0;
4312 *  
4313 *   fe_values.reinit (cell);
4314 *   fe_therm_values.reinit (thermal_cell);
4315 *   mixed_fe_values.reinit (mixed_fe_cell);
4316 *   mesh_motion_fe_values.reinit (mesh_motion_cell);
4317 *  
4318 *   fe_values[displacements].get_function_gradients(
4319 *   Newton_system.current_increment,
4320 *   displacement_gradient_increments);
4321 *  
4322 *   fe_values[displacements].get_function_gradients(
4323 *   Newton_system.previous_deformation,
4324 *   current_displacement_gradients);
4325 *  
4326 *   fe_values[displacements].get_function_values(
4327 *   Newton_system.current_increment,
4328 *   displacement_value_increments);
4329 *  
4330 *   fe_values[displacements].get_function_values(
4331 *   Newton_system.previous_deformation,
4332 *   current_displacement_values);
4333 *  
4334 *   fe_values[displacements].get_function_gradients(
4335 *   Newton_system.previous_time_derivative,
4336 *   displacement_gradient_previous_time_rates);
4337 *  
4338 *   fe_values[displacements].get_function_gradients(
4339 *   Newton_system.previous_second_time_derivative,
4340 *   displacement_gradient_previous_second_time_rates);
4341 *  
4342 *   fe_values[displacements].get_function_values(
4343 *   Newton_system.current_increment,
4344 *   displacement_increments);
4345 *  
4346 *   fe_values[displacements].get_function_values(
4347 *   Newton_system.previous_time_derivative,
4348 *   displacement_previous_time_rates);
4349 *  
4350 *   fe_values[displacements].get_function_values(
4351 *   Newton_system.previous_second_time_derivative,
4352 *   displacement_previous_second_time_rates);
4353 *  
4354 * @endcode
4355 *
4356 * Angular velocity
4357 *
4358 * @code
4359 *   fe_values[angular_velocity].get_function_gradients(
4360 *   Newton_system.current_increment,
4361 *   angular_velocity_gradient_increments);
4362 *  
4363 *   fe_values[angular_velocity].get_function_gradients(
4364 *   Newton_system.previous_time_derivative,
4365 *   angular_velocity_gradient_previous_time_rates);
4366 *  
4367 *   fe_values[angular_velocity].get_function_gradients(
4368 *   Newton_system.previous_second_time_derivative,
4369 *   angular_velocity_gradient_previous_second_time_rates);
4370 *  
4371 *   fe_values[angular_velocity].get_function_values(
4372 *   Newton_system.current_increment,
4373 *   angular_velocity_increments);
4374 *  
4375 *   fe_values[angular_velocity].get_function_values(
4376 *   Newton_system.previous_time_derivative,
4377 *   angular_velocity_previous_time_rates);
4378 *  
4379 *   fe_values[angular_velocity].get_function_values(
4380 *   Newton_system.previous_second_time_derivative,
4381 *   angular_velocity_previous_second_time_rates);
4382 *  
4383 * @endcode
4384 *
4385 * mesh motion
4386 *
4387 * @code
4388 *   mesh_motion_fe_values[displacements].get_function_gradients(
4389 *   mesh_motion_nonlinear_system.current_increment,
4390 *   mesh_motion_gradient_increments);
4391 *  
4392 *   mesh_motion_fe_values[displacements].get_function_gradients(
4393 *   mesh_motion_nonlinear_system.current_increment,
4394 *   mesh_motion_gradient_increments);
4395 *  
4396 * @endcode
4397 *
4398 * temperature
4399 *
4400 * @code
4401 *   fe_therm_values[temperature].get_function_values (
4402 *   thermal_Newton_system.previous_deformation,
4403 *   current_temperature_values);
4404 *   fe_therm_values[temperature].get_function_values (
4405 *   thermal_Newton_system.current_increment,
4406 *   updated_temperature_increments);
4407 *  
4408 * @endcode
4409 *
4410 * get vectors for projection onto mixed fe values
4411 *
4412 * @code
4413 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
4414 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
4415 *   updated_temperature_values.at(q_point) =
4416 *   current_temperature_values.at(q_point)
4417 *   + updated_temperature_increments.at(q_point);
4418 *  
4419 *   const auto current_F = get_deformation_gradient(
4420 *   current_displacement_gradients[q_point],
4421 *   current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
4422 *   );
4423 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(current_F);
4424 *  
4425 *   [[maybe_unused]] const auto mesh_motion_gradient = get_deformation_gradient(
4426 *   -mesh_motion_gradient_increments[q_point],
4427 *   -mesh_motion_value_increments[q_point][0]/fe_values.quadrature_point(q_point)[0]);
4428 *  
4429 *   const Tensor<2, dim+1, Number> updated_F = get_deformation_gradient(
4430 *   current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
4431 *   (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])
4432 *   /fe_values.quadrature_point(q_point)[0]
4433 *   );
4434 *  
4435 *  
4436 *   const Number Jacobian = material_Jacobian * determinant(updated_F);
4437 *   deformation_jacobians.at(q_point) = Jacobian;
4438 *   previous_deformation_jacobian.at(q_point) = material_Jacobian * determinant(current_F);
4439 *  
4440 *   const auto inv_updated_F = invert(updated_F);
4441 *   std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
4442 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4443 *   rate_gradients[i] = postprocess_tensor_dimension(
4444 *   fe_values[displacements].gradient(i, q_point),
4445 *   fe_values[displacements].value(i, q_point)[0]/fe_values.quadrature_point(q_point)[0]) * inv_updated_F;
4446 *   }
4447 *  
4448 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4449 *   const Number strain_divergence_i = trace(rate_gradients[i]);
4450 *   strain_divergences[i].at(q_point) = Jacobian * strain_divergence_i;
4451 *   if (fill_system_matrix) {
4452 *   jacobian_tangents[i].at(q_point) = Jacobian * strain_divergence_i;
4453 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4454 *   strain_divergence_tangents[i][j].at(q_point) =
4455 *   Jacobian
4456 *   * (trace(rate_gradients[i]) * trace(rate_gradients[j])
4457 *   - trace(rate_gradients[i] * rate_gradients[j]));
4458 *   }
4459 *   }
4460 *   }
4461 *   }
4462 *  
4463 *   const unsigned int cell_index = cell->user_index() / n_q_points;
4464 *  
4465 *   mixed_fe_projector[cell_index].project(
4466 *   &projected_temperature_coefficients,
4467 *   updated_temperature_values);
4468 *   mixed_fe_projector[cell_index].project(
4469 *   &projected_Jacobian_coefficients,
4470 *   deformation_jacobians);
4471 *   mixed_fe_projector[cell_index].project(
4472 *   &projected_previous_Jacobian_coefficients,
4473 *   previous_deformation_jacobian);
4474 *   mixed_fe_projector[cell_index].project(
4475 *   &projected_previous_temperature_coefficients,
4476 *   current_temperature_values);
4477 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4478 *   mixed_fe_projector[cell_index].project(
4479 *   &projected_strain_divergence_coefficients[i],
4480 *   strain_divergences[i]);
4481 *   if (fill_system_matrix) {
4482 *   mixed_fe_projector[cell_index].project(
4483 *   &projected_jacobian_tangent_coefficients[i],
4484 *   jacobian_tangents[i]);
4485 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4486 *   mixed_fe_projector[cell_index].project(
4487 *   &projected_strain_divergence_tangent_coefficients[i][j],
4488 *   strain_divergence_tangents[i][j]);
4489 *   }
4490 *   }
4491 *   }
4492 *  
4493 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
4494 *   ConstitutiveModelUpdateFlags materialUpdateFlags =
4495 *   (update_pressure | update_stress_deviator);
4496 *  
4497 *   if (fill_system_matrix) {
4498 *   materialUpdateFlags |=
4499 *   (update_pressure_tangent | update_stress_deviator_tangent);
4500 *   }
4501 *  
4502 *   ConstitutiveModelRequest<dim+1, Number> previous_constitutive_request(materialUpdateFlags);
4503 *  
4504 *   if (update_material_state) {
4505 *   materialUpdateFlags |= update_material_point_history;
4506 *   }
4507 *  
4508 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
4509 *   ConstitutiveModelRequest<dim+1, Number> constitutive_request(materialUpdateFlags);
4510 *  
4511 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
4512 *   mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
4513 *   }
4514 *  
4515 *   const Number radius = fe_values.quadrature_point(q_point)[0];
4516 *   const auto current_F = get_deformation_gradient(
4517 *   current_displacement_gradients[q_point],
4518 *   current_displacement_values[q_point][0]/radius
4519 *   );
4520 *  
4521 *   const auto mesh_motion_gradient = get_deformation_gradient(
4522 *   -mesh_motion_gradient_increments[q_point],
4523 *   -mesh_motion_value_increments[q_point][0]/radius);
4524 *  
4525 *   const Tensor<2, dim+1, Number> updated_F = get_deformation_gradient(
4526 *   current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
4527 *   (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/radius);
4528 *  
4529 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(current_F);
4530 *   [[maybe_unused]] const Number mesh_motion_Jacobian = determinant(mesh_motion_gradient);
4531 *  
4532 *   const auto inv_updated_F = invert(updated_F);
4533 *   const Number Jacobian = determinant(updated_F) * material_Jacobian;
4534 *   const Number previous_Jacobian = determinant(current_F) * material_Jacobian;
4535 *  
4536 *  
4537 *   const Number DENSITY = 8.96e-9;
4538 *  
4539 *   const Tensor<1, dim+1, Number> displacement_increment = postprocess_tensor_dimension(displacement_increments[q_point]);
4540 *   const Tensor<1, dim+1, Number> displacement_previous_time_rate = postprocess_tensor_dimension(displacement_previous_time_rates[q_point]);
4541 *   const Tensor<1, dim+1, Number> displacement_previous_second_time_rate = postprocess_tensor_dimension(displacement_previous_second_time_rates[q_point]);
4542 *   const Tensor<2, dim+1, Number> displacement_gradient_previous_time_rate = postprocess_tensor_dimension(
4543 *   displacement_gradient_previous_time_rates[q_point], displacement_previous_time_rates[q_point][0]/radius);
4544 *   const Tensor<2, dim+1, Number> displacement_gradient_previous_second_time_rate = postprocess_tensor_dimension(
4545 *   displacement_gradient_previous_second_time_rates[q_point], displacement_previous_second_time_rates[q_point][0]/radius);
4546 *  
4547 *   const Tensor<1, dim+1, Number> uc_increment = scalar_to_angular_tensor(angular_velocity_increments[q_point]);
4548 *   const Tensor<1, dim+1, Number> vc_n = scalar_to_angular_tensor(angular_velocity_previous_time_rates[q_point]);
4549 *   const Tensor<1, dim+1, Number> d_vc_d_t_n = scalar_to_angular_tensor(angular_velocity_previous_second_time_rates[q_point]);
4550 *  
4551 *   const Tensor<1, dim+1, Number> d2_x_dt_2_n_plus_1 =
4552 *   (1./(beta*time_increment*time_increment))
4553 *   * (displacement_increment
4554 *   - time_increment * displacement_previous_time_rate
4555 *   - time_increment * time_increment * (0.5-beta) * displacement_previous_second_time_rate);
4556 *  
4557 *   const Tensor<1, dim+1, Number> d_x_dt_n_plus_1 =
4558 *   displacement_previous_time_rate + time_increment * ((1-gamma) * displacement_previous_second_time_rate + gamma * d2_x_dt_2_n_plus_1);
4559 *  
4560 *   const Tensor<2, dim+1, Number> Grad_d_2_x_d_t_2_n_plus_1 =
4561 *   (1./(beta*time_increment*time_increment))
4562 *   * (postprocess_tensor_dimension(
4563 *   displacement_gradient_increments[q_point],
4564 *   displacement_value_increments[q_point][0]/radius)
4565 *   - time_increment * displacement_gradient_previous_time_rate
4566 *   - time_increment * time_increment * (0.5-beta) * displacement_gradient_previous_second_time_rate);
4567 *  
4568 *   const Tensor<2, dim+1, Number> Grad_d_x_d_t_n_plus_1 =
4569 *   displacement_gradient_previous_time_rate
4570 *   + time_increment * (
4571 *   (1.-gamma) * displacement_gradient_previous_second_time_rate
4572 *   + gamma * Grad_d_2_x_d_t_2_n_plus_1);
4573 *  
4574 *   const Tensor<1, dim+1, Number> d_vc_d_t_n_plus_1 =
4575 *   (1./(beta*time_increment*time_increment))
4576 *   * (uc_increment
4577 *   - time_increment * vc_n
4578 *   - time_increment * time_increment * (0.5-beta) * d_vc_d_t_n);
4579 *  
4580 *   const Tensor<1, dim+1, Number> vc_n_plus_1 =
4581 *   vc_n + time_increment * ((1-gamma) * d_vc_d_t_n + gamma * d_vc_d_t_n_plus_1);
4582 *  
4583 *   const Number thR_increment = angular_velocity_increments[q_point];
4584 *   const Number d_thR_d_t_n = angular_velocity_previous_time_rates[q_point];
4585 *   const Number d2_thR_d_t2_n = angular_velocity_previous_second_time_rates[q_point];
4586 *  
4587 *   const Number d2_thR_d_t2_n_plus_1 =
4588 *   (1./(beta*time_increment*time_increment))
4589 *   * (thR_increment
4590 *   - time_increment * d_thR_d_t_n
4591 *   - time_increment * time_increment * (0.5-beta) * d2_thR_d_t2_n);
4592 *  
4593 *   const Number d_thR_d_t_n_plus_1 =
4594 *   d_thR_d_t_n + time_increment * ((1-gamma) * d2_thR_d_t2_n + gamma * d2_thR_d_t2_n_plus_1);
4595 *  
4596 *   const Number one_plus_r_over_R_n = 1.0 + current_displacement_values[q_point][0]/radius;
4597 *   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;
4598 *   const Number d_r_d_t_n_over_R = displacement_previous_time_rate[0] / radius;
4599 *   const Number d_r_d_t_n_plus_one_over_R = d_x_dt_n_plus_1[0] / radius;
4600 *  
4601 *   Tensor<1, dim+1, Number> e_hat_R;
4602 *   e_hat_R[0] = 1;
4603 *  
4604 *   const Tensor<1, dim+1, Number> acceleration_n_plus_1 =
4605 *   d2_x_dt_2_n_plus_1
4606 *   + scalar_to_angular_tensor(
4607 *   d_r_d_t_n_plus_one_over_R * d_thR_d_t_n_plus_1
4608 *   + one_plus_r_over_R_n_plus_1 * d2_thR_d_t2_n_plus_1)
4609 *   - (1.0/radius) * one_plus_r_over_R_n_plus_1 * std::pow(d_thR_d_t_n_plus_1, 2) * e_hat_R;
4610 *  
4611 *   const Tensor<1, dim+1, Number> acceleration_n =
4612 *   displacement_previous_second_time_rate
4613 *   + scalar_to_angular_tensor(
4614 *   d_r_d_t_n_over_R * d_thR_d_t_n
4615 *   + one_plus_r_over_R_n * d2_thR_d_t2_n)
4616 *   - (1.0/radius) * one_plus_r_over_R_n * std::pow(d_thR_d_t_n, 2) * e_hat_R;
4617 *  
4618 *   const Tensor<1, dim+1, Number> acceleration_n_plus_1_minus_alpha_m =
4619 *   alpha_m * acceleration_n + (1-alpha_m) * acceleration_n_plus_1;
4620 *  
4621 *   Tensor<2, dim+1, Number> acceleration_n_plus_1_minus_alpha_m_tangent_modulus;
4622 *   for(unsigned int i=0; i<dim; i++) {
4623 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[i][i] += (1-alpha_m) * d_second_time_rate_d_increment;
4624 *   }
4625 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[dim][0] +=
4626 *   (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);
4627 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[0][0] +=
4628 *   (1-alpha_m) * (-(1.0/radius) * (1.0/radius) * std::pow(d_thR_d_t_n_plus_1, 2));
4629 *  
4630 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[dim][dim] +=
4631 *   (1-alpha_m)
4632 *   * (d_r_d_t_n_plus_one_over_R * d_time_rate_d_increment
4633 *   + one_plus_r_over_R_n_plus_1 * d_second_time_rate_d_increment);
4634 *   acceleration_n_plus_1_minus_alpha_m_tangent_modulus[0][dim] +=
4635 *   (1-alpha_m)
4636 *   * (-(1.0/radius) * one_plus_r_over_R_n * 2 * d_thR_d_t_n * d_time_rate_d_increment);
4637 *  
4638 *  
4639 *   [[maybe_unused]] const auto d2_x_dt_2_n_plus_1_minus_alpha_m =
4640 *   alpha_m * displacement_previous_second_time_rate + (1-alpha_m)*d2_x_dt_2_n_plus_1;
4641 *   [[maybe_unused]] const Number d2_x_dt_2_tangent_1_minus_alpha_m = (1-alpha_m)*d_second_time_rate_d_increment;
4642 *  
4643 *   [[maybe_unused]] const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f =
4644 *   alpha_m * displacement_gradient_previous_time_rate * vc_n
4645 *   + (1-alpha_m) * Grad_d_x_d_t_n_plus_1 * vc_n_plus_1;
4646 *  
4647 *   [[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;
4648 *   [[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;
4649 *  
4650 *   [[maybe_unused]] const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m =
4651 *   alpha_m * current_F * d_vc_d_t_n
4652 *   + (1-alpha_m) * updated_F * d_vc_d_t_n_plus_1;
4653 *  
4654 *   [[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;
4655 *   [[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;
4656 *  
4657 *   std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
4658 *   std::vector<Tensor<2, dim+1, Number>> angular_rate_gradients(dofs_per_cell);
4659 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4660 *   rate_gradients[i] =
4661 *   postprocess_tensor_dimension(
4662 *   fe_values[displacements].gradient(i, q_point),
4663 *   fe_values[displacements].value(i, q_point)[0]/radius) * inv_updated_F;
4664 *   angular_rate_gradients[i] =
4665 *   order_1_tensor_to_angular_gradient(
4666 *   fe_values[angular_velocity].gradient(i, q_point),
4667 *   -fe_values[angular_velocity].value(i, q_point)/radius);
4668 *   }
4669 *  
4670 *   const Tensor<2, dim+1, Number> d_X_prime_d_X = deformation_gradient_from_angular_displacement_gradient(
4671 *   -angular_velocity_increments[q_point],
4672 *   -angular_velocity_gradient_increments[q_point],
4673 *   radius
4674 *   );
4675 *  
4676 *   const Tensor<2, dim+1, Number> rotation_to_X_prime_frame = rotation_tensor_to_transform_B_e(
4677 *   -angular_velocity_increments[q_point],
4678 *   radius
4679 *   );
4680 *  
4681 *   const Tensor<2, dim+1, Number> inv_d_X_prime_d_X = invert(d_X_prime_d_X);
4682 *  
4683 *   const auto f_m_n_plus_1 = inv_d_X_prime_d_X * rotation_to_X_prime_frame;
4684 *  
4685 * @endcode
4686 *
4687 * std::cout << "f_r: " << inv_d_X_prime_d_X << std::endl;
4688 * std::cout << "R: " << previous_elastic_deformation_transformation_tensor << std::endl;
4689 * std::cout << "f_m_n+1: " << f_m_n_plus_1 << std::endl;
4690 *
4691
4692 *
4693 *
4694 * @code
4695 *   Number projected_jacobian = 0;
4696 *   Number projected_previous_jacobian = 0;
4697 *   Number projected_temperature = 0;
4698 *   Number projected_previous_temperature = 0;
4699 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
4700 *   projected_jacobian +=
4701 *   mixed_values(i) * projected_Jacobian_coefficients.at(i);
4702 *   projected_previous_jacobian +=
4703 *   mixed_values(i) * projected_previous_Jacobian_coefficients.at(i);
4704 *   projected_temperature +=
4705 *   mixed_values(i) * projected_temperature_coefficients.at(i);
4706 *   projected_previous_temperature +=
4707 *   mixed_values(i) * projected_previous_temperature_coefficients.at(i);
4708 *   }
4709 *  
4710 *   const auto unnormalized_deformation_gradient_increment = updated_F * f_m_n_plus_1 * invert(current_F);
4711 *  
4712 *   const auto deformation_gradient_increment =
4713 *   std::pow(determinant(unnormalized_deformation_gradient_increment),
4714 *   -Constants<dim, Number>::one_third()) * unnormalized_deformation_gradient_increment;
4715 *  
4716 *   if(std::abs(determinant(deformation_gradient_increment)-1.0) > 1e-8)
4717 *   std::cout << "determinant(deformation_gradient_increment): " << determinant(deformation_gradient_increment) << std::endl;
4718 *  
4719 *   if(false && std::isnan(deformation_gradient_increment.norm())) {
4720 *   std::cout << "deformation_gradient_increment is nan: " << deformation_gradient_increment << std::endl;
4721 *   std::cout << "Jacobian: " << Jacobian
4722 *   << "\nf_m_n_plus_1: " << f_m_n_plus_1
4723 *   << "\ndet(f_m_n_plus_1): " << determinant(f_m_n_plus_1)
4724 *   << "\nprevious_Jacobian: " << previous_Jacobian
4725 *   << "\nupdated_F: " << updated_F
4726 *   << "\ncurrent_F: " << current_F
4727 *   << "\ninvert(current_F): " << invert(current_F)
4728 *   << std::endl;
4729 *   }
4730 *  
4731 *   constitutive_request.set_deformation_Jacobian(projected_jacobian);
4732 *   constitutive_request.set_unprojected_deformation_Jacobian(determinant(updated_F) * material_Jacobian);
4733 *   constitutive_request.set_temperature(projected_temperature);
4734 *   constitutive_request.set_deformation_gradient(deformation_gradient_increment);
4735 *   constitutive_request.set_time_increment(time_increment);
4736 *  
4737 *   try {
4738 *   material.compute_constitutive_request(constitutive_request,
4739 *   quadrature_point_index);
4740 *   } catch (const MaterialDomainException &exc) {
4741 * @endcode
4742 *
4743 * std::cerr << "projected_jacobian: " << projected_jacobian
4744 * << "\ndeformation_gradient_increment: " << deformation_gradient_increment
4745 * << "\nupdated_F: " << updated_F
4746 * << "\nf_m_n_plus_1: " << f_m_n_plus_1
4747 * << "\ncurrent_F: " << current_F
4748 * << "\ninvert(current_F): " << invert(current_F)
4749 * << "\nJacobian: " << Jacobian
4750 * << "\ndeterminant(f_m_n_plus_1): " << determinant(f_m_n_plus_1)
4751 * << "\nprevious_Jacobian: " << previous_Jacobian
4752 * << "\n-------------------\n"
4753 * << std::endl;
4754 * std::cerr << exc.what() << std::endl;
4755 *
4756 * @code
4757 *   kinematic_domains_are_valid = false;
4758 *   continue;
4759 *   }
4760 *  
4761 *   previous_constitutive_request.set_deformation_Jacobian(projected_previous_jacobian);
4762 *   previous_constitutive_request.set_temperature(projected_previous_temperature);
4763 *   previous_constitutive_request.set_deformation_gradient(unit_symmetric_tensor<dim+1, Number>());
4764 *   previous_constitutive_request.set_time_increment(time_increment);
4765 *   previous_constitutive_request.set_is_plastic(false); // the elastic strain is known, no need for predictor-corrector procedure
4766 *  
4767 *   material.compute_constitutive_request(previous_constitutive_request,
4768 *   quadrature_point_index);
4769 *  
4770 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4771 *   projected_strain_divergence[j] =
4772 *   mixed_values(0) * projected_strain_divergence_coefficients[j][0];
4773 *   if (fill_system_matrix) {
4774 *   projected_jacobian_tangent[j] =
4775 *   mixed_values(0) * projected_jacobian_tangent_coefficients[j][0];
4776 *   for (unsigned int k = 0; k < dofs_per_cell; ++k) {
4777 *   projected_strain_divergence_tangent[j][k] =
4778 *   mixed_values(0)
4779 *   * projected_strain_divergence_tangent_coefficients[j][k][0];
4780 *   }
4781 *   }
4782 *   }
4783 *  
4784 *   for (unsigned int i = 1; i < mixed_dofs_per_cell; ++i) {
4785 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4786 *   projected_strain_divergence[j] +=
4787 *   mixed_values(i) * projected_strain_divergence_coefficients[j][i];
4788 *   if (fill_system_matrix) {
4789 *   projected_jacobian_tangent[j] +=
4790 *   mixed_values(i) * projected_jacobian_tangent_coefficients[j][i];
4791 *   for (unsigned int k = 0; k < dofs_per_cell; ++k) {
4792 *   projected_strain_divergence_tangent[j][k] +=
4793 *   mixed_values(i)
4794 *   * projected_strain_divergence_tangent_coefficients[j][k][i];
4795 *   }
4796 *   }
4797 *   }
4798 *   }
4799 *  
4800 *   const Number RJxW = radius / material_Jacobian * fe_values.JxW(q_point);
4801 *  
4802 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4803 *   const auto strain_i = symmetrize(rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F);
4804 *  
4805 * @endcode
4806 *
4807 * stress deviator term
4808 *
4809 * @code
4810 *   const SymmetricTensor<2, dim+1, Number> stress_deviator =
4811 *   alpha_f * previous_constitutive_request.get_stress_deviator()
4812 *   + (1-alpha_f) * constitutive_request.get_stress_deviator();
4813 *   const Number pressure =
4814 *   alpha_f * previous_constitutive_request.get_pressure()
4815 *   + (1-alpha_f) * constitutive_request.get_pressure();
4816 *   cell_residual(i) += strain_i * stress_deviator * RJxW;
4817 *  
4818 * @endcode
4819 *
4820 * pressure term
4821 *
4822 * @code
4823 *   cell_residual(i) +=
4824 *   (projected_strain_divergence.at(i)) * pressure * RJxW;
4825 *  
4826 * @endcode
4827 *
4828 * body force term
4829 *
4830 * @code
4831 *   const unsigned int
4832 *   component_i = mech_fe.system_to_component_index(i).first;
4833 *   for ( typename std::vector<BodyForceApplier<dim, Number> >::const_iterator
4834 *   bodyForceApplier = mechanical_lbc_system.bodyLoadAppliers.begin();
4835 *   bodyForceApplier != mechanical_lbc_system.bodyLoadAppliers.end();
4836 *   ++bodyForceApplier) {
4837 *   cell_residual(i) +=
4838 *   bodyForceApplier->apply(
4839 *   component_i,
4840 *   fe_values.shape_value (i, q_point),
4841 *   RJxW);
4842 *   }
4843 *  
4844 * @endcode
4845 *
4846 * inertial term
4847 *
4848 * @code
4849 *   cell_residual(i) +=
4850 *   (postprocess_tensor_dimension(fe_values[displacements].value(i, q_point)) + scalar_to_angular_tensor(fe_values[angular_velocity].value(i, q_point)))
4851 *   * DENSITY
4852 *   * acceleration_n_plus_1_minus_alpha_m * RJxW;
4853 *   }
4854 *  
4855 *   if (fill_system_matrix) {
4856 *   std::vector<SymmetricTensor<2, dim+1, Number> > stress_deviator_tangents(dofs_per_cell);
4857 *   std::vector<Number> pressure_tangents(dofs_per_cell);
4858 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4859 *  
4860 *   const Tensor<2, dim+1, Number> d_X_prime_d_X_variation =
4861 *   deformation_gradient_from_angular_displacement_gradient_variations(
4862 *   -angular_velocity_increments[q_point],
4863 *   -angular_velocity_gradient_increments[q_point],
4864 *   radius,
4865 *   -fe_values[angular_velocity].value(i, q_point),
4866 *   -fe_values[angular_velocity].gradient(i, q_point)
4867 *   );
4868 *  
4869 *   const Tensor<2, dim+1, Number> rotation_to_X_prime_frame_variation = rotation_tensor_variation_to_transform_B_e(
4870 *   -angular_velocity_increments[q_point],
4871 *   -fe_values[angular_velocity].value(i, q_point),
4872 *   radius
4873 *   );
4874 *  
4875 *   const auto f_m_n_plus_1_variation_inv_f_m_n_plus_1 =
4876 *   (- inv_d_X_prime_d_X * d_X_prime_d_X_variation * inv_d_X_prime_d_X * rotation_to_X_prime_frame
4877 *   + inv_d_X_prime_d_X * rotation_to_X_prime_frame_variation) * invert(f_m_n_plus_1);
4878 *  
4879 *   stress_deviator_tangents[i] = (1-alpha_f) * constitutive_request.get_stress_deviator_tangent(
4880 *   rate_gradients[i]
4881 *   - Constants<dim+1, Number>::one_third()
4882 *   * trace(rate_gradients[i])
4883 *   * unit_symmetric_tensor<dim+1, Number>()
4884 *   + updated_F * f_m_n_plus_1_variation_inv_f_m_n_plus_1 * inv_updated_F
4885 *   - Constants<dim+1, Number>::one_third()
4886 *   * trace(f_m_n_plus_1_variation_inv_f_m_n_plus_1)
4887 *   * unit_symmetric_tensor<dim+1, Number>());
4888 *  
4889 *   pressure_tangents[i] = (1-alpha_f) * constitutive_request.get_pressure_tangent(
4890 *   projected_jacobian_tangent[i]);
4891 *   }
4892 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4893 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4894 * @endcode
4895 *
4896 * stress tangent
4897 *
4898 * @code
4899 *   const Number f_int_dev_tau = symmetrize(rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F) * stress_deviator_tangents[j];
4900 *   cell_matrix(i, j) += (f_int_dev_tau) * RJxW;
4901 * @endcode
4902 *
4903 * pressure_tangent
4904 *
4905 * @code
4906 *   const Number f_int_pressure =
4907 *   projected_strain_divergence.at(i)
4908 *   * pressure_tangents[j];
4909 *   cell_matrix(i, j) += (f_int_pressure) * RJxW;
4910 * @endcode
4911 *
4912 * geometric_tangent
4913 *
4914 * @code
4915 *   const Tensor<2, dim+1, Number> grad_ui_grad_uj = (rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F) * rate_gradients[j];
4916 *   const SymmetricTensor<2, dim+1, Number> sym_grad_ui_grad_uj = symmetrize(grad_ui_grad_uj);
4917 *   const Number f_int_geom =
4918 *   projected_strain_divergence_tangent[i][j]
4919 *   * constitutive_request.get_pressure()
4920 *   - sym_grad_ui_grad_uj
4921 *   * constitutive_request.get_stress_deviator();
4922 *   cell_matrix(i, j) += (f_int_geom) * RJxW;
4923 *  
4924 * @endcode
4925 *
4926 * inertial tangent
4927 *
4928 * @code
4929 *   cell_matrix(i, j) +=
4930 *   (postprocess_tensor_dimension(fe_values[displacements].value(i, q_point))
4931 *   + scalar_to_angular_tensor(fe_values[angular_velocity].value(i, q_point)))
4932 *   * DENSITY
4933 *   * (acceleration_n_plus_1_minus_alpha_m_tangent_modulus
4934 *   * (postprocess_tensor_dimension(fe_values[displacements].value(j, q_point))
4935 *   + scalar_to_angular_tensor(fe_values[angular_velocity].value(j, q_point))))
4936 *   * RJxW;
4937 *   }
4938 *   }
4939 *   }
4940 *   }
4941 *  
4942 *   for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
4943 *   for (auto boundaryForceSpec: mechanical_lbc_system.boundaryLoadAppliers) {
4944 *   if (cell->face(face)->boundary_id() == static_cast<types::boundary_id>(boundaryForceSpec.first)) {
4945 *   fe_face_values.reinit(cell, face);
4946 *   for (unsigned int q_point = 0; q_point < n_face_q_points; ++q_point) {
4947 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4948 *   const unsigned int component_i = mech_fe.system_to_component_index(i).first;
4949 *   cell_residual(i) +=
4950 *   boundaryForceSpec.second.apply(
4951 *   component_i,
4952 *   fe_face_values.shape_value(i, q_point),
4953 *   fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point));
4954 *   }
4955 *   }
4956 *   }
4957 *   }
4958 *  
4959 *   for(const auto boundary_unidirectional_penalty_spec: mechanical_lbc_system.boundary_unidirectional_penalty_specs) {
4960 *   if (cell->face(face)->boundary_id() == boundary_unidirectional_penalty_spec->get_boundary_id()) {
4961 *   const Number reference_displacement_increment = boundary_unidirectional_penalty_spec->get_reference_displacement_increment();
4962 *   const Number residual_force = boundary_unidirectional_penalty_spec->get_residual_force();
4963 *   const Number quadratic_spring_factor = boundary_unidirectional_penalty_spec->get_quadratic_spring_factor();
4964 *  
4965 *   fe_face_values.reinit(cell, face);
4966 *   fe_face_values[displacements].get_function_values(
4967 *   Newton_system.current_increment,
4968 *   face_displacement_value_increments);
4969 *   for (unsigned int q_point = 0; q_point < n_face_q_points; ++q_point) {
4970 *   const Tensor<1, dim, Number> surface_normal = fe_face_values.normal_vector(q_point);
4971 *   const Number surface_displacement = face_displacement_value_increments[q_point] * surface_normal;
4972 *   const Number surface_force =
4973 *   -residual_force
4974 *   + surface_displacement < -reference_displacement_increment?
4975 *   0 :
4976 *   -0.5 * quadratic_spring_factor * std::pow(surface_displacement + reference_displacement_increment, 2);
4977 *   const Number surface_force_tangent_modulus =
4978 *   surface_displacement < -reference_displacement_increment?
4979 *   0 :
4980 *   -quadratic_spring_factor * (surface_displacement + reference_displacement_increment);
4981 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
4982 *   cell_residual(i) -=
4983 *   fe_face_values[displacements].value(i, q_point)
4984 *   * surface_force * surface_normal
4985 *   * fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point);
4986 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
4987 *   cell_matrix(i, j) -=
4988 *   fe_face_values[displacements].value(i, q_point)
4989 *   * surface_force_tangent_modulus * (fe_face_values[displacements].value(j, q_point) * surface_normal) * surface_normal
4990 *   * fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point);
4991 *   }
4992 *   }
4993 *   }
4994 *   }
4995 *   }
4996 *   }
4997 *  
4998 * @endcode
4999 *
5000 * const Number relative_symmetry_norm2 = cell_matrix.relative_symmetry_norm2();
5001 * if(relative_symmetry_norm2 > 1e-8)
5002 * std::cout << "relative_symmetry_norm2: " << cell_matrix.relative_symmetry_norm2() << std::endl;
5003 *
5004
5005 *
5006 *
5007 * @code
5008 *   std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5009 *   cell->get_dof_indices (local_dof_indices);
5010 *   if (fill_system_matrix) {
5011 *   mechanical_dof_system.nodal_constraints.distribute_local_to_global(
5012 *   cell_matrix,
5013 *   cell_residual,
5014 *   local_dof_indices,
5015 *   Newton_system.Newton_step_matrix,
5016 *   Newton_system.Newton_step_residual,
5017 *   true);
5018 *   } else {
5019 *   mechanical_dof_system.nodal_constraints.distribute_local_to_global(
5020 *   cell_residual, local_dof_indices,
5021 *   Newton_system.Newton_step_residual);
5022 *   }
5023 *   } /* if cell is locally owned */
5024 *   } /*for (; cell!=endc; ++cell)*/
5025 *  
5026 *   const unsigned short local_domain_is_valid = kinematic_domains_are_valid ? 1 : 0;
5027 *   unsigned short all_kinematic_domains_are_valid;
5028 *  
5029 * @endcode
5030 *
5031 * did any of the processes fail to assemble?
5032 *
5033 * @code
5034 *   MPI_Allreduce(
5035 *   &local_domain_is_valid,
5036 *   &all_kinematic_domains_are_valid, 1, MPI_UNSIGNED_SHORT,
5037 *   MPI_MIN, mpi_communicator);
5038 *  
5039 *   if (all_kinematic_domains_are_valid < 1) {
5040 *   throw std::runtime_error("The domain is not valid...");
5041 *   }
5042 *  
5043 *   if (fill_system_matrix) {
5044 *   Newton_system.Newton_step_matrix.compress(VectorOperation::add);
5045 *   }
5046 *   Newton_system.Newton_step_residual.compress(VectorOperation::add);
5047 *  
5048 *   } /*PlasticityLabProg<dim,Number>::assemble_mechanical_system()*/
5049 *  
5050 *  
5051 *   template <int dim, typename Number>
5052 *   void PlasticityLabProg<dim, Number>::assemble_thermal_system(
5053 *   NewtonStepSystem &Newton_system,
5054 *   NewtonStepSystem &mechanical_nonlinear_system,
5055 *   const DoFSystem<dim, Number> &thermal_dof_system,
5056 *   const LBCSystem<dim, Number, 1> &thermal_lbc_system,
5057 *   const DoFSystem<dim, Number> &mechanical_dof_system,
5058 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
5059 *   Material<dim+1, Number> &material,
5060 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
5061 *   const std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors,
5062 *   const bool fill_system_matrix) {
5063 *  
5064 *   FEValues<dim> fe_values(
5065 *   mapping,
5066 *   therm_fe,
5067 *   quadrature_formula,
5069 *  
5070 *   FEFaceValues<dim> fe_face_values(
5071 *   mapping,
5072 *   therm_fe,
5073 *   face_quadrature_formula,
5076 *   | update_JxW_values);
5077 *  
5078 *   FEValues<dim> fe_mech_values(
5079 *   mapping,
5080 *   mech_fe,
5081 *   quadrature_formula,
5083 *  
5084 *   FEFaceValues<dim> mech_fe_face_values(
5085 *   mapping,
5086 *   mech_fe,
5087 *   face_quadrature_formula,
5092 *   | update_JxW_values);
5093 *  
5094 *   FEValues<dim> mixed_fe_values(
5095 *   mapping,
5096 *   mixed_var_fe,
5097 *   quadrature_formula,
5098 *   update_values);
5099 *  
5100 *   const unsigned int dofs_per_cell = therm_fe.dofs_per_cell;
5101 *   const unsigned int n_q_points = quadrature_formula.size();
5102 *   const unsigned int n_face_q_points = face_quadrature_formula.size();
5103 *   const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
5104 *  
5105 *   FullMatrix<Number> cell_matrix (dofs_per_cell, dofs_per_cell);
5106 *   Vector<Number> cell_residual (dofs_per_cell);
5107 *  
5108 *   Vector<Number> mixed_values (mixed_dofs_per_cell);
5109 *   std::vector<Number> weighted_updated_J_vec(mixed_dofs_per_cell),
5110 *   weighted_current_J_vec(mixed_dofs_per_cell),
5111 *   weighted_previous_J_vec(mixed_dofs_per_cell),
5112 *   weighted_updated_theta_vec(mixed_dofs_per_cell),
5113 *   weighted_previous_theta_vec(mixed_dofs_per_cell),
5114 *   weighted_J_time_rate_vec(mixed_dofs_per_cell);
5115 *   std::vector< std::vector<Number> > weighted_shape_values(
5116 *   dofs_per_cell,
5117 *   std::vector<Number>(mixed_dofs_per_cell) );
5118 *  
5119 *   std::vector<Number> qp_updated_J_values(n_q_points),
5120 *   qp_previous_J_values(n_q_points),
5121 *   qp_updated_theta_values(n_q_points),
5122 *   qp_previous_theta_values(n_q_points),
5123 *   qp_J_time_rates(n_q_points);
5124 *   std::vector<std::vector<Number> > qp_shape_values(
5125 *   dofs_per_cell,
5126 *   std::vector<Number>(n_q_points));
5127 *  
5128 *   std::vector< Tensor<1, dim, Number> > thermal_gradient_increment(n_q_points),
5129 *   current_thermal_gradient(n_q_points);
5130 *  
5131 *   std::vector< Number > current_temperature_values(n_q_points),
5132 *   temperature_values_increment(n_q_points);
5133 *  
5134 *   std::vector< Number > current_face_temperature_values(n_face_q_points),
5135 *   face_temperature_values_increment(n_face_q_points);
5136 *  
5137 *   std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points),
5138 *   displacement_gradient_increments(n_q_points);
5139 *   std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points),
5140 *   displacement_value_increments(n_q_points);
5141 *  
5142 *   std::vector< Tensor<1, dim, Number> > current_angular_velocity_gradients(n_q_points),
5143 *   angular_velocity_gradient_increments(n_q_points),
5144 *   angular_velocity_gradient_previous_time_rates(n_q_points);
5145 *  
5146 *   std::vector< Number > angular_velocity_increments(n_q_points),
5147 *   current_angular_velocities(n_q_points),
5148 *   angular_velocity_previous_time_rates(n_q_points);
5149 *  
5150 *   std::vector< Tensor<2, dim, Number> > current_face_displacement_gradients(n_face_q_points);
5151 *   std::vector< Tensor<2, dim, Number> > face_displacement_gradient_increments(n_face_q_points);
5152 *  
5153 *   std::vector< Tensor<1, dim, Number> > current_face_displacement_values(n_face_q_points);
5154 *   std::vector< Tensor<1, dim, Number> > face_displacement_value_increments(n_face_q_points);
5155 *  
5157 *   const FEValuesExtractors::Vector displacements (0);
5158 *   const FEValuesExtractors::Scalar angular_velocity(dim);
5159 *   Newton_system.Newton_step_matrix = 0;
5160 *   Newton_system.Newton_step_residual = 0;
5161 *   Newton_system.Newton_step_matrix.compress(VectorOperation::insert);
5162 *   Newton_system.Newton_step_residual.compress(VectorOperation::insert);
5163 *  
5164 *   auto cell = thermal_dof_system.dof_handler.begin_active();
5165 *   auto endc = thermal_dof_system.dof_handler.end();
5166 *   auto mechanical_cell = mechanical_dof_system.dof_handler.begin_active();
5167 *   auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
5168 *   for (; cell != endc; ++cell, ++mechanical_cell, ++mixed_fe_cell) {
5169 *   if (cell->is_locally_owned()) {
5170 *   cell_matrix = 0;
5171 *   cell_residual = 0;
5172 *  
5173 *   fe_values.reinit (cell);
5174 *   fe_mech_values.reinit (mechanical_cell);
5175 *   mixed_fe_values.reinit (mixed_fe_cell);
5176 *  
5177 *   fe_values[temperature].get_function_gradients(
5178 *   Newton_system.current_increment,
5179 *   thermal_gradient_increment);
5180 *  
5181 *   fe_values[temperature].get_function_gradients(
5182 *   Newton_system.previous_deformation,
5183 *   current_thermal_gradient);
5184 *  
5185 *   fe_values[temperature].get_function_values(
5186 *   Newton_system.current_increment,
5187 *   temperature_values_increment);
5188 *  
5189 *   fe_values[temperature].get_function_values(
5190 *   Newton_system.previous_deformation,
5191 *   current_temperature_values);
5192 *  
5193 *   fe_mech_values[displacements].get_function_gradients(
5194 *   mechanical_nonlinear_system.current_increment,
5195 *   displacement_gradient_increments);
5196 *  
5197 *   fe_mech_values[displacements].get_function_gradients(
5198 *   mechanical_nonlinear_system.previous_deformation,
5199 *   current_displacement_gradients);
5200 *  
5201 *   fe_mech_values[displacements].get_function_values(
5202 *   mechanical_nonlinear_system.current_increment,
5203 *   displacement_value_increments);
5204 *  
5205 *   fe_mech_values[displacements].get_function_values(
5206 *   mechanical_nonlinear_system.previous_deformation,
5207 *   current_displacement_values);
5208 *  
5209 * @endcode
5210 *
5211 * Angular velocity
5212 *
5213 * @code
5214 *   fe_mech_values[angular_velocity].get_function_gradients(
5215 *   mechanical_nonlinear_system.current_increment,
5216 *   angular_velocity_gradient_increments);
5217 *  
5218 *   fe_mech_values[angular_velocity].get_function_values(
5219 *   mechanical_nonlinear_system.current_increment,
5220 *   angular_velocity_increments);
5221 *  
5222 * @endcode
5223 *
5224 * get vectors for projection onto mixed fe values
5225 *
5226 * @code
5227 *   for (unsigned int q_point = 0; q_point < n_q_points;
5228 *   ++q_point) {
5229 *  
5230 *   const Number radius = fe_mech_values.quadrature_point(q_point)[0];
5231 *  
5232 *   const auto previous_F = get_deformation_gradient(
5233 *   current_displacement_gradients[q_point],
5234 *   current_displacement_values[q_point][0]/radius);
5235 *  
5236 *   const auto updated_F = get_deformation_gradient(
5237 *   current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
5238 *   (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/radius);
5239 *  
5240 *   const auto deformation_gradient_increment = postprocess_tensor_dimension(
5241 *   displacement_gradient_increments[q_point],
5242 *   displacement_value_increments[q_point][0]/radius);
5243 *  
5244 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
5245 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(previous_F);
5246 *  
5247 *   const Number Jacobian = material_Jacobian * determinant(updated_F);
5248 *   const Number previous_Jacobian = material_Jacobian * determinant(previous_F);
5249 *  
5250 *   qp_previous_J_values.at(q_point) = previous_Jacobian;
5251 *   qp_updated_J_values.at(q_point) = Jacobian;
5252 *   qp_J_time_rates.at(q_point) = Jacobian * trace(deformation_gradient_increment * invert(updated_F)) / time_increment;
5253 *  
5254 *   qp_previous_theta_values.at(q_point) = current_temperature_values.at(q_point);
5255 *   qp_updated_theta_values.at(q_point) = current_temperature_values.at(q_point) + temperature_values_increment.at(q_point);
5256 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5257 *   qp_shape_values.at(i).at(q_point) = fe_values[temperature].value(i, q_point);
5258 *   }
5259 *   }
5260 *  
5261 *   const unsigned int cell_index = cell->user_index() / n_q_points;
5262 *  
5263 *   mixed_fe_projector[cell_index].project(
5264 *   &weighted_updated_J_vec,
5265 *   qp_updated_J_values);
5266 *   mixed_fe_projector[cell_index].project(
5267 *   &weighted_J_time_rate_vec,
5268 *   qp_J_time_rates);
5269 *   mixed_fe_projector[cell_index].project(
5270 *   &weighted_updated_theta_vec,
5271 *   qp_updated_theta_values);
5272 *   mixed_fe_projector[cell_index].project(
5273 *   &weighted_previous_J_vec,
5274 *   qp_previous_J_values);
5275 *   mixed_fe_projector[cell_index].project(
5276 *   &weighted_previous_theta_vec,
5277 *   qp_previous_theta_values);
5278 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5279 *   mixed_fe_projector[cell_index].project(
5280 *   &weighted_shape_values.at(i),
5281 *   qp_shape_values.at(i));
5282 *   }
5283 *  
5284 *   for (unsigned int q_point = 0; q_point < n_q_points;
5285 *   ++q_point) {
5286 *   const ConstitutiveModelUpdateFlags material_update_flags =
5287 *   fill_system_matrix ?
5288 *   (update_heat_flux | update_heat_flux_tangent
5289 *   | update_mechanical_dissipation
5290 *   | update_mechanical_dissipation_tangent
5291 *   | update_stored_heat | update_stored_heat_tangent)
5292 *   :
5293 *   (update_heat_flux | update_mechanical_dissipation
5294 *   | update_stored_heat);
5295 *  
5296 *   const ConstitutiveModelUpdateFlags heating_update_flags =
5297 *   fill_system_matrix ?
5298 *   (update_thermoelastic_heating
5299 *   | update_thermoelastic_heating_tangent)
5300 *   :
5301 *   (update_thermoelastic_heating);
5302 *  
5303 *   point_index_t quadrature_point_index = cell->user_index() + q_point;
5304 *   ConstitutiveModelRequest<dim+1, Number> constitutive_request(material_update_flags);
5305 *   ConstitutiveModelRequest<dim+1, Number> heating_request(heating_update_flags);
5306 *  
5307 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5308 *   mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
5309 *   }
5310 *  
5311 *   Number projected_updated_J = 0;
5312 *   Number projected_previous_J = 0;
5313 *   Number projected_updated_theta = 0;
5314 *   Number projected_previous_theta = 0;
5315 *   Number projected_J_time_rate = 0;
5316 *   Vector<Number> projected_shape_values(dofs_per_cell);
5317 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5318 *   projected_updated_J +=
5319 *   mixed_values(i) * weighted_updated_J_vec.at(i);
5320 *   projected_J_time_rate +=
5321 *   mixed_values(i) * weighted_J_time_rate_vec.at(i);
5322 *   projected_updated_theta +=
5323 *   mixed_values(i) * weighted_updated_theta_vec.at(i);
5324 *   projected_previous_J +=
5325 *   mixed_values(i) * weighted_previous_J_vec.at(i);
5326 *   projected_previous_theta +=
5327 *   mixed_values(i) * weighted_previous_theta_vec.at(i);
5328 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5329 *   projected_shape_values(j) +=
5330 *   mixed_values(i) * weighted_shape_values.at(j).at(i);
5331 *   }
5332 *   }
5333 *  
5334 *   const Number d_theta_dt_n_plus_1 = temperature_values_increment[q_point] / time_increment;
5335 *  
5336 *   const Number d_theta_dt_tangent = 1.0 / time_increment;
5337 *  
5338 *   heating_request.set_deformation_Jacobian(projected_updated_J);
5339 *   heating_request.set_deformation_Jacobian_time_rate(projected_J_time_rate);
5340 *   heating_request.set_temperature(projected_updated_theta);
5341 *   heating_request.set_previous_deformation_Jacobian(projected_previous_J);
5342 *   heating_request.set_previous_temperature(projected_previous_theta);
5343 *   heating_request.set_time_increment(time_increment);
5344 *  
5345 *   const auto current_F = get_deformation_gradient(
5346 *   current_displacement_gradients[q_point],
5347 *   current_displacement_values[q_point][0]/fe_mech_values.quadrature_point(q_point)[0]
5348 *   );
5349 *   const auto updated_F = get_deformation_gradient(
5350 *   current_displacement_gradients[q_point]
5351 *   + displacement_gradient_increments[q_point],
5352 *   (current_displacement_values[q_point][0]
5353 *   + displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5354 *  
5355 *   const auto inv_updated_F = invert(updated_F);
5356 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(current_F);
5357 *   [[maybe_unused]] const Number previous_Jacobian = determinant(current_F) * material_Jacobian;
5358 *   [[maybe_unused]] const Number Jacobian = determinant(updated_F) * material_Jacobian;
5359 *  
5360 *   const Number radius = fe_values.quadrature_point(q_point)[0];
5361 *  
5362 *   const Tensor<2, dim+1, Number> d_X_prime_d_X = deformation_gradient_from_angular_displacement_gradient(
5363 *   -angular_velocity_increments[q_point],
5364 *   -angular_velocity_gradient_increments[q_point],
5365 *   radius
5366 *   );
5367 *  
5368 *   const Tensor<2, dim+1, Number> rotation_to_X_prime_frame = rotation_tensor_to_transform_B_e(
5369 *   -angular_velocity_increments[q_point],
5370 *   radius
5371 *   );
5372 *  
5373 *   const Tensor<2, dim+1, Number> inv_d_X_prime_d_X = invert(d_X_prime_d_X);
5374 *  
5375 *   const auto f_m_n_plus_1 = inv_d_X_prime_d_X * rotation_to_X_prime_frame;
5376 *  
5377 * @endcode
5378 *
5379 * std::cout << "f_r: " << inv_d_X_prime_d_X << std::endl;
5380 * std::cout << "R: " << previous_elastic_deformation_transformation_tensor << std::endl;
5381 * std::cout << "f_m_n+1: " << f_m_n_plus_1 << std::endl;
5382 *
5383
5384 *
5385 *
5386 * @code
5387 *   const auto unnormalized_deformation_gradient_increment = updated_F * f_m_n_plus_1 * invert(current_F);
5388 *  
5389 *   const auto deformation_gradient_increment =
5390 *   std::pow(determinant(unnormalized_deformation_gradient_increment),
5391 *   -Constants<dim, Number>::one_third()) * unnormalized_deformation_gradient_increment;
5392 *  
5393 *   const Number previous_temperature = current_temperature_values[q_point];
5394 *   const Number updated_temperature = previous_temperature + temperature_values_increment[q_point];
5395 *   const auto thermal_gradient =
5396 *   postprocess_tensor_dimension(current_thermal_gradient[q_point] + thermal_gradient_increment[q_point]) * inv_updated_F;
5397 *  
5398 *   constitutive_request.set_deformation_gradient(deformation_gradient_increment);
5399 *   constitutive_request.set_temperature_time_rate(d_theta_dt_n_plus_1);
5400 *   constitutive_request.set_temperature(updated_temperature);
5401 *   constitutive_request.set_thermal_gradient(thermal_gradient);
5402 *   constitutive_request.set_time_increment(time_increment);
5403 *  
5404 *   material.compute_constitutive_request(
5405 *   constitutive_request,
5406 *   quadrature_point_index);
5407 *   material.compute_constitutive_request(
5408 *   heating_request,
5409 *   quadrature_point_index);
5410 *  
5411 *   std::vector<Tensor<1, dim+1, Number>> rate_gradients(dofs_per_cell);
5412 *   std::vector<Number> rate_temperatures(dofs_per_cell);
5413 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5414 *   rate_gradients[i] = postprocess_tensor_dimension(fe_values[temperature].gradient(i, q_point)) * inv_updated_F;
5415 *   rate_temperatures[i] =fe_values[temperature].value(i, q_point);
5416 *   }
5417 *  
5418 *   const Number RJxW = fe_values.quadrature_point(q_point)[0] / material_Jacobian * fe_values.JxW(q_point);
5419 *  
5420 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5421 *  
5422 * @endcode
5423 *
5424 * heat flux term
5425 *
5426 * @code
5427 *   const auto heat_flux = constitutive_request.get_heat_flux();
5428 *   cell_residual(i) += rate_gradients[i]
5429 *   * heat_flux
5430 *   * RJxW;
5431 *  
5432 * @endcode
5433 *
5434 * stored heat term
5435 *
5436 * @code
5437 *   cell_residual(i) += rate_temperatures[i]
5438 *   * constitutive_request.get_stored_heat_rate()
5439 *   * RJxW;
5440 *  
5441 * @endcode
5442 *
5443 * mechanical dissipation term
5444 *
5445 * @code
5446 *   cell_residual(i) -= rate_temperatures[i]
5447 *   * constitutive_request.get_mechanical_dissipation()
5448 *   * RJxW;
5449 *  
5450 * @endcode
5451 *
5452 * elastoplastic heating term
5453 *
5454 * @code
5455 *   cell_residual(i) += (projected_shape_values(i))
5456 *   * heating_request.get_thermo_elastic_heating()
5457 *   * RJxW;
5458 *  
5459 *   for ( typename std::vector<BodyForceApplier<dim, Number> >::const_iterator
5460 *   bodyHeatSourceApplier = thermal_lbc_system.bodyLoadAppliers.cbegin();
5461 *   bodyHeatSourceApplier != thermal_lbc_system.bodyLoadAppliers.cend();
5462 *   ++bodyHeatSourceApplier) {
5463 *   cell_residual(i) += bodyHeatSourceApplier->apply(
5464 *   0, rate_temperatures[i],
5465 *   fe_values.quadrature_point(q_point)[0] * fe_values.JxW(q_point));
5466 *   }
5467 *   }
5468 *  
5469 *   if (fill_system_matrix) {
5470 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5471 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5472 *  
5473 * @endcode
5474 *
5475 * heat flux tangent
5476 *
5477 * @code
5478 *   const Number f_int_q =
5479 *   rate_gradients[i]
5480 *   * constitutive_request.get_heat_flux_tangent(rate_gradients[j]);
5481 *   cell_matrix(i, j) += f_int_q * RJxW;
5482 *  
5483 * @endcode
5484 *
5485 * stored heat rate tangent
5486 *
5487 * @code
5488 *   const Number f_int_cThetaDot =
5489 *   rate_temperatures[i]
5490 *   * constitutive_request.get_stored_heat_rate_tangent(d_theta_dt_tangent*rate_temperatures[j]);
5491 *   cell_matrix(i, j) += f_int_cThetaDot * RJxW;
5492 *  
5493 * @endcode
5494 *
5495 * mechanical dissipation tangent
5496 *
5497 * @code
5498 *   const Number f_int_mech_dissipation =
5499 *   rate_temperatures[i]
5500 *   * constitutive_request.get_mechanical_dissipation_tangent(rate_temperatures[j]);
5501 *   cell_matrix(i, j) -= f_int_mech_dissipation * RJxW;
5502 *  
5503 * @endcode
5504 *
5505 * elastoplastic heating tangent
5506 *
5507 * @code
5508 *   const Number f_int_elastoplastic_heating =
5509 *   (projected_shape_values(i))
5510 *   * heating_request.get_thermo_elastic_heating_tangent(projected_shape_values(j));
5511 *   cell_matrix(i, j) += f_int_elastoplastic_heating * RJxW;
5512 *   }
5513 *   }
5514 *   }
5515 *   }
5516 *  
5517 *   for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
5518 *   fe_face_values.reinit(cell, face);
5519 *   mech_fe_face_values.reinit(mechanical_cell, face);
5520 *  
5521 *   fe_face_values[temperature].get_function_values(
5522 *   Newton_system.previous_deformation,
5523 *   current_face_temperature_values);
5524 *   fe_face_values[temperature].get_function_values(
5525 *   Newton_system.current_increment,
5526 *   face_temperature_values_increment);
5527 *  
5528 *   mech_fe_face_values[displacements].get_function_gradients(
5529 *   mechanical_nonlinear_system.previous_deformation,
5530 *   current_face_displacement_gradients);
5531 *   mech_fe_face_values[displacements].get_function_gradients(
5532 *   mechanical_nonlinear_system.current_increment,
5533 *   face_displacement_gradient_increments);
5534 *  
5535 *   mech_fe_face_values[displacements].get_function_values(
5536 *   mechanical_nonlinear_system.previous_deformation,
5537 *   current_face_displacement_values);
5538 *   mech_fe_face_values[displacements].get_function_values(
5539 *   mechanical_nonlinear_system.current_increment,
5540 *   face_displacement_value_increments);
5541 *  
5542 *  
5543 *   for ( typename std::vector<std::pair<int, BodyForceApplier<dim, Number> > >::const_iterator
5544 *   boundaryHeatSource = thermal_lbc_system.boundaryLoadAppliers.cbegin();
5545 *   boundaryHeatSource != thermal_lbc_system.boundaryLoadAppliers.cend();
5546 *   ++boundaryHeatSource) {
5547 *   if (cell->face(face)->boundary_id() == static_cast<types::boundary_id>(boundaryHeatSource->first)) {
5548 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5549 *   for (unsigned int q_point = 0;
5550 *   q_point < face_quadrature_formula.size();
5551 *   ++q_point) {
5552 *  
5553 *  
5554 *   const auto updated_F = get_deformation_gradient(
5555 *   current_face_displacement_gradients[q_point]
5556 *   + face_displacement_gradient_increments[q_point],
5557 *   (current_face_displacement_values[q_point][0]
5558 *   + face_displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5559 *  
5560 *  
5561 *   const Number J = determinant(updated_F);
5562 *   const Tensor<2, dim+1, Number> inv_deformation_gradient = invert(updated_F);
5563 *   const Tensor<1, dim+1, Number> reference_normal = postprocess_tensor_dimension(mech_fe_face_values.normal_vector(q_point), 0);
5564 *   const Tensor<1, dim+1, Number> F_inv_transpose_N = transpose(inv_deformation_gradient) * reference_normal;
5565 *   const Number norm_F_inv_transpose_N = (F_inv_transpose_N).norm();
5566 *  
5567 *   cell_residual(i) +=
5568 *   boundaryHeatSource->second.apply(
5569 *   0,
5570 *   fe_face_values.shape_value(i, q_point),
5571 *   norm_F_inv_transpose_N * J *
5572 *   fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point));
5573 *   }
5574 *   }
5575 *   }
5576 *   }
5577 *  
5578 *   for ( typename std::vector<std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> > >::const_iterator
5579 *   convectionBC = thermal_lbc_system.convection_BC_appliers.cbegin();
5580 *   convectionBC != thermal_lbc_system.convection_BC_appliers.cend();
5581 *   ++convectionBC) {
5582 *   if (cell->face(face)->boundary_id() == static_cast<types::boundary_id>(convectionBC->first)) {
5583 *   for (unsigned int q_point = 0;
5584 *   q_point < face_quadrature_formula.size();
5585 *   ++q_point) {
5586 *  
5587 *   const unsigned int cell_index = cell->user_index() / quadrature_formula.size();
5588 *   const unsigned int surface_point_key =
5589 *   cell_index * GeometryInfo<dim>::faces_per_cell * n_face_q_points
5590 *   + face * n_face_q_points
5591 *   + q_point;
5592 *  
5593 *   const auto updated_F = get_deformation_gradient(
5594 *   current_face_displacement_gradients[q_point]
5595 *   + face_displacement_gradient_increments[q_point],
5596 *   (current_face_displacement_values[q_point][0]
5597 *   + face_displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5598 *  
5599 *   [[maybe_unused]] const Number J = determinant(updated_F);
5600 *   const Tensor<2, dim+1, Number> inv_deformation_gradient = invert(updated_F);
5601 *   const Tensor<1, dim+1, Number> reference_normal = postprocess_tensor_dimension(mech_fe_face_values.normal_vector(q_point), 0);
5602 *   const Tensor<1, dim+1, Number> F_inv_transpose_N = transpose(inv_deformation_gradient) * reference_normal;
5603 *   [[maybe_unused]] const Number norm_F_inv_transpose_N = (F_inv_transpose_N).norm();
5604 *  
5605 *   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);
5606 *  
5607 *   const Number updated_face_temperature_value =
5608 *   current_face_temperature_values[q_point] +
5609 *   face_temperature_values_increment[q_point];
5610 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5611 *   cell_residual(i) +=
5612 *   convectionBC->second.apply(
5613 *   0,
5614 *   fe_face_values.shape_value(i, q_point),
5615 *   updated_face_temperature_value,
5616 *   RJxW);
5617 *   if (fill_system_matrix) {
5618 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5619 *   cell_matrix(i, j) +=
5620 *   convectionBC->second.apply_gradient(
5621 *   0,
5622 *   fe_face_values.shape_value(i, q_point),
5623 *   fe_face_values.shape_value(j, q_point),
5624 *   RJxW);
5625 *   }
5626 *   }
5627 *   }
5628 *   }
5629 *   }
5630 *   }
5631 *   }
5632 *  
5633 *  
5634 *   std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5635 *   cell->get_dof_indices (local_dof_indices);
5636 *   if (fill_system_matrix) {
5637 *   thermal_dof_system.nodal_constraints.distribute_local_to_global(
5638 *   cell_matrix,
5639 *   cell_residual,
5640 *   local_dof_indices,
5641 *   Newton_system.Newton_step_matrix,
5642 *   Newton_system.Newton_step_residual,
5643 *   true);
5644 *   } else {
5645 *   thermal_dof_system.nodal_constraints.distribute_local_to_global(
5646 *   cell_residual, local_dof_indices,
5647 *   Newton_system.Newton_step_residual);
5648 *   }
5649 *   } /*for (; cell!=endc; ++cell) if(cell->is_locally_owned())*/
5650 *   }
5651 *  
5652 *   if (fill_system_matrix) Newton_system.Newton_step_matrix.compress(VectorOperation::add);
5653 *   Newton_system.Newton_step_residual.compress(VectorOperation::add);
5654 *   }
5655 *  
5656 *   template <int dim, typename Number>
5657 *   void PlasticityLabProg<dim, Number>::assemble_mesh_motion_system(
5658 *   NewtonStepSystem &mesh_motion_nonlinear_system,
5659 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
5660 *   const LBCSystem<dim, Number, dim> &,
5661 *   const NewtonStepSystem &deformation_nonlinear_system,
5662 *   const DoFSystem<dim, Number> &deformation_dof_system,
5663 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
5664 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
5665 *   const bool fill_system_matrix) {
5666 *  
5667 *  
5668 *   const Number mesh_motion_mu = 1.0;
5669 *   const Number mesh_motion_kappa = 5.0;
5670 *   const Number cell_jacobian_exponent = -0.0;
5671 *  
5672 *  
5673 *   FEValues<dim> deformation_fe_values(
5674 *   mapping,
5675 *   mech_fe,
5676 *   quadrature_formula,
5678 *  
5679 *   FEValues<dim> mesh_motion_fe_values(
5680 *   mapping,
5681 *   mesh_motion_fe,
5682 *   quadrature_formula,
5685 *  
5686 *   FEValues<dim> mixed_fe_values(
5687 *   mapping,
5688 *   mixed_var_fe,
5689 *   quadrature_formula,
5690 *   update_values);
5691 *  
5692 *   const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
5693 *   const unsigned int n_q_points = quadrature_formula.size();
5694 *   const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
5695 *  
5696 *   std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
5697 *   std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
5698 *  
5699 *   std::vector< Tensor<2, dim, Number> > current_deformation_gradients(n_q_points);
5700 *   std::vector< Tensor<2, dim, Number> > deformation_gradient_increments(n_q_points);
5701 *  
5702 *   std::vector< Tensor<1, dim, Number> > current_deformation_values(n_q_points);
5703 *   std::vector< Tensor<1, dim, Number> > deformation_value_increments(n_q_points);
5704 *  
5705 *   std::vector< Number > mesh_motion_jacobians(n_q_points);
5706 *   std::vector< std::vector<Number> > strain_divergences(dofs_per_cell, std::vector<Number>(n_q_points));
5707 *   std::vector< std::vector<Number> > jacobian_tangents(dofs_per_cell, std::vector<Number>(n_q_points));
5708 *  
5709 *   std::vector< std::vector< std::vector < Number> > > strain_divergence_tangents(
5710 *   dofs_per_cell,
5711 *   std::vector< std::vector< Number> >(dofs_per_cell,std::vector<Number>(n_q_points)));
5712 *  
5713 *   std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
5714 *   std::vector<std::vector<Number> > projected_strain_divergence_coefficients(
5715 *   dofs_per_cell,
5716 *   std::vector<Number>(mixed_dofs_per_cell));
5717 *   std::vector<std::vector<Number> > projected_jacobian_tangent_coefficients(
5718 *   dofs_per_cell,
5719 *   std::vector<Number>(mixed_dofs_per_cell));
5720 *   std::vector<std::vector<std::vector<Number> > > projected_strain_divergence_tangent_coefficients(
5721 *   dofs_per_cell, std::vector< std::vector< Number> >(
5722 *   dofs_per_cell,
5723 *   std::vector<Number>(mixed_dofs_per_cell)));
5724 *  
5725 *   std::vector<Number> projected_strain_divergence(dofs_per_cell);
5726 *   std::vector<Number> projected_jacobian_tangent(dofs_per_cell);
5727 *   std::vector<std::vector<Number> > projected_strain_divergence_tangent(dofs_per_cell, std::vector<Number>(dofs_per_cell));
5728 *  
5729 *   FullMatrix<Number> cell_matrix(dofs_per_cell, dofs_per_cell);
5730 *   Vector<Number> cell_residual(dofs_per_cell);
5731 *  
5732 *   Vector<Number> mixed_values (mixed_dofs_per_cell);
5733 *  
5734 *   const FEValuesExtractors::Vector displacements (0);
5735 *   const FEValuesExtractors::Scalar angular_velocity(dim);
5737 *  
5738 *   mesh_motion_nonlinear_system.Newton_step_matrix = 0;
5739 *   mesh_motion_nonlinear_system.Newton_step_residual = 0;
5740 *  
5741 *   bool kinematic_domains_are_valid = true; // innocent until proven guilty
5742 *  
5743 *   auto cell = mesh_motion_dof_system.dof_handler.begin_active();
5744 *   auto endc = mesh_motion_dof_system.dof_handler.end();
5745 *   auto deformation_cell = deformation_dof_system.dof_handler.begin_active();
5746 *   auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
5747 *  
5748 *   for (; cell != endc; ++cell, ++deformation_cell, ++mixed_fe_cell) {
5749 *   if (cell->is_locally_owned()) {
5750 *  
5751 *   cell_matrix = 0;
5752 *   cell_residual = 0;
5753 *  
5754 *   mesh_motion_fe_values.reinit (cell);
5755 *   deformation_fe_values.reinit (deformation_cell);
5756 *   mixed_fe_values.reinit (mixed_fe_cell);
5757 *  
5758 *   deformation_fe_values[displacements].get_function_gradients(
5759 *   deformation_nonlinear_system.previous_deformation,
5760 *   current_deformation_gradients);
5761 *  
5762 *   deformation_fe_values[displacements].get_function_gradients(
5763 *   deformation_nonlinear_system.current_increment,
5764 *   deformation_gradient_increments);
5765 *  
5766 *   deformation_fe_values[displacements].get_function_values(
5767 *   deformation_nonlinear_system.previous_deformation,
5768 *   current_deformation_values);
5769 *  
5770 *   deformation_fe_values[displacements].get_function_values(
5771 *   deformation_nonlinear_system.current_increment,
5772 *   deformation_value_increments);
5773 *  
5774 *   mesh_motion_fe_values[displacements].get_function_gradients(
5775 *   mesh_motion_nonlinear_system.current_increment,
5776 *   mesh_motion_gradient_increments);
5777 *  
5778 *   mesh_motion_fe_values[displacements].get_function_values(
5779 *   mesh_motion_nonlinear_system.current_increment,
5780 *   mesh_motion_value_increments);
5781 *  
5782 * @endcode
5783 *
5784 * get vectors for projection onto mixed fe values
5785 *
5786 * @code
5787 *   for (unsigned int q_point = 0; q_point < n_q_points;
5788 *   ++q_point) {
5789 *  
5790 *   const auto mesh_motion_gradient = get_deformation_gradient(
5791 *   -mesh_motion_gradient_increments[q_point],
5792 *   -mesh_motion_value_increments[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
5793 *  
5794 *   const Number Jacobian = determinant(mesh_motion_gradient);
5795 *   mesh_motion_jacobians.at(q_point) = Jacobian;
5796 *  
5797 *   const auto inv_mesh_motion_gradient = invert(mesh_motion_gradient);
5798 *   std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
5799 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5800 *   rate_gradients[i] = postprocess_tensor_dimension(
5801 *   -mesh_motion_fe_values[displacements].gradient(i, q_point),
5802 *   -mesh_motion_fe_values[displacements].value(i, q_point)[0]
5803 *   /mesh_motion_fe_values.quadrature_point(q_point)[0]) * inv_mesh_motion_gradient;
5804 *   }
5805 *  
5806 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5807 *   const Number strain_divergence_i = trace(rate_gradients[i]);
5808 *   strain_divergences[i].at(q_point) = Jacobian * strain_divergence_i;
5809 *   if (fill_system_matrix) {
5810 *   jacobian_tangents[i].at(q_point) = Jacobian * strain_divergence_i;
5811 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5812 *   strain_divergence_tangents[i][j].at(q_point) = Jacobian * (trace(rate_gradients[i]) * trace(rate_gradients[j]) - trace(rate_gradients[i] * rate_gradients[j]));
5813 *   }
5814 *   }
5815 *   }
5816 *   }
5817 *  
5818 *   const unsigned int cell_index = cell->user_index() / n_q_points;
5819 *  
5820 *   mixed_fe_projector[cell_index].project(
5821 *   &projected_Jacobian_coefficients,
5822 *   mesh_motion_jacobians);
5823 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5824 *   mixed_fe_projector[cell_index].project(
5825 *   &projected_strain_divergence_coefficients[i],
5826 *   strain_divergences[i]);
5827 *   if (fill_system_matrix) {
5828 *   mixed_fe_projector[cell_index].project(
5829 *   &projected_jacobian_tangent_coefficients[i],
5830 *   jacobian_tangents[i]);
5831 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5832 *   mixed_fe_projector[cell_index].project(
5833 *   &projected_strain_divergence_tangent_coefficients[i][j],
5834 *   strain_divergence_tangents[i][j]);
5835 *   }
5836 *   }
5837 *   }
5838 *  
5839 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
5840 *  
5841 *   [[maybe_unused]] const point_index_t quadrature_point_index = cell->user_index() + q_point;
5842 *  
5843 *   const Number cell_jacobian = determinant(static_cast<Tensor <2, dim, Number>>(mesh_motion_fe_values.jacobian(q_point)));
5844 *  
5845 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5846 *   mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
5847 *   }
5848 *  
5849 *   const auto mesh_motion_gradient = get_deformation_gradient(
5850 *   -mesh_motion_gradient_increments[q_point],
5851 *   -mesh_motion_value_increments[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
5852 *  
5853 *   const auto deformation_gradient = get_deformation_gradient(
5854 *   current_deformation_gradients[q_point] + deformation_gradient_increments[q_point],
5855 *   (current_deformation_values[q_point][0] + deformation_value_increments[q_point][0])
5856 *   / mesh_motion_fe_values.quadrature_point(q_point)[0]);
5857 *  
5858 *   const auto inv_mesh_motion_gradient = invert(mesh_motion_gradient);
5859 *   const auto inv_deformation_gradient = invert(deformation_gradient);
5860 *  
5861 *   [[maybe_unused]] const Number deformation_Jacobian = determinant(deformation_gradient);
5862 *   const Number mesh_motion_Jacobian = determinant(mesh_motion_gradient);
5863 *  
5864 *   Number projected_jacobian = 0;
5865 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5866 *   projected_jacobian +=
5867 *   mixed_values(i) * projected_Jacobian_coefficients.at(i);
5868 *   }
5869 *  
5870 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5871 *   projected_strain_divergence[j] =
5872 *   mixed_values(0) * projected_strain_divergence_coefficients[j][0];
5873 *   if (fill_system_matrix) {
5874 *   projected_jacobian_tangent[j] =
5875 *   mixed_values(0) * projected_jacobian_tangent_coefficients[j][0];
5876 *   for (unsigned int k = 0; k < dofs_per_cell; ++k) {
5877 *   projected_strain_divergence_tangent[j][k] =
5878 *   mixed_values(0)
5879 *   * projected_strain_divergence_tangent_coefficients[j][k][0];
5880 *   }
5881 *   }
5882 *   }
5883 *  
5884 *   for (unsigned int i = 1; i < mixed_dofs_per_cell; ++i) {
5885 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5886 *   projected_strain_divergence[j] +=
5887 *   mixed_values(i) * projected_strain_divergence_coefficients[j][i];
5888 *   if (fill_system_matrix) {
5889 *   projected_jacobian_tangent[j] +=
5890 *   mixed_values(i) * projected_jacobian_tangent_coefficients[j][i];
5891 *   for (unsigned int k = 0; k < dofs_per_cell; ++k) {
5892 *   projected_strain_divergence_tangent[j][k] +=
5893 *   mixed_values(i)
5894 *   * projected_strain_divergence_tangent_coefficients[j][k][i];
5895 *   }
5896 *   }
5897 *   }
5898 *   }
5899 *  
5900 *   std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
5901 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5902 *   rate_gradients[i] = postprocess_tensor_dimension(
5903 *   -mesh_motion_fe_values[displacements].gradient(i, q_point),
5904 *   -mesh_motion_fe_values[displacements].value(i, q_point)[0]
5905 *   /mesh_motion_fe_values.quadrature_point(q_point)[0]) * inv_mesh_motion_gradient;
5906 *   }
5907 *  
5908 *   const SymmetricTensor<2, dim+1, Number> stress_deviator =
5909 *   std::pow(cell_jacobian, cell_jacobian_exponent) * mesh_motion_mu
5910 *   * std::pow(mesh_motion_Jacobian, -Constants<dim, Number>::two_thirds())
5911 *   * deviator(
5912 *   symmetrize(
5913 *   (deformation_gradient * mesh_motion_gradient)
5914 *   * transpose(deformation_gradient * mesh_motion_gradient)));
5915 *  
5916 *   const Number pressure = mesh_motion_kappa * std::log(projected_jacobian);
5917 *  
5918 *   for (unsigned int i = 0; i < dofs_per_cell; ++i) {
5919 *   const auto strain_i = deformation_gradient * rate_gradients[i] * inv_deformation_gradient;
5920 *  
5921 * @endcode
5922 *
5923 * stress deviator term
5924 *
5925 * @code
5926 *   cell_residual(i) += symmetrize(strain_i) * stress_deviator
5927 *   * mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5928 *  
5929 * @endcode
5930 *
5931 * pressure term
5932 *
5933 * @code
5934 *   cell_residual(i) += (projected_strain_divergence.at(i) * pressure)
5935 *   * mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5936 *  
5937 *   if (fill_system_matrix) {
5938 *  
5939 *   for (unsigned int j = 0; j < dofs_per_cell; ++j) {
5940 *   const auto strain_j = deformation_gradient * rate_gradients[j] * inv_deformation_gradient;
5941 *  
5942 * @endcode
5943 *
5944 * stress tangent
5945 *
5946 * @code
5947 *   const SymmetricTensor<2, dim+1, Number> stress_deviator_tangent_j =
5948 *   std::pow(cell_jacobian, cell_jacobian_exponent) * mesh_motion_mu
5949 *   * std::pow(mesh_motion_Jacobian, -Constants<dim, Number>::two_thirds())
5950 *   * deviator(
5951 *   symmetrize(
5952 *   2 * (strain_j - Constants<dim, Number>::one_third() * trace(strain_j) * unit_symmetric_tensor<dim+1, Number>())
5953 *   * (deformation_gradient * mesh_motion_gradient)
5954 *   * transpose(deformation_gradient * mesh_motion_gradient)));
5955 *  
5956 *   cell_matrix(i, j) += (symmetrize(strain_i) * stress_deviator_tangent_j - symmetrize(strain_i * strain_j) * stress_deviator)
5957 *   * mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5958 *  
5959 * @endcode
5960 *
5961 * pressure_tangent
5962 *
5963 * @code
5964 *   const Number pressure_tangent_j = mesh_motion_kappa * (1.0 / projected_jacobian) * projected_jacobian_tangent[j];
5965 *   cell_matrix(i, j) += (projected_strain_divergence.at(i) * pressure_tangent_j + projected_strain_divergence_tangent[i][j] * pressure)
5966 *   * mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5967 *  
5968 *   }
5969 *   }
5970 *   }
5971 *   }
5972 *  
5973 * @endcode
5974 *
5975 * const Number relative_symmetry_norm2 = cell_matrix.relative_symmetry_norm2();
5976 * if(relative_symmetry_norm2 > 1e-8)
5977 * std::cout << "relative_symmetry_norm2: " << cell_matrix.relative_symmetry_norm2() << std::endl;
5978 *
5979
5980 *
5981 *
5982 * @code
5983 *   std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5984 *   cell->get_dof_indices (local_dof_indices);
5985 *   if (fill_system_matrix) {
5986 *   mesh_motion_dof_system.nodal_constraints.distribute_local_to_global(
5987 *   cell_matrix,
5988 *   cell_residual,
5989 *   local_dof_indices,
5990 *   mesh_motion_nonlinear_system.Newton_step_matrix,
5991 *   mesh_motion_nonlinear_system.Newton_step_residual,
5992 *   true);
5993 *   } else {
5994 *   mesh_motion_dof_system.nodal_constraints.distribute_local_to_global(
5995 *   cell_residual, local_dof_indices,
5996 *   mesh_motion_nonlinear_system.Newton_step_residual);
5997 *   }
5998 *   } /* if cell is locally owned */
5999 *   } /*for (; cell!=endc; ++cell)*/
6000 *  
6001 *   const unsigned short local_domain_is_valid = kinematic_domains_are_valid ? 1 : 0;
6002 *   unsigned short all_kinematic_domains_are_valid;
6003 *  
6004 * @endcode
6005 *
6006 * did any of the processes fail to assemble?
6007 *
6008 * @code
6009 *   MPI_Allreduce(
6010 *   &local_domain_is_valid,
6011 *   &all_kinematic_domains_are_valid, 1, MPI_UNSIGNED_SHORT,
6012 *   MPI_MIN, mpi_communicator);
6013 *  
6014 *   if (all_kinematic_domains_are_valid < 1) {
6015 *   throw std::runtime_error("The domain is not valid...");
6016 *   }
6017 *  
6018 *   if (fill_system_matrix) {
6019 *   mesh_motion_nonlinear_system.Newton_step_matrix.compress(VectorOperation::add);
6020 *   }
6021 *   mesh_motion_nonlinear_system.Newton_step_residual.compress(VectorOperation::add);
6022 *  
6023 *   }
6024 *  
6025 *   template<typename BlockType>
6026 *   class SumOfMatrices : public EnableObserverPointer {
6027 *   public:
6028 *   SumOfMatrices(
6029 *   const BlockType &m1,
6030 *   const BlockType &m2):
6031 *   m1(m1),
6032 *   m2(m2) {
6033 *   }
6034 *  
6035 *   template<typename VectorType>
6036 *   void vmult(VectorType &dst, const VectorType &src) const {
6037 *   m1.vmult(dst, src);
6038 *   m2.vmult_add(dst, src);
6039 *   }
6040 *  
6041 *   private:
6042 *   const BlockType &m1;
6043 *   const BlockType &m2;
6044 *   };
6045 *  
6046 * @endcode
6047 *
6048 * TODO encorporate mechanical and thermal subsystems into structs and include functions in them
6049 *
6050 * @code
6051 *   template <int dim, typename Number>
6052 *   void PlasticityLabProg<dim, Number>::solve_system(
6053 *   const DoFSystem<dim, Number> &dof_system,
6054 *   NewtonStepSystem &nonlinear_system,
6055 *   const bool reset_solution) {
6056 *   TrilinosWrappers::PreconditionAMG preconditioner;
6057 *  
6058 *   const std::vector<std::vector<bool> > constant_modes
6059 *   = DoFTools::extract_constant_modes(dof_system.dof_handler,
6060 *   ComponentMask());
6061 *  
6063 *   additional_data.constant_modes = constant_modes;
6064 *   additional_data.elliptic = true;
6065 *   additional_data.n_cycles = 1;
6066 *   additional_data.w_cycle = false;
6067 *   additional_data.output_details = false;
6068 *   additional_data.smoother_sweeps = 2;
6069 *   additional_data.aggregation_threshold = 1e-2;
6070 *   preconditioner.initialize(nonlinear_system.Newton_step_matrix, additional_data);
6071 *  
6072 *   TrilinosWrappers::MPI::Vector tmp(dof_system.locally_owned_dofs, mpi_communicator);
6073 *   const Number relative_accuracy = 1e-08;
6074 *   const Number solver_tolerance = relative_accuracy
6075 *   * nonlinear_system.Newton_step_matrix.residual(tmp, nonlinear_system.Newton_step_solution,
6076 *   nonlinear_system.Newton_step_residual);
6077 *   SolverControl solver_control(nonlinear_system.Newton_step_matrix.m(),
6078 *   solver_tolerance);
6079 *  
6080 *   SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
6081 *  
6082 *   if (reset_solution) {
6083 *   nonlinear_system.Newton_step_solution = 0;
6084 *   nonlinear_system.Newton_step_solution.compress(VectorOperation::insert);
6085 *   }
6086 *  
6087 *   solver.solve(nonlinear_system.Newton_step_matrix, nonlinear_system.Newton_step_solution,
6088 *   nonlinear_system.Newton_step_residual, preconditioner);
6089 *  
6090 *   pcout << "solved in " << solver_control.last_step() << " steps to residual value of " << solver_control.last_value() << endl;
6091 *   pcout << "solution norm is: " << nonlinear_system.Newton_step_solution.l2_norm() << endl;
6092 *  
6093 *   dof_system.nodal_constraints.distribute (nonlinear_system.Newton_step_solution);
6094 *   } /*ElasticProblem<dim,Number>::solve_system*/
6095 *  
6096 *  
6097 *   template <int dim, typename Number>
6098 *   void PlasticityLabProg<dim, Number>::get_plastic_strain(
6099 *   TrilinosWrappers::MPI::Vector &plastic_strain,
6100 *   const DoFHandler<dim> &discontinuous_dof_handler,
6101 *   const Material<dim+1, Number> &material,
6102 *   const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors) {
6103 *  
6104 *   const FiniteElement<dim> &fe = discontinuous_dof_handler.get_fe();
6105 *  
6106 *   const unsigned int n_q_points = quadrature_formula.size();
6107 *   const unsigned int disc_dofs_per_cell = fe.dofs_per_cell;
6108 *  
6109 *   std::vector<Number> plastic_strain_qp_values(n_q_points);
6110 *   std::vector<Number> projected_plastic_strains(disc_dofs_per_cell);
6111 *  
6112 *   auto cell = discontinuous_dof_handler.begin_active();
6113 *   auto endc = discontinuous_dof_handler.end();
6114 *   for (; cell != endc; ++cell) {
6115 *   if (cell->is_locally_owned()) {
6116 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
6117 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
6118 *   plastic_strain_qp_values[q_point] = std::exp(material.get_state_parameters(quadrature_point_index).at(0)) - 1;
6119 *   }
6120 *  
6121 *   const unsigned int cell_index = cell->user_index() / n_q_points;
6122 *   qp_values_projectors[cell_index].project(
6123 *   &projected_plastic_strains,
6124 *   plastic_strain_qp_values);
6125 *  
6126 *   std::vector<types::global_dof_index> local_dof_indices (disc_dofs_per_cell);
6127 *   cell->get_dof_indices (local_dof_indices);
6128 *   for (unsigned int dof_i = 0; dof_i < disc_dofs_per_cell; ++dof_i) {
6129 *   plastic_strain(local_dof_indices[dof_i]) = projected_plastic_strains.at(dof_i);
6130 *   }
6131 *   }
6132 *   }
6133 *   }
6134 *  
6135 *  
6136 *   template <int dim, typename Number>
6137 *   void PlasticityLabProg<dim, Number>::get_pressure(
6139 *   const DoFHandler<dim> &mixed_fe_dof_handler,
6140 *   TrilinosWrappers::MPI::Vector &von_mises_stress,
6141 *   const DoFHandler<dim> &discontinuous_dof_handler,
6142 *   NewtonStepSystem &Newton_system,
6143 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6144 *   const NewtonStepSystem &thermal_Newton_system,
6145 *   const DoFSystem<dim, Number> &thermal_dof_system,
6146 *   Material<dim+1, Number> &material,
6147 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6148 *   const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors) {
6149 *  
6150 *   FEValues<dim> fe_values(
6151 *   mapping,
6152 *   mech_fe,
6153 *   quadrature_formula,
6155 *  
6156 *   FEValues<dim> fe_therm_values(
6157 *   mapping,
6158 *   therm_fe,
6159 *   quadrature_formula,
6160 *   update_values);
6161 *  
6162 *   FEValues<dim> mixed_fe_values(
6163 *   mapping,
6164 *   mixed_var_fe,
6165 *   quadrature_formula,
6166 *   update_values);
6167 *  
6168 *   const unsigned int n_q_points = quadrature_formula.size();
6169 *   const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
6170 *   const unsigned int disc_dofs_per_cell = discontinuous_dof_handler.get_fe().dofs_per_cell;
6171 *  
6172 *  
6173 *   std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points);
6174 *   std::vector< Tensor<2, dim, Number> > displacement_gradient_increments(n_q_points);
6175 *   std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points);
6176 *   std::vector< Tensor<1, dim, Number> > displacement_value_increments(n_q_points);
6177 *  
6178 *   std::vector< Number > current_temperature_values(n_q_points);
6179 *   std::vector< Number > updated_temperature_increments(n_q_points);
6180 *   std::vector< Number > deformation_jacobians(n_q_points);
6181 *   std::vector< Number > pressure_values(n_q_points);
6182 *   std::vector< Number > von_mises_stress_values(n_q_points);
6183 *  
6184 *   std::vector<Number> projected_temperature_coefficients(mixed_dofs_per_cell);
6185 *   std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
6186 *   std::vector<Number> projected_pressure_coefficients(mixed_dofs_per_cell);
6187 *   std::vector<Number> projected_von_mises_stress_coefficients(disc_dofs_per_cell);
6188 *  
6189 *   Vector<Number> mixed_values(mixed_dofs_per_cell);
6190 *  
6191 *   const FEValuesExtractors::Vector displacements (0);
6193 *  
6194 *   auto cell = mechanical_dof_system.dof_handler.begin_active();
6195 *   auto endc = mechanical_dof_system.dof_handler.end();
6196 *   auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
6197 *   auto mixed_fe_cell = mixed_fe_dof_handler.begin_active();
6198 *   auto discontinuous_fe_cell = discontinuous_dof_handler.begin_active();
6199 *   for (; cell != endc; ++cell, ++thermal_cell, ++mixed_fe_cell, ++discontinuous_fe_cell) {
6200 *   if (cell->is_locally_owned()) {
6201 *  
6202 *   fe_values.reinit (cell);
6203 *   fe_therm_values.reinit (thermal_cell);
6204 *   mixed_fe_values.reinit (mixed_fe_cell);
6205 *  
6206 *   fe_values[displacements].get_function_gradients(
6207 *   Newton_system.current_increment,
6208 *   displacement_gradient_increments);
6209 *  
6210 *   fe_values[displacements].get_function_gradients(
6211 *   Newton_system.previous_deformation,
6212 *   current_displacement_gradients);
6213 *  
6214 *   fe_values[displacements].get_function_values(
6215 *   Newton_system.current_increment,
6216 *   displacement_value_increments);
6217 *  
6218 *   fe_values[displacements].get_function_values(
6219 *   Newton_system.previous_deformation,
6220 *   current_displacement_values);
6221 *  
6222 *   fe_therm_values[temperature].get_function_values (
6223 *   thermal_Newton_system.previous_deformation,
6224 *   current_temperature_values);
6225 *  
6226 *   fe_therm_values[temperature].get_function_values (
6227 *   thermal_Newton_system.current_increment,
6228 *   updated_temperature_increments);
6229 *  
6230 * @endcode
6231 *
6232 * get vectors for projection onto mixed fe values
6233 *
6234 * @code
6235 *   for (unsigned int q_point = 0; q_point < n_q_points;
6236 *   ++q_point) {
6237 *   updated_temperature_increments.at(q_point) += current_temperature_values.at(q_point);
6238 *  
6239 *   const auto current_F = get_deformation_gradient(
6240 *   current_displacement_gradients[q_point],
6241 *   current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
6242 *   );
6243 *   const auto updated_F = get_deformation_gradient(
6244 *   current_displacement_gradients[q_point]
6245 *   + displacement_gradient_increments[q_point],
6246 *   (current_displacement_values[q_point][0]
6247 *   + displacement_value_increments[q_point][0])/fe_values.quadrature_point(q_point)[0]);
6248 *  
6249 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
6250 *   const Number material_Jacobian = material.get_material_Jacobian(quadrature_point_index) / determinant(current_F);
6251 *  
6252 *   deformation_jacobians.at(q_point) = material_Jacobian * determinant(updated_F);
6253 *   }
6254 *  
6255 *   const unsigned int cell_index = cell->user_index() / n_q_points;
6256 *  
6257 *   mixed_fe_projector[cell_index].project(
6258 *   &projected_temperature_coefficients,
6259 *   updated_temperature_increments);
6260 *   mixed_fe_projector[cell_index].project(
6261 *   &projected_Jacobian_coefficients,
6262 *   deformation_jacobians);
6263 *  
6264 *   for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
6265 *  
6266 *   const point_index_t quadrature_point_index = cell->user_index() + q_point;
6267 *   ConstitutiveModelRequest<dim+1, Number> constitutive_request(update_pressure | update_stress_deviator);
6268 *  
6269 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
6270 *   mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
6271 *   }
6272 *  
6273 *   const auto current_F = get_deformation_gradient(
6274 *   current_displacement_gradients[q_point],
6275 *   current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
6276 *   );
6277 *   const auto updated_F = get_deformation_gradient(
6278 *   current_displacement_gradients[q_point]
6279 *   + displacement_gradient_increments[q_point],
6280 *   (current_displacement_values[q_point][0]
6281 *   + displacement_value_increments[q_point][0])/fe_values.quadrature_point(q_point)[0]);
6282 *  
6283 *   [[maybe_unused]] const auto inv_updated_F = invert(updated_F);
6284 *   const Number Jacobian = determinant(updated_F);
6285 *   const Number previous_Jacobian = determinant(current_F);
6286 *  
6287 *   const auto deformation_gradient_increment = std::pow(Jacobian / previous_Jacobian, -Constants<dim, Number>::one_third()) * updated_F * invert(current_F);
6288 *  
6289 *   Number projected_jacobian = 0;
6290 *   Number projected_temperature = 0;
6291 *   for (unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
6292 *   projected_jacobian +=
6293 *   mixed_values(i) * projected_Jacobian_coefficients.at(i);
6294 *   projected_temperature +=
6295 *   mixed_values(i) * projected_temperature_coefficients.at(i);
6296 *   }
6297 *  
6298 *   constitutive_request.set_deformation_Jacobian(projected_jacobian);
6299 *   constitutive_request.set_temperature(projected_temperature);
6300 *   constitutive_request.set_deformation_gradient(deformation_gradient_increment);
6301 *   constitutive_request.set_time_increment(time_increment);
6302 *  
6303 *   material.compute_constitutive_request(constitutive_request,
6304 *   quadrature_point_index);
6305 *  
6306 * @endcode
6307 *
6308 * pressure term
6309 *
6310 * @code
6311 *   pressure_values.at(q_point) = constitutive_request.get_pressure();
6312 *   von_mises_stress_values.at(q_point) =
6313 *   constitutive_request.get_stress_deviator().norm() / Constants<dim, Number>::sqrt2thirds();
6314 *   }
6315 *  
6316 *   mixed_fe_projector[cell_index].project(
6317 *   &projected_pressure_coefficients,
6318 *   pressure_values);
6319 *  
6320 *   qp_values_projectors[cell_index].project(
6321 *   &projected_von_mises_stress_coefficients,
6322 *   von_mises_stress_values);
6323 *  
6324 *   std::vector<types::global_dof_index> local_dof_indices (mixed_dofs_per_cell);
6325 *   mixed_fe_cell->get_dof_indices (local_dof_indices);
6326 *   for (unsigned int dof_i = 0; dof_i < mixed_dofs_per_cell; ++dof_i) {
6327 *   pressure(local_dof_indices[dof_i]) = projected_pressure_coefficients.at(dof_i);
6328 *   }
6329 *  
6330 *   std::vector<types::global_dof_index> local_discontinuous_dof_indices(disc_dofs_per_cell);
6331 *   discontinuous_fe_cell->get_dof_indices (local_discontinuous_dof_indices);
6332 *   for (unsigned int dof_i = 0; dof_i < disc_dofs_per_cell; ++dof_i) {
6333 *   von_mises_stress(local_discontinuous_dof_indices[dof_i]) =
6334 *   projected_von_mises_stress_coefficients.at(dof_i);
6335 *   }
6336 *  
6337 *   } /* if cell is locally owned */
6338 *   } /*for (; cell!=endc; ++cell)*/
6339 *   }
6340 *  
6341 *   template <int dim, typename Number>
6342 *   void PlasticityLabProg<dim, Number>::prepare_output_results(
6343 *   DataOut<dim> &data_out,
6344 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6345 *   const NewtonStepSystem &mechanical_nonlinear_system,
6346 *   const DoFSystem<dim, Number> &thermal_dof_system,
6347 *   const NewtonStepSystem &thermal_nonlinear_system,
6348 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6349 *   const NewtonStepSystem &mesh_motion_nonlinear_system) const {
6350 *  
6351 *   std::vector<std::string> displacement_names(dim, "displacement");
6352 *   displacement_names.emplace_back("angular_displacement");
6353 *   std::vector<std::string> velocity_names(dim, "displacement_time_rate");
6354 *   velocity_names.emplace_back("angular_velocity");
6355 *   std::vector<DataComponentInterpretation::DataComponentInterpretation>
6356 *   data_component_interpretation(
6358 *   data_component_interpretation.push_back(
6360 *  
6361 *   std::vector<DataComponentInterpretation::DataComponentInterpretation>
6362 *   mesh_motion_data_component_interpretation(
6364 *  
6365 *   data_out.add_data_vector(mechanical_dof_system.dof_handler,
6366 *   mechanical_nonlinear_system.previous_deformation,
6367 *   displacement_names,
6368 *   data_component_interpretation);
6369 *   data_out.add_data_vector(mechanical_dof_system.dof_handler,
6370 *   mechanical_nonlinear_system.previous_time_derivative,
6371 *   velocity_names,
6372 *   data_component_interpretation);
6373 *   data_out.add_data_vector(thermal_dof_system.dof_handler,
6374 *   thermal_nonlinear_system.previous_deformation,
6375 *   "Temperature");
6376 *   data_out.add_data_vector(mesh_motion_dof_system.dof_handler,
6377 *   mesh_motion_nonlinear_system.previous_deformation,
6378 *   std::vector<std::string>(dim, "mesh_motion"),
6379 *   mesh_motion_data_component_interpretation);
6380 *   data_out.add_data_vector(mesh_motion_dof_system.dof_handler,
6381 *   mesh_motion_nonlinear_system.previous_time_derivative,
6382 *   std::vector<std::string>(dim, "mesh_velocity"),
6383 *   mesh_motion_data_component_interpretation);
6384 *   data_out.build_patches(mapping, 2);
6385 *   }
6386 *  
6387 *   template <int dim, typename Number>
6388 *   template <typename TriangulationType>
6389 *   void PlasticityLabProg<dim, Number>::write_output_results(
6390 *   DataOut<dim> &data_out,
6391 *   const TriangulationType &tria,
6392 *   const std::string &filename_base) const {
6393 *  
6394 *   const std::string filename =
6395 *   (filename_base + "-"
6396 *   + Utilities::int_to_string(tria.locally_owned_subdomain(), 4));
6397 *  
6398 *   std::ofstream output_vtu((filename + ".vtu").c_str());
6399 *   data_out.write_vtu(output_vtu);
6400 *  
6401 *   if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0) {
6402 *   std::vector<std::string> filenames;
6403 *   for (unsigned int i = 0;
6404 *   i < Utilities::MPI::n_mpi_processes(mpi_communicator); ++i)
6405 *   filenames.push_back(filename_base + "-"
6407 *   + ".vtu");
6408 *   std::ofstream pvtu_master_output((filename_base + ".pvtu").c_str());
6409 *   data_out.write_pvtu_record(pvtu_master_output, filenames);
6410 *   std::ofstream visit_master_output((filename_base + ".visit").c_str());
6411 *   DataOutBase::write_visit_record(visit_master_output, filenames);
6412 *   }
6413 *   } /* output_results */
6414 *  
6415 *   template class PlasticityLabProg<2, double>;
6416 *  
6417 *   } /*namespace PlasticityLab*/
6418 * @endcode
6419
6420
6421<a name="ann-src/PlasticityLabProg.h"></a>
6422<h1>Annotated version of src/PlasticityLabProg.h</h1>
6423 *
6424 *
6425 *
6426 *
6427 * @code
6428 *   /*
6429 *   * PlasticityLabProg.h
6430 *   *
6431 *   * Created on: 09 Jul 2014
6432 *   * Author: cerecam
6433 *   */
6434 *  
6435 *   #ifndef PLASTICITYLABPROG_H_
6436 *   #define PLASTICITYLABPROG_H_
6437 *  
6438 *   #include <deal.II/fe/fe_q.h>
6439 *   #include <deal.II/fe/fe_dgp.h>
6440 *   #include <deal.II/fe/fe_system.h>
6441 *   #include <deal.II/fe/mapping_q.h>
6442 *  
6443 *   #include <deal.II/distributed/tria.h>
6444 *  
6445 *   #include <deal.II/numerics/data_out.h>
6446 *   #include <deal.II/base/function.h>
6447 *   #include <stdexcept>
6448 *  
6449 *   #include "DoFSystem.h"
6450 *   #include "LBCSystem.h"
6451 *   #include "MixedFEProjector.h"
6452 *   #include "Material.h"
6453 *   #include "NewtonStepSystem.h"
6454 *  
6455 *   namespace PlasticityLab {
6456 *   using namespace dealii;
6457 *  
6458 *   template <int dim, typename Number = double>
6459 *   class PlasticityLabProg {
6460 *   public:
6461 *   PlasticityLabProg(Material<dim+1, Number> &);
6462 *   virtual ~PlasticityLabProg();
6463 *   void run();
6464 *  
6465 *   private:
6466 *   void make_grid (int);
6467 *   void make_cylindrical_grid(
6468 *   Triangulation<dim> &triangulation,
6469 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6470 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6471 *   int n_initial_global_refinements);
6472 *   void make_grid_();
6473 *   void make_necking_grid(
6474 *   Triangulation<dim> &triangulation,
6475 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6476 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6477 *   int n_initial_global_refinements);
6478 *   void make_interference_cylinder_grid(
6479 *   Triangulation<dim> &triangulation,
6480 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6481 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6482 *   int n_initial_global_refinements);
6483 *   void make_cylindrical_impact_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_ball_in_hypershell_grid(
6489 *   Triangulation<dim> &triangulation,
6490 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6491 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
6492 *   int n_initial_global_refinements);
6493 *   void make_hook_membrane_grid(int);
6494 *  
6495 *   void set_mesh_motion_LBCs(
6496 *   Triangulation<dim> &triangulation,
6497 *   LBCSystem<dim, Number, dim> &mesh_motion_lbc_system);
6498 *  
6499 *  
6500 *   Tensor<2, dim+1, Number> get_rotation_tensor(const Tensor<2, dim+1, Number> &skew_symmetric_rotation) const;
6501 *   Tensor<2, dim+1, Number> get_rotation_tensor_variation(
6502 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation,
6503 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation_variation) const;
6504 *  
6505 *  
6506 *   void remap_material_state_variables(
6507 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6508 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6509 *   const NewtonStepSystem &mechanical_nonlinear_system,
6510 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6511 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6512 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6513 *   Material<dim+1, Number> &material,
6514 *   std::unordered_map<point_index_t, Tensor<2, dim+1, Number>> &remapped_deformation_gradients);
6515 *  
6516 *  
6517 *   void remap_thermal_field(
6518 *   NewtonStepSystem &thermal_nonlinear_system,
6519 *   const DoFSystem<dim, Number> &thermal_dof_system,
6520 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6521 *   const DoFSystem<dim, Number> &mesh_motion_dof_system);
6522 *  
6523 *  
6524 *   void remap_mechanical_fields(
6525 *   NewtonStepSystem &mechanical_nonlinear_system,
6526 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6527 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6528 *   const DoFSystem<dim, Number> &mesh_motion_dof_system);
6529 *  
6530 *  
6531 *   template <typename TriangulationType, typename MaterialType>
6532 *   void setup_material_data(TriangulationType &triangulation,
6533 *   MaterialType &material);
6534 *  
6535 *   void setup_material_area_factors(
6536 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6537 *   std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors);
6538 *  
6539 *   void update_material_area_factors(
6540 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6541 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6542 *   std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors);
6543 *  
6544 *   template <typename TriangulationType>
6545 *   void setup_mixed_fe_projection_data(
6546 *   const TriangulationType &triangulation,
6547 *   std::vector< MixedFEProjector<dim, Number> > &MixedFeProjectors,
6548 *   const FiniteElement<dim> &MixedFE,
6549 *   const Quadrature<dim> &quadrature_formula);
6550 *  
6551 *   void assemble_mechanical_system(
6552 *   NewtonStepSystem &Newton_system,
6553 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6554 *   const LBCSystem<dim, Number, dim+1> &mechanical_lbc_system,
6555 *   const NewtonStepSystem &mesh_motion_nonlinear_system,
6556 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6557 *   const NewtonStepSystem &thermal_Newton_system,
6558 *   const DoFSystem<dim, Number> &thermal_dof_system,
6559 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6560 *   Material<dim+1, Number> &material,
6561 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6562 *   const bool fill_system_matrix = true,
6563 *   const bool update_material_state = false);
6564 *  
6565 *   void assemble_thermal_system(
6566 *   NewtonStepSystem &Newton_system,
6567 *   NewtonStepSystem &mechanical_nonlinear_system,
6568 *   const DoFSystem<dim, Number> &thermal_dof_system,
6569 *   const LBCSystem<dim, Number, 1> &thermal_lbc_system,
6570 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6571 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6572 *   Material<dim+1, Number> &material,
6573 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6574 *   const std::unordered_map<size_t, Tensor<1, dim+1, Number>> &material_area_factors,
6575 *   const bool fill_system_matrix = true);
6576 *  
6577 *   void assemble_mesh_motion_system(
6578 *   NewtonStepSystem &mesh_motion_nonlinear_system,
6579 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6580 *   const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
6581 *   const NewtonStepSystem &deformation_nonlinear_system,
6582 *   const DoFSystem<dim, Number> &deformation_dof_system,
6583 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6584 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6585 *   const bool fill_system_matrix = true);
6586 *  
6587 *   void solve_system(const DoFSystem<dim, Number> &dof_system,
6588 *   NewtonStepSystem &nonlinear_system,
6589 *   const bool reset_solution=true);
6590 *  
6591 *   void prepare_output_results(DataOut<dim> &data_out,
6592 *   const DoFSystem<dim, Number> &dof_system,
6593 *   const NewtonStepSystem &nonlinear_system,
6594 *   const DoFSystem<dim, Number> &thermal_dof_system,
6595 *   const NewtonStepSystem &thermal_nonlinear_system,
6596 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6597 *   const NewtonStepSystem &mesh_motion_nonlinear_system) const;
6598 *  
6599 *   template <typename TriangulationType>
6600 *   void write_output_results(DataOut<dim> &data_out,
6601 *   const TriangulationType &tria,
6602 *   const std::string &filename_base) const;
6603 *  
6604 *   void get_plastic_strain(
6605 *   TrilinosWrappers::MPI::Vector &plastic_strain,
6606 *   const DoFHandler<dim> &discontinuous_dof_handler,
6607 *   const Material<dim+1, Number> &material,
6608 *   const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors);
6609 *  
6610 *   void get_pressure(
6612 *   const DoFHandler<dim> &mixed_fe_dof_handler,
6613 *   TrilinosWrappers::MPI::Vector &von_mises_stress,
6614 *   const DoFHandler<dim> &discontinuous_dof_handler,
6615 *   NewtonStepSystem &Newton_system,
6616 *   const DoFSystem<dim, Number> &mechanical_dof_system,
6617 *   const NewtonStepSystem &thermal_Newton_system,
6618 *   const DoFSystem<dim, Number> &thermal_dof_system,
6619 *   Material<dim+1, Number> &material,
6620 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6621 *   const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors);
6622 *  
6623 *   void solve_mechanical_step(int time_step);
6624 *   void solve_thermal_step(int time_step);
6625 *  
6626 *   void solve_mesh_motion_step(
6627 *   NewtonStepSystem &mesh_motion_nonlinear_system,
6628 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
6629 *   const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
6630 *   const NewtonStepSystem &deformation_nonlinear_system,
6631 *   const DoFSystem<dim, Number> &deformation_dof_system,
6632 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
6633 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6634 *   const int time_step);
6635 *  
6636 *   Tensor<2, dim+1, Number> get_deformation_gradient(
6637 *   const Tensor<2, dim, Number> &increment_gradient,
6638 *   const Number increment_0_over_rho) {
6639 *   Tensor<2, dim+1, Number> deformation_gradient = unit_symmetric_tensor<dim+1, Number>();
6640 *   for(unsigned int i=0; i<dim; ++i){
6641 *   for(unsigned int j=0; j<dim; ++j) {
6642 *   deformation_gradient[i][j] += increment_gradient[i][j];
6643 *   }
6644 *   }
6645 *   deformation_gradient[dim][dim] += increment_0_over_rho;
6646 *   return deformation_gradient;
6647 *   }
6648 *  
6649 *   Tensor<2, dim+1, Number> postprocess_tensor_dimension(
6650 *   const Tensor<2, dim, Number> &dimension_short_tensor,
6651 *   const Number entry_0_over_rho) {
6652 *   Tensor<2, dim+1, Number> postprocessed_tensor;
6653 *   for(unsigned int i=0; i<dim; ++i){
6654 *   for(unsigned int j=0; j<dim; ++j) {
6655 *   postprocessed_tensor[i][j] = dimension_short_tensor[i][j];
6656 *   }
6657 *   }
6658 *   postprocessed_tensor[dim][dim] = entry_0_over_rho;
6659 *   return postprocessed_tensor;
6660 *   }
6661 *  
6662 *   Tensor<1, dim+1, Number> postprocess_tensor_dimension(
6663 *   const Tensor<1, dim, Number> &dimension_short_tensor,
6664 *   const Number entry_at_dim=static_cast<Number>(0.0)) {
6665 *   Tensor<1, dim+1, Number> postprocessed_tensor;
6666 *   for(unsigned int i=0; i<dim; ++i){
6667 *   postprocessed_tensor[i] += dimension_short_tensor[i];
6668 *   }
6669 *   postprocessed_tensor[dim] = entry_at_dim;
6670 *   return postprocessed_tensor;
6671 *   }
6672 *  
6673 *   Tensor<1, dim+1, Number> scalar_to_angular_tensor(const Number angular_value) {
6674 *   Tensor<1, dim+1, Number> postprocessed_tensor = Tensor<1, dim+1, Number>();
6675 *   postprocessed_tensor[dim] = angular_value;
6676 *   return postprocessed_tensor;
6677 *   }
6678 *  
6679 *   Tensor<2, dim+1, Number> order_1_tensor_to_angular_gradient(
6680 *   const Tensor<1, dim, Number> &in_plane_gradient,
6681 *   const Number minus_entry_over_rho) {
6682 *   Tensor<2, dim+1, Number> postprocessed_tensor;
6683 *   for(unsigned int i=0; i<dim; ++i) {
6684 *   postprocessed_tensor[dim][i] = in_plane_gradient[i];
6685 *   }
6686 *   postprocessed_tensor[0][dim] = minus_entry_over_rho;
6687 *   return postprocessed_tensor;
6688 *   }
6689 *  
6690 *   Tensor<2, dim+1, Number> deformation_gradient_from_angular_displacement_gradient(
6691 *   const Number angular_displacement,
6692 *   const Tensor<1, dim, Number> &angular_displacement_gradient,
6693 *   const Number radius
6694 *   ) {
6695 *   if(2 != dim) {
6696 *   throw std::logic_error("Radial deformation gradient not implemented for dim!=2");
6697 *   }
6698 *  
6700 *   const Number theta = angular_displacement / radius;
6701 *   Tensor<1, dim, Number> angular_displacmenet_over_r_squared;
6702 *   angular_displacmenet_over_r_squared[0] = angular_displacement / (radius * radius);
6703 *   const Tensor<1, dim, Number> theta_gradient = angular_displacement_gradient / radius - angular_displacmenet_over_r_squared;
6704 *  
6705 *   result[0][0] = std::cos(theta) - radius * std::sin(theta) * theta_gradient[0];
6706 *   result[0][1] = - radius * std::sin(theta) * theta_gradient[1];
6707 *   result[0][2] = -std::sin(theta);
6708 *  
6709 *   result[1][0] = 0;
6710 *   result[1][1] = 1;
6711 *   result[1][2] = 0;
6712 *  
6713 *   result[2][0] = std::sin(theta) + radius * std::cos(theta) * theta_gradient[0];
6714 *   result[2][1] = radius * std::cos(theta) * theta_gradient[1];
6715 *   result[2][2] = std::cos(theta);
6716 *  
6717 *   return result;
6718 *   }
6719 *  
6720 *   Tensor<2, dim+1, Number> deformation_gradient_from_angular_displacement_gradient_variations(
6721 *   const Number angular_displacement,
6722 *   const Tensor<1, dim, Number> &angular_displacement_gradient,
6723 *   const Number radius,
6724 *   const Number angular_displacement_variation,
6725 *   const Tensor<1, dim, Number> &angular_displacement_gradient_variation
6726 *   ) {
6727 *   if(2 != dim) {
6728 *   throw std::logic_error("Radial deformation gradient not implemented for dim!=2");
6729 *   }
6730 *  
6732 *   const Number theta = angular_displacement / radius;
6733 *   const Number theta_variation = angular_displacement_variation / radius;
6734 *  
6735 *   Tensor<1, dim, Number> angular_displacmenet_over_r_squared;
6736 *   angular_displacmenet_over_r_squared[0] = angular_displacement / (radius * radius);
6737 *   const Tensor<1, dim, Number> theta_gradient = angular_displacement_gradient / radius - angular_displacmenet_over_r_squared;
6738 *  
6739 *   Tensor<1, dim, Number> angular_displacmenet_variation_over_r_squared;
6740 *   angular_displacmenet_variation_over_r_squared[0] = angular_displacement_variation / (radius * radius);
6741 *   const Tensor<1, dim, Number> theta_gradient_variation = angular_displacement_gradient_variation / radius - angular_displacmenet_variation_over_r_squared;
6742 *  
6743 *   result[0][0] = - std::sin(theta) * theta_variation
6744 *   - radius * std::cos(theta) * theta_variation * theta_gradient[0]
6745 *   - radius * std::sin(theta) * theta_gradient_variation[0];
6746 *  
6747 *   result[0][1] = - radius * std::cos(theta) * theta_variation * theta_gradient[1]
6748 *   - radius * std::sin(theta) * theta_gradient_variation[1];
6749 *  
6750 *   result[0][2] = -std::cos(theta) * theta_variation;
6751 *  
6752 *   result[1][0] = 0;
6753 *   result[1][1] = 0;
6754 *   result[1][2] = 0;
6755 *  
6756 *   result[2][0] = std::cos(theta) * theta_variation
6757 *   - radius * std::sin(theta) * theta_variation * theta_gradient[0]
6758 *   + radius * std::cos(theta) * theta_gradient_variation[0];
6759 *  
6760 *   result[2][1] = - radius * std::sin(theta) * theta_variation * theta_gradient[1]
6761 *   + radius * std::cos(theta) * theta_gradient_variation[1];
6762 *  
6763 *   result[2][2] = - std::sin(theta) * theta_variation;
6764 *  
6765 *   return result;
6766 *   }
6767 *  
6768 *   Tensor<2, dim+1, Number> rotation_tensor_to_transform_B_e(
6769 *   const Number angular_displacement,
6770 *   const Number radius
6771 *   ) {
6772 *   if(2 != dim) {
6773 *   throw std::logic_error("Radial deformation gradient not implemented for dim!=2");
6774 *   }
6775 *  
6777 *   const Number theta = angular_displacement / radius;
6778 *  
6779 *   result[0][0] = std::cos(theta);
6780 *   result[0][1] = 0;
6781 *   result[0][2] = -std::sin(theta);
6782 *  
6783 *   result[1][0] = 0;
6784 *   result[1][1] = 1;
6785 *   result[1][2] = 0;
6786 *  
6787 *   result[2][0] = std::sin(theta);
6788 *   result[2][1] = 0;
6789 *   result[2][2] = std::cos(theta);
6790 *  
6791 *   return result;
6792 *   }
6793 *  
6794 *   Tensor<2, dim+1, Number> rotation_tensor_variation_to_transform_B_e(
6795 *   const Number angular_displacement,
6796 *   const Number angular_displacement_variation,
6797 *   const Number radius
6798 *   ) {
6799 *   if(2 != dim) {
6800 *   throw std::logic_error("Radial deformation gradient not implemented for dim!=2");
6801 *   }
6802 *  
6804 *   const Number theta = angular_displacement / radius;
6805 *   const Number theta_variation = angular_displacement_variation / radius;
6806 *  
6807 *   result[0][0] = -std::sin(theta) * theta_variation;
6808 *   result[0][1] = 0;
6809 *   result[0][2] = -std::cos(theta) * theta_variation;
6810 *  
6811 *   result[1][0] = 0;
6812 *   result[1][1] = 0;
6813 *   result[1][2] = 0;
6814 *  
6815 *   result[2][0] = std::cos(theta) * theta_variation;
6816 *   result[2][1] = 0;
6817 *   result[2][2] = -std::sin(theta) * theta_variation;
6818 *  
6819 *   return result;
6820 *   }
6821 *  
6823 *   ConditionalOStream pcout;
6824 *  
6825 *   const Number order;
6826 *   FESystem<dim> mech_fe;
6827 *   FE_Q<dim> therm_fe;
6828 *   FE_DGP<dim> mixed_var_fe;
6829 *   FESystem<dim> mesh_motion_fe;
6830 *   MappingQ<dim> mapping;
6831 *  
6833 *  
6834 *   DoFSystem<dim, Number> mech_dof_system;
6835 *   DoFSystem<dim, Number> therm_dof_system;
6836 *   DoFSystem<dim, Number> mixed_fe_dof_system;
6837 *  
6838 *   LBCSystem<dim, Number, dim+1> mech_lbc_system;
6839 *   LBCSystem<dim, Number, 1> therm_lbc_system;
6840 *  
6841 *   NewtonStepSystem mech_nonlinear_system;
6842 *   NewtonStepSystem therm_nonlinear_system;
6843 *  
6844 *   NewtonStepSystem mesh_motion_nonlinear_system;
6845 *   DoFSystem<dim, Number> mesh_motion_dof_system;
6846 *   LBCSystem<dim, Number, dim> mesh_motion_lbc_system;
6847 *  
6848 *   NewtonStepSystem deformation_remapping_nonlinear_system;
6849 *  
6850 *   QGauss<dim> quadrature_formula;
6851 *   QGauss<dim-1> face_quadrature_formula;
6852 *  
6853 *   Material<dim+1, Number> &material;
6854 *  
6855 *   std::vector< MixedFEProjector<dim, Number> > mixed_FE_projectors;
6856 *  
6857 *   std::unordered_map<size_t, Tensor<1, dim+1, Number>> material_area_factors;
6858 *  
6859 *   Number time_increment = 1.0e-01; /*0.5e-6;*/ // [s]
6860 *   unsigned int output_rate = 1;
6861 *   Number time_since_start = 0;
6862 *  
6863 *   const Number ambient_temperature = 293.0; // [K]
6864 *   const Number rho_infty = 0.0;
6865 *  
6866 *   const unsigned int surface_boundary_id = 2;
6867 *  
6868 *   const bool COMPUTE_FORCES_PER_UNIT_AREA_IN_CURRENT_CONFIGURATION = false;
6869 *   const bool use_sigmoid_friction_law = true;
6870 *  
6871 *   Number global_lagrangian_penalty_factor = 1.0;
6872 *  
6873 *   };
6874 *  
6875 *   struct NewtonIterationDivergenceException : std::exception {
6876 *   const char *what() const _GLIBCXX_USE_NOEXCEPT override {
6877 *   return "Newton step solution diverged!\n";
6878 *   }
6879 *   };
6880 *  
6881 *   } /*namespace PlasticityLab*/
6882 *  
6883 *   #endif /* PLASTICITYLABPROG_H_ */
6884 * @endcode
6885
6886
6887<a name="ann-src/PlasticityLabProgDrivers.cpp"></a>
6888<h1>Annotated version of src/PlasticityLabProgDrivers.cpp</h1>
6889 *
6890 *
6891 *
6892 *
6893 * @code
6894 *   #include <sstream>
6895 *  
6896 *   #include <deal.II/grid/tria.h>
6897 *   #include <deal.II/grid/grid_generator.h>
6898 *   #include <deal.II/grid/grid_in.h>
6899 *   #include <deal.II/grid/manifold_lib.h>
6900 *   #include <deal.II/grid/grid_tools.h>
6901 *  
6902 *  
6903 *   #include <deal.II/fe/fe_dgq.h>
6904 *  
6905 *   #include "RotationFunction.h"
6906 *   #include "ScaleZFunction.h"
6907 *   #include "ScaleComponentFunction.h"
6908 *   #include "PlasticityLabProg.h"
6909 *  
6910 *   using namespace dealii;
6911 *   using std::endl;
6912 *  
6913 *   namespace PlasticityLab {
6914 *  
6915 *   template <int dim, typename Number>
6916 *   void PlasticityLabProg<dim, Number>::run() {
6917 * @endcode
6918 *
6919 * make_grid_();
6920 * make_ball_in_hypershell_grid(
6921 * make_cylindrical_grid(
6922 * make_cylindrical_impact_grid(
6923 *
6924 * @code
6925 *   make_necking_grid(
6926 *   triangulation,
6927 *   mech_lbc_system,
6928 *   therm_lbc_system,
6929 *   3);
6930 * @endcode
6931 *
6932 * triangulation,
6933 * mech_lbc_system,
6934 * therm_lbc_system,
6935 * 3);
6936 * make_hook_membrane_grid(1);
6937 *
6938
6939 *
6940 *
6941 * @code
6942 *   set_mesh_motion_LBCs(triangulation, mesh_motion_lbc_system);
6943 *  
6944 *   const Number total_elongation = 8.0; // mm
6945 *   const Number elongation_rate = 1.0; // [mm/s]
6947 *  
6948 *   mech_dof_system.setup_dof_system(mech_fe);
6949 *   mech_lbc_system.apply_constraints(mech_dof_system);
6950 *   mech_nonlinear_system.setup(mech_dof_system);
6951 *  
6952 *   therm_dof_system.setup_dof_system(therm_fe);
6953 *   therm_lbc_system.apply_constraints(therm_dof_system);
6954 *   therm_nonlinear_system.setup(therm_dof_system);
6955 *  
6956 * @endcode
6957 *
6958 * Initialize the temperature solution vector. Because we are
6959 * initializing with a possibly non-zero value, we can't just
6960 * assign that value to the vector in a parallel setting because
6961 * the solution vector has ghost entries and so is
6962 * read-only. Rather, we create a completely distributed vector,
6963 * assign the value to it, and then copy that into the solution
6964 * vector.
6965 *
6966 * @code
6967 *   {
6968 *   TrilinosWrappers::MPI::Vector tmp (therm_dof_system.locally_owned_dofs,
6969 *   mpi_communicator);
6970 *   tmp = ambient_temperature;
6971 *   therm_nonlinear_system.previous_deformation = tmp;
6972 *   }
6973 *  
6974 *   mixed_fe_dof_system.setup_dof_system(mixed_var_fe);
6975 *  
6976 *   mesh_motion_dof_system.setup_dof_system(mesh_motion_fe);
6977 *   mesh_motion_lbc_system.apply_constraints(mesh_motion_dof_system);
6978 *   mesh_motion_nonlinear_system.setup(mesh_motion_dof_system);
6979 *  
6980 *   deformation_remapping_nonlinear_system.setup(mech_dof_system);
6981 *  
6982 *   setup_material_data(triangulation, material);
6983 *   setup_material_area_factors(mesh_motion_dof_system, material_area_factors);
6984 *  
6985 *   setup_mixed_fe_projection_data(
6986 *   triangulation, mixed_FE_projectors,
6987 *   mixed_var_fe, quadrature_formula);
6988 *  
6989 *   std::vector< MixedFEProjector<dim, Number> > discontinuous_projectors;
6990 *   FE_DGQ<dim> discontinuous_fe(1);
6991 *  
6992 *   setup_mixed_fe_projection_data(
6993 *   triangulation, discontinuous_projectors,
6994 *   discontinuous_fe, quadrature_formula);
6995 *  
6996 *   TrilinosWrappers::MPI::Vector pressure(
6997 *   mixed_fe_dof_system.locally_owned_dofs,
6998 *   mpi_communicator);
6999 *  
7000 *   DoFSystem<dim, Number> discontinuous_dof_system(triangulation, mapping);
7001 *   discontinuous_dof_system.setup_dof_system(discontinuous_fe);
7002 *   TrilinosWrappers::MPI::Vector plastic_strain(
7003 *   discontinuous_dof_system.locally_owned_dofs,
7004 *   mpi_communicator);
7005 *   TrilinosWrappers::MPI::Vector von_mises_stress(
7006 *   discontinuous_dof_system.locally_owned_dofs,
7007 *   mpi_communicator);
7008 *  
7009 *   {
7010 *   TrilinosWrappers::MPI::Vector initial_velocity(
7011 *   mech_dof_system.locally_owned_dofs,
7012 *   mpi_communicator);
7013 *  
7014 *   MPI_Barrier(mpi_communicator);
7015 *  
7016 *   for(const auto initial_velocity_interpolation_handler: mech_lbc_system.initial_velocity_interpolation_handlers) {
7017 *   initial_velocity_interpolation_handler->interpolate(initial_velocity, mech_dof_system);
7018 *   }
7019 *  
7020 * @endcode
7021 *
7022 * Assigning the locally-owned vector into the ghosted vector performs
7023 * the necessary ghost import; compress() must not be called on a
7024 * vector that has ghost elements (it is read-only).
7025 *
7026 * @code
7027 *   mech_nonlinear_system.previous_time_derivative = initial_velocity;
7028 *   }
7029 *  
7030 *  
7031 *   {
7032 *   TrilinosWrappers::MPI::Vector initial_deformation(
7033 *   mech_dof_system.locally_owned_dofs,
7034 *   mpi_communicator);
7035 *  
7036 *   MPI_Barrier(mpi_communicator);
7037 *  
7038 *   for(const auto initial_deformation_interpolation_handler: mech_lbc_system.initial_deformation_interpolation_handlers) {
7039 *   initial_deformation_interpolation_handler->interpolate(initial_deformation, mech_dof_system);
7040 *   }
7041 *  
7042 *   mech_nonlinear_system.previous_deformation = initial_deformation;
7043 *   }
7044 *  
7045 *  
7046 *   for (unsigned int timeStep = 0; timeStep < n_steps + 1; ++timeStep) {
7047 *   for(const auto increment_interpolation_handler: mech_lbc_system.increment_interpolation_handlers) {
7048 *   increment_interpolation_handler->advance_time(time_increment);
7049 *   }
7050 *  
7051 *   get_plastic_strain(
7052 *   plastic_strain,
7053 *   discontinuous_dof_system.dof_handler,
7054 *   material,
7055 *   discontinuous_projectors);
7056 *  
7057 *   get_pressure(
7058 *   pressure,
7059 *   mixed_fe_dof_system.dof_handler,
7060 *   von_mises_stress,
7061 *   discontinuous_dof_system.dof_handler,
7062 *   mech_nonlinear_system,
7063 *   mech_dof_system,
7064 *   therm_nonlinear_system,
7065 *   therm_dof_system,
7066 *   material,
7067 *   mixed_FE_projectors,
7068 *   discontinuous_projectors);
7069 *  
7070 *   if(0==timeStep % output_rate) {
7071 *   pcout << "\nOutputting results..." << endl;
7072 *   DataOut<dim> data_out;
7073 *  
7074 *   data_out.add_data_vector(
7075 *   discontinuous_dof_system.dof_handler,
7076 *   plastic_strain,
7077 *   "plastic_strain");
7078 *   data_out.build_patches();
7079 *  
7080 *   data_out.add_data_vector(
7081 *   mixed_fe_dof_system.dof_handler,
7082 *   pressure,
7083 *   "pressure");
7084 *   data_out.build_patches();
7085 *  
7086 *   data_out.add_data_vector(
7087 *   discontinuous_dof_system.dof_handler,
7088 *   von_mises_stress,
7089 *   "von_mises_stress");
7090 *  
7091 *   prepare_output_results(
7092 *   data_out,
7093 *   mech_dof_system,
7094 *   mech_nonlinear_system,
7095 *   therm_dof_system,
7096 *   therm_nonlinear_system,
7097 *   mesh_motion_dof_system,
7098 *   mesh_motion_nonlinear_system);
7099 *  
7100 *   std::ostringstream oss;
7101 *   oss << "step_" << timeStep;
7102 *   const std::string output_name = oss.str();
7103 *   write_output_results(data_out, triangulation, output_name);
7104 *   }
7105 *  
7106 *   if (timeStep == n_steps) break;
7107 *  
7108 *   pcout << "\n\nStarting time step " << timeStep << ":\n\n" << endl;
7109 *  
7110 *   {
7111 *   TrilinosWrappers::MPI::Vector step_increment(
7112 *   mech_dof_system.locally_owned_dofs,
7113 *   mpi_communicator);
7114 *  
7115 *   MPI_Barrier(mpi_communicator);
7116 *  
7117 *   for(const auto increment_interpolation_handler: mech_lbc_system.increment_interpolation_handlers) {
7118 *   increment_interpolation_handler->interpolate(step_increment, mech_dof_system);
7119 *   }
7120 *  
7121 *   mech_nonlinear_system.current_increment = step_increment;
7122 *   }
7123 *  
7124 *   solve_mesh_motion_step(
7125 *   mesh_motion_nonlinear_system,
7126 *   mesh_motion_dof_system,
7127 *   mesh_motion_lbc_system,
7128 *   mech_nonlinear_system,
7129 *   mech_dof_system,
7130 *   mixed_fe_dof_system,
7131 *   mixed_FE_projectors,
7132 *   timeStep);
7133 *  
7134 *   mesh_motion_nonlinear_system.advance_time(time_increment, rho_infty, false);
7135 * @endcode
7136 *
7137 * The mesh-motion deformation is the negative of the just-computed
7138 * increment. 'previous_deformation' is a ghosted (read-only) vector, so
7139 * this negation is delegated to the nonlinear system, which performs the
7140 * arithmetic in fully-distributed temporaries.
7141 *
7142 * @code
7143 *   mesh_motion_nonlinear_system.set_previous_deformation_to_negative_current_increment();
7144 *  
7145 *   std::unordered_map<point_index_t, Tensor<2, dim+1, Number>> remapped_deformation_gradients;
7146 *   remap_material_state_variables(
7147 *   mesh_motion_nonlinear_system,
7148 *   mesh_motion_dof_system,
7149 *   mech_nonlinear_system,
7150 *   mech_dof_system,
7151 *   mixed_fe_dof_system,
7152 *   mixed_FE_projectors,
7153 *   material,
7154 *   remapped_deformation_gradients);
7155 *  
7156 *   remap_thermal_field(
7157 *   therm_nonlinear_system,
7158 *   therm_dof_system,
7159 *   mesh_motion_nonlinear_system,
7160 *   mesh_motion_dof_system);
7161 *  
7162 *   remap_mechanical_fields(
7163 *   mech_nonlinear_system,
7164 *   mech_dof_system,
7165 *   mesh_motion_nonlinear_system,
7166 *   mesh_motion_dof_system);
7167 *  
7168 *   update_material_area_factors(
7169 *   mesh_motion_nonlinear_system,
7170 *   mesh_motion_dof_system,
7171 *   material_area_factors);
7172 *  
7173 *   solve_mechanical_step(timeStep);
7174 *  
7175 *   solve_thermal_step(timeStep);
7176 *  
7177 *   solve_mechanical_step(timeStep);
7178 *  
7179 * @endcode
7180 *
7181 * udpate material state
7182 *
7183 * @code
7184 *   pcout << "\n\t\tassembling mechanical system updating material state..." << endl;
7185 *   assemble_mechanical_system(
7186 *   mech_nonlinear_system,
7187 *   mech_dof_system,
7188 *   mech_lbc_system,
7189 *   mesh_motion_nonlinear_system,
7190 *   mesh_motion_dof_system,
7191 *   therm_nonlinear_system,
7192 *   therm_dof_system,
7193 *   mixed_fe_dof_system,
7194 *   material,
7195 *   mixed_FE_projectors,
7196 *   false,
7197 *   true);
7198 *  
7199 *   mech_nonlinear_system.advance_time(time_increment, rho_infty, true);
7200 * @endcode
7201 *
7202 * Accumulate the thermal increment into the (ghosted, read-only)
7203 * temperature field. The nonlinear system performs the addition in
7204 * fully-distributed temporaries and assigns the result back.
7205 *
7206 * @code
7207 *   therm_nonlinear_system.add_current_increment_to_previous_deformation();
7208 *  
7209 *   therm_nonlinear_system.current_increment = 0;
7210 *  
7211 *   pcout << "Next timestep..." << std::endl;
7212 *  
7213 *   } /*for(timeStep)*/
7214 *   }
7215 *  
7216 *   template<int dim, typename Number>
7217 *   void PlasticityLabProg<dim, Number>::solve_mechanical_step(int time_step) {
7218 *  
7219 *   TrilinosWrappers::MPI::Vector total_residual;
7220 *  
7221 *   for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7222 *  
7223 *   pcout << "\n\ttime step " << time_step
7224 *   << ", Newton step " << NewtonStep << "..."
7225 *   << "\n\t\tassembling mechanical system with tangents..." << endl;
7226 *  
7227 *   assemble_mechanical_system(
7228 *   mech_nonlinear_system,
7229 *   mech_dof_system,
7230 *   mech_lbc_system,
7231 *   mesh_motion_nonlinear_system,
7232 *   mesh_motion_dof_system,
7233 *   therm_nonlinear_system,
7234 *   therm_dof_system,
7235 *   mixed_fe_dof_system,
7236 *   material,
7237 *   mixed_FE_projectors,
7238 *   true);
7239 *  
7240 *   total_residual = mech_nonlinear_system.Newton_step_residual;
7241 *   total_residual.compress(VectorOperation::insert);
7242 *  
7243 *   pcout << "-------------------------------------------------------------------" << endl;
7244 *  
7245 *   pcout << "Normalized system residual: "
7246 *   << std::sqrt(total_residual.norm_sqr())
7247 *   << " ..." << endl;
7248 *   pcout << "-------------------------------------------------------------------" << endl;
7249 *  
7250 *   if (std::sqrt(total_residual.norm_sqr()) <= 1e-5) {
7251 *   break;
7252 *   }
7253 *  
7254 *   const Number old_residual = total_residual.norm_sqr();
7255 *   Number previous_residual = old_residual;
7256 *  
7257 *   pcout << "solving system..." << endl;
7258 *   try {
7259 *   solve_system(mech_dof_system, mech_nonlinear_system);
7260 *   } catch (...) {
7261 *   if (std::isnan(mech_nonlinear_system.Newton_step_solution.norm_sqr())) {
7262 *   throw;
7263 *   }
7264 *   pcout << "System solution falied. Continuing with partial solution..." << endl;
7265 *   }
7266 *   mech_dof_system.nodal_constraints.distribute(
7267 *   mech_nonlinear_system.Newton_step_solution);
7268 *   const Number solution_norm = std::sqrt(
7269 *   mech_nonlinear_system.Newton_step_solution.norm_sqr());
7270 *   TrilinosWrappers::MPI::Vector full_step_increment(mech_nonlinear_system.current_increment);
7271 *   TrilinosWrappers::MPI::Vector temp_locally_owned_increment(mech_dof_system.locally_owned_dofs);
7272 *  
7273 *   Number clip_factor =
7274 *   (solution_norm <= std::sqrt(old_residual)) ?
7275 *   1.0 : sqrt(old_residual) / solution_norm;
7276 *   if (clip_factor < 1.0) pcout << "clip factor: " << clip_factor << endl;
7277 *  
7278 *   pcout << "doing line search..." << endl;
7279 *   [[maybe_unused]] bool hit_line_search_limit = false;
7280 *   for (unsigned int i = 0; true/*i < 18*/; ++i) {
7281 *   const Number alpha = std::pow(0.5, static_cast<Number>(i));
7282 *   if (i > 5 && clip_factor * alpha * solution_norm < 1e-1) {
7283 *   hit_line_search_limit = true;
7284 *   break;
7285 *   }
7286 *   if (i > 0) pcout << "\tline search step " << i << "..." << endl;
7287 *  
7288 *   while (true) {
7289 *   temp_locally_owned_increment = full_step_increment;
7290 *   temp_locally_owned_increment.sadd(1, -alpha * clip_factor, mech_nonlinear_system.Newton_step_solution);
7291 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7292 *   mech_nonlinear_system.current_increment = temp_locally_owned_increment;
7293 *  
7294 *   try {
7295 *   assemble_mechanical_system(
7296 *   mech_nonlinear_system,
7297 *   mech_dof_system,
7298 *   mech_lbc_system,
7299 *   mesh_motion_nonlinear_system,
7300 *   mesh_motion_dof_system,
7301 *   therm_nonlinear_system,
7302 *   therm_dof_system,
7303 *   mixed_fe_dof_system,
7304 *   material,
7305 *   mixed_FE_projectors,
7306 *   false);
7307 *   } catch (const std::runtime_error &) {
7308 *   clip_factor *= 0.125; // using a power of 0.5; better for binary arithmetic
7309 *   pcout << "\t-------------------------------------------------------------------" << endl;
7310 *   pcout << "\tDeformation too large, causing degenerate mesh..." << endl;
7311 *   pcout << "\tupdated clip factor: " << clip_factor << endl;
7312 *   pcout << "\t-------------------------------------------------------------------" << endl;
7313 *   continue;
7314 *   }
7315 *   break;
7316 *   }
7317 *  
7318 *   total_residual = mech_nonlinear_system.Newton_step_residual;
7319 *   total_residual.compress(VectorOperation::insert);
7320 *  
7321 *   const Number current_residual = total_residual.norm_sqr();
7322 *  
7323 *   pcout << "\t-------------------------------------------------------------------" << endl;
7324 *  
7325 *   pcout << "\tNormalized system residual: "
7326 *   << std::sqrt(current_residual)
7327 *   << " ..." << endl;
7328 *   pcout << "\t-------------------------------------------------------------------" << endl;
7329 *  
7330 *   if (previous_residual < old_residual and current_residual >= previous_residual) {
7331 *   pcout << "\t---Accepting previous residual: " << std::sqrt(previous_residual)
7332 *   << " ..." << endl;
7333 *  
7334 *   temp_locally_owned_increment = full_step_increment;
7335 *   temp_locally_owned_increment.sadd(1, -2 * alpha * clip_factor, mech_nonlinear_system.Newton_step_solution);
7336 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7337 *   mech_nonlinear_system.current_increment = temp_locally_owned_increment;
7338 *   break;
7339 *   }
7340 *   previous_residual = current_residual;
7341 *   }
7342 *  
7343 *   }
7344 *   }
7345 *  
7346 *  
7347 *   template<int dim, typename Number>
7348 *   void PlasticityLabProg<dim, Number>::solve_thermal_step(int time_step) {
7349 *  
7350 *   TrilinosWrappers::MPI::Vector total_therm_residual;
7351 *   const Number starting_thermal_residual_squared_norm = 1.0;
7352 *  
7353 *   for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7354 *  
7355 *   pcout << "\n\ttime step " << time_step
7356 *   << ", Newton step " << NewtonStep << "..."
7357 *   << "\n\t\tassembling thermal system with tangents..." << endl;
7358 *  
7359 *   assemble_thermal_system(
7360 *   therm_nonlinear_system,
7361 *   mech_nonlinear_system,
7362 *   therm_dof_system,
7363 *   therm_lbc_system,
7364 *   mech_dof_system,
7365 *   mixed_fe_dof_system,
7366 *   material,
7367 *   mixed_FE_projectors,
7368 *   material_area_factors,
7369 *   true);
7370 *  
7371 *   total_therm_residual = therm_nonlinear_system.Newton_step_residual;
7372 *   total_therm_residual.compress(VectorOperation::insert);
7373 *  
7374 *   pcout << "-------------------------------------------------------------------" << endl;
7375 *   pcout << "Normalized system residual (contactor): "
7376 *   << std::sqrt(total_therm_residual.norm_sqr()
7377 *   / starting_thermal_residual_squared_norm)
7378 *   << " ..." << endl;
7379 *   pcout << "-------------------------------------------------------------------" << endl;
7380 *  
7381 *   if (std::sqrt(total_therm_residual.norm_sqr()
7382 *   / starting_thermal_residual_squared_norm) <= 1e-6) {
7383 *   break;
7384 *   }
7385 *  
7386 *   const Number old_residual = total_therm_residual.norm_sqr();
7387 *  
7388 *   pcout << "solving system..." << endl;
7389 *  
7390 *   solve_system(therm_dof_system, therm_nonlinear_system);
7391 *  
7392 *   therm_dof_system.nodal_constraints.distribute(therm_nonlinear_system.Newton_step_solution);
7393 *   TrilinosWrappers::MPI::Vector full_step_increment(therm_nonlinear_system.current_increment);
7394 *  
7395 *   TrilinosWrappers::MPI::Vector temp_locally_owned_increment(therm_dof_system.locally_owned_dofs);
7396 *  
7397 *  
7398 *   pcout << "doing line search..." << endl;
7399 *   for (unsigned int i = 0; i < (NewtonStep > 0 ? 6 : 1); ++i) {
7400 *   const Number alpha = std::pow(0.5, static_cast<Number>(i));
7401 *  
7402 *   temp_locally_owned_increment = full_step_increment;
7403 *   temp_locally_owned_increment.sadd(1, -alpha, therm_nonlinear_system.Newton_step_solution);
7404 *   therm_dof_system.nodal_constraints.distribute(temp_locally_owned_increment);
7405 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7406 *   therm_nonlinear_system.current_increment = temp_locally_owned_increment;
7407 *  
7408 *   assemble_thermal_system(
7409 *   therm_nonlinear_system,
7410 *   mech_nonlinear_system,
7411 *   therm_dof_system,
7412 *   therm_lbc_system,
7413 *   mech_dof_system,
7414 *   mixed_fe_dof_system,
7415 *   material,
7416 *   mixed_FE_projectors,
7417 *   material_area_factors,
7418 *   false);
7419 *  
7420 *   total_therm_residual = therm_nonlinear_system.Newton_step_residual;
7421 *   total_therm_residual.compress(VectorOperation::insert);
7422 *  
7423 *   const Number current_residual = total_therm_residual.norm_sqr();
7424 *   if (current_residual < old_residual)
7425 *   break;
7426 *   }
7427 *   }
7428 *   pcout << endl;
7429 *   }
7430 *  
7431 *  
7432 *   template<int dim, typename Number>
7433 *   void PlasticityLabProg<dim, Number>::solve_mesh_motion_step(
7434 *   NewtonStepSystem &mesh_motion_nonlinear_system,
7435 *   const DoFSystem<dim, Number> &mesh_motion_dof_system,
7436 *   const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
7437 *   const NewtonStepSystem &deformation_nonlinear_system,
7438 *   const DoFSystem<dim, Number> &deformation_dof_system,
7439 *   const DoFSystem<dim, Number> &mixed_fe_dof_system,
7440 *   const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
7441 *   const int time_step) {
7442 *  
7443 *   TrilinosWrappers::MPI::Vector total_residual;
7444 *  
7445 *   for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7446 *  
7447 *   pcout << "\n\ttime step " << time_step
7448 *   << ", Newton step " << NewtonStep << "..."
7449 *   << "\n\t\tassembling mesh motion system with tangents..." << endl;
7450 *  
7451 *   assemble_mesh_motion_system(
7452 *   mesh_motion_nonlinear_system,
7453 *   mesh_motion_dof_system,
7454 *   mesh_motion_lbc_system,
7455 *   deformation_nonlinear_system,
7456 *   deformation_dof_system,
7457 *   mixed_fe_dof_system,
7458 *   mixed_fe_projector,
7459 *   true);
7460 *  
7461 *   total_residual = mesh_motion_nonlinear_system.Newton_step_residual;
7462 *   total_residual.compress(VectorOperation::insert);
7463 *  
7464 *   pcout << "-------------------------------------------------------------------" << endl;
7465 *  
7466 *   pcout << "Normalized system residual: "
7467 *   << std::sqrt(total_residual.norm_sqr())
7468 *   << " ..." << endl;
7469 *   pcout << "-------------------------------------------------------------------" << endl;
7470 *  
7471 *   if (std::sqrt(total_residual.norm_sqr()) <= 1e-4) {
7472 *   break;
7473 *   }
7474 *  
7475 *   const Number old_residual = total_residual.norm_sqr();
7476 *   Number previous_residual = old_residual;
7477 *  
7478 *   pcout << "solving system..." << endl;
7479 *   try {
7480 *   solve_system(mesh_motion_dof_system, mesh_motion_nonlinear_system);
7481 *   } catch (...) {
7482 *   if (std::isnan(mesh_motion_nonlinear_system.Newton_step_solution.norm_sqr())) {
7483 *   throw;
7484 *   }
7485 *   pcout << "System solution falied. Continuing with partial solution..." << endl;
7486 *   }
7487 *   mesh_motion_dof_system.nodal_constraints.distribute(mesh_motion_nonlinear_system.Newton_step_solution);
7488 *   const Number solution_norm = std::sqrt(mesh_motion_nonlinear_system.Newton_step_solution.norm_sqr());
7489 *   TrilinosWrappers::MPI::Vector full_step_increment(mesh_motion_nonlinear_system.current_increment);
7490 *   TrilinosWrappers::MPI::Vector temp_locally_owned_increment(mesh_motion_dof_system.locally_owned_dofs);
7491 *  
7492 *   Number clip_factor =
7493 *   (solution_norm <= std::sqrt(old_residual)) ? 1.0 : sqrt(old_residual) / solution_norm;
7494 *   if (clip_factor < 1.0) pcout << "clip factor: " << clip_factor << endl;
7495 *  
7496 *   pcout << "doing line search..." << endl;
7497 *   [[maybe_unused]] bool hit_line_search_limit = false;
7498 *   for (unsigned int i = 0; true/*i < 18*/; ++i) {
7499 *   const Number alpha = std::pow(0.5, static_cast<Number>(i));
7500 *   if (i > 5 && clip_factor * alpha * solution_norm < 1e-1) {
7501 *   hit_line_search_limit = true;
7502 *   break;
7503 *   }
7504 *   if (i > 0) pcout << "\tline search step " << i << "..." << endl;
7505 *  
7506 *   while (true) {
7507 *   temp_locally_owned_increment = full_step_increment;
7508 *   temp_locally_owned_increment.sadd(1, -alpha * clip_factor, mesh_motion_nonlinear_system.Newton_step_solution);
7509 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7510 *   mesh_motion_nonlinear_system.current_increment = temp_locally_owned_increment;
7511 *  
7512 *   try {
7513 *   assemble_mesh_motion_system(
7514 *   mesh_motion_nonlinear_system,
7515 *   mesh_motion_dof_system,
7516 *   mesh_motion_lbc_system,
7517 *   deformation_nonlinear_system,
7518 *   deformation_dof_system,
7519 *   mixed_fe_dof_system,
7520 *   mixed_fe_projector,
7521 *   false);
7522 *   } catch (const std::runtime_error &) {
7523 *   clip_factor *= 0.125; // using a power of 0.5; better for binary arithmetic
7524 *   pcout << "\t-------------------------------------------------------------------" << endl;
7525 *   pcout << "\tDeformation too large, causing degenerate mesh..." << endl;
7526 *   pcout << "\tupdated clip factor: " << clip_factor << endl;
7527 *   pcout << "\t-------------------------------------------------------------------" << endl;
7528 *   continue;
7529 *   }
7530 *   break;
7531 *   }
7532 *  
7533 *   total_residual = mesh_motion_nonlinear_system.Newton_step_residual;
7534 *   total_residual.compress(VectorOperation::insert);
7535 *  
7536 *   const Number current_residual = total_residual.norm_sqr();
7537 *  
7538 *   pcout << "\t-------------------------------------------------------------------" << endl;
7539 *  
7540 *   pcout << "\tNormalized system residual: "
7541 *   << std::sqrt(current_residual)
7542 *   << " ..." << endl;
7543 *   pcout << "\t-------------------------------------------------------------------" << endl;
7544 *  
7545 *   if (previous_residual < old_residual and current_residual >= previous_residual) {
7546 *   pcout << "\t---Accepting previous residual: " << std::sqrt(previous_residual)
7547 *   << " ..." << endl;
7548 *  
7549 *   temp_locally_owned_increment = full_step_increment;
7550 *   temp_locally_owned_increment.sadd(1, -2 * alpha * clip_factor, mesh_motion_nonlinear_system.Newton_step_solution);
7551 *   temp_locally_owned_increment.compress(VectorOperation::insert);
7552 *   mesh_motion_nonlinear_system.current_increment = temp_locally_owned_increment;
7553 *   break;
7554 *   }
7555 *   previous_residual = current_residual;
7556 *   }
7557 *   }
7558 *   }
7559 *  
7560 *  
7561 *   template <int dim>
7562 *   struct RefiningTransform
7563 *   {
7564 *   RefiningTransform(
7565 *   double height,
7566 *   double refining_fraction,
7567 *   double base=0,
7568 *   size_t dimension=1) :
7569 *   height(height),
7570 *   refining_fraction(refining_fraction),
7571 *   base(base),
7572 *   dimension(dimension) {}
7573 *  
7574 *   Point<dim> operator()(const Point<dim> &p) const
7575 *   {
7576 *   Point<dim> q = p;
7577 *   if ((p[dimension]-base)/(height-base) <= 0.5) {
7578 *   q[dimension] = base + refining_fraction/0.5 * (p[dimension]-base);
7579 *   } else if ((p[dimension]-base)/(height-base) > 0.5) {
7580 *   q[dimension] = base + refining_fraction * (height - base) + (1.0 - refining_fraction) / 0.5 * (p[dimension] - 0.5 * (height + base));
7581 *   }
7582 *   return q;
7583 *   }
7584 *  
7585 *   double height;
7586 *   double refining_fraction;
7587 *   double base;
7588 *   size_t dimension;
7589 *   };
7590 *  
7591 *  
7592 *   template <int dim, typename Number>
7593 *   void PlasticityLabProg<dim, Number>::set_mesh_motion_LBCs(
7594 *   Triangulation<dim> &triangulation,
7595 *   LBCSystem<dim, Number, dim> &mesh_motion_lbc_system) {
7596 *  
7597 *   std::set<types::boundary_id> all_boundary_ids;
7598 *   for(types::boundary_id id: triangulation.get_boundary_ids()) {
7599 *   all_boundary_ids.insert(id);
7600 *   }
7601 *  
7602 *   mesh_motion_lbc_system.no_normal_flux_constraints.push_back(std::make_pair(0, all_boundary_ids));
7603 *   }
7604 *  
7605 *  
7606 *   template <int dim, typename Number>
7607 *   void PlasticityLabProg<dim, Number>::make_cylindrical_grid(
7608 *   Triangulation<dim> &triangulation,
7609 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
7610 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
7611 *   int n_initial_global_refinements) {
7612 *  
7613 *   [[maybe_unused]] const Number initial_velocity = 1.9e5; // [mm/s]
7614 *   const Number height = 2.5*25.4; // [mm]
7615 *   const Number inner_radius = 12.5; // [mm]
7616 *   const Number radius = 12.5; // [mm]
7617 *  
7618 *   const Number top_coordinate = height/2;
7619 *   const Number base_coordinate = 0.0;
7620 *  
7621 *   const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
7622 *   const unsigned int aspect_ratio = std::ceil(0.25 * height / radius);
7623 *  
7624 *   GridGenerator::subdivided_hyper_rectangle(
7625 *   triangulation,
7626 *   std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
7627 *   Point<dim>(inner_radius, base_coordinate),
7628 *   Point<dim>(inner_radius + radius, top_coordinate),
7629 *   true
7630 *   );
7631 *  
7632 *   for (auto &cell: triangulation.active_cell_iterators()) {
7633 *   for (const auto &face : cell->face_iterators()) {
7634 *   if(face->boundary_id() == 0 || face->boundary_id() == 1) {
7635 *   if(face->center()[1] > 0.95 * height/2) {
7636 *   face->set_boundary_id(4);
7637 *   }
7638 *   }
7639 *   }
7640 *   }
7641 *  
7642 * @endcode
7643 *
7644 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.3, base_coordinate), triangulation);
7645 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.4, base_coordinate), triangulation);
7646 * GridTools::transform(RefiningTransform<dim>/(inner_radius, 0.35, inner_radius + radius, 0), triangulation);
7647 *
7648
7649 *
7650 * for(unsigned int i=0; i<2; i++) {
7651 * for (auto &cell : triangulation.active_cell_iterators()) {
7652 * for (const auto &face : cell->face_iterators()) {
7653 * if (face->boundary_id() == 2) {
7654 * cell->set_refine_flag();
7655 * break;
7656 * }
7657 * }
7658 * }
7659 * triangulation.execute_coarsening_and_refinement();
7660 * }
7661 *
7662
7663 *
7664 *
7665 * @code
7666 *   ComponentMask x_component_mask(dim+1, false);
7667 *   x_component_mask.set(0, true);
7668 *   ComponentMask y_component_mask(dim+1, false);
7669 *   y_component_mask.set(1, true);
7670 *   ComponentMask x_and_y_component_mask(dim+1, false);
7671 *   x_and_y_component_mask.set(0, true);
7672 *   x_and_y_component_mask.set(1, true);
7673 *   ComponentMask z_component_mask(dim+1, false);
7674 *   z_component_mask.set(dim-1, true);
7675 *   ComponentMask rho_component_mask(dim+1, false);
7676 *   rho_component_mask.set(dim, true);
7677 *  
7678 * @endcode
7679 *
7680 * std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
7681 * base_constraint_function_map.insert(
7682 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7683 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7684 * InterpolatoryConstraintApplier<dim, Number>(
7685 * base_constraint_function_map,
7686 * y_component_mask));
7687 *
7688
7689 *
7690 *
7691 * @code
7692 *   std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7693 *   top_constraint_function_map.insert(
7694 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7695 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7696 *   InterpolatoryConstraintApplier<dim, Number>(
7697 *   top_constraint_function_map,
7698 *   x_component_mask));
7699 *  
7700 *   std::map< types::boundary_id, const Function< dim, Number > * > clamp_constraint_function_map;
7701 *   clamp_constraint_function_map.insert(
7702 *   std::pair<types::boundary_id, Function<dim, Number>*>(4, &mech_lbc_system.zero_function));
7703 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7704 *   InterpolatoryConstraintApplier<dim, Number>(
7705 *   clamp_constraint_function_map,
7706 *   x_component_mask));
7707 *  
7708 *   if(std::abs(inner_radius) < 1e-16) {
7709 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_constraint_function_map;
7710 *   axial_constraint_function_map.insert(
7711 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7712 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7713 *   InterpolatoryConstraintApplier<dim, Number>(
7714 *   axial_constraint_function_map,
7715 *   x_component_mask));
7716 *  
7717 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
7718 *   axial_rotation_constraint_function_map.insert(
7719 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7720 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7721 *   InterpolatoryConstraintApplier<dim, Number>(
7722 *   axial_rotation_constraint_function_map,
7723 *   rho_component_mask));
7724 *   }
7725 *  
7726 * @endcode
7727 *
7728 * therm_lbc_system.boundaryLoadAppliers.push_back(
7729 * std::pair<int,BodyForceApplier<dim,Number> >(
7730 * 2, BodyForceApplier<dim,Number>(0, 22e0)));
7731 *
7732
7733 *
7734 *
7735 * @code
7736 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
7737 *   top_rotation_constraint_function_map.insert(
7738 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7739 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7740 *   InterpolatoryConstraintApplier<dim, Number>(
7741 *   top_rotation_constraint_function_map,
7742 *   rho_component_mask));
7743 *  
7744 * @endcode
7745 *
7746 * std::map< types::boundary_id, const Function< dim, Number > * > base_rotation_constraint_function_map;
7747 * base_rotation_constraint_function_map.insert(
7748 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7749 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7750 * InterpolatoryConstraintApplier<dim, Number>(
7751 * base_rotation_constraint_function_map,
7752 * rho_component_mask));
7753 *
7754
7755 *
7756 * Thermal constraints
7757 *
7758 * @code
7759 *   const Number convection_coefficient = /*17.5e-6*/ 100e-6; // [J.mm^-2.s^-1.K^-1]
7760 *   therm_lbc_system.convection_BC_appliers.push_back(
7761 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7762 *   0,
7763 *   ConvectionBoundaryConditionApplier<dim, Number>(
7764 *   0, convection_coefficient, ambient_temperature)));
7765 *   therm_lbc_system.convection_BC_appliers.push_back(
7766 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7767 *   1,
7768 *   ConvectionBoundaryConditionApplier<dim, Number>(
7769 *   0, convection_coefficient, ambient_temperature)));
7770 *   therm_lbc_system.convection_BC_appliers.push_back(
7771 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7772 *   2,
7773 *   ConvectionBoundaryConditionApplier<dim, Number>(
7774 *   0, convection_coefficient, ambient_temperature)));
7775 *   therm_lbc_system.convection_BC_appliers.push_back(
7776 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7777 *   3,
7778 *   ConvectionBoundaryConditionApplier<dim, Number>(
7779 *   0, convection_coefficient, ambient_temperature)));
7780 *  
7781 * @endcode
7782 *
7783 * therm_lbc_system.convection_BC_appliers.push_back(
7784 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7785 * 2,
7786 * ConvectionBoundaryConditionApplier<dim, Number>(
7787 * 0, 3000*convection_coefficient, 1350.0 /*a little less than melting*/)));
7788 *
7789
7790 *
7791 * const Number total_elongation = 2 * 80.0; // mm
7792 * const Number elongation_rate = time_since_start < 6.0? 0.05 : 1.75; // [mm/s]
7793 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
7794 * auto scale_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7795 * new ConstantFunction<dim, Number>({0, -total_elongation/(static_cast<Number>(n_steps)/**height*/), 0}),
7796 * true,
7797 * y_component_mask,
7798 * false,
7799 * ComponentMask(dim+1, false),
7800 * 3,
7801 * mapping);
7802 *
7803
7804 *
7805 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_z_handler);
7806 *
7807
7808 *
7809 *
7810 * @code
7811 *   mech_lbc_system.boundaryLoadAppliers.push_back(
7812 *   std::pair<int,BodyForceApplier<dim,Number> >(
7813 *   3, BodyForceApplier<dim,Number>(dim-1, -40)));
7814 *  
7815 *   auto top_surface_unidirectional_penalty_spec = new BoundaryUnidirectionalPenaltySpec<Number>(3, 1e-2, 0, 1e4 / (time_increment * time_increment) );
7816 *   mech_lbc_system.boundary_unidirectional_penalty_specs.push_back(top_surface_unidirectional_penalty_spec);
7817 *  
7818 * @endcode
7819 *
7820 * auto constant_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7821 * new ScaleZFunction<dim, Number, dim+1>(-total_elongation/(static_cast<Number>(n_steps)*time_increment/**height*/), dim-1),
7822 * true,
7823 * y_component_mask,
7824 * false,
7825 * ComponentMask(dim+1, false),
7826 * 0,
7827 * mapping);
7828 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_velocity_handler);
7829 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7830 * top_constraint_function_map.insert(
7831 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7832 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7833 * InterpolatoryConstraintApplier<dim, Number>(
7834 * top_constraint_function_map,
7835 * y_component_mask));
7836 *
7837
7838 *
7839 *
7840 * @code
7841 *   const Number drive_speed = 0.8*314.159/3.0; // [rad/s]
7842 *  
7843 *   auto scale_rotation_increment = new IncrementInterpolationHandler<dim, Number, dim+1>(
7844 *   new ScaleComponentFunction<dim, Number, dim+1>(drive_speed * time_increment, 0, dim),
7845 *   true,
7846 *   rho_component_mask,
7847 *   false,
7848 *   ComponentMask(dim+1, false),
7849 *   3,
7850 *   mapping);
7851 *   mech_lbc_system.increment_interpolation_handlers.push_back(scale_rotation_increment);
7852 *  
7853 *   auto constant_angular_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7854 *   new ScaleComponentFunction<dim, Number, dim+1>(drive_speed, 0, dim),
7855 *   true,
7856 *   rho_component_mask,
7857 *   false,
7858 *   ComponentMask(dim+1, false),
7859 *   3,
7860 *   mapping);
7861 *   mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_angular_velocity_handler);
7862 *  
7863 * @endcode
7864 *
7865 * mech_lbc_system.boundaryLoadAppliers.push_back(
7866 * std::pair<int,BodyForceApplier<dim,Number> >(
7867 * 1, BodyForceApplier<dim,Number>(dim, 3.750e0)));
7868 *
7869
7870 *
7871 *
7872 * @code
7873 *   } /* make_cylindrical_grid() */
7874 *  
7875 *  
7876 *   template <int dim, typename Number>
7877 *   void PlasticityLabProg<dim, Number>::make_grid_() {
7878 *  
7879 *   } /*make_grid_()*/
7880 *  
7881 *   template <int dim>
7882 *   struct InterferenceTaperTransform
7883 *   {
7884 *   Point<dim> operator()(const Point<dim> &p) const
7885 *   {
7886 *   Point<dim> q = p;
7887 *   if (p[0]>=35 && p[0]<=300 && p[1]<=0 && p[1]>=-150)
7888 *   {
7889 *   q[0] += 5 * ((p[1] + 150) / 150) * ((p[0]-300) / (35-300));
7890 *   }
7891 *   return q;
7892 *   }
7893 *   };
7894 *  
7895 *   template <int dim>
7896 *   struct NeckingTaperTransform
7897 *   {
7898 *   double factor;
7899 *   NeckingTaperTransform(double factor) : factor(factor) {}
7900 *  
7901 *   Point<dim> operator()(const Point<dim> &p) const
7902 *   {
7903 *   Point<dim> q = p;
7904 *   q[0] += factor * q[0] * q[1];
7905 *   return q;
7906 *   }
7907 *   };
7908 *  
7909 *  
7910 *   template <int dim, typename Number>
7911 *   void PlasticityLabProg<dim, Number>::make_necking_grid(
7912 *   Triangulation<dim> &triangulation,
7913 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
7914 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
7915 *   int n_initial_global_refinements) {
7916 *  
7917 *   const Number height = 53.334; // [mm]
7918 *   const Number radius = 6.413; // [mm]
7919 *  
7920 *   const Number top_coordinate = height/2;
7921 *   const Number base_coordinate = 0.0;
7922 *   const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
7923 *   const unsigned int aspect_ratio = std::ceil(0.5 * height / radius);
7924 *  
7925 *   GridGenerator::subdivided_hyper_rectangle(
7926 *   triangulation,
7927 *   std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
7928 *   Point<dim>(0, base_coordinate),
7929 *   Point<dim>(radius, top_coordinate),
7930 *   true
7931 *   );
7932 *  
7933 * @endcode
7934 *
7935 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.15, base_coordinate), triangulation);
7936 *
7937
7938 *
7939 *
7940 * @code
7941 *   ComponentMask x_component_mask(dim+1, false);
7942 *   x_component_mask.set(0, true);
7943 *   ComponentMask y_component_mask(dim+1, false);
7944 *   y_component_mask.set(1, true);
7945 *   ComponentMask z_component_mask(dim+1, false);
7946 *   z_component_mask.set(dim-1, true);
7947 *   ComponentMask rho_component_mask(dim+1, false);
7948 *   rho_component_mask.set(dim, true);
7949 *  
7950 *   std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
7951 *   base_constraint_function_map.insert(
7952 *   std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7953 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7954 *   InterpolatoryConstraintApplier<dim, Number>(
7955 *   base_constraint_function_map,
7956 *   y_component_mask));
7957 *  
7958 *   std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7959 *   top_constraint_function_map.insert(
7960 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7961 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7962 *   InterpolatoryConstraintApplier<dim, Number>(
7963 *   top_constraint_function_map,
7964 *   y_component_mask));
7965 *  
7966 *   std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
7967 *   yz_constraint_function_map.insert(
7968 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7969 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7970 *   InterpolatoryConstraintApplier<dim, Number>(
7971 *   yz_constraint_function_map,
7972 *   x_component_mask));
7973 *  
7974 *  
7975 *   const Number total_elongation = 2*8.0; // mm
7976 *   const Number elongation_rate = 2*1.0; // [mm/s]
7977 *   const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
7978 *  
7979 *   auto scale_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7980 *   new ScaleZFunction<dim, Number, dim+1>(total_elongation/(static_cast<Number>(n_steps)*height), dim-1),
7981 *   true,
7982 *   y_component_mask,
7983 *   false,
7984 *   ComponentMask(dim+1, false),
7985 *   0,
7986 *   mapping);
7987 *  
7988 *   mech_lbc_system.increment_interpolation_handlers.push_back(scale_z_handler);
7989 *  
7990 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
7991 *   top_rotation_constraint_function_map.insert(
7992 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7993 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7994 *   InterpolatoryConstraintApplier<dim, Number>(
7995 *   top_rotation_constraint_function_map,
7996 *   rho_component_mask));
7997 *  
7998 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
7999 *   axial_rotation_constraint_function_map.insert(
8000 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8001 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8002 *   InterpolatoryConstraintApplier<dim, Number>(
8003 *   axial_rotation_constraint_function_map,
8004 *   rho_component_mask));
8005 *  
8006 * @endcode
8007 *
8008 * Thermal constraints
8009 *
8010 * @code
8011 *   const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8012 *   therm_lbc_system.convection_BC_appliers.push_back(
8013 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8014 *   1,
8015 *   ConvectionBoundaryConditionApplier<dim, Number>(
8016 *   0, convection_coefficient, ambient_temperature)));
8017 *   therm_lbc_system.convection_BC_appliers.push_back(
8018 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8019 *   3,
8020 *   ConvectionBoundaryConditionApplier<dim, Number>(
8021 *   0, convection_coefficient, ambient_temperature)));
8022 *   } /* make_necking_grid() */
8023 *  
8024 *  
8025 *   template <int dim, typename Number>
8026 *   void PlasticityLabProg<dim, Number>::make_interference_cylinder_grid(
8027 *   Triangulation<dim> &triangulation,
8028 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8029 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
8030 *   int n_initial_global_refinements) {
8031 *  
8032 *   const Number height = 300.0; // [mm]
8033 *   const Number radius = 40.0; // [mm]
8034 *  
8035 *   const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
8036 *   const unsigned int aspect_ratio = std::ceil(0.5 * height / radius);
8037 *  
8038 *   GridGenerator::subdivided_hyper_rectangle(
8039 *   triangulation,
8040 *   std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
8041 *   Point<dim>(0, 0),
8042 *   Point<dim>(radius, height),
8043 *   true
8044 *   );
8045 *  
8046 * @endcode
8047 *
8048 * mech_lbc_system.boundaryLoadAppliers.push_back(
8049 * std::pair<int,BodyForceApplier<dim,Number> >(
8050 * 1, BodyForceApplier<dim,Number>(dim, 0.8*4.50e1)));
8051 *
8052
8053 *
8054 *
8055 * @code
8056 *   ComponentMask x_component_mask(dim+1, false);
8057 *   x_component_mask.set(0, true);
8058 *   ComponentMask y_component_mask(dim+1, false);
8059 *   y_component_mask.set(1, true);
8060 *   ComponentMask z_component_mask(dim+1, false);
8061 *   z_component_mask.set(dim-1, true);
8062 *   ComponentMask rho_component_mask(dim+1, false);
8063 *   rho_component_mask.set(dim, true);
8064 *  
8065 *   std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
8066 *   top_constraint_function_map.insert(
8067 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8068 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8069 *   InterpolatoryConstraintApplier<dim, Number>(
8070 *   top_constraint_function_map,
8071 *   y_component_mask));
8072 *  
8073 *   std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
8074 *   yz_constraint_function_map.insert(
8075 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8076 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8077 *   InterpolatoryConstraintApplier<dim, Number>(
8078 *   yz_constraint_function_map,
8079 *   x_component_mask));
8080 *  
8081 *  
8082 *   const Number total_elongation = 300.0; // mm
8083 *   const Number elongation_rate = 1.0; // [mm/s]
8084 *   const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
8085 *  
8086 *   auto push_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8087 *   new ConstantFunction<dim, Number>(std::vector< Number >{0, -total_elongation/static_cast<Number>(n_steps), 0}),
8088 *   true,
8089 *   y_component_mask,
8090 *   false,
8091 *   ComponentMask(dim+1, false),
8092 *   0,
8093 *   mapping);
8094 *  
8095 *   mech_lbc_system.increment_interpolation_handlers.push_back(push_z_handler);
8096 *  
8097 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8098 *   top_rotation_constraint_function_map.insert(
8099 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8100 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8101 *   InterpolatoryConstraintApplier<dim, Number>(
8102 *   top_rotation_constraint_function_map,
8103 *   rho_component_mask));
8104 *  
8105 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8106 *   axial_rotation_constraint_function_map.insert(
8107 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8108 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8109 *   InterpolatoryConstraintApplier<dim, Number>(
8110 *   axial_rotation_constraint_function_map,
8111 *   rho_component_mask));
8112 *  
8113 *   const Number drive_speed = 0.2; // [rad/s]
8114 *  
8115 *   auto scale_rotation_increment = new IncrementInterpolationHandler<dim, Number, dim+1>(
8116 *   new ScaleComponentFunction<dim, Number, dim+1>(drive_speed * time_increment, 0, dim),
8117 *   true,
8118 *   rho_component_mask,
8119 *   false,
8120 *   ComponentMask(dim+1, false),
8121 *   3,
8122 *   mapping);
8123 *   mech_lbc_system.increment_interpolation_handlers.push_back(scale_rotation_increment);
8124 *   auto constant_angular_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8125 *   new ScaleComponentFunction<dim, Number, dim+1>(drive_speed, 0, dim),
8126 *   true,
8127 *   rho_component_mask,
8128 *   false,
8129 *   ComponentMask(dim+1, false),
8130 *   3,
8131 *   mapping);
8132 *   mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_angular_velocity_handler);
8133 *  
8134 * @endcode
8135 *
8136 * auto constant_velocity_angular_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8137 * new ScaleComponentFunction<dim, Number, dim+1>(0.0e-3, 0, dim),
8138 * true,
8139 * rho_component_mask,
8140 * false,
8141 * ComponentMask(dim+1, false),
8142 * 0,
8143 * mapping);
8144 *
8145
8146 *
8147 * mech_lbc_system.initial_deformation_interpolation_handlers.push_back(constant_velocity_angular_handler);
8148 *
8149
8150 *
8151 * Thermal constraints
8152 *
8153 * @code
8154 *   const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8155 *   therm_lbc_system.convection_BC_appliers.push_back(
8156 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8157 *   1,
8158 *   ConvectionBoundaryConditionApplier<dim, Number>(
8159 *   0, convection_coefficient, ambient_temperature)));
8160 *   therm_lbc_system.convection_BC_appliers.push_back(
8161 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8162 *   2,
8163 *   ConvectionBoundaryConditionApplier<dim, Number>(
8164 *   0, convection_coefficient, ambient_temperature)));
8165 *   therm_lbc_system.convection_BC_appliers.push_back(
8166 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8167 *   3,
8168 *   ConvectionBoundaryConditionApplier<dim, Number>(
8169 *   0, convection_coefficient, ambient_temperature)));
8170 *  
8171 * @endcode
8172 *
8173 * std::map< types::boundary_id, const Function< dim, Number > * > thermal_constraint_function_map;
8174 * thermal_constraint_function_map.insert(
8175 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &therm_lbc_system.zero_function));
8176 * thermal_constraint_function_map.insert(
8177 * std::pair<types::boundary_id, Function<dim, Number>*>(8, &therm_lbc_system.zero_function));
8178 * therm_dof_system.interpolatoryConstraintAppliers.push_back(
8179 * InterpolatoryConstraintApplier<dim,Number>(
8180 * thermal_constraint_function_map,ComponentMask(1, true)));
8181 *
8182 * @code
8183 *   } /* make_interference_cylinder_grid() */
8184 *  
8185 *  
8186 *   template <int dim, typename Number>
8187 *   void PlasticityLabProg<dim, Number>::make_ball_in_hypershell_grid(
8188 *   Triangulation<dim> &triangulation,
8189 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8190 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
8191 *   int n_initial_global_refinements) {
8192 *  
8193 *   const unsigned int INNER_BOUNDARY_ID = 0;
8194 *  
8195 *   const Number outer_radius = 60.0; // [mm]
8196 *  
8197 *   GridGenerator::half_hyper_ball(
8198 *   triangulation,
8199 *   Point<dim>(0, -10),
8200 *   outer_radius
8201 *   );
8202 *  
8203 *   for (const auto &cell : triangulation.active_cell_iterators()) {
8204 *   cell->set_boundary_id(INNER_BOUNDARY_ID);
8205 *   }
8206 *  
8207 *   triangulation.refine_global(n_initial_global_refinements);
8208 *  
8209 *   mech_lbc_system.boundaryLoadAppliers.push_back(
8210 *   std::pair<int,BodyForceApplier<dim,Number> >(
8211 *   1, BodyForceApplier<dim,Number>(dim, 0.8*4.50e1)));
8212 *  
8213 *   ComponentMask x_component_mask(dim+1, false);
8214 *   x_component_mask.set(0, true);
8215 *   ComponentMask y_component_mask(dim+1, false);
8216 *   y_component_mask.set(1, true);
8217 *   ComponentMask z_component_mask(dim+1, false);
8218 *   z_component_mask.set(dim-1, true);
8219 *   ComponentMask rho_component_mask(dim+1, false);
8220 *   rho_component_mask.set(dim, true);
8221 *   ComponentMask all_component_mask(dim+1, true);
8222 *  
8223 *   std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
8224 *   yz_constraint_function_map.insert(
8225 *   std::pair<types::boundary_id, Function<dim, Number>*>(1, &mech_lbc_system.zero_function));
8226 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8227 *   InterpolatoryConstraintApplier<dim, Number>(
8228 *   yz_constraint_function_map,
8229 *   x_component_mask));
8230 *  
8231 *   std::map< types::boundary_id, const Function< dim, Number > * > down_constraint_function_map;
8232 *   down_constraint_function_map.insert(
8233 *   std::pair<types::boundary_id, Function<dim, Number>*>(INNER_BOUNDARY_ID, &mech_lbc_system.zero_function));
8234 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8235 *   InterpolatoryConstraintApplier<dim, Number>(
8236 *   down_constraint_function_map,
8237 *   y_component_mask));
8238 *  
8239 *   const Number total_elongation = 300.0; // mm
8240 *   const Number elongation_rate = 225.0e-2; // [mm/s]
8241 *   const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
8242 *  
8243 *   auto push_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8244 *   new ConstantFunction<dim, Number>(std::vector< Number >{0, -total_elongation/static_cast<Number>(n_steps), 0}),
8245 *   true,
8246 *   y_component_mask,
8247 *   false,
8248 *   ComponentMask(dim+1, false),
8249 *   INNER_BOUNDARY_ID,
8250 *   mapping);
8251 *  
8252 *   mech_lbc_system.increment_interpolation_handlers.push_back(push_z_handler);
8253 *  
8254 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8255 *   top_rotation_constraint_function_map.insert(
8256 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8257 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8258 *   InterpolatoryConstraintApplier<dim, Number>(
8259 *   top_rotation_constraint_function_map,
8260 *   rho_component_mask));
8261 *  
8262 * @endcode
8263 *
8264 * Thermal constraints
8265 *
8266 * @code
8267 *   const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8268 *   therm_lbc_system.convection_BC_appliers.push_back(
8269 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8270 *   1,
8271 *   ConvectionBoundaryConditionApplier<dim, Number>(
8272 *   0, convection_coefficient, ambient_temperature)));
8273 *   therm_lbc_system.convection_BC_appliers.push_back(
8274 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8275 *   2,
8276 *   ConvectionBoundaryConditionApplier<dim, Number>(
8277 *   0, convection_coefficient, ambient_temperature)));
8278 *   therm_lbc_system.convection_BC_appliers.push_back(
8279 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8280 *   3,
8281 *   ConvectionBoundaryConditionApplier<dim, Number>(
8282 *   0, convection_coefficient, ambient_temperature)));
8283 *   } /* make_ball_in_hypershell_grid() */
8284 *  
8285 *  
8286 *  
8287 *  
8288 *  
8289 *   template <int dim, typename Number>
8290 *   void PlasticityLabProg<dim, Number>::make_cylindrical_impact_grid(
8291 *   Triangulation<dim> &triangulation,
8292 *   LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8293 *   LBCSystem<dim, Number, 1> &therm_lbc_system,
8294 *   int n_initial_global_refinements) {
8295 *  
8296 *   const Number initial_velocity = 1.9e5; // [mm/s]
8297 *   const Number height = 25.4; // [mm]
8298 *   const Number radius = 3.81; // [mm]
8299 *  
8300 *   const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
8301 *   const unsigned int aspect_ratio = std::ceil(0.25 * height / radius);
8302 *  
8303 *   GridGenerator::subdivided_hyper_rectangle(
8304 *   triangulation,
8305 *   std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
8306 *   Point<dim>(0, 0),
8307 *   Point<dim>(radius, height),
8308 *   true
8309 *   );
8310 *  
8311 * @endcode
8312 *
8313 * mech_lbc_system.boundaryLoadAppliers.push_back(
8314 * std::pair<int,BodyForceApplier<dim,Number> >(
8315 * 6, BodyForceApplier<dim,Number>(2, -4.50)));
8316 *
8317
8318 *
8319 *
8320 * @code
8321 *   ComponentMask x_component_mask(dim, false);
8322 *   x_component_mask.set(0, true);
8323 *   ComponentMask y_component_mask(3, false);
8324 *   y_component_mask.set(1, true);
8325 *   ComponentMask z_component_mask(dim, false);
8326 *   z_component_mask.set(dim-1, true);
8327 *   ComponentMask rho_component_mask(dim+1, false);
8328 *   rho_component_mask.set(dim, true);
8329 *  
8330 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_constraint_function_map;
8331 *   axial_constraint_function_map.insert(
8332 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8333 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8334 *   InterpolatoryConstraintApplier<dim, Number>(
8335 *   axial_constraint_function_map,
8336 *   x_component_mask));
8337 *  
8338 *   std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
8339 *   base_constraint_function_map.insert(
8340 *   std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
8341 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8342 *   InterpolatoryConstraintApplier<dim, Number>(
8343 *   base_constraint_function_map,
8344 *   y_component_mask));
8345 *  
8346 *   auto constant_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8347 *   new ConstantFunction<dim, Number>(std::vector< Number >{0, -initial_velocity, 0}),
8348 *   true,
8349 *   y_component_mask,
8350 *   false,
8351 *   ComponentMask(dim, false),
8352 *   0,
8353 *   mapping);
8354 *  
8355 *   mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_velocity_handler);
8356 *  
8357 *   std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8358 *   top_rotation_constraint_function_map.insert(
8359 *   std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8360 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8361 *   InterpolatoryConstraintApplier<dim, Number>(
8362 *   top_rotation_constraint_function_map,
8363 *   rho_component_mask));
8364 *  
8365 *   std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8366 *   axial_rotation_constraint_function_map.insert(
8367 *   std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8368 *   mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8369 *   InterpolatoryConstraintApplier<dim, Number>(
8370 *   axial_rotation_constraint_function_map,
8371 *   rho_component_mask));
8372 *  
8373 *   auto constant_velocity_angular_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8374 *   new ScaleComponentFunction<dim, Number, dim+1>(0.0e2, 0, dim),
8375 *   true,
8376 *   rho_component_mask,
8377 *   false,
8378 *   ComponentMask(dim+1, false),
8379 *   0,
8380 *   mapping);
8381 *  
8382 *   mech_lbc_system.initial_deformation_interpolation_handlers.push_back(constant_velocity_angular_handler);
8383 *  
8384 * @endcode
8385 *
8386 * Thermal constraints
8387 *
8388 * @code
8389 *   const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8390 *   therm_lbc_system.convection_BC_appliers.push_back(
8391 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8392 *   1,
8393 *   ConvectionBoundaryConditionApplier<dim, Number>(
8394 *   0, convection_coefficient, ambient_temperature)));
8395 *   therm_lbc_system.convection_BC_appliers.push_back(
8396 *   std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8397 *   3,
8398 *   ConvectionBoundaryConditionApplier<dim, Number>(
8399 *   0, convection_coefficient, ambient_temperature)));
8400 *  
8401 * @endcode
8402 *
8403 * std::map< types::boundary_id, const Function< dim, Number > * > thermal_constraint_function_map;
8404 * thermal_constraint_function_map.insert(
8405 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &therm_lbc_system.zero_function));
8406 * thermal_constraint_function_map.insert(
8407 * std::pair<types::boundary_id, Function<dim, Number>*>(8, &therm_lbc_system.zero_function));
8408 * therm_dof_system.interpolatoryConstraintAppliers.push_back(
8409 * InterpolatoryConstraintApplier<dim,Number>(
8410 * thermal_constraint_function_map,ComponentMask(1, true)));
8411 *
8412
8413 *
8414 *
8415 * @code
8416 *   } /* make_cylindrical_impact_grid() */
8417 *  
8418 *  
8419 *   template <int dim, typename Number>
8420 *   void PlasticityLabProg<dim, Number>::make_hook_membrane_grid(
8421 *   int /*n_initial_global_refinements*/) {
8422 *  
8423 *   } /* make_necking_grid() */
8424 *  
8425 *  
8426 *  
8427 *   template <int dim, typename Number>
8428 *   Tensor<2, dim+1, Number> PlasticityLabProg<dim, Number>::get_rotation_tensor(
8429 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation) const {
8430 *   const Number theta = Constants<dim, Number>::sqrt_half() * skew_symmetric_rotation.norm();
8431 *   if (theta > 1e-8) {
8432 *   const Number h1 = (1./(theta*theta)*(1.-std::cos(theta)));
8433 *   const Number h2 = (1./theta*std::sin(theta));
8434 *   return static_cast<Tensor<2, dim+1, Number>>(unit_symmetric_tensor<dim+1, Number>())
8435 *   + h1 * skew_symmetric_rotation * skew_symmetric_rotation
8436 *   + h2 * skew_symmetric_rotation;
8437 *   } else {
8438 *   return static_cast<Tensor<2, dim+1, Number>>(unit_symmetric_tensor<dim+1, Number>());
8439 *   }
8440 *   }
8441 *  
8442 *  
8443 *   template <int dim, typename Number>
8444 *   Tensor<2, dim+1, Number> PlasticityLabProg<dim, Number>::get_rotation_tensor_variation(
8445 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation,
8446 *   const Tensor<2, dim+1, Number> &skew_symmetric_rotation_variation) const {
8447 *  
8448 *   const Number theta = Constants<dim, Number>::sqrt_half() * skew_symmetric_rotation.norm();
8449 *   if (theta > 1e-8) {
8450 *   const Number h1 = (1./(theta*theta)*(1.-std::cos(theta)));
8451 *   const Number h2 = (1./theta*std::sin(theta));
8452 *   const Number delta_theta = 1./(2.*theta) * scalar_product(skew_symmetric_rotation, skew_symmetric_rotation_variation);
8453 *   const Number delta_h1 = (-2./theta * (h1 - 0.5 * h2)) * delta_theta;
8454 *   const Number delta_h2 = (-1./theta * h2 + 1./theta * std::cos(theta)) * delta_theta;
8455 *   const Tensor<2, dim+1, Number> rotation_tensor_variation = delta_h1 * skew_symmetric_rotation * skew_symmetric_rotation
8456 *   + h1 * skew_symmetric_rotation_variation * skew_symmetric_rotation
8457 *   + h1 * skew_symmetric_rotation * skew_symmetric_rotation_variation
8458 *   + delta_h2 * skew_symmetric_rotation
8459 *   + h2 * skew_symmetric_rotation_variation;
8460 *   return rotation_tensor_variation;
8461 *   } else {
8462 *   return Tensor<2, dim+1, Number>();
8463 *   }
8464 *   }
8465 *  
8466 *   }
8467 *  
8468 * @endcode
8469
8470
8471<a name="ann-src/PointHistory.h"></a>
8472<h1>Annotated version of src/PointHistory.h</h1>
8473 *
8474 *
8475 *
8476 *
8477 * @code
8478 *   /*
8479 *   * PointHistory.h
8480 *   *
8481 *   * Created on: 21 Jul 2014
8482 *   * Author: cerecam
8483 *   */
8484 *  
8485 *   #ifndef POINTHISTORY_H_
8486 *   #define POINTHISTORY_H_
8487 *  
8488 *   #include <deal.II/base/utilities.h>
8489 *   #include <deal.II/base/function.h>
8490 *  
8491 *   #include <deal.II/numerics/vector_tools.h>
8492 *   #include <deal.II/numerics/matrix_tools.h>
8493 *   #include <deal.II/numerics/data_out.h>
8494 *  
8495 *   #include <deal.II/lac/trilinos_vector.h>
8496 *  
8497 *   namespace PlasticityLab {
8498 *  
8499 *   template <int dim, typename Number = double>
8500 *   class PointHistory {
8501 *   public:
8502 *   PointHistory();
8503 *   virtual ~PointHistory();
8504 *  
8505 *   struct HardeningParameters {
8506 *   HardeningParameters(
8507 *   Number equivalent_plastic_strain,
8508 *   ::SymmetricTensor<2, dim, Number> kinematic_hardening):
8509 *   equivalent_plastic_strain(equivalent_plastic_strain),
8510 *   kinematic_hardening(kinematic_hardening) { }
8511 *   HardeningParameters() {}
8512 *  
8513 *   Number equivalent_plastic_strain;
8514 *   ::SymmetricTensor<2, dim, Number> kinematic_hardening;
8515 *   };
8516 *  
8517 *   PointHistory(const ::SymmetricTensor<2, dim, Number> &,
8518 *   const HardeningParameters &,
8519 *   Number plastic_entropy,
8520 *   Number material_Jacobian);
8521 *  
8522 *   ::SymmetricTensor<2, dim, Number> plastic_strain;
8523 *   HardeningParameters hardening_parameters;
8524 *   Number plastic_entropy;
8525 *   Number material_Jacobian;
8526 *   };
8527 *  
8528 *  
8529 *   template <int dim, typename Number>
8530 *   PointHistory<dim, Number>::PointHistory()
8531 *   :
8532 *   plastic_strain (::unit_symmetric_tensor<dim, Number>()),
8533 *   hardening_parameters(Number(0.0), Number(0.0) * ::unit_symmetric_tensor<dim, Number>()),
8534 *   plastic_entropy(Number(0.0)),
8535 *   material_Jacobian(1.0) {
8536 *   }
8537 *  
8538 *   template <int dim, typename Number>
8539 *   PointHistory<dim, Number>::
8540 *   PointHistory(const ::SymmetricTensor<2, dim, Number> &plastic_strain,
8541 *   const HardeningParameters &hardening_parameters,
8542 *   const Number plastic_entropy,
8543 *   const Number material_Jacobian):
8544 *   plastic_strain(plastic_strain),
8545 *   hardening_parameters(hardening_parameters),
8546 *   plastic_entropy(plastic_entropy),
8547 *   material_Jacobian(material_Jacobian) {
8548 *   }
8549 *  
8550 *   template <int dim, typename Number>
8551 *   PointHistory<dim, Number>::~PointHistory() {
8552 *   }
8553 *  
8554 *   } /* namespace PlasticityLab */
8555 *  
8556 *   #endif /* POINTHISTORY_H_ */
8557 * @endcode
8558
8559
8560<a name="ann-src/ReferencePoint.h"></a>
8561<h1>Annotated version of src/ReferencePoint.h</h1>
8562 *
8563 *
8564 *
8565 *
8566 * @code
8567 *   /*
8568 *   * ReferencePoint.h
8569 *   *
8570 *   * Created on: 29 Nov 2020
8571 *   * Author: maien
8572 *   */
8573 *  
8574 *   #ifndef REFERENCEPOINT_H_
8575 *   #define REFERENCEPOINT_H_
8576 *  
8577 *   #include <memory>
8578 *   #include <deal.II/dofs/dof_handler.h>
8579 *   #include <deal.II/base/point.h>
8580 *  
8581 *   using namespace dealii;
8582 *  
8583 *   namespace PlasticityLab {
8584 *   template <int dim, typename Number>
8585 *   class ReferencePoint {
8586 *   public:
8587 *   ReferencePoint();
8588 *   virtual ~ReferencePoint();
8589 *  
8590 *   typename DoFHandler<dim>::active_cell_iterator mesh_motion_cell;
8591 *   typename DoFHandler<dim>::active_cell_iterator field_cell;
8592 *   unsigned int q_point;
8593 *   Point<dim, Number> reference_point;
8594 *   Point<dim, Number> remapped_point;
8595 *   };
8596 *  
8597 *   template <int dim, typename Number>
8598 *   ReferencePoint<dim, Number>::ReferencePoint() {
8599 *   }
8600 *  
8601 *   template <int dim, typename Number>
8602 *   ReferencePoint<dim, Number>::~ReferencePoint() {}
8603 *  
8604 *   } /* namespace PlasticityLab */
8605 *  
8606 *   #endif /* REFERENCEPOINT_H_ */
8607 * @endcode
8608
8609
8610<a name="ann-src/RemappedPoint.h"></a>
8611<h1>Annotated version of src/RemappedPoint.h</h1>
8612 *
8613 *
8614 *
8615 *
8616 * @code
8617 *   /*
8618 *   * RemappedPoint.h
8619 *   *
8620 *   * Created on: 29 Nov 2020
8621 *   * Author: maien
8622 *   */
8623 *  
8624 *   #ifndef REMAPPEDPOINT_H_
8625 *   #define REMAPPEDPOINT_H_
8626 *  
8627 *   #include <memory>
8628 *   #include <deal.II/dofs/dof_handler.h>
8629 *   #include <deal.II/base/point.h>
8630 *  
8631 *   using namespace dealii;
8632 *  
8633 *   namespace PlasticityLab {
8634 *   template <int dim, typename Number>
8635 *   class RemappedPoint {
8636 *   public:
8637 *   RemappedPoint();
8638 *   virtual ~RemappedPoint();
8639 *  
8640 *   typename DoFHandler<dim>::active_cell_iterator mesh_motion_cell;
8641 *   typename DoFHandler<dim>::active_cell_iterator field_cell;
8642 *   typename DoFHandler<dim>::active_cell_iterator mixed_fe_cell;
8643 *   Point<dim, Number> unit_cell_point;
8644 *   Point<dim, Number> remapped_point;
8645 *   };
8646 *  
8647 *   template <int dim, typename Number>
8648 *   RemappedPoint<dim, Number>::RemappedPoint() {
8649 *   }
8650 *  
8651 *   template <int dim, typename Number>
8652 *   RemappedPoint<dim, Number>::~RemappedPoint() {}
8653 *  
8654 *   } /* namespace PlasticityLab */
8655 *  
8656 *   #endif /* REMAPPEDPOINT_H_ */
8657 * @endcode
8658
8659
8660<a name="ann-src/RotationFunction.h"></a>
8661<h1>Annotated version of src/RotationFunction.h</h1>
8662 *
8663 *
8664 *
8665 *
8666 * @code
8667 *   /*
8668 *   * RotationFunction.h
8669 *   *
8670 *   * Created on: 06 Dec 2016
8671 *   * Author: maien
8672 *   */
8673 *  
8674 *   #ifndef ROTATIONFUNCTION_H_
8675 *   #define ROTATIONFUNCTION_H_
8676 *  
8677 *   #include <math.h>
8678 *   #include <deal.II/base/function.h>
8679 *   #include <deal.II/base/utilities.h>
8680 *  
8681 *   using namespace dealii;
8682 *  
8683 *   namespace PlasticityLab {
8684 *  
8685 *   template<int dim, typename Number = double>
8686 *   class RotationFunction: public Function<dim, Number> {
8687 *   public:
8688 *   RotationFunction(
8689 *   const Number angular_frequency,
8690 *   const Number axial_velocity,
8691 *   const Number current_angle = 0.0);
8692 *   virtual ~RotationFunction();
8693 *  
8694 *   virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const;
8695 *   virtual void set_time (const Number new_time);
8696 *  
8697 *   private:
8698 *   void update_rotation_matrix();
8699 *   Tensor<2, dim, Number> previousRotationMatrix, currentRotationMatrix;
8700 *   Number current_angle;
8701 *   Number previous_displacement, current_displacement;
8702 *   Number angular_frequency;
8703 *   Number axial_velocity;
8704 *   };
8705 *  
8706 *   template<int dim, typename Number = double>
8707 *   class AngularVelocityFunction: public Function<dim, Number> {
8708 *   public:
8709 *   AngularVelocityFunction(const Number angular_frequency) : Function<dim, Number>(dim) {
8710 *   this->angular_frequency = angular_frequency;
8711 *   }
8712 *   virtual ~AngularVelocityFunction() {}
8713 *  
8714 *   virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const {
8715 *   values[0] = - 2 * 3.14159 * angular_frequency * p[1];
8716 *   values[1] = 2 * 3.14159 * angular_frequency * p[0];
8717 *   if(3==dim) {
8718 *   values[2] = 0;
8719 *   }
8720 *   }
8721 *  
8722 *   private:
8723 *   Number angular_frequency;
8724 *   };
8725 *  
8726 *   template<int dim, typename Number>
8727 *   RotationFunction<dim, Number>::~RotationFunction() {}
8728 *  
8729 *   template<int dim, typename Number>
8730 *   RotationFunction<dim, Number>::RotationFunction(
8731 *   const Number angular_frequency,
8732 *   const Number axial_velocity,
8733 *   const Number current_angle) : Function<dim, Number>(dim) {
8734 *   this->angular_frequency = angular_frequency;
8735 *   this->axial_velocity = axial_velocity;
8736 *   this->current_angle = current_angle;
8737 *   this->set_time(0.0);
8738 *   current_displacement = 0.0;
8739 *   }
8740 *  
8741 *   template<int dim, typename Number>
8742 *   void RotationFunction<dim, Number>::vector_value (const Point< dim > &p, Vector< Number > &values) const {
8743 *   const auto p_prev = previousRotationMatrix * p;
8744 *   const auto res = currentRotationMatrix * p;
8745 *   for (unsigned int i = 0; i < dim; ++i)
8746 *   values[i] = res[i] - p_prev[i] + (i == 2 ? current_displacement - previous_displacement : 0.0);
8747 *   }
8748 *  
8749 *   template<int dim, typename Number>
8750 *   void RotationFunction<dim, Number>::update_rotation_matrix () {
8751 *   previousRotationMatrix = currentRotationMatrix;
8752 *   const Number c_theta = std::cos(current_angle);
8753 *   const Number s_theta = std::sin(current_angle);
8754 *   currentRotationMatrix[0][0] = c_theta;
8755 *   currentRotationMatrix[0][1] = -s_theta;
8756 *   currentRotationMatrix[1][0] = s_theta;
8757 *   currentRotationMatrix[1][1] = c_theta;
8758 *   if (dim == 3)
8759 *   currentRotationMatrix[2][2] = 1.0;
8760 *   }
8761 *  
8762 *   template<int dim, typename Number>
8763 *   void RotationFunction<dim, Number>::set_time (const Number new_time) {
8764 *   Function<dim, Number>::set_time(new_time);
8765 *   current_angle = angular_frequency * Function<dim, Number>::get_time();
8766 *   update_rotation_matrix();
8767 *   previous_displacement = current_displacement;
8768 *   current_displacement = axial_velocity * Function<dim, Number>::get_time();
8769 *   }
8770 *  
8771 *   } /* namespace PlasticityLab */
8772 *  
8773 *   #endif /* ROTATIONFUNCTION_H_ */
8774 * @endcode
8775
8776
8777<a name="ann-src/ScaleComponentFunction.h"></a>
8778<h1>Annotated version of src/ScaleComponentFunction.h</h1>
8779 *
8780 *
8781 *
8782 *
8783 * @code
8784 *   /*
8785 *   * ScaleComponentFunction.h
8786 *   *
8787 *   * Created on: 28 Dec 2019
8788 *   * Author: maien
8789 *   */
8790 *  
8791 *   #ifndef SCALECOMPONENTFUNCTION_H_
8792 *   #define SCALECOMPONENTFUNCTION_H_
8793 *  
8794 *   #include <math.h>
8795 *   #include <deal.II/base/function.h>
8796 *   #include <deal.II/base/utilities.h>
8797 *  
8798 *   using namespace dealii;
8799 *  
8800 *   namespace PlasticityLab {
8801 *  
8802 *   template<int dim, typename Number = double, int components=dim>
8803 *   class ScaleComponentFunction: public Function<dim, Number> {
8804 *   public:
8805 *   ScaleComponentFunction(
8806 *   const Number scale_factor,
8807 *   const unsigned int in_component=2,
8808 *   const unsigned int out_component=2);
8809 *   virtual ~ScaleComponentFunction();
8810 *   virtual void vector_value(const Point<dim> &p, Vector<Number> &values) const override;
8811 *  
8812 *   private:
8813 *   Number scale_factor;
8814 *   const unsigned int in_component;
8815 *   const unsigned int out_component;
8816 *   };
8817 *  
8818 *   template<int dim, typename Number, int components>
8819 *   ScaleComponentFunction<dim, Number, components>::ScaleComponentFunction(
8820 *   const Number scale_factor,
8821 *   const unsigned int in_component,
8822 *   const unsigned int out_component) :
8823 *   Function<dim, Number>(components),
8824 *   scale_factor(scale_factor),
8825 *   in_component(in_component),
8826 *   out_component(out_component) { }
8827 *  
8828 *   template<int dim, typename Number, int components>
8829 *   ScaleComponentFunction<dim, Number, components>::~ScaleComponentFunction() {}
8830 *  
8831 *   template<int dim, typename Number, int components>
8832 *   void ScaleComponentFunction<dim, Number, components>::vector_value(const Point<dim> &p, Vector<Number> &values) const {
8833 *   values *= 0.0;
8834 *   values[out_component] = scale_factor * p[in_component];
8835 *   }
8836 *  
8837 *   } /* namespace PlasticityLab */
8838 *  
8839 *   #endif /* SCALECOMPONENTFUNCTION_H_ */
8840 * @endcode
8841
8842
8843<a name="ann-src/ScaleZFunction.h"></a>
8844<h1>Annotated version of src/ScaleZFunction.h</h1>
8845 *
8846 *
8847 *
8848 *
8849 * @code
8850 *   /*
8851 *   * ScaleZFunction.h
8852 *   *
8853 *   * Created on: 06 Dec 2016
8854 *   * Author: maien
8855 *   */
8856 *  
8857 *   #ifndef SCALEZFUNCTION_H_
8858 *   #define SCALEZFUNCTION_H_
8859 *  
8860 *   #include <math.h>
8861 *   #include <deal.II/base/function.h>
8862 *   #include <deal.II/base/utilities.h>
8863 *  
8864 *   using namespace dealii;
8865 *  
8866 *   namespace PlasticityLab {
8867 *  
8868 *   template<int dim, typename Number = double, int components=dim>
8869 *   class ScaleZFunction: public Function<dim, Number> {
8870 *   public:
8871 *   ScaleZFunction(const Number scale_factor, const unsigned int component=2);
8872 *   virtual ~ScaleZFunction();
8873 *   virtual void vector_value(const Point<dim> &p, Vector<Number> &values) const override;
8874 *  
8875 *   private:
8876 *   Number scale_factor;
8877 *   const unsigned int component;
8878 *   };
8879 *  
8880 *   template<int dim, typename Number, int components>
8881 *   ScaleZFunction<dim, Number, components>::ScaleZFunction(
8882 *   const Number scale_factor,
8883 *   const unsigned int component) :
8884 *   Function<dim, Number>(components),
8885 *   component(component) {
8886 *   this->scale_factor = scale_factor;
8887 *   }
8888 *  
8889 *   template<int dim, typename Number, int components>
8890 *   ScaleZFunction<dim, Number, components>::~ScaleZFunction() {}
8891 *  
8892 *   template<int dim, typename Number, int components>
8893 *   void ScaleZFunction<dim, Number, components>::vector_value(const Point<dim> &p, Vector<Number> &values) const {
8894 *   values *= 0.0;
8895 *   values[component] = scale_factor * p[component];
8896 *   }
8897 *  
8898 *   } /* namespace PlasticityLab */
8899 *  
8900 *   #endif /* SCALEZFUNCTION_H_ */
8901 * @endcode
8902
8903
8904<a name="ann-src/TensorUtilities.h"></a>
8905<h1>Annotated version of src/TensorUtilities.h</h1>
8906 *
8907 *
8908 *
8909 *
8910 * @code
8911 *   /*
8912 *   * TensorUtilities.h
8913 *   *
8914 *   * Created on: 06 Nov 2020
8915 *   * Author: maien
8916 *   */
8917 *  
8918 *   #ifndef TENSOR_UTILITIES_H_
8919 *   #define TENSOR_UTILITIES_H_
8920 *  
8921 *   #include<exception>
8922 *  
8923 *   #include <deal.II/base/tensor.h>
8924 *   #include <deal.II/base/symmetric_tensor.h>
8925 *  
8926 *  
8927 *   using namespace dealii;
8928 *  
8929 *   namespace PlasticityLab {
8930 *   template <int dim, typename Number>
8931 *   SymmetricTensor<2, dim, Number> get_log_of_tensor(
8932 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate) {
8933 *   try{
8934 *   const auto eig_vals_vecs = eigenvectors(symmetric_stretch_rate);
8935 *   SymmetricTensor<2, dim, Number> result =
8936 *   std::log(eig_vals_vecs[0].first)
8937 *   * symmetrize(
8938 *   outer_product(
8939 *   eig_vals_vecs[0].second,
8940 *   eig_vals_vecs[0].second));
8941 *   for(unsigned int d=1; d<dim; ++d) {
8942 *   result +=
8943 *   std::log(eig_vals_vecs[d].first)
8944 *   * symmetrize(
8945 *   outer_product(
8946 *   eig_vals_vecs[d].second,
8947 *   eig_vals_vecs[d].second));
8948 *   }
8949 *   return result;
8950 *   } catch(std::exception& e) {
8951 *   std::cout << "Could not get log of tensor: " << symmetric_stretch_rate << std::endl;
8952 *   return symmetric_stretch_rate;
8953 *   }
8954 *  
8955 *   }
8956 *  
8957 *   template <int dim, typename Number>
8958 *   SymmetricTensor<2, dim, Number> get_log_of_tensor_variation(
8959 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate,
8960 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate_variation) {
8961 *   const double epsilon = 1e-10;
8962 *   return (1./epsilon) * (get_log_of_tensor(symmetric_stretch_rate + epsilon * symmetric_stretch_rate_variation) - get_log_of_tensor(symmetric_stretch_rate));
8963 *   }
8964 *  
8965 *   template <int dim, typename Number>
8966 *   SymmetricTensor<2, dim, Number> get_exp_of_tensor(
8967 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate) {
8968 *   try{
8969 *   const auto eig_vals_vecs = eigenvectors(symmetric_stretch_rate);
8970 *   SymmetricTensor<2, dim, Number> result =
8971 *   std::exp(eig_vals_vecs[0].first)
8972 *   * symmetrize(
8973 *   outer_product(
8974 *   eig_vals_vecs[0].second,
8975 *   eig_vals_vecs[0].second));
8976 *   for(unsigned int d=1; d<dim; ++d) {
8977 *   result +=
8978 *   std::exp(eig_vals_vecs[d].first)
8979 *   * symmetrize(
8980 *   outer_product(
8981 *   eig_vals_vecs[d].second,
8982 *   eig_vals_vecs[d].second));
8983 *   }
8984 *   return result;
8985 *   } catch(std::exception& e) {
8986 *   std::cout << "Could not get exp of tensor: " << symmetric_stretch_rate << std::endl;
8987 *   return symmetric_stretch_rate;
8988 *   }
8989 *   }
8990 *  
8991 *   template <int dim, typename Number>
8992 *   SymmetricTensor<2, dim, Number> get_exp_of_tensor_variation(
8993 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate,
8994 *   const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate_variation) {
8995 *   const Number epsilon = 1e-10;
8996 *   return (1./epsilon) * (get_exp_of_tensor(symmetric_stretch_rate + epsilon * symmetric_stretch_rate_variation) - get_exp_of_tensor(symmetric_stretch_rate));
8997 *   }
8998 *   }
8999 *  
9000 *   #endif // TENSOR_UTILITIES_H_ * @endcode
9001
9002
9003<a name="ann-src/ThermoPlasticMaterial.cpp"></a>
9004<h1>Annotated version of src/ThermoPlasticMaterial.cpp</h1>
9005 *
9006 *
9007 *
9008 *
9009 * @code
9010 *   /*
9011 *   * ThermoPlasticMaterial.cpp
9012 *   *
9013 *   * Created on: 05 Jan 2015
9014 *   * Author: maien
9015 *   */
9016 *  
9017 *   #include <math.h>
9018 *   #include <sstream>
9019 *  
9020 *   #include <deal.II/base/tensor.h>
9021 *   #include <deal.II/base/symmetric_tensor.h>
9022 *  
9023 *   #include "symmetric_tensor_entries.h"
9024 *  
9025 *   #include "ExponentialHardeningThermoviscoplasticYieldLaw.h"
9026 *   #include "JohnsonCookThermoviscoplasticYieldLaw.h"
9027 *  
9028 *   #include "ThermoPlasticMaterial.h"
9029 *   #include "Constants.h"
9030 *   #include "TensorUtilities.h"
9031 *  
9032 *   namespace PlasticityLab {
9033 *  
9034 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9035 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9036 *   ThermoPlasticMaterial(
9037 *   const Number kappa,
9038 *   const Number mu,
9039 *   const Number thermal_expansion_coefficient,
9040 *   const Number thermal_conductivity,
9041 *   const Number heat_capacity,
9042 *   const Number dissipation_factor,
9043 *   const ViscoplasticYieldLaw &viscoplastic_yield_law) :
9044 *   kappa (kappa),
9045 *   mu (mu),
9046 *   thermal_expansion_coefficient(thermal_expansion_coefficient),
9047 *   thermal_conductivity(thermal_conductivity),
9048 *   heat_capacity(heat_capacity),
9049 *   reference_temperature(293.15),
9050 *   dissipation_factor(dissipation_factor),
9051 *   viscoplastic_yield_law(viscoplastic_yield_law) { }
9052 *  
9053 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9054 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::~ThermoPlasticMaterial() {
9055 *   }
9056 *  
9057 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9058 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::compute_constitutive_request(
9059 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9060 *   const point_index_t &point_index) {
9061 *   const ConstitutiveModelUpdateFlags update_flags = constitutive_request.get_update_flags();
9062 *  
9063 *   if (update_pressure & update_flags)
9064 *   compute_pressure(constitutive_request, point_index);
9065 *  
9066 *   if ((update_stress_deviator | update_mechanical_dissipation) & update_flags)
9067 *   compute_stress_deviator_and_d_gamma(constitutive_request, point_index);
9068 *  
9069 *   if (update_heat_flux & update_flags)
9070 *   compute_heat_flux(constitutive_request, point_index);
9071 *  
9072 *   if (update_thermoelastic_heating & update_flags)
9073 *   compute_thermo_elastic_heating(constitutive_request, point_index);
9074 *  
9075 *   if (update_stored_heat & update_flags)
9076 *   compute_stored_heat_rate(constitutive_request, point_index);
9077 *   }
9078 *  
9079 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9080 *   std::vector<Number> ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_state_parameters(
9081 *   const point_index_t &point_index,
9082 *   const Tensor<2, dim, Number> &reference_transformation) const {
9083 *   std::vector<Number> state_parameters;
9084 *   state_parameters.reserve(get_material_parameter_count());
9085 *  
9086 *   const PointHistory<dim, Number> &point_history = material_point_history.at(point_index);
9087 *   state_parameters.push_back(std::log(1 + point_history.hardening_parameters.equivalent_plastic_strain));
9088 *  
9089 *   const Number reference_transformation_Jacobian = determinant(reference_transformation);
9090 *   const auto isochoric_reference_transformation =
9091 *   std::pow(reference_transformation_Jacobian, -Constants<dim, Number>::one_third()) * reference_transformation;
9092 *  
9093 *   const SymmetricTensor<2, dim, Number> log_of_b_e =
9094 *   get_log_of_tensor(
9095 *   symmetrize(
9096 *   isochoric_reference_transformation
9097 *   * static_cast<Tensor<2, dim, Number>>(point_history.plastic_strain)
9098 *   * transpose(isochoric_reference_transformation)));
9099 *  
9100 *   for (const auto &element :
9101 *   dealii_utils::symmetric_tensor_entries(log_of_b_e)) {
9102 *   state_parameters.push_back(element);
9103 *   }
9104 *  
9105 *   for (const auto &element :
9106 *   dealii_utils::symmetric_tensor_entries(
9107 *   point_history.hardening_parameters.kinematic_hardening)
9108 *   ) {
9109 *   state_parameters.push_back(element);
9110 *   }
9111 *  
9112 *   state_parameters.push_back(std::log(std::pow(reference_transformation_Jacobian, 1) * point_history.material_Jacobian));
9113 *  
9114 *   return state_parameters;
9115 *   }
9116 *  
9117 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9118 *   size_t ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>:: get_material_parameter_count() const {
9119 *   return 1 + 2 * (dim * (dim + 1) / 2) + 1; // one scalar and two symmetric tensors and one more scalar
9120 *   }
9121 *  
9122 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9123 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::set_state_parameters(
9124 *   const point_index_t &point_index,
9125 *   const std::vector<Number> &state_parameters,
9126 *   const Tensor<2, dim, Number> &reference_transformation) {
9127 *   PointHistory<dim, Number> &point_history = material_point_history.at(point_index);
9128 *   size_t cursor = 0;
9129 *  
9130 *   point_history.hardening_parameters.equivalent_plastic_strain = std::exp(state_parameters[cursor++]) - 1;
9131 *  
9132 *   SymmetricTensor<2, dim, Number> log_of_b_e;
9133 *  
9134 *   for (auto &element :
9135 *   dealii_utils::symmetric_tensor_entries(log_of_b_e)) {
9136 *   element = state_parameters[cursor++];
9137 *   }
9138 *  
9139 *   const Number reference_transformation_Jacobian = determinant(reference_transformation);
9140 *   const auto inverse_isochoric_reference_transformation =
9141 *   std::pow(reference_transformation_Jacobian, Constants<dim, Number>::one_third()) * invert(reference_transformation);
9142 *  
9143 *   point_history.plastic_strain = symmetrize(
9144 *   inverse_isochoric_reference_transformation
9145 *   * static_cast<Tensor<2, dim, Number>>(get_exp_of_tensor(log_of_b_e))
9146 *   * transpose(inverse_isochoric_reference_transformation));
9147 *  
9148 *   for (auto &element :
9149 *   dealii_utils::symmetric_tensor_entries(
9150 *   point_history.hardening_parameters.kinematic_hardening
9151 *   )) {
9152 *   element = state_parameters[cursor++];
9153 *   }
9154 *  
9155 *   point_history.material_Jacobian = std::pow(reference_transformation_Jacobian, -1) * std::exp(state_parameters[cursor++]);
9156 *   }
9157 *  
9158 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9159 *   Number ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_material_Jacobian(const point_index_t &point_index) const {
9160 *   return material_point_history.at(point_index).material_Jacobian;
9161 *   }
9162 *  
9163 *  
9164 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9165 *   ::SymmetricTensor<2, dim, Number> ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_plastic_strain(const point_index_t &point_index) const {
9166 *   return material_point_history.at(point_index).plastic_strain;
9167 *   }
9168 *  
9169 *  
9170 *  
9171 *  
9172 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9173 *   void
9174 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::setup_point_history (const point_index_t point_count) {
9175 *   {
9176 *   std::vector< PointHistory<dim, Number> > tmp;
9177 *   tmp.swap (material_point_history);
9178 *   }
9179 *   const typename PointHistory<dim, Number>::HardeningParameters hardening_parameters(
9180 *   Number(0.0),
9181 *   Number(0.0)*::unit_symmetric_tensor<dim, Number>());
9182 *   const PointHistory< dim, Number> point_history(unit_symmetric_tensor<dim, Number>(),
9183 *   hardening_parameters,
9184 *   Number(0.0),
9185 *   Number(1.0));
9186 *   material_point_history.resize (point_count, point_history);
9187 *   }
9188 *  
9189 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9190 *   inline void
9191 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9192 *   compute_pressure(ConstitutiveModelRequest<dim, Number> &constitutive_request,
9193 *   const point_index_t &) {
9194 *   const Number J = constitutive_request.get_deformation_Jacobian();
9195 *   const Number temperature = constitutive_request.get_temperature();
9196 *   if (J > 0) {
9197 *   const Number p = kappa * (J-1.0/J) - 3 * kappa * thermal_expansion_coefficient * (temperature - reference_temperature) * (1 + 1./(J*J));
9198 *   constitutive_request.set_pressure(p);
9199 * @endcode
9200 *
9201 * pressure tangent
9202 *
9203 * @code
9204 *   const Number dp = kappa * (1 + 1/(J*J)) - 3 * kappa * thermal_expansion_coefficient * (temperature - reference_temperature) * (-2 * 1./(J*J*J));
9205 *   constitutive_request.set_pressure_tangent_modulus(dp);
9206 *   } else {
9207 *   std::ostringstream convert;
9208 *   convert << "Encountered deformation gradient with non-positive determinant! " << J;
9209 *   throw MaterialDomainException(convert.str());
9210 *   }
9211 *   }
9212 *  
9213 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9214 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::compute_stress_deviator_and_d_gamma(
9215 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9216 *   const point_index_t &point_index) {
9217 *   const ConstitutiveModelUpdateFlags update_flags = constitutive_request.get_update_flags();
9218 *   const Tensor<2, dim, Number> b_e = material_point_history[point_index].plastic_strain;
9219 *   typename PointHistory<dim, Number>::HardeningParameters hardening_parameters =
9220 *   material_point_history[point_index].hardening_parameters;
9221 *   const Tensor<2, dim, Number> isochoric_deformation_gradient = constitutive_request.get_deformation_gradient();
9222 *   const Number temperature = constitutive_request.get_temperature();
9223 *   const auto b_e_bar_next = static_cast<SymmetricTensor<2, dim, Number> >(
9224 *   symmetrize(isochoric_deformation_gradient * b_e
9225 *   * transpose(isochoric_deformation_gradient)));
9226 *   if(std::isnan(b_e_bar_next.norm())) {
9227 *   std::cout << "b_e_bar_next is nan: " << b_e_bar_next << std::endl;
9228 *   std::cout << "b_e: " << b_e << std::endl;
9229 *   std::cout << "isochoric_deformation_gradient: " << isochoric_deformation_gradient << std::endl;
9230 *   std::ostringstream convert;
9231 *   convert << "Encountered an elastic deviatoric tensor with NaN values! ";
9232 *   throw MaterialDomainException(convert.str());
9233 *   }
9234 *   const auto epsilon_e_bar_next = get_log_of_tensor<>(b_e_bar_next);
9235 *   const SymmetricTensor<2, dim, Number> dev_stress_trial = deviator((0.5 * mu) * epsilon_e_bar_next);
9236 * @endcode
9237 *
9238 * const SymmetricTensor<2, dim, Number> dev_stress_trial = deviator((0.5 * mu) * b_e_bar_next);
9239 *
9240 * @code
9241 *   const SymmetricTensor<2, dim, Number> ksi_trial = dev_stress_trial
9242 *   - hardening_parameters.kinematic_hardening;
9243 *   const Number norm_ksi_trial = ksi_trial.norm();
9244 *   const Number mu_bar = (0.5 * mu);
9245 * @endcode
9246 *
9247 * const Number mu_bar = (0.5 * mu) * Constants<dim, Number>::one_third()
9248 * * trace(b_e_bar_next);
9249 *
9250 * @code
9251 *   const SymmetricTensor<2, dim, Number> stress_flow_direction = ksi_trial
9252 *   / norm_ksi_trial;
9253 *   constitutive_request.set_b_e_bar(b_e_bar_next);
9254 *   constitutive_request.set_mu((0.5 * mu));
9255 *   const Number time_increment = constitutive_request.get_time_increment();
9256 *  
9257 *   const Number trial_yield_criterion = viscoplastic_yield_law.trial_yield_criterion(norm_ksi_trial,
9258 *   hardening_parameters.equivalent_plastic_strain,
9259 *   0.0,
9260 *   time_increment,
9261 *   temperature);
9262 *  
9263 *   if (0 < trial_yield_criterion && constitutive_request.get_is_plastic()) {
9264 *   constitutive_request.set_is_plastic(true);
9265 *   Number delta_gamma, alpha_n_plus_1;
9266 *   try {
9267 *   determine_delta_gamma(delta_gamma, alpha_n_plus_1, norm_ksi_trial,
9268 *   mu_bar, hardening_parameters.equivalent_plastic_strain, temperature,
9269 *   time_increment, 1e-04, 300);
9270 *   } catch(const MaterialDomainException &exc) {
9271 *   std::cout << "isochoric_deformation_gradient: " << isochoric_deformation_gradient
9272 *   << "\nb_e: " << b_e
9273 *   << "\nb_e_bar_next: " << b_e_bar_next
9274 *   << "\nmu_bar: " << mu_bar
9275 *   << std::endl;
9276 *   std::cerr << exc.what() << std::endl;
9277 * @endcode
9278 *
9279 * throw exc;
9280 *
9281 * @code
9282 *   }
9283 *   constitutive_request.set_delta_gamma(delta_gamma);
9284 *  
9285 * @endcode
9286 *
9287 * 4. Update back stress, plastic strain and stress
9288 *
9289 * @code
9290 *   Number K_alpha_n_plus_1, K_alpha_n, H_alpha_n_plus_1, H_alpha_n;
9291 *   Number DK_alpha_n_plus_1, DH_alpha_n_plus_1;
9292 *   viscoplastic_yield_law.hardening_values(H_alpha_n,
9293 *   K_alpha_n,
9294 *   hardening_parameters.equivalent_plastic_strain,
9295 *   0.0,
9296 *   time_increment,
9297 *   temperature);
9298 *   const Number y_alpha = viscoplastic_yield_law.hardening_values(
9299 *   H_alpha_n_plus_1,
9300 *   K_alpha_n_plus_1,
9301 *   alpha_n_plus_1,
9302 *   delta_gamma,
9303 *   time_increment,
9304 *   temperature);
9305 *   [[maybe_unused]] const Number d_y_alpha_d_alpha = viscoplastic_yield_law.hardening_alpha_derivatives(
9306 *   DH_alpha_n_plus_1,
9307 *   DK_alpha_n_plus_1,
9308 *   alpha_n_plus_1,
9309 *   delta_gamma,
9310 *   time_increment,
9311 *   temperature);
9312 *  
9313 *   if (update_stress_deviator & update_flags) {
9314 *   const SymmetricTensor<2, dim, Number> stress = deviator(dev_stress_trial
9315 *   - 2 * mu_bar * delta_gamma
9316 *   * stress_flow_direction);
9317 *   constitutive_request.set_stress_deviator(stress);
9318 *   constitutive_request.set_dH(DH_alpha_n_plus_1);
9319 *   constitutive_request.set_dK(DK_alpha_n_plus_1);
9320 *   if (update_material_point_history & update_flags) {
9321 *   material_point_history[point_index].hardening_parameters.equivalent_plastic_strain =
9322 *   alpha_n_plus_1;
9323 *   material_point_history[point_index].hardening_parameters.kinematic_hardening =
9324 *   hardening_parameters.kinematic_hardening
9325 *   + Constants<dim, Number>::sqrt2thirds()
9326 *   * (K_alpha_n_plus_1 - K_alpha_n)
9327 *   * stress_flow_direction;
9328 *  
9329 * @endcode
9330 *
9331 * // compute one_third_I_bar_e (c.f. Simo, Miehe 1992 pp 64)
9332 * const auto stress_over_mu = stress / (0.5 * mu);
9333 * const Number norm_stress_over_mu = stress_over_mu.norm();
9334 * const Number J_e2 = 0.5 * norm_stress_over_mu * norm_stress_over_mu;
9335 * const Number J_e3 = determinant(stress_over_mu);
9336 * const Number q = 0.5*(1-J_e3);
9337 * const Number sqrt_d = std::sqrt(-std::pow(Constants<dim, Number>::one_third()*J_e2, 3) + q*q);
9338 * const Number one_third_I_bar_e = std::pow(q + sqrt_d, Constants<dim, Number>::one_third())
9339 * + std::pow(q - sqrt_d, Constants<dim, Number>::one_third());
9340 *
9341
9342 *
9343 * auto b_e_bar = stress / (0.5 * mu)
9344 * + Constants<dim, Number>::one_third() * trace(b_e_bar_next)
9345 * * unit_symmetric_tensor<dim, Number>();
9346 *
9347 * @code
9348 *   auto b_e_bar = get_exp_of_tensor(stress / (0.5 * mu));
9349 *  
9350 * @endcode
9351 *
9352 * correct volumetric component so that return mapping does not change volume
9353 *
9354 * @code
9355 *   const Number det_b_e_bar_trial = determinant(b_e_bar_next);
9356 *   Number det_plastic_strain = determinant(b_e_bar);
9357 *   if(std::abs(det_plastic_strain - 1) > 1e-7) {
9358 *   std::cout << "det_plastic_strain: " << det_plastic_strain << std::endl;
9359 *   }
9360 *   while (std::abs(det_plastic_strain-det_b_e_bar_trial) > 1e-10) {
9361 *   const Number u = (det_b_e_bar_trial - det_plastic_strain) / (det_plastic_strain * trace(invert(b_e_bar)));
9362 *   b_e_bar += u*unit_symmetric_tensor<dim, Number>();
9363 *   det_plastic_strain = determinant(b_e_bar);
9364 *   }
9365 *  
9366 *   [[maybe_unused]] const Tensor<2, dim, Number> inverse_isochoric_deformation_gradient = invert(isochoric_deformation_gradient);
9367 *   material_point_history[point_index].plastic_strain = b_e_bar;
9368 *   }
9369 *   } /*if(update_stress_deviator & update_flags)*/
9370 *   if (update_mechanical_dissipation & update_flags) {
9371 *   const Number time_increment = constitutive_request.get_time_increment();
9372 *   const Number mechanical_dissipation =
9373 *   dissipation_factor
9374 *   * Constants<dim, Number>::sqrt2thirds()
9375 *   * y_alpha * delta_gamma
9376 *   / (1000. * time_increment); // [J.mm^-3.s^-1]
9377 *   constitutive_request.set_mechanical_dissipation(mechanical_dissipation);
9378 *   Number DH_theta, DK_theta;
9379 *   const Number d_y_alpha_d_theta =
9380 *   viscoplastic_yield_law.hardening_temperature_derivatives(DH_theta, DK_theta,
9381 *   alpha_n_plus_1,
9382 *   delta_gamma,
9383 *   time_increment,
9384 *   temperature);
9385 *   const Number mechanical_dissipation_temperature_tangent =
9386 *   dissipation_factor
9387 *   * d_y_alpha_d_theta
9388 *   * (Constants<dim, Number>::sqrt2thirds() * delta_gamma
9389 *   - y_alpha / (3 * mu_bar))
9390 *   / (1000. * time_increment); // [J.mm^-3.s^-3.K^-1]
9391 *   constitutive_request.set_mechanical_dissipation_tangent_modulus(
9392 *   mechanical_dissipation_temperature_tangent);
9393 *   } /*if (update_mechanical_dissipation & updateFlags)*/
9394 *   } /*if ( trial yield criterion test )*/
9395 *   else {
9396 *   constitutive_request.set_delta_gamma(0.0);
9397 *   constitutive_request.set_is_plastic(false);
9398 *   if (update_stress_deviator & update_flags) {
9399 *   constitutive_request.set_stress_deviator(dev_stress_trial);
9400 *   constitutive_request.set_dK(0.0);
9401 *   constitutive_request.set_dH(0.0);
9402 *   }
9403 *   if (update_mechanical_dissipation & update_flags) {
9404 *   constitutive_request.set_mechanical_dissipation(0.0);
9405 *   constitutive_request.set_mechanical_dissipation_tangent_modulus(0.0);
9406 *   }
9407 * @endcode
9408 *
9409 * The following is only necessary for the elastic case when b_e is tracked instead of G_p
9410 *
9411 * @code
9412 *   if (update_stress_deviator & update_flags) {
9413 *   if (update_material_point_history & update_flags) {
9414 *   material_point_history[point_index].plastic_strain = b_e_bar_next;
9415 *   }
9416 *   }
9417 *   } /*else*/
9418 * @endcode
9419 *
9420 * The following is only necessary if the total Jacobian is tracked (J_c * J_m), rather than just J_m
9421 *
9422 * @code
9423 *   if (update_material_point_history & update_flags) {
9424 *   material_point_history.at(point_index).material_Jacobian = constitutive_request.get_unprojected_deformation_Jacobian();
9425 *   }
9426 *   } /*computeStressDeviatorAndDGamma()*/
9427 *  
9428 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9429 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9430 *   compute_heat_flux(
9431 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9432 *   const point_index_t &) {
9433 *   const Tensor<1, dim, Number> thermal_gradient = constitutive_request.get_thermal_gradient();
9434 *   constitutive_request.set_heat_flux(thermal_conductivity * thermal_gradient);
9435 *   constitutive_request.set_heat_flux_tangent_moduli(thermal_conductivity * unit_symmetric_tensor<dim, Number>());
9436 *   }
9437 *  
9438 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9439 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9440 *   compute_thermo_elastic_heating(
9441 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9442 *   const point_index_t &point_index) {
9443 *   const auto point_history = material_point_history.at(point_index);
9444 *   const Number J = constitutive_request.get_deformation_Jacobian();
9445 *   const Number previous_J = constitutive_request.get_previous_deformation_Jacobian();
9446 *   [[maybe_unused]] const Number J_time_rate = constitutive_request.get_deformation_Jacobian_time_rate();
9447 *   const Number theta = constitutive_request.get_temperature();
9448 *   [[maybe_unused]] const Number previous_theta = constitutive_request.get_previous_temperature();
9449 *   const Number time_increment = constitutive_request.get_time_increment();
9450 *   if (J != 0 and previous_J != 0) {
9451 *   const Number eta = (3.0/1000.0) * kappa * thermal_expansion_coefficient * (J - 1.0/J);
9452 *   const Number previous_eta = (3.0/1000.0) * kappa * thermal_expansion_coefficient * (previous_J - 1.0/previous_J);
9453 *   constitutive_request.set_thermo_elastic_heating(-theta * (eta - previous_eta) / time_increment);
9454 *   constitutive_request.set_thermo_elastic_heating_tangent_modulus(-(eta - previous_eta) / time_increment);
9455 *   } else {
9456 * @endcode
9457 *
9458 * TODO define and throw appropriate exception: bad deformation gradient!
9459 *
9460 * @code
9461 *   constitutive_request.set_thermo_elastic_heating(0);
9462 *   constitutive_request.set_thermo_elastic_heating_tangent_modulus(0);
9463 *   }
9464 *   }
9465 *  
9466 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9467 *   void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9468 *   compute_stored_heat_rate(
9469 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9470 *   const point_index_t &) {
9471 *   const Number stored_heat_rate = heat_capacity * constitutive_request.get_temperature_time_rate();
9472 *   constitutive_request.set_stored_heat_rate(stored_heat_rate);
9473 *   constitutive_request.set_stored_heat_rate_tangent_modulus(heat_capacity);
9474 *   }
9475 *  
9476 *   template <int dim, typename ViscoplasticYieldLaw, typename Number>
9477 *   inline void
9478 *   ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9479 *   determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
9480 *   const Number norm_ksi_trial,
9481 *   const Number mu_bar,
9482 *   const Number alpha_n,
9483 *   const Number temperature,
9484 *   const Number time_increment,
9485 *   const Number tol,
9486 *   const unsigned int max_iter) const {
9487 *   unsigned int k = 0;
9488 *   const Number sqrt2thirds = Constants<dim, Number>::sqrt2thirds();
9489 *   const Number two_thirds = Constants<dim, Number>::two_thirds();
9490 *   Number g_of_gamma_k, Dg_of_gamma_k;
9491 *   Number H_alpha_n, H_alpha_n_plus_1, K_alpha_n, K_alpha_n_plus_1;
9492 *   Number DK_alpha_n_plus_1, DH_alpha_n_plus_1;
9493 *  
9494 *   delta_gamma = 0;
9495 *   alpha_n_plus_1 = alpha_n;
9496 *  
9497 *   viscoplastic_yield_law.hardening_values(H_alpha_n, K_alpha_n, alpha_n, 0.0, time_increment, temperature);
9498 *  
9499 *   viscoplastic_yield_law.hardening_values(H_alpha_n_plus_1, K_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9500 *   g_of_gamma_k = norm_ksi_trial
9501 *   - 2 * mu_bar * delta_gamma
9502 *   - sqrt2thirds * H_alpha_n_plus_1
9503 *   - sqrt2thirds * (K_alpha_n_plus_1 - K_alpha_n);
9504 *   do {
9505 *   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);
9506 *   Dg_of_gamma_k = -2 * mu_bar - two_thirds * (DK_alpha_n_plus_1 + DH_alpha_n_plus_1);
9507 *  
9508 *   delta_gamma = delta_gamma - g_of_gamma_k / Dg_of_gamma_k;
9509 *   alpha_n_plus_1 = alpha_n + sqrt2thirds * delta_gamma;
9510 *  
9511 *   viscoplastic_yield_law.hardening_values(H_alpha_n_plus_1, K_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9512 *   g_of_gamma_k = norm_ksi_trial
9513 *   - 2 * mu_bar * delta_gamma
9514 *   - sqrt2thirds * H_alpha_n_plus_1
9515 *   - sqrt2thirds * (K_alpha_n_plus_1 - K_alpha_n);
9516 *   } while (std::fabs(g_of_gamma_k) > tol && ++k < max_iter);
9517 *   if (std::fabs(g_of_gamma_k) > tol) {
9518 *   std::ostringstream convert;
9519 *   convert << "Did not converge after " << k << " iterations. g: " << g_of_gamma_k
9520 *   << ", norm_ksi_trial: " << norm_ksi_trial
9521 *   << ", mu_bar: " << mu_bar
9522 *   << ", H_alpha_n_plus_1: " << H_alpha_n_plus_1
9523 *   << ", alpha: " << alpha_n_plus_1
9524 *   << ", delta_gamma: " << delta_gamma
9525 *   << ", temperature: " << temperature
9526 *   << ", gradient: " << Dg_of_gamma_k;
9527 *   throw MaterialDomainException(convert.str());
9528 *   }
9529 *   }
9530 *  
9531 *   template class ThermoPlasticMaterial<3, ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>;
9532 *   template class ThermoPlasticMaterial<2, ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>;
9533 *  
9534 *   template class ThermoPlasticMaterial<3, JohnsonCookThermoviscoplasticYieldLaw<double>, double>;
9535 *   template class ThermoPlasticMaterial<2, JohnsonCookThermoviscoplasticYieldLaw<double>, double>;
9536 *  
9537 *   } /* namespace PlasticityLab */
9538 * @endcode
9539
9540
9541<a name="ann-src/ThermoPlasticMaterial.h"></a>
9542<h1>Annotated version of src/ThermoPlasticMaterial.h</h1>
9543 *
9544 *
9545 *
9546 *
9547 * @code
9548 *   /*
9549 *   * ThermoPlasticMaterial.h
9550 *   *
9551 *   * Created on: 05 Jan 2015
9552 *   * Author: maien
9553 *   */
9554 *  
9555 *   #ifndef THERMOPLASTICMATERIAL_H_
9556 *   #define THERMOPLASTICMATERIAL_H_
9557 *  
9558 *   #include "PointHistory.h"
9559 *   #include "Material.h"
9560 *   #include "ConstitutiveModelRequest.h"
9561 *  
9562 *   using namespace dealii;
9563 *  
9564 *   namespace PlasticityLab {
9565 *  
9566 *   template <int dim, typename ViscoplasticYieldLaw, typename Number = double>
9567 *   class ThermoPlasticMaterial : public Material<dim, Number> {
9568 *   public:
9569 *   ThermoPlasticMaterial(const Number kappa,
9570 *   const Number mu,
9571 *   const Number thermal_expansion_coefficient,
9572 *   const Number thermal_conductivity,
9573 *   const Number heat_capacity,
9574 *   const Number dissipation_factor,
9575 *   const ViscoplasticYieldLaw &viscoplastic_yield_law);
9576 *  
9577 *   virtual ~ThermoPlasticMaterial();
9578 *  
9579 *   void compute_constitutive_request(
9580 *   ConstitutiveModelRequest <dim, Number> &constitutive_request,
9581 *   const point_index_t &point_index) override;
9582 *  
9583 *   Number get_material_Jacobian(const point_index_t &point_index) const override;
9584 *   ::SymmetricTensor<2, dim, Number> get_plastic_strain(const point_index_t &point_index) const override;
9585 *  
9586 *   std::vector<Number> get_state_parameters(
9587 *   const point_index_t &point_index,
9588 *   const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) const override;
9589 *  
9590 *   void set_state_parameters(
9591 *   const point_index_t &point_index,
9592 *   const std::vector<Number> &state_parameters,
9593 *   const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) override;
9594 *   size_t get_material_parameter_count() const override;
9595 *  
9596 *  
9597 *   void setup_point_history (const point_index_t point_count) override;
9598 *  
9599 *   private:
9600 *   const Number kappa;
9601 *   const Number mu;
9602 *  
9603 *   const Number thermal_expansion_coefficient;
9604 *   const Number thermal_conductivity;
9605 *   const Number heat_capacity;
9606 *   const Number reference_temperature;
9607 *  
9608 *   const Number dissipation_factor;
9609 *   const ViscoplasticYieldLaw viscoplastic_yield_law;
9610 *  
9611 *   std::vector< PointHistory<dim, Number> > material_point_history;
9612 *  
9613 *   inline void
9614 *   compute_pressure(
9615 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9616 *   const point_index_t &point_index);
9617 *  
9618 *   inline void
9619 *   determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
9620 *   const Number norm_ksi_trial,
9621 *   const Number mu_bar,
9622 *   const Number alpha_n,
9623 *   const Number temperature,
9624 *   const Number time_increment,
9625 *   const Number tol, unsigned int max_iter) const;
9626 *  
9627 *   void compute_stress_deviator_and_d_gamma(
9628 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9629 *   const point_index_t &point_index);
9630 *  
9631 *   void compute_heat_flux(
9632 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9633 *   const point_index_t &point_index);
9634 *  
9635 *   void compute_thermo_elastic_heating(
9636 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9637 *   const point_index_t &point_index);
9638 *  
9639 *   void compute_stored_heat_rate(
9640 *   ConstitutiveModelRequest<dim, Number> &constitutive_request,
9641 *   const point_index_t &point_index);
9642 *  
9643 *   };
9644 *  
9645 *   } /* namespace PlasticityLab */
9646 *  
9647 *   #endif /* THERMOPLASTICMATERIAL_H_ */
9648 * @endcode
9649
9650
9651<a name="ann-src/TimeRateRequest.h"></a>
9652<h1>Annotated version of src/TimeRateRequest.h</h1>
9653 *
9654 *
9655 *
9656 *
9657 * @code
9658 *   /*
9659 *   * TimeRateRequest.h
9660 *   *
9661 *   * Created on: 27 Nov 2019
9662 *   * Author: maien
9663 *   */
9664 *  
9665 *   #ifndef TIMERATEREQUEST_H_
9666 *   #define TIMERATEREQUEST_H_
9667 *  
9668 *   #include <deal.II/base/tensor.h>
9669 *  
9670 *   #include "Constants.h"
9671 *   #include "TimeRateUpdateFlags.h"
9672 *  
9673 *   namespace PlasticityLab {
9674 *  
9675 *   template <typename ValueType, int dim, typename Number=double>
9676 *   class TimeRateRequest {
9677 *   public:
9678 *   TimeRateRequest(TimeRateUpdateFlags);
9679 *   virtual ~TimeRateRequest();
9680 *  
9681 * @endcode
9682 *
9683 * Interface to be used by request client (FE system assembler)
9684 * --request configuration stage--
9685 *
9686 * @code
9687 *   void set_value(const ValueType &value);
9688 *   void set_previous_value(const ValueType &previous_value);
9689 *   void set_second_previous_value(const ValueType &second_previous_value);
9690 *  
9691 *   void set_time_increment(const Number time_increment);
9692 *   void set_previous_time_increment(const Number previous_time_increment);
9693 *  
9694 *   void set_previous_partial_time_rate(const ValueType &previous_partial_time_rate);
9695 *   void set_previous_total_time_rate(const ValueType &previous_total_time_rate);
9696 *  
9697 *   void set_velocity(const ::Tensor<1, dim, Number> &velocity);
9698 *  
9699 * @endcode
9700 *
9701 * Interface to be used by request client (FE system assembler)
9702 * --request response retrieval and interrogation stage--
9703 *
9704 * @code
9705 *   ValueType get_partial_time_rate() const;
9706 *   ValueType get_total_time_rate() const;
9707 *   ValueType get_partial_second_time_rate() const;
9708 *   ValueType get_total_second_time_rate() const;
9709 *  
9710 *   ValueType get_partial_time_rate_tangent(const ValueType &value_increment) const;
9711 *   ValueType get_partial_second_time_rate_tangent(const ValueType &value_increment) const;
9712 *  
9713 *   template<typename GradientType>
9714 *   ValueType get_total_time_rate_tangent(
9715 *   const ValueType &value_increment,
9716 *   const ValueType &gradient_increment) const;
9717 *  
9718 *   template<typename GradientType>
9719 *   ValueType get_total_second_time_rate_tangent(
9720 *   const ValueType &value_increment,
9721 *   const ValueType &gradient_increment) const;
9722 *  
9723 * @endcode
9724 *
9725 * interface used by constitutive model object to perform computation
9726 * TODO consider hiding this interface and exposing it through adapter
9727 *
9728 * @code
9729 *   TimeRateUpdateFlags get_update_flags() const;
9730 *   ValueType get_value() const;
9731 *   ValueType get_previous_value() const;
9732 *   ValueType get_second_previous_value() const;
9733 *  
9734 *   Number get_time_increment() const;
9735 *   Number get_previous_time_increment() const;
9736 *  
9737 *   ValueType get_previous_partial_time_rate() const;
9738 *   ValueType get_previous_total_time_rate() const;
9739 *  
9740 *   ::Tensor<1, dim, Number> get_velocity() const;
9741 *  
9742 * @endcode
9743 *
9744 * set the results
9745 *
9746 * @code
9747 *   void set_partial_time_rate(const ValueType &partial_time_rate);
9748 *   void set_total_time_rate(const ValueType &total_time_rate);
9749 *   void set_partial_second_time_rate(const ValueType &partial_second_time_rate);
9750 *   void set_total_second_time_rate(const ValueType &total_second_time_rate);
9751 *  
9752 *   void set_partial_time_rate_tangent(const ValueType &partial_time_rate_tangent);
9753 *   void set_total_time_rate_tangent(const ValueType &total_time_rate_tangent);
9754 *   void set_partial_second_time_rate_tangent(const ValueType &partial_second_time_rate_tangent);
9755 *   void set_total_second_time_rate_tangent(const ValueType &total_second_time_rate_tangent);
9756 *  
9757 *   protected:
9758 * @endcode
9759 *
9760 * inputs
9761 *
9762 * @code
9763 *   TimeRateUpdateFlags update_flags;
9764 *  
9765 *   ValueType value;
9766 *   ValueType previous_value;
9767 *   ValueType second_previous_value;
9768 *  
9769 *   Number time_increment;
9770 *   Number previous_time_increment;
9771 *  
9772 *   ValueType previous_partial_time_rate;
9773 *   ValueType previous_total_time_rate;
9774 *  
9775 *   ::Tensor<1, dim, Number> velocity;
9776 *  
9777 * @endcode
9778 *
9779 * outputs
9780 *
9781 * @code
9782 *   ValueType partial_time_rate;
9783 *   ValueType total_time_rate;
9784 *   ValueType partial_second_time_rate;
9785 *   ValueType total_second_time_rate;
9786 *  
9787 *   ValueType partial_time_rate_tangent;
9788 *   ValueType total_time_rate_tangent;
9789 *   ValueType partial_second_time_rate_tangent;
9790 *   ValueType total_second_time_rate_tangent;
9791 *   };
9792 *  
9793 *  
9794 *   template <typename ValueType, int dim, typename Number>
9795 *   TimeRateRequest<ValueType, dim, Number>::
9796 *   TimeRateRequest(TimeRateUpdateFlags update_flags):
9797 *   update_flags(update_flags) {
9798 *   }
9799 *  
9800 *   template <typename ValueType, int dim, typename Number>
9801 *   TimeRateRequest<ValueType, dim, Number>::~TimeRateRequest() { }
9802 *  
9803 *  
9804 *   template <typename ValueType, int dim, typename Number>
9805 *   void TimeRateRequest<ValueType, dim, Number>::
9806 *   set_value(const ValueType &value) {
9807 *   this->value = value;
9808 *   }
9809 *  
9810 *  
9811 *   template <typename ValueType, int dim, typename Number>
9812 *   void TimeRateRequest<ValueType, dim, Number>::
9813 *   set_previous_value(const ValueType &previous_value) {
9814 *   this->previous_value = previous_value;
9815 *   }
9816 *  
9817 *  
9818 *   template <typename ValueType, int dim, typename Number>
9819 *   void TimeRateRequest<ValueType, dim, Number>::
9820 *   set_second_previous_value(const ValueType &second_previous_value) {
9821 *   this->second_previous_value = second_previous_value;
9822 *   }
9823 *  
9824 *  
9825 *   template <typename ValueType, int dim, typename Number>
9826 *   void TimeRateRequest<ValueType, dim, Number>::
9827 *   set_time_increment(const Number time_increment) {
9828 *   this->time_increment = time_increment;
9829 *   }
9830 *  
9831 *  
9832 *   template <typename ValueType, int dim, typename Number>
9833 *   void TimeRateRequest<ValueType, dim, Number>::
9834 *   set_previous_time_increment(const Number previous_time_increment) {
9835 *   this->previous_time_increment = previous_time_increment;
9836 *   }
9837 *  
9838 *  
9839 *   template <typename ValueType, int dim, typename Number>
9840 *   void TimeRateRequest<ValueType, dim, Number>::
9841 *   set_previous_partial_time_rate(const ValueType &previous_partial_time_rate) {
9842 *   this->previous_partial_time_rate = previous_partial_time_rate;
9843 *   }
9844 *  
9845 *  
9846 *   template <typename ValueType, int dim, typename Number>
9847 *   void TimeRateRequest<ValueType, dim, Number>::
9848 *   set_previous_total_time_rate(const ValueType &previous_total_time_rate) {
9849 *   this->previous_total_time_rate = previous_total_time_rate;
9850 *   }
9851 *  
9852 *  
9853 *   template <typename ValueType, int dim, typename Number>
9854 *   void TimeRateRequest<ValueType, dim, Number>::
9855 *   set_velocity(const ::Tensor<1, dim, Number> &velocity) {
9856 *   this->velocity = velocity;
9857 *   }
9858 *  
9859 *  
9860 *  
9861 *  
9862 *   template <typename ValueType, int dim, typename Number>
9863 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9864 *   get_partial_time_rate() const {
9865 *   return partial_time_rate;
9866 *   }
9867 *  
9868 *  
9869 *   template <typename ValueType, int dim, typename Number>
9870 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9871 *   get_total_time_rate() const {
9872 *   return total_time_rate;
9873 *   }
9874 *  
9875 *  
9876 *   template <typename ValueType, int dim, typename Number>
9877 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9878 *   get_partial_second_time_rate() const {
9879 *   return partial_second_time_rate;
9880 *   }
9881 *  
9882 *  
9883 *   template <typename ValueType, int dim, typename Number>
9884 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9885 *   get_total_second_time_rate() const {
9886 *   return total_second_time_rate;
9887 *   }
9888 *  
9889 *  
9890 *   template <typename ValueType, int dim, typename Number>
9891 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9892 *   get_partial_time_rate_tangent(const ValueType &value_increment) const {
9893 *   return partial_time_rate_tangent;
9894 *   }
9895 *  
9896 *  
9897 *   template <typename ValueType, int dim, typename Number>
9898 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9899 *   get_partial_second_time_rate_tangent(const ValueType &value_increment) const {
9900 *   return partial_second_time_rate_tangent;
9901 *   }
9902 *  
9903 *  
9904 *   template <typename ValueType, int dim, typename Number>
9905 *   template<typename GradientType>
9906 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9907 *   get_total_time_rate_tangent(
9908 *   const ValueType &value_increment,
9909 *   const ValueType &gradient_increment) const {
9910 *   throw;
9911 *   }
9912 *  
9913 *  
9914 *   template <typename ValueType, int dim, typename Number>
9915 *   template<typename GradientType>
9916 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9917 *   get_total_second_time_rate_tangent(
9918 *   const ValueType &value_increment,
9919 *   const ValueType &gradient_increment) const {
9920 *   throw;
9921 *   }
9922 *  
9923 *  
9924 *   /*
9925 *  
9926 *   */
9927 *   template <typename ValueType, int dim, typename Number>
9928 *   TimeRateUpdateFlags TimeRateRequest<ValueType, dim, Number>::
9929 *   get_update_flags() const {
9930 *   return update_flags;
9931 *   }
9932 *  
9933 *  
9934 *   template <typename ValueType, int dim, typename Number>
9935 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9936 *   get_value() const {
9937 *   return value;
9938 *   }
9939 *  
9940 *  
9941 *   template <typename ValueType, int dim, typename Number>
9942 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9943 *   get_previous_value() const {
9944 *   return previous_value;
9945 *   }
9946 *  
9947 *  
9948 *   template <typename ValueType, int dim, typename Number>
9949 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9950 *   get_second_previous_value() const {
9951 *   return second_previous_value;
9952 *   }
9953 *  
9954 *  
9955 *   template <typename ValueType, int dim, typename Number>
9956 *   Number TimeRateRequest<ValueType, dim, Number>::
9957 *   get_time_increment() const {
9958 *   return time_increment;
9959 *   }
9960 *  
9961 *  
9962 *   template <typename ValueType, int dim, typename Number>
9963 *   Number TimeRateRequest<ValueType, dim, Number>::
9964 *   get_previous_time_increment() const {
9965 *   return previous_time_increment;
9966 *   }
9967 *  
9968 *  
9969 *   template <typename ValueType, int dim, typename Number>
9970 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9971 *   get_previous_partial_time_rate() const {
9972 *   return previous_partial_time_rate;
9973 *   }
9974 *  
9975 *  
9976 *   template <typename ValueType, int dim, typename Number>
9977 *   ValueType TimeRateRequest<ValueType, dim, Number>::
9978 *   get_previous_total_time_rate() const {
9979 *   return previous_total_time_rate;
9980 *   }
9981 *  
9982 *  
9983 *   template <typename ValueType, int dim, typename Number>
9984 *   ::Tensor<1, dim, Number> TimeRateRequest<ValueType, dim, Number>::
9985 *   get_velocity() const {
9986 *   return velocity;
9987 *   }
9988 *  
9989 *  
9990 *   /*
9991 *  
9992 *   */
9993 *   template <typename ValueType, int dim, typename Number>
9994 *   void TimeRateRequest<ValueType, dim, Number>::
9995 *   set_partial_time_rate(const ValueType &partial_time_rate) {
9996 *   this->partial_time_rate = partial_time_rate;
9997 *   }
9998 *  
9999 *  
10000 *   template <typename ValueType, int dim, typename Number>
10001 *   void TimeRateRequest<ValueType, dim, Number>::
10002 *   set_total_time_rate(const ValueType &total_time_rate) {
10003 *   this->total_time_rate = total_time_rate;
10004 *   }
10005 *  
10006 *  
10007 *   template <typename ValueType, int dim, typename Number>
10008 *   void TimeRateRequest<ValueType, dim, Number>::
10009 *   set_partial_second_time_rate(const ValueType &partial_second_time_rate) {
10010 *   this->partial_second_time_rate = partial_second_time_rate;
10011 *   }
10012 *  
10013 *  
10014 *   template <typename ValueType, int dim, typename Number>
10015 *   void TimeRateRequest<ValueType, dim, Number>::
10016 *   set_total_second_time_rate(const ValueType &total_second_time_rate) {
10017 *   this->total_second_time_rate = total_second_time_rate;
10018 *   }
10019 *  
10020 *  
10021 *   template <typename ValueType, int dim, typename Number>
10022 *   void TimeRateRequest<ValueType, dim, Number>::
10023 *   set_partial_time_rate_tangent(const ValueType &partial_time_rate_tangent) {
10024 *   this->partial_time_rate_tangent = partial_time_rate_tangent;
10025 *   }
10026 *  
10027 *  
10028 *   template <typename ValueType, int dim, typename Number>
10029 *   void TimeRateRequest<ValueType, dim, Number>::
10030 *   set_total_time_rate_tangent(const ValueType &total_time_rate_tangent) {
10031 *   this->total_time_rate_tangent = total_time_rate_tangent;
10032 *   }
10033 *  
10034 *  
10035 *   template <typename ValueType, int dim, typename Number>
10036 *   void TimeRateRequest<ValueType, dim, Number>::
10037 *   set_partial_second_time_rate_tangent(const ValueType &partial_second_time_rate_tangent) {
10038 *   this->partial_second_time_rate_tangent = partial_second_time_rate_tangent;
10039 *   }
10040 *  
10041 *  
10042 *   template <typename ValueType, int dim, typename Number>
10043 *   void TimeRateRequest<ValueType, dim, Number>::
10044 *   set_total_second_time_rate_tangent(const ValueType &total_second_time_rate_tangent) {
10045 *   this->total_second_time_rate_tangent = total_second_time_rate_tangent;
10046 *   }
10047 *  
10048 *  
10049 *   } /* namespace PlasticityLab */
10050 *  
10051 *   #endif /* TIMERATEREQUEST_H_ */
10052 * @endcode
10053
10054
10055<a name="ann-src/TimeRateUpdateFlags.h"></a>
10056<h1>Annotated version of src/TimeRateUpdateFlags.h</h1>
10057 *
10058 *
10059 *
10060 *
10061 * @code
10062 *   /*
10063 *   * TimeRateUpdateFlags.h
10064 *   *
10065 *   * Created on: 27 Nov 2019
10066 *   * Author: maien
10067 *   */
10068 *  
10069 *   #ifndef TIMERATEUPDATEFLAGS_H_
10070 *   #define TIMERATEUPDATEFLAGS_H_
10071 *  
10072 *   namespace PlasticityLab {
10073 *  
10074 *   enum TimeRateUpdateFlags {
10075 *   default_timerate_update_flags = 0x0000,
10076 *   update_partial_time_rate = 0x0001,
10077 *   update_total_time_rate = 0x0002,
10078 *   update_partial_second_time_rate=0x0004,
10079 *   update_total_second_time_rate=0x0008,
10080 *   update_partial_time_rate_tangent=0x0010,
10081 *   update_total_time_rate_tangent=0x0020,
10082 *   update_partial_second_time_rate_tangent=0x0040,
10083 *   update_total_second_time_rate_tangent=0x0080
10084 *   };
10085 *  
10086 *   inline
10087 *   TimeRateUpdateFlags
10088 *   operator | (TimeRateUpdateFlags f1, TimeRateUpdateFlags f2) {
10089 *   return static_cast<TimeRateUpdateFlags> (
10090 *   static_cast<unsigned int> (f1) |
10091 *   static_cast<unsigned int> (f2));
10092 *   }
10093 *  
10094 *   inline
10095 *   const TimeRateUpdateFlags &
10096 *   operator |= (TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2) {
10097 *   f1 = f1 | f2;
10098 *   return f1;
10099 *   }
10100 *  
10101 *   inline
10102 *   TimeRateUpdateFlags
10103 *   operator & (TimeRateUpdateFlags f1, TimeRateUpdateFlags f2) {
10104 *   return static_cast<TimeRateUpdateFlags> (
10105 *   static_cast<unsigned int> (f1) &
10106 *   static_cast<unsigned int> (f2));
10107 *   }
10108 *  
10109 *   inline
10110 *   const TimeRateUpdateFlags &
10111 *   operator &= (TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2) {
10112 *   f1 = f1 & f2;
10113 *   return f1;
10114 *   }
10115 *  
10116 *   } /* namespace PlasticityLab */
10117 *  
10118 *   #endif /*TIMERATEUPDATEFLAGS_H_*/
10119 * @endcode
10120
10121
10122<a name="ann-src/main.cpp"></a>
10123<h1>Annotated version of src/main.cpp</h1>
10124 *
10125 *
10126 *
10127 * ============================================================================
10128 * Name : main.cpp
10129 * Author : Maien Hamed
10130 * Version :
10131 * Copyright :
10132 * Description : Hello World in C++, Ansi-style
10133 * ============================================================================
10134 *
10135
10136 *
10137 *
10138 * @code
10139 *   #include <iostream>
10140 *  
10141 *   #include "utilities.h"
10142 *   #include "ThermoPlasticMaterial.h"
10143 *   #include "ExponentialHardeningThermoviscoplasticYieldLaw.h"
10144 *   #include "JohnsonCookThermoviscoplasticYieldLaw.h"
10145 *   #include "ExponentialHardeningElastoplasticMaterial.h"
10146 *   #include "PlasticityLabProg.h"
10147 *  
10148 *   #define DIM 2
10149 *  
10150 *   PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10151 *   getExponentialHardeningThermoPlasticMaterial();
10152 *  
10153 *   PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10154 *   getJohnsonCookThermoPlasticMaterial();
10155 *  
10156 *   int main(int argc, char **argv) {
10157 *   try {
10158 *   Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv);
10159 *   {
10160 *   deallog.depth_console(0);
10161 *   auto material = getExponentialHardeningThermoPlasticMaterial();
10162 *   PlasticityLab::PlasticityLabProg<DIM> plasticityLab(material);
10163 *   plasticityLab.run();
10164 *   if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
10165 *   std::cout << "Finished." << std::endl; // prints
10166 *   }
10167 *   } catch (std::exception &exc) {
10168 *   std::cerr << std::endl << std::endl
10169 *   << "----------------------------------------------------"
10170 *   << std::endl;
10171 *   std::cerr << "Exception on processing: " << std::endl
10172 *   << exc.what() << std::endl
10173 *   << "Aborting!" << std::endl
10174 *   << "----------------------------------------------------"
10175 *   << std::endl;
10176 *   return 1;
10177 *   } catch (...) {
10178 *   std::cerr << std::endl << std::endl
10179 *   << "----------------------------------------------------"
10180 *   << std::endl;
10181 *   std::cerr << "Unknown exception!" << std::endl
10182 *   << "Aborting!" << std::endl
10183 *   << "----------------------------------------------------"
10184 *   << std::endl;
10185 *   return 1;
10186 *   }
10187 *   return 0;
10188 *   }
10189 *  
10190 *   PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10191 *   getExponentialHardeningThermoPlasticMaterial() {
10192 *   double kappa (164206.0), // [MPa]
10193 *   mu (801938.0), // [MPa]
10194 *   thermal_expansion_coefficient(1.0e-5), // [K^-1]
10195 *   thermal_conductivity(4.5e-2), // [J/mm.K.s]
10196 *   heat_capacity(3.588e-3), // cp*rho: [J.mm^-3.K^-1]
10197 *   K_0(450.0/*std::numeric_limits<double>::max()*/), // [MPa]
10198 *   K_infty(715.0/*std::numeric_limits<double>::max()*/), // [MPa]
10199 *   delta(16.93), // dimensionless
10200 *   H_bar(129.24), // [MPa]
10201 *   beta(1.0), // dimensionless (1.0 for isotropic hardening, 0.0 for kinematic hardening)
10202 *   flow_stress_softening(0.002), // [K^-1]
10203 *   hardening_softening(0.002), // [K^-1]
10204 *   dissipation_factor(0.9); // dimensionless
10205 *  
10206 *   PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double> thermo_viscoplastic_yield_law(
10207 *   K_0,
10208 *   K_infty,
10209 *   delta,
10210 *   H_bar,
10211 *   beta,
10212 *   flow_stress_softening,
10213 *   hardening_softening);
10214 *  
10215 *   return PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10216 *   (kappa,
10217 *   mu,
10218 *   thermal_expansion_coefficient,
10219 *   thermal_conductivity,
10220 *   heat_capacity,
10221 *   dissipation_factor,
10222 *   thermo_viscoplastic_yield_law);
10223 *   }
10224 *  
10225 *   PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10226 *   getJohnsonCookThermoPlasticMaterial() {
10227 *   double kappa (103300.0), // [MPa]
10228 *   mu (47690.0), // [MPa]
10229 *   A(89.7), // [MPa]
10230 *   B(291.87), // [MPa]
10231 *   C(0.025), // dimensionless
10232 *   m(1.09), // dimensionless
10233 *   n(0.31), // dimensionless
10234 *   melting_temperature(1356), // [K]
10235 *   reference_temperature(293.15), // [K]
10236 *   reference_strain_rate(1.0), // [s^-1]
10237 *   thermal_expansion_coefficient(1.0e-5), // [K^-1]
10238 *   thermal_conductivity(4.5e-2), // [J/mm.K.s] // http://www.matweb.com/search/datasheet_print.aspx?matguid=193434cf42e343fab880e1dabdb143ba
10239 *   heat_capacity(3.588e-3), // cp*rho: [J.mm^-3.K^-1]
10240 *   dissipation_factor(0.9); // dimensionless
10241 *  
10242 *   PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double> thermo_viscoplastic_yield_law(
10243 *   mu, A, B, C,
10244 *   m, n,
10245 *   melting_temperature,
10246 *   reference_strain_rate,
10247 *   reference_temperature);
10248 *  
10249 *   return PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10250 *   (kappa,
10251 *   mu,
10252 *   thermal_expansion_coefficient,
10253 *   thermal_conductivity,
10254 *   heat_capacity,
10255 *   dissipation_factor,
10256 *   thermo_viscoplastic_yield_law);
10257 *   }
10258 * @endcode
10259
10260
10261<a name="ann-src/symmetric_tensor_entries.h"></a>
10262<h1>Annotated version of src/symmetric_tensor_entries.h</h1>
10263 *
10264 *
10265 *
10266 *
10267 * @code
10268 *   #pragma once
10269 *  
10270 *   #include <deal.II/base/symmetric_tensor.h>
10271 *  
10272 *   #include <cstddef>
10273 *   #include <iterator>
10274 *  
10275 *   namespace dealii_utils
10276 *   {
10277 * @endcode
10278 *
10279 * ---------------- Const view ----------------
10280 *
10281 * @code
10282 *   template <int rank, int dim, typename Number>
10283 *   class SymmetricTensorConstEntriesView
10284 *   {
10285 *   public:
10286 *   using tensor_type = ::SymmetricTensor<rank, dim, Number>;
10287 *  
10288 *   explicit SymmetricTensorConstEntriesView(const tensor_type &t) : t_(&t) {}
10289 *  
10290 *   class const_iterator
10291 *   {
10292 *   public:
10293 *   using iterator_category = std::forward_iterator_tag;
10294 *   using value_type = Number;
10295 *   using difference_type = std::ptrdiff_t;
10296 *   using pointer = const Number *;
10297 *   using reference = const Number &;
10298 *  
10299 *   const_iterator() = default;
10300 *   const_iterator(const tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10301 *  
10302 *   reference operator*() const { return t_->access_raw_entry(i_); }
10303 *  
10304 *   const_iterator &operator++() { ++i_; return *this; }
10305 *   const_iterator operator++(int) { const_iterator tmp(*this); ++(*this); return tmp; }
10306 *  
10307 *   friend bool operator==(const const_iterator &a, const const_iterator &b)
10308 *   {
10309 *   return a.t_ == b.t_ && a.i_ == b.i_;
10310 *   }
10311 *   friend bool operator!=(const const_iterator &a, const const_iterator &b) { return !(a == b); }
10312 *  
10313 *   private:
10314 *   const tensor_type *t_ = nullptr;
10315 *   unsigned int i_ = 0;
10316 *   };
10317 *  
10318 *   const_iterator begin() const { return const_iterator(t_, 0u); }
10319 *   const_iterator end() const { return const_iterator(t_, tensor_type::n_independent_components); }
10320 *   const_iterator cbegin() const { return begin(); }
10321 *   const_iterator cend() const { return end(); }
10322 *  
10323 *   private:
10324 *   const tensor_type *t_;
10325 *   };
10326 *  
10327 *  
10328 * @endcode
10329 *
10330 * ---------------- Mutable view ----------------
10331 *
10332 * @code
10333 *   template <int rank, int dim, typename Number>
10334 *   class SymmetricTensorMutableEntriesView
10335 *   {
10336 *   public:
10337 *   using tensor_type = ::SymmetricTensor<rank, dim, Number>;
10338 *  
10339 *   explicit SymmetricTensorMutableEntriesView(tensor_type &t) : t_(&t) {}
10340 *  
10341 *   class iterator
10342 *   {
10343 *   public:
10344 *   using iterator_category = std::forward_iterator_tag;
10345 *   using value_type = Number;
10346 *   using difference_type = std::ptrdiff_t;
10347 *   using pointer = Number *;
10348 *   using reference = Number &;
10349 *  
10350 *   iterator() = default;
10351 *   iterator(tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10352 *  
10353 *   reference operator*() const { return t_->access_raw_entry(i_); }
10354 *  
10355 *   iterator &operator++() { ++i_; return *this; }
10356 *   iterator operator++(int) { iterator tmp(*this); ++(*this); return tmp; }
10357 *  
10358 *   friend bool operator==(const iterator &a, const iterator &b)
10359 *   {
10360 *   return a.t_ == b.t_ && a.i_ == b.i_;
10361 *   }
10362 *   friend bool operator!=(const iterator &a, const iterator &b) { return !(a == b); }
10363 *  
10364 *   private:
10365 *   tensor_type *t_ = nullptr;
10366 *   unsigned int i_ = 0;
10367 *   };
10368 *  
10369 *   class const_iterator
10370 *   {
10371 *   public:
10372 *   using iterator_category = std::forward_iterator_tag;
10373 *   using value_type = Number;
10374 *   using difference_type = std::ptrdiff_t;
10375 *   using pointer = const Number *;
10376 *   using reference = const Number &;
10377 *  
10378 *   const_iterator() = default;
10379 *   const_iterator(const tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10380 *  
10381 *   reference operator*() const { return t_->access_raw_entry(i_); }
10382 *  
10383 *   const_iterator &operator++() { ++i_; return *this; }
10384 *   const_iterator operator++(int) { const_iterator tmp(*this); ++(*this); return tmp; }
10385 *  
10386 *   friend bool operator==(const const_iterator &a, const const_iterator &b)
10387 *   {
10388 *   return a.t_ == b.t_ && a.i_ == b.i_;
10389 *   }
10390 *   friend bool operator!=(const const_iterator &a, const const_iterator &b) { return !(a == b); }
10391 *  
10392 *   private:
10393 *   const tensor_type *t_ = nullptr;
10394 *   unsigned int i_ = 0;
10395 *   };
10396 *  
10397 *   iterator begin() { return iterator(t_, 0u); }
10398 *   iterator end() { return iterator(t_, tensor_type::n_independent_components); }
10399 *  
10400 *   const_iterator begin() const { return const_iterator(t_, 0u); }
10401 *   const_iterator end() const { return const_iterator(t_, tensor_type::n_independent_components); }
10402 *   const_iterator cbegin() const { return begin(); }
10403 *   const_iterator cend() const { return end(); }
10404 *  
10405 *   private:
10406 *   tensor_type *t_;
10407 *   };
10408 *  
10409 *  
10410 * @endcode
10411 *
10412 * ---------------- Factories ----------------
10413 *
10414 * @code
10415 *   template <int rank, int dim, typename Number>
10416 *   SymmetricTensorConstEntriesView<rank, dim, Number>
10417 *   symmetric_tensor_entries(const ::SymmetricTensor<rank, dim, Number> &t)
10418 *   {
10419 *   return SymmetricTensorConstEntriesView<rank, dim, Number>(t);
10420 *   }
10421 *  
10422 *   template <int rank, int dim, typename Number>
10423 *   SymmetricTensorMutableEntriesView<rank, dim, Number>
10424 *   symmetric_tensor_entries(::SymmetricTensor<rank, dim, Number> &t)
10425 *   {
10426 *   return SymmetricTensorMutableEntriesView<rank, dim, Number>(t);
10427 *   }
10428 *   } // namespace dealii_utils
10429 * @endcode
10430
10431
10432<a name="ann-src/utilities.h"></a>
10433<h1>Annotated version of src/utilities.h</h1>
10434 *
10435 *
10436 *
10437 *
10438 * @code
10439 *   #ifndef _UTILITIES_H
10440 *   #define _UTILITIES_H
10441 *  
10442 *   #include <deal.II/base/utilities.h>
10443 *   #include <mpi.h>
10444 *  
10445 *   namespace PlasticityLab {
10446 *  
10447 *   [[maybe_unused]] static MPI_Comm mpi_communicator(MPI_COMM_WORLD);
10448 *  
10449 *   struct NotImplementedException : std::exception {
10450 *   const char *what() const _GLIBCXX_USE_NOEXCEPT override {
10451 *   return "Not Implemented.!\n";
10452 *   }
10453 *   };
10454 *  
10455 *   } /*namespace PlasticityLab*/
10456 *  
10457 *  
10458 *   #endif /*_UTILITIES_H*/
10459 * @endcode
10460
10461
10462*/
*const Number elongation_rate
*  iterator end()
*mech_lbc_system interpolatoryConstraintAppliers push_back * InterpolatoryConstraintApplier(*top_constraint_function_map, *y_component_mask)
*  const Number radius
*const unsigned int n_steps
***const Number total_elongation
*  x_component_mask set(0, true)
*  *  *  struct InterferenceTaperTransform *  
*  *  const_iterator()=default
*  *endcode **Thermal constraints **code *  const Number convection_coefficient
Definition fe_q.h:552
const unsigned int dofs_per_cell
Definition fe_data.h:434
virtual void advance_time(const Number delta_t)
Abstract base class for mapping classes.
Definition mapping.h:318
Definition point.h:111
DerivativeForm< 1, spacedim, dim, Number > transpose(const DerivativeForm< 1, dim, spacedim, Number > &DF)
unsigned int cell_index
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.
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
STL namespace.
::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
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()