172 *
#ifndef BODYFORCEAPPLIER_H_
173 *
#define BODYFORCEAPPLIER_H_
177 *
template <
int dim,
typename Number =
double>
178 *
class BodyForceApplier {
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;
187 *
const unsigned int direction;
188 *
const Number bodyForceMagnitude;
192 *
template <
int dim,
typename Number>
193 *
BodyForceApplier<dim, Number>::
194 *
BodyForceApplier(
int direction,
Number bodyForceMagnitude)
195 *
: direction(direction), bodyForceMagnitude(bodyForceMagnitude) {
199 *
template <
int dim,
typename Number>
200 *
BodyForceApplier<dim, Number>::~BodyForceApplier() {
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;
219<a name=
"ann-src/BoundaryUnidirectionalPenaltySpec.h"></a>
220<h1>Annotated version of src/BoundaryUnidirectionalPenaltySpec.h</h1>
233 *
#ifndef BOUNDARYUNIDIRECTIONALPENALTYSPEC_H_
234 *
#define BOUNDARYUNIDIRECTIONALPENALTYSPEC_H_
238 *
template<
typename Number =
double>
239 *
class BoundaryUnidirectionalPenaltySpec {
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) {}
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; }
258 *
const Number reference_displacement_increment;
259 *
const Number residual_force;
260 *
const Number quadratic_spring_factor;
269<a name=
"ann-src/Constants.h"></a>
270<h1>Annotated version of src/Constants.h</h1>
283 *
#ifndef CONSTANTS_H_
284 *
#define CONSTANTS_H_
289 *
template <
int dim,
typename Number>
292 *
inline static const Number one_third() {
293 *
return static_cast<Number>(0.33333333333333333333333333333333333333333333333333);
296 *
inline static const Number sqrt2thirds() {
297 *
return static_cast<Number>(0.81649658092772603273242802490196379732198249355222);
300 *
inline static const Number two_thirds() {
301 *
return static_cast<Number>(0.66666666666666666666666666666666666666666666666666);
304 *
inline static const Number sqrt_half() {
305 *
return static_cast<Number>(0.70710678118654752440084436210484903928483593768847);
308 *
inline static const Number sqrt_2() {
309 *
return static_cast<Number>(1.41421356237309504880168872420969807856967187537694);
313 *
inline static const Number one_over_dim() {
315 *
return static_cast<Number>(0.33333333333333333333333333333333333333333333333333);
317 *
return static_cast<Number>(0.5);
319 *
return static_cast<Number>(1./
static_cast<Number>(dim));
322 *
inline static const Number two_over_dim() {
324 *
return static_cast<Number>(0.66666666666666666666666666666666666666666666666666);
326 *
return static_cast<Number>(1.0);
328 *
return static_cast<Number>(2./
static_cast<Number>(dim));
333 *
inline void get_generalized_alpha_method_params(
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);
352<a name=
"ann-src/ConstitModelUpdateFlags.h"></a>
353<h1>Annotated version of src/ConstitModelUpdateFlags.h</h1>
366 *
#ifndef CONSTITMODELUPDATEFLAGS_H_
367 *
#define CONSTITMODELUPDATEFLAGS_H_
371 *
enum ConstitutiveModelUpdateFlags {
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
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));
399 *
const ConstitutiveModelUpdateFlags &
400 *
operator |= (ConstitutiveModelUpdateFlags &f1, ConstitutiveModelUpdateFlags f2) {
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));
414 *
const ConstitutiveModelUpdateFlags &
415 *
operator &= (ConstitutiveModelUpdateFlags &f1, ConstitutiveModelUpdateFlags f2) {
426<a name=
"ann-src/ConstitutiveModelRequest.h"></a>
427<h1>Annotated version of src/ConstitutiveModelRequest.h</h1>
440 *
#ifndef CONSTITUTIVEMODELREQUEST_H_
441 *
#define CONSTITUTIVEMODELREQUEST_H_
443 *
#include <deal.II/base/tensor.h>
444 *
#include <deal.II/base/symmetric_tensor.h>
446 *
#include
"Constants.h"
447 *
#include
"ConstitModelUpdateFlags.h"
448 *
#include
"TensorUtilities.h"
452 *
template <
int dim,
typename Number>
453 *
class ConstitutiveModelRequest {
455 *
ConstitutiveModelRequest(ConstitutiveModelUpdateFlags);
456 *
virtual ~ConstitutiveModelRequest();
460 * Interface to be used by request client (FE system assembler)
461 * --request configuration stage--
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);
477 * Interface to be used by request client (FE system assembler)
478 * --request response retrieval and interrogation stage--
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;
499 *
interface used by constitutive model object to perform computation
500 * TODO consider hiding
this interface and exposing it through adapter
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;
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);
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);
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
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);
533 *
void set_delta_gamma(
const Number delta_gamma);
534 *
void set_dK(
const Number dK);
535 *
void set_dH(
const Number dH);
538 *
void set_elastic_entropy_tangent_modulus(
const Number elastic_entropy_tangent_modulus);
539 *
void set_mechanical_dissipation_tangent_modulus(
const Number mechanicalDissipationTangentModulus);
543 *
ConstitutiveModelUpdateFlags update_flags;
545 *
Tensor<2, dim, Number> deformation_gradient;
546 *
Number deformation_Jacobian, previous_deformation_Jacobian, deformation_Jacobian_time_rate;
547 *
Number unprojected_deformation_Jacobian;
549 *
Tensor<1, dim, Number> thermal_gradient;
552 *
SymmetricTensor<2, dim, Number> stress_deviator;
553 *
Tensor<1, dim, Number> heat_flux;
554 *
Number stored_heat_rate;
556 *
Number mechanical_dissipation;
557 *
Number thermo_elastic_heating;
562 *
Number pressure_tangent_modulus;
564 *
SymmetricTensor<2, dim, Number> b_e_bar;
565 *
SymmetricTensor<2, dim, Number> heat_flux_tangent_moduli;
566 *
Number stored_heat_rate_tangent_modulus;
567 *
Number elastic_entropy_tangent_modulus;
568 *
Number mechanical_dissipation_tangent_modulus;
569 *
Number thermo_elastic_heating_tangent_modulus;
572 *
template <
int dim,
typename Number>
573 *
ConstitutiveModelRequest<dim, Number>::
574 *
ConstitutiveModelRequest(ConstitutiveModelUpdateFlags update_flags):
575 *
update_flags(update_flags) {
579 *
template <
int dim,
typename Number>
580 *
bool ConstitutiveModelRequest<dim, Number>::get_is_plastic()
const {
584 *
template <
int dim,
typename Number>
585 *
ConstitutiveModelRequest<dim, Number>::~ConstitutiveModelRequest() { }
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;
593 *
template <
int dim,
typename Number>
594 *
void ConstitutiveModelRequest<dim, Number>::
595 *
set_deformation_Jacobian(
Number deformation_Jacobian) {
596 *
this->deformation_Jacobian = deformation_Jacobian;
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;
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;
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;
617 *
template <
int dim,
typename Number>
618 *
void ConstitutiveModelRequest<dim, Number>::
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;
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;
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;
641 *
template <
int dim,
typename Number>
642 *
void ConstitutiveModelRequest<dim, Number>::
647 *
template <
int dim,
typename Number>
648 *
Number ConstitutiveModelRequest<dim, Number>::get_pressure() {
652 *
template <
int dim,
typename Number>
654 *
ConstitutiveModelRequest<dim, Number>::
655 *
get_pressure_tangent(
const Number volume_change_increment) {
656 *
return pressure_tangent_modulus * volume_change_increment;
659 *
template <
int dim,
typename Number>
660 *
SymmetricTensor<2, dim, Number> ConstitutiveModelRequest<dim, Number>::
661 *
get_stress_deviator()
const {
662 *
return stress_deviator;
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;
676 * TODO ensure that all the debugging tests were removed
683 *
Number d_mu_bar = Constants<dim, Number>::one_third() *
mu *
trace(d_b_e_bar);
685 * SymmetricTensor<2, dim, Number> dev_b_e_direction =
deviator(b_e_bar) / norm_dev_b_e_bar;
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;
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));
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));
705 *
return deviator(d_trial_stress_dev);
708 *
template <
int dim,
typename Number>
709 *
Tensor<1, dim, Number>
710 *
ConstitutiveModelRequest<dim, Number>::get_heat_flux()
const {
714 *
template <
int dim,
typename Number>
715 *
Tensor<1, dim, Number>
716 *
ConstitutiveModelRequest<dim, Number>::
717 *
get_heat_flux_tangent(
const Tensor<1, dim, Number> &thermal_gradient_increment)
const {
718 *
return heat_flux_tangent_moduli * thermal_gradient_increment;
721 *
template <
int dim,
typename Number>
723 *
ConstitutiveModelRequest<dim, Number>::get_stored_heat_rate()
const {
724 *
return stored_heat_rate;
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;
733 *
template <
int dim,
typename Number>
734 *
Number ConstitutiveModelRequest<dim, Number>::
735 *
get_elastic_entropy()
const {
736 *
return elastic_entropy;
739 *
template <
int dim,
typename Number>
740 *
Number ConstitutiveModelRequest<dim, Number>::
741 *
get_elastic_entropy_tangent(
const Number temperature_increment)
const {
745 *
template <
int dim,
typename Number>
746 *
Number ConstitutiveModelRequest<dim, Number>::
747 *
get_mechanical_dissipation()
const {
748 *
return mechanical_dissipation;
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;
757 *
template <
int dim,
typename Number>
758 *
Number ConstitutiveModelRequest<dim, Number>::
759 *
get_thermo_elastic_heating()
const {
760 *
return thermo_elastic_heating;
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;
769 *
template <
int dim,
typename Number>
770 *
ConstitutiveModelUpdateFlags ConstitutiveModelRequest<dim, Number>::
772 *
return update_flags;
775 *
template <
int dim,
typename Number>
776 *
Tensor<2, dim, Number> ConstitutiveModelRequest<dim, Number>::
777 *
get_deformation_gradient()
const {
778 *
return deformation_gradient;
781 *
template <
int dim,
typename Number>
782 *
Number ConstitutiveModelRequest<dim, Number>::
783 *
get_deformation_Jacobian()
const {
784 *
return deformation_Jacobian;
787 *
template <
int dim,
typename Number>
788 *
Number ConstitutiveModelRequest<dim, Number>::
789 *
get_unprojected_deformation_Jacobian()
const {
790 *
return unprojected_deformation_Jacobian;
793 *
template <
int dim,
typename Number>
794 *
Number ConstitutiveModelRequest<dim, Number>::
795 *
get_previous_deformation_Jacobian()
const {
796 *
return previous_deformation_Jacobian;
799 *
template <
int dim,
typename Number>
800 *
Number ConstitutiveModelRequest<dim, Number>::
801 *
get_deformation_Jacobian_time_rate()
const {
802 *
return deformation_Jacobian_time_rate;
805 *
template <
int dim,
typename Number>
806 *
Number ConstitutiveModelRequest<dim, Number>::
807 *
get_temperature()
const {
811 *
template <
int dim,
typename Number>
812 *
Number ConstitutiveModelRequest<dim, Number>::
813 *
get_previous_temperature()
const {
814 *
return previous_temperature;
817 *
template <
int dim,
typename Number>
818 *
Number ConstitutiveModelRequest<dim, Number>::
819 *
get_temperature_time_rate()
const {
820 *
return temperature_time_rate;
823 *
template <
int dim,
typename Number>
824 *
Tensor<1, dim, Number> ConstitutiveModelRequest<dim, Number>::
825 *
get_thermal_gradient()
const {
826 *
return thermal_gradient;
829 *
template <
int dim,
typename Number>
830 *
Number ConstitutiveModelRequest<dim, Number>::
835 *
template <
int dim,
typename Number>
836 *
void ConstitutiveModelRequest<dim, Number>::
837 *
set_pressure(
Number pressure) {
838 *
this->pressure = pressure;
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;
847 *
template <
int dim,
typename Number>
848 *
void ConstitutiveModelRequest<dim, Number>::
849 *
set_b_e_bar(
const SymmetricTensor<2, dim, Number> &b_e_bar) {
850 *
this->b_e_bar = b_e_bar;
853 *
template <
int dim,
typename Number>
854 *
void ConstitutiveModelRequest<dim, Number>::
859 *
template <
int dim,
typename Number>
860 *
void ConstitutiveModelRequest<dim, Number>::
862 *
this->is_plastic = is_plastic;
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;
871 *
template <
int dim,
typename Number>
872 *
void ConstitutiveModelRequest<dim, Number>::
873 *
set_dK(
const Number dK) {
877 *
template <
int dim,
typename Number>
878 *
void ConstitutiveModelRequest<dim, Number>::
879 *
set_dH(
const Number dH) {
883 *
template <
int dim,
typename Number>
884 *
void ConstitutiveModelRequest<dim, Number>::
886 *
this->heat_flux = heat_flux;
889 *
template <
int dim,
typename Number>
890 *
void ConstitutiveModelRequest<dim, Number>::
892 *
this->stored_heat_rate = stored_heat_rate;
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;
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;
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;
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;
919 *
template <
int dim,
typename Number>
920 *
void ConstitutiveModelRequest<dim, Number>::
922 *
this->heat_flux_tangent_moduli = heat_flux_tangent_modului;
925 *
template <
int dim,
typename Number>
926 *
void ConstitutiveModelRequest<dim, Number>::
928 *
this->stored_heat_rate_tangent_modulus = stored_heat_rate_tangent_modulus;
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;
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;
943 *
template <
int dim,
typename Number>
944 *
void ConstitutiveModelRequest<dim, Number>::
946 *
this->thermo_elastic_heating_tangent_modulus = thermo_elastic_heating_tangent_modulus;
955<a name=
"ann-src/ConvectionBoundaryConditionApplier.h"></a>
956<h1>Annotated version of src/ConvectionBoundaryConditionApplier.h</h1>
969 *
#ifndef CONVECTIONBOUNDARYCONDITIONAPPLIER_H_
970 *
#define CONVECTIONBOUNDARYCONDITIONAPPLIER_H_
974 *
template <
int dim,
typename Number =
double>
975 *
class ConvectionBoundaryConditionApplier {
977 *
ConvectionBoundaryConditionApplier();
978 *
ConvectionBoundaryConditionApplier(
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;
993 *
const unsigned int direction;
995 *
const Number ambient_field_value;
999 *
template <
int dim,
typename Number>
1000 *
ConvectionBoundaryConditionApplier<dim, Number>::
1001 *
ConvectionBoundaryConditionApplier(
1004 *
Number ambient_field_value)
1005 *
: direction(direction),
1007 *
ambient_field_value(ambient_field_value) {
1011 *
template <
int dim,
typename Number>
1012 *
ConvectionBoundaryConditionApplier<dim, Number>::~ConvectionBoundaryConditionApplier() {
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)
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) {
1045<a name=
"ann-src/DoFSystem.h"></a>
1046<h1>Annotated version of src/DoFSystem.h</h1>
1059 *
#ifndef DOFSYSTEM_H_
1060 *
#define DOFSYSTEM_H_
1062 *
#include <deal.II/dofs/dof_tools.h>
1063 *
#include <deal.II/base/conditional_ostream.h>
1065 *
#include
"InterpolatoryConstraintApplier.h"
1066 *
#include
"BodyForceApplier.h"
1067 *
#include
"ConvectionBoundaryConditionApplier.h"
1069 *
#include
"utilities.h"
1071 *
using namespace dealii;
1075 *
template <
int dim,
typename Number=
double>
1078 *
DoFSystem (const ::Triangulation<dim> &triangulation,
1079 *
const ::Mapping<dim> &
mapping);
1081 *
DoFHandler<dim> dof_handler;
1083 *
AffineConstraints<Number> nodal_constraints;
1085 *
IndexSet locally_owned_dofs;
1086 *
IndexSet locally_relevant_dofs;
1088 *
void setup_dof_system (
const FiniteElement<dim> &fe);
1089 *
const ::Mapping<dim> &
mapping;
1093 *
template<
int dim,
typename Number>
1094 *
DoFSystem <dim, Number> :: DoFSystem(const ::Triangulation<dim> &triangulation,
1095 *
const ::Mapping<dim> &
mapping) :
1096 *
dof_handler(triangulation),
1100 *
template <
int dim,
typename Number>
1102 *
dof_handler.distribute_dofs(fe);
1103 *
locally_owned_dofs = dof_handler.locally_owned_dofs();
1106 *
nodal_constraints.reinit(locally_owned_dofs, locally_relevant_dofs);
1116<a name=
"ann-src/ExponentialHardeningElastoplasticMaterial.cpp"></a>
1117<h1>Annotated version of src/ExponentialHardeningElastoplasticMaterial.cpp</h1>
1132 *
#include <deal.II/base/symmetric_tensor.h>
1134 *
#include
"ExponentialHardeningElastoplasticMaterial.h"
1135 *
#include
"utilities.h"
1139 *
template <
int dim,
typename Number>
1140 *
ExponentialHardeningElastoplasticMaterial<dim, Number>::
1141 *
ExponentialHardeningElastoplasticMaterial
1157 *
stress_strain_tensor_kappa (kappa
1160 *
stress_strain_tensor_mu (2 *
mu
1167 *
template <
int dim,
typename Number>
1168 *
ExponentialHardeningElastoplasticMaterial<dim, Number>::
1169 *
~ExponentialHardeningElastoplasticMaterial() {
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 {
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> &) {
1188 *
template <
int dim,
typename Number>
1189 *
size_t ExponentialHardeningElastoplasticMaterial<dim, Number>::
1190 *
get_material_parameter_count()
const {
1195 *
template <
int dim,
typename Number>
1196 *
Number ExponentialHardeningElastoplasticMaterial<dim, Number>::get_material_Jacobian(
const point_index_t &)
const {
1200 *
template <
int dim,
typename Number>
1201 * ::SymmetricTensor<2, dim, Number> ExponentialHardeningElastoplasticMaterial<dim, Number>::get_plastic_strain(
const point_index_t &)
const {
1206 *
template <
int dim,
typename Number>
1207 *
void ExponentialHardeningElastoplasticMaterial<dim, Number>::
1208 *
compute_constitutive_request(ConstitutiveModelRequest<dim, Number> &constitutive_request,
1211 *
typename PointHistory<dim, Number>::HardeningParameters
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);
1219 *
SymmetricTensor<2, dim, Number>
1224 *
Number delta_gamma, alpha_n_plus_1;
1233 * 4. Update back stress, plastic strain and stress
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 =
1247 *
* (H_alpha_n_plus_1 - H_alpha_n)
1249 *
material_point_history[
point_index].plastic_strain =
1253 *
SymmetricTensor<2, dim, Number>
1259 *
Number theta_bar_n_plus_1 = 1 / (1 + (DK_alpha_n_plus_1 + DH_alpha_n_plus_1) / (3 *
mu))
1260 *
- (1 - theta_n_plus_1);
1261 *
const SymmetricTensor<4, dim, Number> one_prod_one =
1263 *
elastoplastic_tangent_moduli = kappa * one_prod_one
1269 * TODO change code such that request update flags are respected
1272 *
constitutive_request.set_stress_deviator(stress);
1275 * constitutiveRequest.setStressDeviatorTangentModuli(elastoplastic_tangent_moduli);
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);
1285 * constitutiveRequest.setStressDeviatorTangentModuli(elastoplastic_tangent_moduli);
1291 *
template <
int dim,
typename Number>
1293 *
ExponentialHardeningElastoplasticMaterial<dim, Number>::
1294 *
setup_point_history (
const point_index_t point_count) {
1296 *
std::vector< PointHistory<dim, Number> > tmp;
1297 *
tmp.swap (material_point_history);
1299 *
material_point_history.resize (point_count);
1302 *
template <
int dim,
typename Number>
1304 *
ExponentialHardeningElastoplasticMaterial<dim, Number>::
1308 *
Number tol,
unsigned int max_iter)
const {
1309 *
unsigned int k = 0;
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;
1316 *
alpha_n_plus_1 = alpha_n;
1318 *
exponential_hardening_values(K_alpha_n, H_alpha_n, alpha_n);
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));
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));
1329 *
delta_gamma = delta_gamma - g_of_gamma_k / Dg_of_gamma_k;
1330 *
alpha_n_plus_1 = alpha_n + sqrt2thirds * delta_gamma;
1332 *
}
while (std::fabs(g_of_gamma_k) > tol && k < max_iter);
1335 *
template <
int dim,
typename Number>
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;
1346 *
template <
int dim,
typename Number>
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;
1357 *
template <
int dim,
typename 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);
1369 *
template class ExponentialHardeningElastoplasticMaterial<3, double>;
1370 *
template class ExponentialHardeningElastoplasticMaterial<2, double>;
1376<a name=
"ann-src/ExponentialHardeningElastoplasticMaterial.h"></a>
1377<h1>Annotated version of src/ExponentialHardeningElastoplasticMaterial.h</h1>
1390 *
#ifndef EXPONENTIALHARDENINGMATERIAL_H_
1391 *
#define EXPONENTIALHARDENINGMATERIAL_H_
1393 *
#include
"PointHistory.h"
1394 *
#include
"Material.h"
1395 *
#include
"ConstitutiveModelRequest.h"
1397 *
using namespace dealii;
1401 *
template <
int dim,
typename Number =
double>
1402 *
class ExponentialHardeningElastoplasticMaterial :
public Material<dim, Number> {
1404 *
ExponentialHardeningElastoplasticMaterial(
const Number E,
1407 *
const Number K_infty,
1408 *
const Number delta,
1409 *
const Number H_bar,
1410 *
const Number beta);
1412 *
virtual ~ExponentialHardeningElastoplasticMaterial();
1414 *
void compute_constitutive_request(
1415 *
ConstitutiveModelRequest<dim, Number> &constitutive_request,
1416 *
const point_index_t &point_index)
override;
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;
1421 *
void setup_point_history (
const point_index_t point_count)
override;
1423 *
std::vector<Number> get_state_parameters(
1424 *
const point_index_t &point_index,
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;
1437 *
const Number K_0, K_infty, delta, H_bar;
1441 *
const SymmetricTensor<4, dim, Number> stress_strain_tensor_kappa;
1442 *
const SymmetricTensor<4, dim, Number> stress_strain_tensor_mu;
1444 *
std::vector< PointHistory< dim, Number> > material_point_history;
1448 *
const Number norm_ksi_trial,
1449 *
const Number alpha_n,
1450 *
Number tol,
unsigned int max_iter)
const;
1453 *
exponential_hardening_values(Number &kinematic_hardening,
1454 *
Number &isotropic_hardening,
1455 *
const Number alpha)
const;
1458 *
exponential_hardening_derivatives(Number &D_kinematic_hardening,
1459 *
Number &D_isotropic_hardening,
1460 *
const Number alpha)
const;
1464 *
const Number alpha)
const;
1474<a name=
"ann-src/ExponentialHardeningThermoviscoplasticYieldLaw.h"></a>
1475<h1>Annotated version of src/ExponentialHardeningThermoviscoplasticYieldLaw.h</h1>
1488 *
#ifndef EXPONENTIALHARDENINGTHERMOVISCOPLASTICYIELDLAW_H_
1489 *
#define EXPONENTIALHARDENINGTHERMOVISCOPLASTICYIELDLAW_H_
1491 *
#include
"Constants.h"
1495 *
template<
typename Number>
1496 *
class ExponentialHardeningThermoviscoplasticYieldLaw {
1498 *
ExponentialHardeningThermoviscoplasticYieldLaw(
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) :
1512 *
flow_stress_softening(flow_stress_softening),
1513 *
hardening_softening(hardening_softening),
1515 *
viscous_hardening_factor(0.0),
1516 *
sqrt2thirds(Constants<3,
Number>::sqrt2thirds()) {}
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;
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)))
1540 *
D_isotropic_hardening = beta * Dh;
1541 *
D_kinematic_hardening = (1 - beta) * Dh;
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 {
1552 *
-flow_stress_softening * K_0
1553 *
- hardening_softening * ((K_infty - K_0) * (1 -
exp(-delta * alpha)) + H_bar * alpha)
1555 *
D_isotropic_hardening = beta * Dh;
1556 *
D_kinematic_hardening = (1 - beta) * Dh;
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);
1571 *
const Number K_0, K_infty, delta, H_bar;
1573 *
const Number flow_stress_softening, hardening_softening;
1575 *
const Number viscous_hardening_factor;
1576 *
const Number sqrt2thirds;
1577 *
const Number softening_threshold = 0.98;
1585<a name=
"ann-src/IncrementInterpolationHandler.h"></a>
1586<h1>Annotated version of src/IncrementInterpolationHandler.h</h1>
1599 *
#ifndef INCREMENTINTERPOLATIONHANDLER_H_
1600 *
#define INCREMENTINTERPOLATIONHANDLER_H_
1603 *
using namespace dealii;
1606 *
template <
int dim,
typename Number=
double,
int components=dim>
1607 *
class IncrementInterpolationHandler {
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,
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),
1625 *
~IncrementInterpolationHandler(){
1626 *
delete increment_interpolation_function;
1629 *
void advance_time(
const Number delta_t);
1631 *
template<
typename VectorType>
1632 *
void distribute_step_constraints(VectorType &increment)
const {
1633 *
if(do_constrain) {
1634 *
function_constraint.distribute(increment);
1638 *
template<
typename VectorType>
1639 *
void interpolate(VectorType &increment,
const DoFSystem<dim, Number> &dof_system)
const {
1640 *
if(do_interpolate) {
1643 *
dof_system.dof_handler,
1644 *
*increment_interpolation_function,
1646 *
interpolation_component_mask);
1650 *
void reinit_constraint_matrix(
const DoFSystem<dim, Number> &dof_system) {
1651 *
if(do_constrain) {
1652 *
function_constraint.reinit(dof_system.locally_relevant_dofs);
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();
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;
1668 *
AffineConstraints<Number> function_constraint;
1669 *
const Mapping<dim> &
mapping;
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);
1684<a name=
"ann-src/InterpolatoryConstraintApplier.h"></a>
1698 *
#ifndef INTERPOLATORYCONSTRAINTAPPLIER_H_
1699 *
#define INTERPOLATORYCONSTRAINTAPPLIER_H_
1701 *
#include <deal.II/dofs/dof_tools.h>
1702 *
#include <deal.II/numerics/vector_tools.h>
1706 *
template <
int dim,
typename Number =
double>
1711 * ::ComponentMask componentMask);
1712 *
virtual ~InterpolatoryConstraintApplier();
1714 *
void configure(std::map<
::types::boundary_id, const ::Function< dim, Number > * > constraintFunctionMap,
1715 * ::ComponentMask componentMask);
1718 * ::DoFHandler<dim> &doFHandler,
1719 * ::AffineConstraints<Number> &constraintMatrix,
1720 *
bool useComponentMask =
true)
const;
1723 *
std::map< ::types::boundary_id, const ::Function< dim, Number > * > constraintFunctionMap;
1724 * ::ComponentMask componentMask;
1727 *
template <
int dim,
typename Number>
1728 *
InterpolatoryConstraintApplier<dim, Number>::InterpolatoryConstraintApplier() {
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) {
1739 *
template <
int dim,
typename Number>
1740 *
InterpolatoryConstraintApplier<dim, Number>::~InterpolatoryConstraintApplier() {
1743 *
template <
int dim,
typename Number>
1744 *
void InterpolatoryConstraintApplier<dim, Number>::configure
1746 * ::ComponentMask componentMask) {
1747 *
this->constraintFunctionMap = std::map< ::types::boundary_id, const ::Function< dim, Number > * >(constraintFunctionMap);
1748 *
this->componentMask = ::ComponentMask(componentMask);
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,
1759 *
constraintFunctionMap,
1763 * ::VectorTools::interpolate_boundary_values(
mapping,
1765 *
constraintFunctionMap,
1766 *
constraintMatrix);
1775<a name=
"ann-src/JohnsonCookThermoviscoplasticYieldLaw.h"></a>
1776<h1>Annotated version of src/JohnsonCookThermoviscoplasticYieldLaw.h</h1>
1789 *
#ifndef JOHNSONCOOKTHERMOVISCOPLASTICYIELDLAW_H_
1790 *
#define JOHNSONCOOKTHERMOVISCOPLASTICYIELDLAW_H_
1794 *
#include
"Constants.h"
1799 *
template<
typename Number>
1800 *
class JohnsonCookThermoviscoplasticYieldLaw {
1802 *
JohnsonCookThermoviscoplasticYieldLaw(
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) :
1819 *
melting_temperature(melting_temperature),
1820 *
reference_strain_rate(reference_strain_rate),
1823 *
sqrt2thirds(Constants<2,
Number>::sqrt2thirds()),
1824 *
exp_one_half(std::
exp(0.5)) {}
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;
1844 *
get_elastoplastic_factor(alpha)
1845 *
* get_viscosity_factor(gamma, time_increment)
1846 *
* get_softening_factor(temperature)
1848 *
isotropic_hardening = beta * h;
1849 *
kinematic_hardening = (1 - beta) * h;
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);
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
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;
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)
1900 *
D_isotropic_hardening = beta * Dh;
1901 *
D_kinematic_hardening = (1.0 - beta) * Dh;
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;
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;
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);
1951 *
Number get_elastoplastic_factor(
const Number alpha)
const {
1952 *
if(alpha > max_strain) {
1953 *
return A + B *
std::pow(max_strain, n);
1955 *
if(alpha >= eps) {
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;
1969 *
return 1.0 +
C * slope * sqrt2thirds *
gamma *
gamma;
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));
1977 *
return 0.0 + softening_threshold;
1980 *
return 1.0 + softening_threshold;
1983 *
Number get_elastoplastic_factor_tangent(
const Number alpha)
const {
1984 *
if(alpha > max_strain) {
1987 *
if(alpha >= eps) {
1988 *
return B * n *
std::pow(alpha, n-1.0);
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;
2001 *
return 2 *
C * slope *
gamma;
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);
2016 *
void get_small_hardening_fit(Number &slope, Number &intercept,
const Number time_increment)
const {
2019 * the
log factor is annoying when below 1.0. Replace it by a parabula till it behaves.
2023 *
intercept = exp_one_half/(sqrt2thirds * log_factor);
2024 *
slope = 1./(2*intercept*intercept*sqrt2thirds);
2027 *
Number get_Carreau_viscocity(Number strain_rate, Number sigma_0_theta)
const {
2028 *
if(sigma_0_theta <= 0) {
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;
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;
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);
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;
2063 *
const Number melting_temperature;
2064 *
const Number reference_strain_rate;
2067 *
const Number sqrt2thirds;
2068 *
const Number exp_one_half;
2071 *
const Number softening_threshold = 0.0;
2072 *
const Number viscosity_regularization_factor = 0;
2073 *
const Number max_strain = std::numeric_limits<Number>::max();
2077 * Carreau fluid parameters
2080 *
const bool use_Carreau_viscous_law =
false;
2081 *
const Number epsilon_dot_0 = 1;
2083 *
const Number mu_0 = 1e18;
2084 *
const Number mu_infty = 1
e-4;
2093<a name=
"ann-src/LBCSystem.h"></a>
2094<h1>Annotated version of src/LBCSystem.h</h1>
2107 *
#ifndef LBCSYSTEM_H_
2108 *
#define LBCSYSTEM_H_
2110 *
#include <deal.II/base/function.h>
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"
2120 *
using namespace dealii;
2125 *
template <
int dim,
typename Number=
double,
int components=dim>
2128 *
LBCSystem(): zero_function(components){}
2130 *
for(
auto increment_interpolation_handler: increment_interpolation_handlers) {
2131 *
delete increment_interpolation_handler;
2133 *
for(
auto initial_velocity_interpolation_handler: initial_velocity_interpolation_handlers) {
2134 *
delete initial_velocity_interpolation_handler;
2136 *
for(
auto initial_deformation_interpolation_handler: initial_deformation_interpolation_handlers) {
2137 *
delete initial_deformation_interpolation_handler;
2139 *
for(
auto boundary_unidirectional_penalty_spec: boundary_unidirectional_penalty_specs) {
2140 *
delete boundary_unidirectional_penalty_spec;
2144 *
void apply_constraints(DoFSystem<dim, Number> &dof_system)
const;
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;
2158 *
ZeroFunction<dim, Number> zero_function;
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);
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);
2179 *
dof_system.nodal_constraints.close();
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;
2188 *
for(
auto initial_velocity_interpolation_handler: initial_velocity_interpolation_handlers) {
2189 *
delete initial_velocity_interpolation_handler;
2191 *
for(
auto initial_deformation_interpolation_handler: initial_deformation_interpolation_handlers) {
2192 *
delete initial_deformation_interpolation_handler;
2194 *
for(
auto boundary_unidirectional_penalty_spec: boundary_unidirectional_penalty_specs) {
2195 *
delete boundary_unidirectional_penalty_spec;
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();
2217<a name=
"ann-src/Material.h"></a>
2218<h1>Annotated version of src/
Material.h</h1>
2231 *
#ifndef MATERIAL_H_
2232 *
#define MATERIAL_H_
2234 *
using namespace dealii;
2236 *
#include
"ConstitutiveModelRequest.h"
2237 *
#include <stdexcept>
2241 *
typedef size_t point_index_t;
2243 *
template <
int dim,
typename Number =
double>
2246 *
virtual ~Material() = 0;
2248 *
virtual void compute_constitutive_request(
2249 *
ConstitutiveModelRequest <dim, Number> &constitutive_request,
2250 *
const point_index_t &point_index) = 0;
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;
2255 *
virtual void setup_point_history(
const point_index_t point_count) = 0;
2257 *
virtual std::vector<Number> get_state_parameters(
2258 *
const point_index_t &point_index,
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;
2269 *
template <
int dim,
typename Number>
2270 *
inline Material<dim, Number>::~Material() {
2273 *
class MaterialDomainException:
public std::runtime_error {
2275 *
MaterialDomainException();
2276 *
MaterialDomainException(std::string s): std::runtime_error(s) {};
2285<a name=
"ann-src/MixedFEProjector.h"></a>
2286<h1>Annotated version of src/MixedFEProjector.h</h1>
2299 *
#ifndef MIXEDFEPROJECTOR_H_
2300 *
#define MIXEDFEPROJECTOR_H_
2304 *
#include <deal.II/base/tensor.h>
2305 *
#include <deal.II/fe/fe_values.h>
2307 *
#include <deal.II/lac/vector.h>
2309 *
#include
"utilities.h"
2311 *
template <
int dim,
typename Number =
double>
2312 *
class MixedFEProjector {
2314 *
MixedFEProjector();
2316 *
const unsigned int mixed_dofs_per_cell,
2317 *
const ::FEValues<dim> &mixed_fe_values);
2318 *
virtual ~MixedFEProjector();
2320 *
template <
typename T>
2322 *
std::vector<T> *coefficients_of_mixed_dofs,
2323 *
const std::vector<T> &values_at_q_points)
const;
2327 *
unsigned int mixed_dofs_per_cell;
2328 *
std::vector<std::vector<Number > > M_inv_ksi;
2331 *
template <
int dim,
typename Number>
2332 *
MixedFEProjector<dim, Number>::MixedFEProjector():
2334 *
mixed_dofs_per_cell(0),
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);
2351 *
for (
unsigned int q_point = 0; q_point <
n_q_points;
2355 * Prep to compute mixed primary variables (Simo & Miehe 1992)
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);
2364 *
ksi.at(q_point)[i] = i_value * mixed_fe_values.quadrature_point(q_point)[0] * mixed_fe_values.JxW(q_point);
2368 *
M_inv.invert(M_matrix);
2370 *
for (
unsigned int q_point = 0; q_point <
n_q_points;
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);
2379 *
template <
int dim,
typename Number>
2380 *
MixedFEProjector<dim, Number>::~MixedFEProjector() {}
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];
2398<a name=
"ann-src/NewtonStepSystem.h"></a>
2399<h1>Annotated version of src/NewtonStepSystem.h</h1>
2412 *
#ifndef NEWTONSTEPSYSTEM_H_
2413 *
#define NEWTONSTEPSYSTEM_H_
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>
2420 *
#include
"DoFSystem.h"
2421 *
#include
"Constants.h"
2423 *
using namespace dealii;
2427 *
class NewtonStepSystem {
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);
2437 *
dof_system.dof_handler, sparsity_pattern,
2438 *
dof_system.nodal_constraints,
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);
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);
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);
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);
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);
2490 *
dof_system.dof_handler, sparsity_pattern,
2491 *
dof_system.nodal_constraints,
2495 *
sparsity_pattern.compress();
2496 *
Newton_step_matrix.reinit(sparsity_pattern);
2499 *
void advance_time(
double delta_t,
double rho_infty,
const bool reset_increment=
true) {
2501 *
double alpha_m, alpha_f,
gamma, beta;
2502 *
get_generalized_alpha_method_params(
2503 *
&alpha_m, &alpha_f, &gamma, &beta, rho_infty);
2505 *
_locally_owned_previous_time_derivative = previous_time_derivative;
2506 *
_locally_owned_previous_second_time_derivative = previous_second_time_derivative;
2508 *
const TrilinosWrappers::MPI::Vector previous_second_time_derivative_backup(_locally_owned_previous_second_time_derivative);
2510 *
_locally_owned_previous_second_time_derivative = current_increment;
2511 *
_locally_owned_previous_second_time_derivative.add(
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,
2521 *
_locally_owned_previous_second_time_derivative);
2524 *
previous_time_derivative = _locally_owned_previous_time_derivative;
2525 *
previous_second_time_derivative = _locally_owned_previous_second_time_derivative;
2531 * Update the deformation vector with the computed increment.
2534 *
add_current_increment_to_previous_deformation();
2536 *
if(reset_increment) {
2537 *
current_increment = 0;
2543 * Add the current Newton increment into the deformation vector, i.e.
2544 * compute previous_deformation += current_increment.
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.
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;
2565 * Set the deformation vector to the
negative of the current increment,
2566 * i.e. compute previous_deformation = -current_increment.
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.
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;
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;
2587 *
TrilinosWrappers::MPI::Vector previous_time_derivative;
2588 *
TrilinosWrappers::MPI::Vector previous_second_time_derivative;
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;
2602<a name=
"ann-src/PlasticityLabProg.cpp"></a>
2603<h1>Annotated version of src/PlasticityLabProg.cpp</h1>
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>
2625 *
#include <deal.II/lac/affine_constraints.h>
2627 *
#include
"TimeRateUpdateFlags.h"
2628 *
#include
"TimeRateRequest.h"
2630 *
#include
"PlasticityLabProg.h"
2631 *
#include
"PlasticityLabProgDrivers.cpp"
2633 *
#include
"ReferencePoint.h"
2634 *
#include
"RemappedPoint.h"
2636 *
using namespace dealii;
2640 *
template <
int dim,
typename Number>
2641 *
PlasticityLabProg<dim, Number>::PlasticityLabProg(
2642 *
Material<dim+1, Number> &material) :
2647 *
mech_fe(FE_Q<dim>(order), dim, FE_Q<dim>(order), 1),
2649 *
mixed_var_fe(order-1),
2650 *
mesh_motion_fe(FE_Q<dim>(order), dim),
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) { }
2662 *
template <
int dim,
typename Number>
2663 *
PlasticityLabProg<dim, Number>::~PlasticityLabProg() {
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();
2684 *
template <
int dim,
typename Number>
2685 *
void PlasticityLabProg<dim, Number>::setup_material_area_factors(
2686 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
2692 *
face_quadrature_formula,
2694 *
const unsigned int n_face_q_points = face_quadrature_formula.size();
2696 *
for (
auto cell = mesh_motion_dof_system.dof_handler.begin_active();
2697 *
cell != mesh_motion_dof_system.dof_handler.end();
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)) {
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 =
2708 *
+ face * n_face_q_points
2710 *
material_area_factors[surface_point_key] = postprocess_tensor_dimension(
fe_face_values.normal_vector(q_point), 0);
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,
2727 *
face_quadrature_formula,
2730 *
const unsigned int n_face_q_points = face_quadrature_formula.size();
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);
2737 *
for (
auto cell = mesh_motion_dof_system.dof_handler.begin_active();
2738 *
cell != mesh_motion_dof_system.dof_handler.end();
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)) {
2746 *
mesh_motion_nonlinear_system.current_increment,
2747 *
mesh_motion_gradient_increments);
2750 *
mesh_motion_nonlinear_system.current_increment,
2751 *
mesh_motion_value_increments);
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 =
2757 *
+ face * n_face_q_points
2760 *
const auto mesh_motion_gradient = get_deformation_gradient(
2761 *
-mesh_motion_gradient_increments[q_point],
2762 *
-mesh_motion_value_increments[q_point][0]
2765 *
material_area_factors[surface_point_key] =
std::pow(
determinant(mesh_motion_gradient), -1)
2767 *
* material_area_factors[surface_point_key];
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,
2786 *
quadrature_formula,
2789 *
const unsigned int num_cells = triangulation.n_active_cells(),
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,
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,
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;
2822 *
quadrature_formula,
2828 *
quadrature_formula,
2833 *
mixed_fe_dof_system.dof_handler.get_fe(),
2834 *
quadrature_formula,
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);
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);
2845 *
const unsigned int material_parameter_count = material.get_material_parameter_count();
2850 *
std::vector<ReferencePoint<dim, Number>> reference_points;
2851 *
std::vector<Point<dim, Number>> remapped_point_positions;
2853 *
for (
auto cell = mesh_motion_dof_system.dof_handler.begin_active();
2854 *
cell != mesh_motion_dof_system.dof_handler.end();
2856 *
if (cell->is_locally_owned()) {
2857 *
mesh_motion_fe_values.reinit(cell);
2859 *
mesh_motion_fe_values[displacements].get_function_values(
2860 *
mesh_motion_nonlinear_system.current_increment,
2861 *
mesh_motion_value_increments);
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];
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;
2874 *
reference_points.push_back(reference_point);
2875 *
remapped_point_positions.push_back(remapped_point_position);
2882 *
MPI_Barrier(mpi_communicator);
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);
2895 *
&num_reference_points,
2897 *
&reference_point_counts[0],
2899 *
mpi_communicator);
2900 *
MPI_Comm_rank(mpi_communicator, &this_process);
2901 *
displs.resize(nprocesses);
2903 *
for (
int i = 1; i < nprocesses; ++i) {
2904 *
displs[i] = displs[i - 1] + reference_point_counts[i - 1];
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);
2913 *
&remapped_point_positions[0],
2914 *
num_reference_points,
2916 *
&received_remapped_positions[0],
2917 *
&reference_point_counts[0],
2920 *
mpi_communicator);
2922 *
MPI_Barrier(mpi_communicator);
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];
2928 *
mesh_motion_dof_system.dof_handler,
2930 *
auto cell = cell_and_point.first;
2931 *
auto unit_cell_point = cell_and_point.second;
2934 * here, we
're assuming that `find_active_cell_around_point` returns the same
2935 * cell and point when called with different dof_handlers
2938 * auto mechanical_cell_and_point = GridTools::find_active_cell_around_point(
2940 * mechanical_dof_system.dof_handler,
2942 * auto mechanical_cell = mechanical_cell_and_point.first;
2943 * auto mixed_fe_cell_and_point = GridTools::find_active_cell_around_point(
2945 * mixed_fe_dof_system.dof_handler,
2947 * auto mixed_fe_cell = mixed_fe_cell_and_point.first;
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;
2957 * MPI_Barrier(mpi_communicator);
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)
2963 * &this_process_owns_remapped_point[displs[process]],
2964 * reference_point_counts[process],
2966 * &remapped_point_candidates[0],
2967 * reference_point_counts[process],
2970 * mpi_communicator);
2973 * std::vector<unsigned int> remapped_point_owning_process(num_reference_points);
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;
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;
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
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;
3003 *
MPI_Barrier(mpi_communicator);
3005 *
for (
int process = 0; process < nprocesses; ++process) {
3006 *
if (reference_point_counts[process] > 0) {
3008 *
&remote_remapped_point_is_accepted[0],
3009 *
reference_point_counts[process],
3011 *
&local_remapped_point_is_accepted[displs[process]],
3012 *
reference_point_counts[process],
3015 *
mpi_communicator);
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];
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];
3033 *
MPI_Barrier(mpi_communicator);
3035 *
std::vector<unsigned int> mapping_remote_remapped_point_counts(nprocesses);
3036 *
for (
int i = 0; i < nprocesses; ++i) {
3038 *
&mapping_remote_reference_point_counts[0],
3040 *
&mapping_remote_remapped_point_counts[i],
3042 *
i, mpi_communicator);
3046 *
std::vector<std::vector<Number> > local_state_parameter_groups(nprocesses);
3047 *
std::vector<std::vector<Number> > remote_state_parameter_groups(nprocesses);
3049 *
std::vector<std::vector<Number> > local_deformation_gradient_groups(nprocesses);
3050 *
std::vector<std::vector<Number> > remote_deformation_gradient_groups(nprocesses);
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));
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));
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);
3071 *
remapped_point_quadrature,
3077 *
remapped_point_quadrature,
3082 *
mixed_fe_dof_system.dof_handler.get_fe(),
3083 *
remapped_point_quadrature,
3086 *
remapped_point_fe_values.reinit(remapped_point.mesh_motion_cell);
3087 *
mesh_motion_fe_values.reinit(remapped_point.mesh_motion_cell);
3089 *
remapped_point_mechanical_fe_values.reinit(remapped_point.field_cell);
3090 *
mechanical_fe_values.reinit(remapped_point.field_cell);
3092 *
remapped_point_mixed_fe_values.reinit(remapped_point.mixed_fe_cell);
3094 *
mesh_motion_fe_values[displacements].get_function_gradients(
3095 *
mesh_motion_nonlinear_system.current_increment,
3096 *
mesh_motion_gradient_increments);
3098 *
mesh_motion_fe_values[displacements].get_function_values(
3099 *
mesh_motion_nonlinear_system.current_increment,
3100 *
mesh_motion_value_increments);
3102 *
mechanical_fe_values[displacements].get_function_gradients(
3103 *
mechanical_nonlinear_system.previous_deformation,
3104 *
previous_deformation_gradients);
3106 *
mechanical_fe_values[displacements].get_function_values(
3107 *
mechanical_nonlinear_system.previous_deformation,
3108 *
previous_deformation_values);
3110 *
remapped_point_mechanical_fe_values[displacements].get_function_gradients(
3111 *
mechanical_nonlinear_system.previous_deformation,
3112 *
previous_deformation_gradient_at_remapped_point);
3114 *
remapped_point_mechanical_fe_values[displacements].get_function_values(
3115 *
mechanical_nonlinear_system.previous_deformation,
3116 *
previous_deformation_value_at_remapped_point);
3118 *
std::vector< std::vector<Number> > material_parameters_at_q_points(
3119 *
material_parameter_count,
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;
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]);
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];
3137 *
std::vector<std::vector<Number> > projected_material_parameters_coefficients(
3138 *
material_parameter_count,
3139 *
std::vector<Number>(mixed_dofs_per_cell));
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]);
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);
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];
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];
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]);
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];
3177 *
++next_to_process.at(group);
3182 *
enum MessageFlag {
3183 *
MATERIAL_STATE_PARAMETER,
3184 *
REMAPPED_DEFORMATION_GRADIENT
3187 *
const unsigned int
3188 *
material_state_parameter_requests_offset = 0,
3189 *
remapped_deformation_gradient_requests_offset = 1,
3190 *
request_array_size = 2;
3192 *
std::vector<MPI_Request> requests_vector(2 * nprocesses * request_array_size);
3194 *
for (
int i = 0; i < nprocesses; ++i) {
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,
3200 *
&requests_vector[i + nprocesses * material_state_parameter_requests_offset]);
3203 *
for (
int i = 0; i < nprocesses; ++i) {
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,
3209 *
&requests_vector[i + nprocesses * remapped_deformation_gradient_requests_offset]);
3212 *
for (
int i = 0; i < nprocesses; ++i) {
3213 *
const unsigned int row_start = i + nprocesses * request_array_size;
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,
3220 *
&requests_vector[row_start + nprocesses * material_state_parameter_requests_offset]);
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,
3227 *
&requests_vector[row_start + nprocesses * remapped_deformation_gradient_requests_offset]);
3231 *
std::vector<MPI_Status> statuses_vector(2 * request_array_size * nprocesses);
3233 *
2 * request_array_size * nprocesses,
3234 *
&requests_vector[0],
3235 *
&statuses_vector[0]);
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);
3242 *
ReferencePoint<dim, Number> &reference_point = reference_points[i];
3244 *
mesh_motion_fe_values.reinit(reference_point.mesh_motion_cell);
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);
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);
3259 *
mesh_motion_fe_values[displacements].get_function_gradients(
3260 *
mesh_motion_nonlinear_system.current_increment,
3261 *
mesh_motion_gradient_increments);
3263 *
mesh_motion_fe_values[displacements].get_function_values(
3264 *
mesh_motion_nonlinear_system.current_increment,
3265 *
mesh_motion_value_increments);
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]);
3271 *
const point_index_t quadrature_point_index = reference_point.mesh_motion_cell->user_index() + reference_point.q_point;
3273 *
remapped_deformation_gradients[quadrature_point_index] = previous_deformation_gradient;
3275 *
++next_to_process.at(group);
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) {
3288 *
const Quadrature<dim> thermal_fe_support_point_quadrature(therm_fe.get_unit_support_points());
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;
3297 *
thermal_fe_support_point_quadrature,
3303 *
thermal_fe_support_point_quadrature,
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);
3313 *
std::vector<ReferencePoint<dim, Number>> reference_points;
3314 *
std::vector<Point<dim, Number>> remapped_point_positions;
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);
3322 *
mesh_motion_fe_values[displacements].get_function_values(
3323 *
mesh_motion_nonlinear_system.current_increment,
3324 *
mesh_motion_value_increments);
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];
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;
3337 *
reference_points.push_back(reference_point);
3338 *
remapped_point_positions.push_back(remapped_point_position);
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);
3356 *
&num_reference_points,
3358 *
&reference_point_counts[0],
3360 *
mpi_communicator);
3361 *
MPI_Comm_rank(mpi_communicator, &this_process);
3362 *
displs.resize(nprocesses);
3364 *
for (
int i = 1; i < nprocesses; ++i) {
3365 *
displs[i] = displs[i - 1] + reference_point_counts[i - 1];
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);
3375 *
&remapped_point_positions[0],
3376 *
num_reference_points,
3378 *
&received_remapped_positions[0],
3379 *
&reference_point_counts[0],
3382 *
mpi_communicator);
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];
3389 *
thermal_dof_system.dof_handler,
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;
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)
3403 *
&this_process_owns_thermal_point[displs[process]],
3404 *
reference_point_counts[process],
3406 *
&thermal_point_candidates[0],
3407 *
reference_point_counts[process],
3410 *
mpi_communicator);
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;
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;
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
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;
3442 * for (int process = 0; process < nprocesses; ++process) {
3443 * if (reference_point_counts[process] > 0) {
3445 * &remote_thermal_point_is_accepted[0],
3446 * reference_point_counts[process],
3448 * &local_thermal_point_is_accepted[displs[process]],
3449 * reference_point_counts[process],
3452 * mpi_communicator);
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];
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];
3470 * MPI_Barrier(mpi_communicator);
3472 * std::vector<unsigned int> thermal_remote_remapped_point_counts(nprocesses);
3473 * for (int i = 0; i < nprocesses; ++i) {
3475 * &thermal_remote_reference_point_counts[0],
3477 * &thermal_remote_remapped_point_counts[i],
3479 * i, mpi_communicator);
3485 * std::vector<std::vector<Number> > local_previous_temperature_groups(nprocesses);
3486 * std::vector<std::vector<Number> > remote_previous_temperature_groups(nprocesses);
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));
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);
3498 * Quadrature<dim> thermal_point_quadrature(
3499 * std::vector<Point<dim, Number>> (1, thermal_point.unit_cell_point));
3501 * FEValues<dim> thermal_point_fe_values(
3504 * thermal_point_quadrature,
3507 * thermal_point_fe_values.reinit(thermal_point.field_cell);
3509 * thermal_point_fe_values[temperature].get_function_values(
3510 * thermal_nonlinear_system.previous_deformation,
3511 * previous_temperatures);
3513 * local_previous_temperature_groups.at(group).at(next_to_process.at(group)) = previous_temperatures[0];
3515 * ++next_to_process.at(group);
3520 * enum MessageFlag {
3521 * PREVIOUS_TEMPERATURE
3524 * const unsigned int
3525 * previous_temperature_requests_offset = 0,
3526 * request_array_size = 1;
3528 * std::vector<MPI_Request> requests_vector(2 * nprocesses * request_array_size);
3530 * for (int i = 0; i < nprocesses; ++i) {
3532 * local_previous_temperature_groups.at(i).data(),
3533 * thermal_remote_reference_point_counts.at(i),
3534 * MPI_DOUBLE, i, PREVIOUS_TEMPERATURE,
3536 * &requests_vector[i + nprocesses * previous_temperature_requests_offset]);
3539 * for (int i = 0; i < nprocesses; ++i) {
3540 * const unsigned int row_start = i + nprocesses * request_array_size;
3543 * remote_previous_temperature_groups.at(i).data(),
3544 * thermal_remote_remapped_point_counts.at(i),
3545 * MPI_DOUBLE, i, PREVIOUS_TEMPERATURE,
3547 * &requests_vector[row_start + nprocesses * previous_temperature_requests_offset]);
3551 * std::vector<MPI_Status> statuses_vector(2 * request_array_size * nprocesses);
3553 * 2 * request_array_size * nprocesses,
3554 * &requests_vector[0],
3555 * &statuses_vector[0]);
3557 * TrilinosWrappers::SparsityPattern sparsity_pattern(
3558 * thermal_dof_system.locally_owned_dofs,
3559 * mpi_communicator);
3561 * DoFTools::make_sparsity_pattern(
3562 * thermal_dof_system.dof_handler, sparsity_pattern,
3563 * AffineConstraints<Number>(),
3565 * Utilities::MPI::this_mpi_process(mpi_communicator));
3566 * sparsity_pattern.compress();
3568 * TrilinosWrappers::SparseMatrix projection_matrix(sparsity_pattern);
3569 * TrilinosWrappers::MPI::Vector projection_residual(thermal_dof_system.locally_owned_dofs, mpi_communicator);
3571 * projection_matrix = 0;
3572 * projection_residual = 0;
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);
3584 * cell_residual = 0;
3586 * ReferencePoint<dim, Number> &reference_point = reference_points[i];
3588 * thermal_fe_values.reinit(reference_point.field_cell);
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);
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);
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));
3612 * ++next_to_process.at(group);
3615 * projection_matrix.compress(
3616 * VectorOperation::add);
3617 * projection_residual.compress(
3618 * VectorOperation::add);
3622 * solve the thermal projection system
3625 * TrilinosWrappers::PreconditionAMG preconditioner;
3627 * #if DEAL_II_VERSION_GTE(9,7,0)
3628 * const std::vector<std::vector<bool> > constant_modes
3629 * = DoFTools::extract_constant_modes(thermal_dof_system.dof_handler,
3632 * std::vector<std::vector<bool> > constant_modes;
3633 * DoFTools::extract_constant_modes(thermal_dof_system.dof_handler, ComponentMask(), constant_modes);
3636 * TrilinosWrappers::PreconditionAMG::AdditionalData additional_data;
3637 * additional_data.constant_modes = constant_modes;
3638 * additional_data.elliptic = true;
3639 * additional_data.n_cycles = 1;
3640 * additional_data.w_cycle = false;
3641 * additional_data.output_details = false;
3642 * additional_data.smoother_sweeps = 2;
3643 * additional_data.aggregation_threshold = 1e-2;
3644 * preconditioner.initialize(projection_matrix, additional_data);
3646 * TrilinosWrappers::MPI::Vector tmp(thermal_dof_system.locally_owned_dofs, mpi_communicator);
3647 * const Number relative_accuracy = 1e-08;
3648 * const Number solver_tolerance = relative_accuracy
3649 * * projection_matrix.residual(tmp, thermal_nonlinear_system.Newton_step_solution,
3650 * projection_residual);
3651 * SolverControl solver_control(projection_matrix.m(),
3652 * solver_tolerance);
3654 * SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
3656 * thermal_nonlinear_system.Newton_step_solution = 0;
3658 * solver.solve(projection_matrix, thermal_nonlinear_system.Newton_step_solution,
3659 * projection_residual, preconditioner);
3661 * thermal_nonlinear_system.previous_deformation = thermal_nonlinear_system.Newton_step_solution;
3668 * template<int dim, typename Number>
3669 * void PlasticityLabProg<dim, Number>::remap_mechanical_fields(
3670 * NewtonStepSystem &mechanical_nonlinear_system,
3671 * const DoFSystem<dim, Number> &mechanical_dof_system,
3672 * const NewtonStepSystem &mesh_motion_nonlinear_system,
3673 * const DoFSystem<dim, Number> &mesh_motion_dof_system) {
3675 * const Quadrature<dim> mechanical_fe_support_point_quadrature(mech_fe.base_element(0).get_unit_support_points());
3677 * const unsigned int n_q_points = mechanical_fe_support_point_quadrature.size();
3678 * [[maybe_unused]] const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
3679 * const unsigned int mechanical_dofs_per_cell = mech_fe.dofs_per_cell;
3681 * FEValues<dim> mesh_motion_fe_values(
3684 * mechanical_fe_support_point_quadrature,
3685 * update_values | update_quadrature_points);
3687 * FEValues<dim> mechanical_fe_values(
3690 * mechanical_fe_support_point_quadrature,
3691 * update_values | update_quadrature_points);
3693 * std::vector< Tensor<1, dim, Number> > previous_remapped_deformations(1);
3694 * std::vector< Tensor<1, dim, Number> > previous_remapped_velocity(1);
3695 * std::vector< Tensor<1, dim, Number> > previous_remapped_second_time_rate(1);
3696 * std::vector< Number > previous_remapped_twist_deformations(1);
3697 * std::vector< Number > previous_remapped_twist_velocity(1);
3698 * std::vector< Number > previous_remapped_twist_second_time_rate(1);
3699 * std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
3700 * std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
3702 * const FEValuesExtractors::Vector displacements(0);
3703 * const FEValuesExtractors::Scalar angular_velocities(dim);
3705 * std::vector<ReferencePoint<dim, Number>> reference_points;
3706 * std::vector<Point<dim, Number>> remapped_point_positions;
3707 * std::unordered_map<point_index_t, unsigned int> quadrature_point_reference_point_id;
3708 * auto cell = mesh_motion_dof_system.dof_handler.begin_active();
3709 * auto mechanical_cell = mechanical_dof_system.dof_handler.begin_active();
3710 * for (; cell != mesh_motion_dof_system.dof_handler.end(); ++cell, ++mechanical_cell) {
3711 * if (cell->is_locally_owned()) {
3712 * mesh_motion_fe_values.reinit(cell);
3714 * mesh_motion_fe_values[displacements].get_function_values(
3715 * mesh_motion_nonlinear_system.current_increment,
3716 * mesh_motion_value_increments);
3718 * for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
3719 * const Point<dim, Number> reference_point_position = mesh_motion_fe_values.quadrature_point(q_point);
3720 * const Point<dim, Number> remapped_point_position = reference_point_position - mesh_motion_value_increments[q_point];
3722 * ReferencePoint<dim, Number> reference_point;
3723 * reference_point.mesh_motion_cell = cell;
3724 * reference_point.field_cell = mechanical_cell;
3725 * reference_point.q_point = q_point;
3726 * reference_point.reference_point = reference_point_position;
3727 * reference_point.remapped_point = remapped_point_position;
3729 * reference_points.push_back(reference_point);
3730 * remapped_point_positions.push_back(remapped_point_position);
3732 * const point_index_t quadrature_point_index = cell->user_index() + q_point;
3733 * quadrature_point_reference_point_id[quadrature_point_index] = reference_points.size() - 1;
3740 * MPI_Datatype PointType;
3741 * MPI_Type_contiguous(dim, MPI_DOUBLE, &PointType);
3742 * MPI_Type_commit(&PointType);
3743 * std::vector<int> displs;
3744 * std::vector< Point<dim, Number>> received_remapped_positions;
3745 * std::vector<RemappedPoint<dim, Number>> remapped_points;
3746 * int nprocesses, this_process;
3747 * int num_reference_points = reference_points.size();
3748 * MPI_Comm_size(mpi_communicator, &nprocesses);
3749 * std::vector<int> reference_point_counts(nprocesses);
3751 * &num_reference_points,
3753 * &reference_point_counts[0],
3755 * mpi_communicator);
3756 * MPI_Comm_rank(mpi_communicator, &this_process);
3757 * displs.resize(nprocesses);
3759 * for (int i = 1; i < nprocesses; ++i) {
3760 * displs[i] = displs[i - 1] + reference_point_counts[i - 1];
3763 * const unsigned int count_received_reference_points = displs[nprocesses - 1] + reference_point_counts[nprocesses - 1];
3764 * received_remapped_positions.resize(count_received_reference_points);
3765 * remapped_points.resize(count_received_reference_points);
3766 * std::vector<char> this_process_owns_remapped_point(count_received_reference_points);
3769 * &remapped_point_positions[0],
3770 * num_reference_points,
3772 * &received_remapped_positions[0],
3773 * &reference_point_counts[0],
3776 * mpi_communicator);
3779 * for(unsigned int received_point_id=0; received_point_id < count_received_reference_points; received_point_id++) {
3780 * auto point = received_remapped_positions[received_point_id];
3781 * auto remapped_cell_and_point = GridTools::find_active_cell_around_point(
3783 * mechanical_dof_system.dof_handler,
3785 * auto mechanical_cell = remapped_cell_and_point.first;
3786 * auto mechanical_unit_cell_point = remapped_cell_and_point.second;
3787 * remapped_points[received_point_id].field_cell = mechanical_cell;
3788 * remapped_points[received_point_id].unit_cell_point = mechanical_unit_cell_point;
3789 * remapped_points[received_point_id].remapped_point = point;
3790 * this_process_owns_remapped_point[received_point_id] = mechanical_cell.state() == IteratorState::valid && mechanical_cell->is_locally_owned()? 1 : 0;
3793 * std::vector<char> remapped_point_candidates(num_reference_points * nprocesses);
3794 * for (int process = 0; process < nprocesses; ++process) {
3795 * if (reference_point_counts[process] > 0)
3797 * &this_process_owns_remapped_point[displs[process]],
3798 * reference_point_counts[process],
3800 * &remapped_point_candidates[0],
3801 * reference_point_counts[process],
3804 * mpi_communicator);
3807 * std::vector<unsigned int> remapped_point_owning_process(num_reference_points);
3808 * for (int i = 0; i < num_reference_points; ++i) {
3809 * remapped_point_owning_process[i] = 0;
3810 * for (int j = 1; j < nprocesses; ++j) {
3811 * if (remapped_point_candidates[j * num_reference_points + i] == 1) {
3812 * remapped_point_owning_process[i] = j;
3818 * std::vector<RemappedPoint<dim, Number>> mapping_remapped_points;
3819 * std::vector<unsigned int> reference_point_owning_process;
3820 * std::vector<unsigned int> reference_point_index_at_remote_process;
3824 * This should really be a vector<bool>, but addresses of individual elements of
3825 * vector<bool> cannot be taken. It's a
template specialization to
save space
3828 *
std::vector<char> remote_remapped_point_is_accepted(num_reference_points * nprocesses);
3829 *
std::vector<char> local_remapped_point_is_accepted(count_received_reference_points);
3830 *
for (
int i = 0; i < num_reference_points; ++i) {
3831 *
for (
unsigned int j = 0; j < static_cast<unsigned int>(nprocesses); ++j) {
3832 *
remote_remapped_point_is_accepted[j * num_reference_points + i] = (remapped_point_owning_process[i] == j) ? 1 : 0;
3836 *
for (
int process = 0; process < nprocesses; ++process) {
3837 *
if (reference_point_counts[process] > 0) {
3839 *
&remote_remapped_point_is_accepted[0],
3840 *
reference_point_counts[process],
3842 *
&local_remapped_point_is_accepted[displs[process]],
3843 *
reference_point_counts[process],
3846 *
mpi_communicator);
3850 *
std::vector<unsigned int> remote_reference_point_counts(nprocesses, 0);
3851 *
for (
int process = 0; process < nprocesses; ++process) {
3852 *
for (
int i = 0; i < reference_point_counts[process]; ++i) {
3853 *
if (local_remapped_point_is_accepted[displs[process] + i]) {
3854 *
RemappedPoint<dim, Number> accepted_remapped_point = remapped_points[displs[process] + i];
3856 *
mapping_remapped_points.push_back(accepted_remapped_point);
3857 *
reference_point_owning_process.push_back(process);
3858 *
reference_point_index_at_remote_process.push_back(i);
3859 *
++remote_reference_point_counts[process];
3864 *
MPI_Barrier(mpi_communicator);
3866 *
std::vector<unsigned int> remote_remapped_point_counts(nprocesses);
3867 *
for (
int i = 0; i < nprocesses; ++i) {
3869 *
&remote_reference_point_counts[0],
3871 *
&remote_remapped_point_counts[i],
3873 *
i, mpi_communicator);
3876 *
std::vector<std::vector<Number> > local_previous_deformation_groups(nprocesses);
3877 *
std::vector<std::vector<Number> > local_previous_velocity_groups(nprocesses);
3878 *
std::vector<std::vector<Number> > local_previous_second_time_rate_groups(nprocesses);
3879 *
std::vector<std::vector<Number> > remote_previous_deformation_groups(nprocesses);
3880 *
std::vector<std::vector<Number> > remote_previous_velocity_groups(nprocesses);
3881 *
std::vector<std::vector<Number> > remote_previous_second_time_rate_groups(nprocesses);
3883 *
for (
int i = 0; i < nprocesses; ++i) {
3884 *
local_previous_deformation_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3885 *
local_previous_velocity_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3886 *
local_previous_second_time_rate_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3887 *
remote_previous_deformation_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3888 *
remote_previous_velocity_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3889 *
remote_previous_second_time_rate_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3892 *
std::vector<unsigned int> next_to_process(nprocesses, 0);
3893 *
for (
unsigned int i = 0; i < mapping_remapped_points.size(); ++i) {
3894 *
const unsigned int group = reference_point_owning_process.at(i);
3895 *
const RemappedPoint<dim, Number> remapped_point = mapping_remapped_points.at(i);
3903 *
remapped_point_quadrature,
3906 *
remapped_point_fe_values.reinit(remapped_point.field_cell);
3908 *
remapped_point_fe_values[displacements].get_function_values(
3909 *
mechanical_nonlinear_system.previous_deformation,
3910 *
previous_remapped_deformations);
3912 *
remapped_point_fe_values[displacements].get_function_values(
3913 *
mechanical_nonlinear_system.previous_time_derivative,
3914 *
previous_remapped_velocity);
3916 *
remapped_point_fe_values[displacements].get_function_values(
3917 *
mechanical_nonlinear_system.previous_second_time_derivative,
3918 *
previous_remapped_second_time_rate);
3920 *
remapped_point_fe_values[angular_velocities].get_function_values(
3921 *
mechanical_nonlinear_system.previous_deformation,
3922 *
previous_remapped_twist_deformations);
3924 *
remapped_point_fe_values[angular_velocities].get_function_values(
3925 *
mechanical_nonlinear_system.previous_time_derivative,
3926 *
previous_remapped_twist_velocity);
3928 *
remapped_point_fe_values[angular_velocities].get_function_values(
3929 *
mechanical_nonlinear_system.previous_second_time_derivative,
3930 *
previous_remapped_twist_second_time_rate);
3932 *
for(
unsigned int dim_i=0; dim_i<dim; dim_i++) {
3933 *
local_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3934 *
previous_remapped_deformations[0][dim_i];
3935 *
local_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3936 *
previous_remapped_velocity[0][dim_i];
3937 *
local_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3938 *
previous_remapped_second_time_rate[0][dim_i];
3941 *
local_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3942 *
previous_remapped_twist_deformations[0];
3943 *
local_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3944 *
previous_remapped_twist_velocity[0];
3945 *
local_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3946 *
previous_remapped_twist_second_time_rate[0];
3948 *
++next_to_process.at(group);
3951 *
enum MessageFlag {
3952 *
PREVIOUS_DEFORMATION,
3953 *
PREVIOUS_VELOCITY,
3954 *
PREVIOUS_SECOND_TIME_RATE
3957 *
const unsigned int
3958 *
previous_deformation_requests_offset = 0,
3959 *
previous_velocity_requests_offset = 1,
3960 *
previous_second_time_rate_requests_offset = 2,
3961 *
request_array_size = 3;
3963 *
std::vector<MPI_Request> requests_vector(2 * nprocesses * request_array_size);
3965 *
for (
int i = 0; i < nprocesses; ++i) {
3967 *
local_previous_deformation_groups.at(i).data(),
3968 *
(dim+1) * remote_reference_point_counts.at(i),
3969 *
MPI_DOUBLE, i, PREVIOUS_DEFORMATION,
3971 *
&requests_vector[i + nprocesses * previous_deformation_requests_offset]);
3974 *
local_previous_velocity_groups.at(i).data(),
3975 *
(dim+1) * remote_reference_point_counts.at(i),
3976 *
MPI_DOUBLE, i, PREVIOUS_VELOCITY,
3978 *
&requests_vector[i + nprocesses * previous_velocity_requests_offset]);
3981 *
local_previous_second_time_rate_groups.at(i).data(),
3982 *
(dim+1) * remote_reference_point_counts.at(i),
3983 *
MPI_DOUBLE, i, PREVIOUS_SECOND_TIME_RATE,
3985 *
&requests_vector[i + nprocesses * previous_second_time_rate_requests_offset]);
3988 *
for (
int i = 0; i < nprocesses; ++i) {
3989 *
const unsigned int row_start = i + nprocesses * request_array_size;
3992 *
remote_previous_deformation_groups.at(i).data(),
3993 *
(dim+1) * remote_remapped_point_counts.at(i),
3994 *
MPI_DOUBLE, i, PREVIOUS_DEFORMATION,
3996 *
&requests_vector[row_start + nprocesses * previous_deformation_requests_offset]);
3999 *
remote_previous_velocity_groups.at(i).data(),
4000 *
(dim+1) * remote_remapped_point_counts.at(i),
4001 *
MPI_DOUBLE, i, PREVIOUS_VELOCITY,
4003 *
&requests_vector[row_start + nprocesses * previous_velocity_requests_offset]);
4006 *
remote_previous_second_time_rate_groups.at(i).data(),
4007 *
(dim+1) * remote_remapped_point_counts.at(i),
4008 *
MPI_DOUBLE, i, PREVIOUS_SECOND_TIME_RATE,
4010 *
&requests_vector[row_start + nprocesses * previous_second_time_rate_requests_offset]);
4014 *
std::vector<MPI_Status> statuses_vector(2 * request_array_size * nprocesses);
4016 *
2 * request_array_size * nprocesses,
4017 *
&requests_vector[0],
4018 *
&statuses_vector[0]);
4021 *
mechanical_dof_system.locally_owned_dofs,
4022 *
mpi_communicator);
4025 *
mechanical_dof_system.dof_handler, sparsity_pattern,
4029 *
sparsity_pattern.compress();
4037 *
projection_matrix = 0;
4038 *
projection_residual = 0;
4039 *
projection_velocity_residual = 0;
4040 *
projection_second_time_rate_residual = 0;
4044 *
Vector<Number> cell_velocity_residual(mechanical_dofs_per_cell);
4045 *
Vector<Number> cell_second_time_rate_residual(mechanical_dofs_per_cell);
4047 *
next_to_process.clear();
4048 *
next_to_process.resize(nprocesses, 0);
4049 *
for (
unsigned int i = 0; i < reference_points.size(); ++i) {
4050 *
unsigned int group = remapped_point_owning_process.at(i);
4054 *
cell_velocity_residual = 0;
4055 *
cell_second_time_rate_residual = 0;
4057 *
ReferencePoint<dim, Number> &reference_point = reference_points[i];
4059 *
mechanical_fe_values.reinit(reference_point.field_cell);
4065 *
for(
unsigned int dim_i=0; dim_i<dim; dim_i++) {
4066 *
remapped_previous_deformation[dim_i] =
4067 *
reference_point.remapped_point[dim_i]
4068 *
- reference_point.reference_point[dim_i]
4069 *
+ remote_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4070 *
remapped_previous_velocity[dim_i] = remote_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4071 *
remapped_previous_second_time_rate[dim_i] = remote_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4074 *
const Number remapped_previous_twist_deformation = remote_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4075 *
const Number remapped_previous_twist_velocity = remote_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4076 *
const Number remapped_previous_twist_second_time_rate = remote_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4078 *
for(
unsigned int dof_i=0; dof_i<mechanical_dofs_per_cell; dof_i++) {
4079 *
const auto shape_value_i = postprocess_tensor_dimension(
4080 *
mechanical_fe_values[displacements].
value(dof_i, reference_point.q_point),
4081 *
mechanical_fe_values[angular_velocities].value(dof_i, reference_point.q_point));
4084 *
shape_value_i * postprocess_tensor_dimension(remapped_previous_deformation, remapped_previous_twist_deformation);
4086 *
cell_velocity_residual(dof_i) +=
4087 *
shape_value_i * postprocess_tensor_dimension(remapped_previous_velocity, remapped_previous_twist_velocity);
4089 *
cell_second_time_rate_residual(dof_i) +=
4090 *
shape_value_i * postprocess_tensor_dimension(remapped_previous_second_time_rate, remapped_previous_twist_second_time_rate);
4092 *
for(
unsigned int dof_j=0; dof_j<mechanical_dofs_per_cell; dof_j++) {
4093 *
const auto shape_value_j = postprocess_tensor_dimension(
4094 *
mechanical_fe_values[displacements].
value(dof_j, reference_point.q_point),
4095 *
mechanical_fe_values[angular_velocities].value(dof_j, reference_point.q_point));
4097 *
cell_matrix(dof_i, dof_j) += shape_value_i * shape_value_j;
4102 *
std::vector<types::global_dof_index> local_dof_indices(mechanical_dofs_per_cell);
4103 *
reference_point.field_cell->get_dof_indices(local_dof_indices);
4104 *
projection_residual.add(local_dof_indices, cell_residual);
4105 *
projection_velocity_residual.add(local_dof_indices, cell_velocity_residual);
4106 *
projection_second_time_rate_residual.add(local_dof_indices, cell_second_time_rate_residual);
4107 *
for(
unsigned int dof_i=0; dof_i<mechanical_dofs_per_cell; dof_i++) {
4108 *
for(
unsigned int dof_j=0; dof_j<mechanical_dofs_per_cell; dof_j++) {
4109 *
projection_matrix.add(local_dof_indices[dof_i], local_dof_indices[dof_j],
cell_matrix(dof_i, dof_j));
4113 *
++next_to_process.at(group);
4123 * solve the projection system
4129 *
const std::vector<std::vector<bool> > constant_modes
4133 *
std::vector<std::vector<bool> > constant_modes;
4138 *
additional_data.constant_modes = constant_modes;
4139 *
additional_data.elliptic =
true;
4140 *
additional_data.n_cycles = 1;
4141 *
additional_data.w_cycle =
false;
4142 *
additional_data.output_details =
false;
4143 *
additional_data.smoother_sweeps = 2;
4144 *
additional_data.aggregation_threshold = 1
e-2;
4145 *
preconditioner.initialize(projection_matrix, additional_data);
4148 *
const Number relative_accuracy = 1
e-08;
4149 *
const Number solver_tolerance = relative_accuracy
4150 *
* projection_matrix.residual(tmp, projection_solution,
4151 *
projection_residual);
4153 *
solver_tolerance);
4157 *
projection_solution = 0;
4159 *
solver.solve(projection_matrix, projection_solution,
4160 *
projection_residual, preconditioner);
4162 *
mechanical_nonlinear_system.previous_deformation = projection_solution;
4164 *
projection_solution = 0;
4165 *
solver.solve(projection_matrix, projection_solution,
4166 *
projection_velocity_residual, preconditioner);
4167 *
mechanical_nonlinear_system.previous_time_derivative = projection_solution;
4169 *
projection_solution = 0;
4170 *
solver.solve(projection_matrix, projection_solution,
4171 *
projection_second_time_rate_residual, preconditioner);
4172 *
mechanical_nonlinear_system.previous_second_time_derivative = projection_solution;
4177 *
template <
int dim,
typename Number>
4178 *
void PlasticityLabProg<dim, Number>::assemble_mechanical_system(
4179 *
NewtonStepSystem &Newton_system,
4180 *
const DoFSystem<dim, Number> &mechanical_dof_system,
4181 *
const LBCSystem<dim, Number, dim+1> &mechanical_lbc_system,
4182 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
4183 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
4184 *
const NewtonStepSystem &thermal_Newton_system,
4185 *
const DoFSystem<dim, Number> &thermal_dof_system,
4186 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
4188 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
4189 *
const bool fill_system_matrix,
4190 *
const bool update_material_state) {
4194 *
quadrature_formula,
4200 *
face_quadrature_formula,
4206 *
quadrature_formula,
4212 *
quadrature_formula,
4218 *
quadrature_formula,
4222 *
const unsigned int n_q_points = quadrature_formula.size();
4223 *
const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
4224 *
const unsigned int n_face_q_points = face_quadrature_formula.size();
4226 *
std::vector< Tensor<2, dim, Number> > current_displacement_gradients(
n_q_points);
4227 *
std::vector< Tensor<2, dim, Number> > displacement_gradient_increments(
n_q_points);
4229 *
std::vector< Tensor<1, dim, Number> > current_displacement_values(
n_q_points);
4230 *
std::vector< Tensor<1, dim, Number> > displacement_value_increments(
n_q_points);
4232 *
std::vector< Tensor<2, dim, Number> > displacement_gradient_previous_time_rates(
n_q_points);
4233 *
std::vector< Tensor<2, dim, Number> > displacement_gradient_previous_second_time_rates(
n_q_points);
4235 *
std::vector< Tensor<1, dim, Number> > displacement_increments(
n_q_points);
4236 *
std::vector< Tensor<1, dim, Number> > displacement_previous_time_rates(
n_q_points);
4237 *
std::vector< Tensor<1, dim, Number> > displacement_previous_second_time_rates(
n_q_points);
4239 *
std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_increments(
n_q_points);
4240 *
std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_previous_time_rates(
n_q_points);
4241 *
std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_previous_second_time_rates(
n_q_points);
4243 *
std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(
n_q_points);
4244 *
std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(
n_q_points);
4246 *
std::vector< Number > angular_velocity_increments(
n_q_points);
4247 *
std::vector< Number > angular_velocity_previous_time_rates(
n_q_points);
4248 *
std::vector< Number > angular_velocity_previous_second_time_rates(
n_q_points);
4250 *
std::vector< Number > current_temperature_values(
n_q_points);
4251 *
std::vector< Number > updated_temperature_increments(
n_q_points);
4252 *
std::vector< Number > updated_temperature_values(
n_q_points);
4254 *
std::vector< Tensor<1, dim, Number> > face_displacement_value_increments(n_face_q_points);
4256 *
std::vector< Number > deformation_jacobians(
n_q_points);
4257 *
std::vector< Number > previous_deformation_jacobian(
n_q_points);
4258 *
std::vector< std::vector<Number> > strain_divergences(
4261 *
std::vector< std::vector<Number> > jacobian_tangents(
4265 *
std::vector< std::vector< std::vector < Number> > > strain_divergence_tangents(
4267 *
std::vector< std::vector< Number> >(
4271 *
std::vector<Number> projected_temperature_coefficients(mixed_dofs_per_cell);
4272 *
std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
4273 *
std::vector<Number> projected_previous_temperature_coefficients(mixed_dofs_per_cell);
4274 *
std::vector<Number> projected_previous_Jacobian_coefficients(mixed_dofs_per_cell);
4275 *
std::vector<std::vector<Number> > projected_strain_divergence_coefficients(
4277 *
std::vector<Number>(mixed_dofs_per_cell));
4278 *
std::vector<std::vector<Number> > projected_jacobian_tangent_coefficients(
4280 *
std::vector<Number>(mixed_dofs_per_cell));
4281 *
std::vector<std::vector<std::vector<Number> > > projected_strain_divergence_tangent_coefficients(
4284 *
std::vector<Number>(mixed_dofs_per_cell)));
4286 *
std::vector<Number> projected_strain_divergence(
dofs_per_cell);
4287 *
std::vector<Number> projected_jacobian_tangent(
dofs_per_cell);
4288 *
std::vector<std::vector<Number> > projected_strain_divergence_tangent(
4301 *
Newton_system.Newton_step_matrix = 0;
4302 *
Newton_system.Newton_step_residual = 0;
4304 *
double alpha_m, alpha_f,
gamma, beta;
4305 *
get_generalized_alpha_method_params(
4306 *
&alpha_m, &alpha_f, &gamma, &beta, rho_infty);
4311 *
bool kinematic_domains_are_valid =
true;
4313 *
auto cell = mechanical_dof_system.dof_handler.begin_active();
4314 *
auto endc = mechanical_dof_system.dof_handler.end();
4315 *
auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
4316 *
auto mesh_motion_cell = mesh_motion_dof_system.dof_handler.begin_active();
4317 *
auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
4318 *
for (; cell != endc; ++cell, ++thermal_cell, ++mesh_motion_cell, ++mixed_fe_cell) {
4319 *
if (cell->is_locally_owned()) {
4323 *
fe_values.reinit (cell);
4324 *
fe_therm_values.reinit (thermal_cell);
4325 *
mixed_fe_values.reinit (mixed_fe_cell);
4326 *
mesh_motion_fe_values.reinit (mesh_motion_cell);
4328 *
fe_values[displacements].get_function_gradients(
4329 *
Newton_system.current_increment,
4330 *
displacement_gradient_increments);
4332 *
fe_values[displacements].get_function_gradients(
4333 *
Newton_system.previous_deformation,
4334 *
current_displacement_gradients);
4336 *
fe_values[displacements].get_function_values(
4337 *
Newton_system.current_increment,
4338 *
displacement_value_increments);
4340 *
fe_values[displacements].get_function_values(
4341 *
Newton_system.previous_deformation,
4342 *
current_displacement_values);
4344 *
fe_values[displacements].get_function_gradients(
4345 *
Newton_system.previous_time_derivative,
4346 *
displacement_gradient_previous_time_rates);
4348 *
fe_values[displacements].get_function_gradients(
4349 *
Newton_system.previous_second_time_derivative,
4350 *
displacement_gradient_previous_second_time_rates);
4352 *
fe_values[displacements].get_function_values(
4353 *
Newton_system.current_increment,
4354 *
displacement_increments);
4356 *
fe_values[displacements].get_function_values(
4357 *
Newton_system.previous_time_derivative,
4358 *
displacement_previous_time_rates);
4360 *
fe_values[displacements].get_function_values(
4361 *
Newton_system.previous_second_time_derivative,
4362 *
displacement_previous_second_time_rates);
4369 *
fe_values[angular_velocity].get_function_gradients(
4370 *
Newton_system.current_increment,
4371 *
angular_velocity_gradient_increments);
4373 *
fe_values[angular_velocity].get_function_gradients(
4374 *
Newton_system.previous_time_derivative,
4375 *
angular_velocity_gradient_previous_time_rates);
4377 *
fe_values[angular_velocity].get_function_gradients(
4378 *
Newton_system.previous_second_time_derivative,
4379 *
angular_velocity_gradient_previous_second_time_rates);
4381 *
fe_values[angular_velocity].get_function_values(
4382 *
Newton_system.current_increment,
4383 *
angular_velocity_increments);
4385 *
fe_values[angular_velocity].get_function_values(
4386 *
Newton_system.previous_time_derivative,
4387 *
angular_velocity_previous_time_rates);
4389 *
fe_values[angular_velocity].get_function_values(
4390 *
Newton_system.previous_second_time_derivative,
4391 *
angular_velocity_previous_second_time_rates);
4398 *
mesh_motion_fe_values[displacements].get_function_gradients(
4399 *
mesh_motion_nonlinear_system.current_increment,
4400 *
mesh_motion_gradient_increments);
4402 *
mesh_motion_fe_values[displacements].get_function_gradients(
4403 *
mesh_motion_nonlinear_system.current_increment,
4404 *
mesh_motion_gradient_increments);
4411 *
fe_therm_values[
temperature].get_function_values (
4412 *
thermal_Newton_system.previous_deformation,
4413 *
current_temperature_values);
4414 *
fe_therm_values[
temperature].get_function_values (
4415 *
thermal_Newton_system.current_increment,
4416 *
updated_temperature_increments);
4420 * get vectors
for projection onto mixed fe values
4423 *
for (
unsigned int q_point = 0; q_point <
n_q_points; ++q_point) {
4424 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
4425 *
updated_temperature_values.at(q_point) =
4426 *
current_temperature_values.at(q_point)
4427 *
+ updated_temperature_increments.at(q_point);
4429 *
const auto current_F = get_deformation_gradient(
4430 *
current_displacement_gradients[q_point],
4431 *
current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
4435 *
[[maybe_unused]]
const auto mesh_motion_gradient = get_deformation_gradient(
4436 *
-mesh_motion_gradient_increments[q_point],
4437 *
-mesh_motion_value_increments[q_point][0]/fe_values.quadrature_point(q_point)[0]);
4440 *
current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
4441 *
(current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])
4442 *
/fe_values.quadrature_point(q_point)[0]
4447 *
deformation_jacobians.at(q_point) = Jacobian;
4450 *
const auto inv_updated_F =
invert(updated_F);
4451 *
std::vector<Tensor<2, dim+1, Number>> rate_gradients(
dofs_per_cell);
4453 *
rate_gradients[i] = postprocess_tensor_dimension(
4454 *
fe_values[displacements].
gradient(i, q_point),
4455 *
fe_values[displacements].
value(i, q_point)[0]/fe_values.quadrature_point(q_point)[0]) * inv_updated_F;
4459 *
const Number strain_divergence_i =
trace(rate_gradients[i]);
4460 *
strain_divergences[i].at(q_point) = Jacobian * strain_divergence_i;
4461 *
if (fill_system_matrix) {
4462 *
jacobian_tangents[i].at(q_point) = Jacobian * strain_divergence_i;
4464 *
strain_divergence_tangents[i][j].at(q_point) =
4466 *
* (
trace(rate_gradients[i]) *
trace(rate_gradients[j])
4467 *
-
trace(rate_gradients[i] * rate_gradients[j]));
4473 *
const unsigned int cell_index = cell->user_index() /
n_q_points;
4475 *
mixed_fe_projector[cell_index].project(
4476 *
&projected_temperature_coefficients,
4477 *
updated_temperature_values);
4478 *
mixed_fe_projector[cell_index].project(
4479 *
&projected_Jacobian_coefficients,
4480 *
deformation_jacobians);
4481 *
mixed_fe_projector[cell_index].project(
4482 *
&projected_previous_Jacobian_coefficients,
4483 *
previous_deformation_jacobian);
4484 *
mixed_fe_projector[cell_index].project(
4485 *
&projected_previous_temperature_coefficients,
4486 *
current_temperature_values);
4488 *
mixed_fe_projector[cell_index].project(
4489 *
&projected_strain_divergence_coefficients[i],
4490 *
strain_divergences[i]);
4491 *
if (fill_system_matrix) {
4492 *
mixed_fe_projector[cell_index].project(
4493 *
&projected_jacobian_tangent_coefficients[i],
4494 *
jacobian_tangents[i]);
4496 *
mixed_fe_projector[cell_index].project(
4497 *
&projected_strain_divergence_tangent_coefficients[i][j],
4498 *
strain_divergence_tangents[i][j]);
4503 *
for (
unsigned int q_point = 0; q_point <
n_q_points; ++q_point) {
4504 *
ConstitutiveModelUpdateFlags materialUpdateFlags =
4505 *
(update_pressure | update_stress_deviator);
4507 *
if (fill_system_matrix) {
4508 *
materialUpdateFlags |=
4509 *
(update_pressure_tangent | update_stress_deviator_tangent);
4512 *
ConstitutiveModelRequest<dim+1, Number> previous_constitutive_request(materialUpdateFlags);
4514 *
if (update_material_state) {
4515 *
materialUpdateFlags |= update_material_point_history;
4518 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
4519 *
ConstitutiveModelRequest<dim+1, Number> constitutive_request(materialUpdateFlags);
4521 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
4522 *
mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
4525 *
const Number
radius = fe_values.quadrature_point(q_point)[0];
4526 *
const auto current_F = get_deformation_gradient(
4527 *
current_displacement_gradients[q_point],
4528 *
current_displacement_values[q_point][0]/
radius
4531 *
const auto mesh_motion_gradient = get_deformation_gradient(
4532 *
-mesh_motion_gradient_increments[q_point],
4533 *
-mesh_motion_value_increments[q_point][0]/
radius);
4536 *
current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
4537 *
(current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/
radius);
4540 *
[[maybe_unused]]
const Number mesh_motion_Jacobian =
determinant(mesh_motion_gradient);
4542 *
const auto inv_updated_F =
invert(updated_F);
4547 *
const Number DENSITY = 8.96e-9;
4549 *
const Tensor<1, dim+1, Number> displacement_increment = postprocess_tensor_dimension(displacement_increments[q_point]);
4550 *
const Tensor<1, dim+1, Number> displacement_previous_time_rate = postprocess_tensor_dimension(displacement_previous_time_rates[q_point]);
4551 *
const Tensor<1, dim+1, Number> displacement_previous_second_time_rate = postprocess_tensor_dimension(displacement_previous_second_time_rates[q_point]);
4553 *
displacement_gradient_previous_time_rates[q_point], displacement_previous_time_rates[q_point][0]/
radius);
4555 *
displacement_gradient_previous_second_time_rates[q_point], displacement_previous_second_time_rates[q_point][0]/
radius);
4559 *
const Tensor<1, dim+1, Number> d_vc_d_t_n = scalar_to_angular_tensor(angular_velocity_previous_second_time_rates[q_point]);
4562 *
(1./(beta*time_increment*time_increment))
4563 *
* (displacement_increment
4568 *
displacement_previous_time_rate +
time_increment * ((1-
gamma) * displacement_previous_second_time_rate +
gamma * d2_x_dt_2_n_plus_1);
4571 *
(1./(beta*time_increment*time_increment))
4572 *
* (postprocess_tensor_dimension(
4573 *
displacement_gradient_increments[q_point],
4574 *
displacement_value_increments[q_point][0]/
radius)
4579 *
displacement_gradient_previous_time_rate
4581 *
(1.-gamma) * displacement_gradient_previous_second_time_rate
4582 *
+
gamma * Grad_d_2_x_d_t_2_n_plus_1);
4585 *
(1./(beta*time_increment*time_increment))
4593 *
const Number thR_increment = angular_velocity_increments[q_point];
4594 *
const Number d_thR_d_t_n = angular_velocity_previous_time_rates[q_point];
4595 *
const Number d2_thR_d_t2_n = angular_velocity_previous_second_time_rates[q_point];
4597 *
const Number d2_thR_d_t2_n_plus_1 =
4598 *
(1./(beta*time_increment*time_increment))
4603 *
const Number d_thR_d_t_n_plus_1 =
4606 *
const Number one_plus_r_over_R_n = 1.0 + current_displacement_values[q_point][0]/
radius;
4607 *
const Number one_plus_r_over_R_n_plus_1 = 1.0 + (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/
radius;
4608 *
const Number d_r_d_t_n_over_R = displacement_previous_time_rate[0] /
radius;
4609 *
const Number d_r_d_t_n_plus_one_over_R = d_x_dt_n_plus_1[0] /
radius;
4615 *
d2_x_dt_2_n_plus_1
4616 *
+ scalar_to_angular_tensor(
4617 *
d_r_d_t_n_plus_one_over_R * d_thR_d_t_n_plus_1
4618 *
+ one_plus_r_over_R_n_plus_1 * d2_thR_d_t2_n_plus_1)
4619 *
- (1.0/
radius) * one_plus_r_over_R_n_plus_1 *
std::pow(d_thR_d_t_n_plus_1, 2) * e_hat_R;
4622 *
displacement_previous_second_time_rate
4623 *
+ scalar_to_angular_tensor(
4624 *
d_r_d_t_n_over_R * d_thR_d_t_n
4625 *
+ one_plus_r_over_R_n * d2_thR_d_t2_n)
4626 *
- (1.0/
radius) * one_plus_r_over_R_n *
std::pow(d_thR_d_t_n, 2) * e_hat_R;
4629 *
alpha_m * acceleration_n + (1-alpha_m) * acceleration_n_plus_1;
4632 *
for(
unsigned int i=0; i<dim; i++) {
4633 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[i][i] += (1-alpha_m) * d_second_time_rate_d_increment;
4635 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[dim][0] +=
4636 *
(1-alpha_m) * (d_time_rate_d_increment/
radius * d_thR_d_t_n_plus_1 + 1.0/
radius * d2_thR_d_t2_n_plus_1);
4637 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[0][0] +=
4640 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[dim][dim] +=
4642 *
* (d_r_d_t_n_plus_one_over_R * d_time_rate_d_increment
4643 *
+ one_plus_r_over_R_n_plus_1 * d_second_time_rate_d_increment);
4644 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[0][dim] +=
4646 *
* (-(1.0/
radius) * one_plus_r_over_R_n * 2 * d_thR_d_t_n * d_time_rate_d_increment);
4649 *
[[maybe_unused]]
const auto d2_x_dt_2_n_plus_1_minus_alpha_m =
4650 *
alpha_m * displacement_previous_second_time_rate + (1-alpha_m)*d2_x_dt_2_n_plus_1;
4651 *
[[maybe_unused]]
const Number d2_x_dt_2_tangent_1_minus_alpha_m = (1-alpha_m)*d_second_time_rate_d_increment;
4653 *
[[maybe_unused]]
const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f =
4654 *
alpha_m * displacement_gradient_previous_time_rate * vc_n
4655 *
+ (1-alpha_m) * Grad_d_x_d_t_n_plus_1 * vc_n_plus_1;
4657 *
[[maybe_unused]]
const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f_F_tangent = (1-alpha_m) * d_time_rate_d_increment * vc_n_plus_1;
4658 *
[[maybe_unused]]
const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f_v_tangent = (1-alpha_m) * Grad_d_x_d_t_n_plus_1;
4660 *
[[maybe_unused]]
const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m =
4661 *
alpha_m * current_F * d_vc_d_t_n
4662 *
+ (1-alpha_m) * updated_F * d_vc_d_t_n_plus_1;
4664 *
[[maybe_unused]]
const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m_F_tangent = (1-alpha_m) * d_vc_d_t_n_plus_1;
4665 *
[[maybe_unused]]
const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m_V_tangent = (1-alpha_m) * updated_F * d_second_time_rate_d_increment;
4667 *
std::vector<Tensor<2, dim+1, Number>> rate_gradients(
dofs_per_cell);
4668 *
std::vector<Tensor<2, dim+1, Number>> angular_rate_gradients(
dofs_per_cell);
4670 *
rate_gradients[i] =
4671 *
postprocess_tensor_dimension(
4672 *
fe_values[displacements].
gradient(i, q_point),
4673 *
fe_values[displacements].
value(i, q_point)[0]/
radius) * inv_updated_F;
4674 *
angular_rate_gradients[i] =
4675 *
order_1_tensor_to_angular_gradient(
4676 *
fe_values[angular_velocity].
gradient(i, q_point),
4677 *
-fe_values[angular_velocity].
value(i, q_point)/
radius);
4681 *
-angular_velocity_increments[q_point],
4682 *
-angular_velocity_gradient_increments[q_point],
4687 *
-angular_velocity_increments[q_point],
4693 *
const auto f_m_n_plus_1 = inv_d_X_prime_d_X * rotation_to_X_prime_frame;
4697 * std::cout <<
"f_r: " << inv_d_X_prime_d_X << std::endl;
4698 * std::cout <<
"R: " << previous_elastic_deformation_transformation_tensor << std::endl;
4699 * std::cout <<
"f_m_n+1: " << f_m_n_plus_1 << std::endl;
4705 *
Number projected_jacobian = 0;
4706 *
Number projected_previous_jacobian = 0;
4707 *
Number projected_temperature = 0;
4708 *
Number projected_previous_temperature = 0;
4709 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
4710 *
projected_jacobian +=
4711 *
mixed_values(i) * projected_Jacobian_coefficients.at(i);
4712 *
projected_previous_jacobian +=
4713 *
mixed_values(i) * projected_previous_Jacobian_coefficients.at(i);
4714 *
projected_temperature +=
4715 *
mixed_values(i) * projected_temperature_coefficients.at(i);
4716 *
projected_previous_temperature +=
4717 *
mixed_values(i) * projected_previous_temperature_coefficients.at(i);
4720 *
const auto unnormalized_deformation_gradient_increment = updated_F * f_m_n_plus_1 *
invert(current_F);
4722 *
const auto deformation_gradient_increment =
4724 *
-Constants<dim, Number>::one_third()) * unnormalized_deformation_gradient_increment;
4727 *
std::cout <<
"determinant(deformation_gradient_increment): " <<
determinant(deformation_gradient_increment) << std::endl;
4729 *
if(
false && std::isnan(deformation_gradient_increment.norm())) {
4730 *
std::cout <<
"deformation_gradient_increment is nan: " << deformation_gradient_increment << std::endl;
4731 *
std::cout <<
"Jacobian: " << Jacobian
4732 *
<<
"\nf_m_n_plus_1: " << f_m_n_plus_1
4733 *
<<
"\ndet(f_m_n_plus_1): " <<
determinant(f_m_n_plus_1)
4734 *
<<
"\nprevious_Jacobian: " << previous_Jacobian
4735 *
<<
"\nupdated_F: " << updated_F
4736 *
<<
"\ncurrent_F: " << current_F
4737 *
<<
"\ninvert(current_F): " <<
invert(current_F)
4741 *
constitutive_request.set_deformation_Jacobian(projected_jacobian);
4742 *
constitutive_request.set_unprojected_deformation_Jacobian(
determinant(updated_F) * material_Jacobian);
4743 *
constitutive_request.set_temperature(projected_temperature);
4744 *
constitutive_request.set_deformation_gradient(deformation_gradient_increment);
4745 *
constitutive_request.set_time_increment(time_increment);
4748 *
material.compute_constitutive_request(constitutive_request,
4749 *
quadrature_point_index);
4750 *
}
catch (
const MaterialDomainException &exc) {
4753 * std::cerr <<
"projected_jacobian: " << projected_jacobian
4754 * <<
"\ndeformation_gradient_increment: " << deformation_gradient_increment
4755 * <<
"\nupdated_F: " << updated_F
4756 * <<
"\nf_m_n_plus_1: " << f_m_n_plus_1
4757 * <<
"\ncurrent_F: " << current_F
4758 * <<
"\ninvert(current_F): " <<
invert(current_F)
4759 * <<
"\nJacobian: " << Jacobian
4760 * <<
"\ndeterminant(f_m_n_plus_1): " <<
determinant(f_m_n_plus_1)
4761 * <<
"\nprevious_Jacobian: " << previous_Jacobian
4762 * <<
"\n-------------------\n"
4764 * std::cerr << exc.what() << std::endl;
4767 *
kinematic_domains_are_valid =
false;
4771 *
previous_constitutive_request.set_deformation_Jacobian(projected_previous_jacobian);
4772 *
previous_constitutive_request.set_temperature(projected_previous_temperature);
4774 *
previous_constitutive_request.set_time_increment(time_increment);
4775 *
previous_constitutive_request.set_is_plastic(
false);
4777 *
material.compute_constitutive_request(previous_constitutive_request,
4778 *
quadrature_point_index);
4781 *
projected_strain_divergence[j] =
4782 *
mixed_values(0) * projected_strain_divergence_coefficients[j][0];
4783 *
if (fill_system_matrix) {
4784 *
projected_jacobian_tangent[j] =
4785 *
mixed_values(0) * projected_jacobian_tangent_coefficients[j][0];
4787 *
projected_strain_divergence_tangent[j][k] =
4789 *
* projected_strain_divergence_tangent_coefficients[j][k][0];
4794 *
for (
unsigned int i = 1; i < mixed_dofs_per_cell; ++i) {
4796 *
projected_strain_divergence[j] +=
4797 *
mixed_values(i) * projected_strain_divergence_coefficients[j][i];
4798 *
if (fill_system_matrix) {
4799 *
projected_jacobian_tangent[j] +=
4800 *
mixed_values(i) * projected_jacobian_tangent_coefficients[j][i];
4802 *
projected_strain_divergence_tangent[j][k] +=
4804 *
* projected_strain_divergence_tangent_coefficients[j][k][i];
4813 *
const auto strain_i =
symmetrize(rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F);
4821 *
alpha_f * previous_constitutive_request.get_stress_deviator()
4822 *
+ (1-alpha_f) * constitutive_request.get_stress_deviator();
4823 *
const Number pressure =
4824 *
alpha_f * previous_constitutive_request.get_pressure()
4825 *
+ (1-alpha_f) * constitutive_request.get_pressure();
4834 *
(projected_strain_divergence.at(i)) * pressure * RJxW;
4841 *
const unsigned int
4842 *
component_i = mech_fe.system_to_component_index(i).first;
4843 *
for (
typename std::vector<BodyForceApplier<dim, Number> >
::const_iterator
4844 *
bodyForceApplier = mechanical_lbc_system.bodyLoadAppliers.begin();
4845 *
bodyForceApplier != mechanical_lbc_system.bodyLoadAppliers.end();
4846 *
++bodyForceApplier) {
4848 *
bodyForceApplier->apply(
4850 *
fe_values.shape_value (i, q_point),
4860 *
(postprocess_tensor_dimension(fe_values[displacements].
value(i, q_point)) + scalar_to_angular_tensor(fe_values[angular_velocity].
value(i, q_point)))
4862 *
* acceleration_n_plus_1_minus_alpha_m * RJxW;
4865 *
if (fill_system_matrix) {
4866 *
std::vector<SymmetricTensor<2, dim+1, Number> > stress_deviator_tangents(
dofs_per_cell);
4871 *
deformation_gradient_from_angular_displacement_gradient_variations(
4872 *
-angular_velocity_increments[q_point],
4873 *
-angular_velocity_gradient_increments[q_point],
4875 *
-fe_values[angular_velocity].
value(i, q_point),
4876 *
-fe_values[angular_velocity].
gradient(i, q_point)
4880 *
-angular_velocity_increments[q_point],
4881 *
-fe_values[angular_velocity].
value(i, q_point),
4885 *
const auto f_m_n_plus_1_variation_inv_f_m_n_plus_1 =
4886 *
(- inv_d_X_prime_d_X * d_X_prime_d_X_variation * inv_d_X_prime_d_X * rotation_to_X_prime_frame
4887 *
+ inv_d_X_prime_d_X * rotation_to_X_prime_frame_variation) *
invert(f_m_n_plus_1);
4889 *
stress_deviator_tangents[i] = (1-alpha_f) * constitutive_request.get_stress_deviator_tangent(
4891 *
- Constants<dim+1, Number>::one_third()
4892 *
*
trace(rate_gradients[i])
4894 *
+ updated_F * f_m_n_plus_1_variation_inv_f_m_n_plus_1 * inv_updated_F
4895 *
- Constants<dim+1, Number>::one_third()
4896 *
*
trace(f_m_n_plus_1_variation_inv_f_m_n_plus_1)
4899 *
pressure_tangents[i] = (1-alpha_f) * constitutive_request.get_pressure_tangent(
4900 *
projected_jacobian_tangent[i]);
4909 *
const Number f_int_dev_tau =
symmetrize(rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F) * stress_deviator_tangents[j];
4916 *
const Number f_int_pressure =
4917 *
projected_strain_divergence.at(i)
4918 *
* pressure_tangents[j];
4925 *
const Tensor<2, dim+1, Number> grad_ui_grad_uj = (rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F) * rate_gradients[j];
4927 *
const Number f_int_geom =
4928 *
projected_strain_divergence_tangent[i][j]
4929 *
* constitutive_request.get_pressure()
4930 *
- sym_grad_ui_grad_uj
4931 *
* constitutive_request.get_stress_deviator();
4940 *
(postprocess_tensor_dimension(fe_values[displacements].
value(i, q_point))
4941 *
+ scalar_to_angular_tensor(fe_values[angular_velocity].
value(i, q_point)))
4943 *
* (acceleration_n_plus_1_minus_alpha_m_tangent_modulus
4944 *
* (postprocess_tensor_dimension(fe_values[displacements].
value(j, q_point))
4945 *
+ scalar_to_angular_tensor(fe_values[angular_velocity].
value(j, q_point))))
4952 *
for (
unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
4953 *
for (
auto boundaryForceSpec: mechanical_lbc_system.boundaryLoadAppliers) {
4954 *
if (cell->face(face)->boundary_id() ==
static_cast<types::boundary_id>(boundaryForceSpec.first)) {
4956 *
for (
unsigned int q_point = 0; q_point < n_face_q_points; ++q_point) {
4958 *
const unsigned int component_i = mech_fe.system_to_component_index(i).first;
4960 *
boundaryForceSpec.second.apply(
4969 *
for(
const auto boundary_unidirectional_penalty_spec: mechanical_lbc_system.boundary_unidirectional_penalty_specs) {
4970 *
if (cell->face(face)->boundary_id() == boundary_unidirectional_penalty_spec->get_boundary_id()) {
4971 *
const Number reference_displacement_increment = boundary_unidirectional_penalty_spec->get_reference_displacement_increment();
4972 *
const Number residual_force = boundary_unidirectional_penalty_spec->get_residual_force();
4973 *
const Number quadratic_spring_factor = boundary_unidirectional_penalty_spec->get_quadratic_spring_factor();
4977 *
Newton_system.current_increment,
4978 *
face_displacement_value_increments);
4979 *
for (
unsigned int q_point = 0; q_point < n_face_q_points; ++q_point) {
4981 *
const Number surface_displacement = face_displacement_value_increments[q_point] * surface_normal;
4982 *
const Number surface_force =
4984 *
+ surface_displacement < -reference_displacement_increment?
4986 *
-0.5 * quadratic_spring_factor *
std::pow(surface_displacement + reference_displacement_increment, 2);
4987 *
const Number surface_force_tangent_modulus =
4988 *
surface_displacement < -reference_displacement_increment?
4990 *
-quadratic_spring_factor * (surface_displacement + reference_displacement_increment);
4994 *
* surface_force * surface_normal
4999 *
* surface_force_tangent_modulus * (
fe_face_values[displacements].value(j, q_point) * surface_normal) * surface_normal
5010 *
const Number relative_symmetry_norm2 =
cell_matrix.relative_symmetry_norm2();
5011 *
if(relative_symmetry_norm2 > 1e-8)
5012 * std::cout <<
"relative_symmetry_norm2: " <<
cell_matrix.relative_symmetry_norm2() << std::endl;
5018 *
std::vector<types::global_dof_index> local_dof_indices (
dofs_per_cell);
5019 *
cell->get_dof_indices (local_dof_indices);
5020 *
if (fill_system_matrix) {
5021 *
mechanical_dof_system.nodal_constraints.distribute_local_to_global(
5024 *
local_dof_indices,
5025 *
Newton_system.Newton_step_matrix,
5026 *
Newton_system.Newton_step_residual,
5029 *
mechanical_dof_system.nodal_constraints.distribute_local_to_global(
5030 *
cell_residual, local_dof_indices,
5031 *
Newton_system.Newton_step_residual);
5036 *
const unsigned short local_domain_is_valid = kinematic_domains_are_valid ? 1 : 0;
5037 *
unsigned short all_kinematic_domains_are_valid;
5041 * did any of the processes fail to
assemble?
5045 *
&local_domain_is_valid,
5046 *
&all_kinematic_domains_are_valid, 1, MPI_UNSIGNED_SHORT,
5047 *
MPI_MIN, mpi_communicator);
5049 *
if (all_kinematic_domains_are_valid < 1) {
5050 *
throw std::runtime_error(
"The domain is not valid...");
5053 *
if (fill_system_matrix) {
5061 *
template <
int dim,
typename Number>
5062 *
void PlasticityLabProg<dim, Number>::assemble_thermal_system(
5063 *
NewtonStepSystem &Newton_system,
5064 *
NewtonStepSystem &mechanical_nonlinear_system,
5065 *
const DoFSystem<dim, Number> &thermal_dof_system,
5066 *
const LBCSystem<dim, Number, 1> &thermal_lbc_system,
5067 *
const DoFSystem<dim, Number> &mechanical_dof_system,
5068 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
5070 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
5072 *
const bool fill_system_matrix) {
5077 *
quadrature_formula,
5083 *
face_quadrature_formula,
5091 *
quadrature_formula,
5097 *
face_quadrature_formula,
5107 *
quadrature_formula,
5110 *
const unsigned int dofs_per_cell = therm_fe.dofs_per_cell;
5111 *
const unsigned int n_q_points = quadrature_formula.size();
5112 *
const unsigned int n_face_q_points = face_quadrature_formula.size();
5113 *
const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
5119 *
std::vector<Number> weighted_updated_J_vec(mixed_dofs_per_cell),
5120 *
weighted_current_J_vec(mixed_dofs_per_cell),
5121 *
weighted_previous_J_vec(mixed_dofs_per_cell),
5122 *
weighted_updated_theta_vec(mixed_dofs_per_cell),
5123 *
weighted_previous_theta_vec(mixed_dofs_per_cell),
5124 *
weighted_J_time_rate_vec(mixed_dofs_per_cell);
5125 *
std::vector< std::vector<Number> > weighted_shape_values(
5127 *
std::vector<Number>(mixed_dofs_per_cell) );
5129 *
std::vector<Number> qp_updated_J_values(
n_q_points),
5134 *
std::vector<std::vector<Number> > qp_shape_values(
5138 *
std::vector< Tensor<1, dim, Number> > thermal_gradient_increment(
n_q_points),
5141 *
std::vector< Number > current_temperature_values(
n_q_points),
5144 *
std::vector< Number > current_face_temperature_values(n_face_q_points),
5145 *
face_temperature_values_increment(n_face_q_points);
5147 *
std::vector< Tensor<2, dim, Number> > current_displacement_gradients(
n_q_points),
5148 *
displacement_gradient_increments(
n_q_points);
5149 *
std::vector< Tensor<1, dim, Number> > current_displacement_values(
n_q_points),
5152 *
std::vector< Tensor<1, dim, Number> > current_angular_velocity_gradients(
n_q_points),
5153 *
angular_velocity_gradient_increments(
n_q_points),
5154 *
angular_velocity_gradient_previous_time_rates(
n_q_points);
5156 *
std::vector< Number > angular_velocity_increments(
n_q_points),
5158 *
angular_velocity_previous_time_rates(
n_q_points);
5160 *
std::vector< Tensor<2, dim, Number> > current_face_displacement_gradients(n_face_q_points);
5161 *
std::vector< Tensor<2, dim, Number> > face_displacement_gradient_increments(n_face_q_points);
5163 *
std::vector< Tensor<1, dim, Number> > current_face_displacement_values(n_face_q_points);
5164 *
std::vector< Tensor<1, dim, Number> > face_displacement_value_increments(n_face_q_points);
5169 *
Newton_system.Newton_step_matrix = 0;
5170 *
Newton_system.Newton_step_residual = 0;
5174 *
auto cell = thermal_dof_system.dof_handler.begin_active();
5175 *
auto endc = thermal_dof_system.dof_handler.end();
5176 *
auto mechanical_cell = mechanical_dof_system.dof_handler.begin_active();
5177 *
auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
5178 *
for (; cell != endc; ++cell, ++mechanical_cell, ++mixed_fe_cell) {
5179 *
if (cell->is_locally_owned()) {
5183 *
fe_values.reinit (cell);
5184 *
fe_mech_values.reinit (mechanical_cell);
5185 *
mixed_fe_values.reinit (mixed_fe_cell);
5188 *
Newton_system.current_increment,
5189 *
thermal_gradient_increment);
5192 *
Newton_system.previous_deformation,
5193 *
current_thermal_gradient);
5196 *
Newton_system.current_increment,
5197 *
temperature_values_increment);
5200 *
Newton_system.previous_deformation,
5201 *
current_temperature_values);
5203 *
fe_mech_values[displacements].get_function_gradients(
5204 *
mechanical_nonlinear_system.current_increment,
5205 *
displacement_gradient_increments);
5207 *
fe_mech_values[displacements].get_function_gradients(
5208 *
mechanical_nonlinear_system.previous_deformation,
5209 *
current_displacement_gradients);
5211 *
fe_mech_values[displacements].get_function_values(
5212 *
mechanical_nonlinear_system.current_increment,
5213 *
displacement_value_increments);
5215 *
fe_mech_values[displacements].get_function_values(
5216 *
mechanical_nonlinear_system.previous_deformation,
5217 *
current_displacement_values);
5224 *
fe_mech_values[angular_velocity].get_function_gradients(
5225 *
mechanical_nonlinear_system.current_increment,
5226 *
angular_velocity_gradient_increments);
5228 *
fe_mech_values[angular_velocity].get_function_values(
5229 *
mechanical_nonlinear_system.current_increment,
5230 *
angular_velocity_increments);
5234 * get vectors
for projection onto mixed fe values
5237 *
for (
unsigned int q_point = 0; q_point <
n_q_points;
5240 *
const Number
radius = fe_mech_values.quadrature_point(q_point)[0];
5242 *
const auto previous_F = get_deformation_gradient(
5243 *
current_displacement_gradients[q_point],
5244 *
current_displacement_values[q_point][0]/
radius);
5246 *
const auto updated_F = get_deformation_gradient(
5247 *
current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
5248 *
(current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/
radius);
5250 *
const auto deformation_gradient_increment = postprocess_tensor_dimension(
5251 *
displacement_gradient_increments[q_point],
5252 *
displacement_value_increments[q_point][0]/
radius);
5254 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
5260 *
qp_previous_J_values.at(q_point) = previous_Jacobian;
5261 *
qp_updated_J_values.at(q_point) = Jacobian;
5264 *
qp_previous_theta_values.at(q_point) = current_temperature_values.at(q_point);
5265 *
qp_updated_theta_values.at(q_point) = current_temperature_values.at(q_point) + temperature_values_increment.at(q_point);
5267 *
qp_shape_values.at(i).at(q_point) = fe_values[
temperature].value(i, q_point);
5271 *
const unsigned int cell_index = cell->user_index() /
n_q_points;
5273 *
mixed_fe_projector[cell_index].project(
5274 *
&weighted_updated_J_vec,
5275 *
qp_updated_J_values);
5276 *
mixed_fe_projector[cell_index].project(
5277 *
&weighted_J_time_rate_vec,
5279 *
mixed_fe_projector[cell_index].project(
5280 *
&weighted_updated_theta_vec,
5281 *
qp_updated_theta_values);
5282 *
mixed_fe_projector[cell_index].project(
5283 *
&weighted_previous_J_vec,
5284 *
qp_previous_J_values);
5285 *
mixed_fe_projector[cell_index].project(
5286 *
&weighted_previous_theta_vec,
5287 *
qp_previous_theta_values);
5289 *
mixed_fe_projector[cell_index].project(
5290 *
&weighted_shape_values.at(i),
5291 *
qp_shape_values.at(i));
5294 *
for (
unsigned int q_point = 0; q_point <
n_q_points;
5296 *
const ConstitutiveModelUpdateFlags material_update_flags =
5297 *
fill_system_matrix ?
5298 *
(update_heat_flux | update_heat_flux_tangent
5299 *
| update_mechanical_dissipation
5300 *
| update_mechanical_dissipation_tangent
5301 *
| update_stored_heat | update_stored_heat_tangent)
5303 *
(update_heat_flux | update_mechanical_dissipation
5304 *
| update_stored_heat);
5306 *
const ConstitutiveModelUpdateFlags heating_update_flags =
5307 *
fill_system_matrix ?
5308 *
(update_thermoelastic_heating
5309 *
| update_thermoelastic_heating_tangent)
5311 *
(update_thermoelastic_heating);
5313 *
point_index_t quadrature_point_index = cell->user_index() + q_point;
5314 *
ConstitutiveModelRequest<dim+1, Number> constitutive_request(material_update_flags);
5315 *
ConstitutiveModelRequest<dim+1, Number> heating_request(heating_update_flags);
5317 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5318 *
mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
5321 *
Number projected_updated_J = 0;
5322 *
Number projected_previous_J = 0;
5323 *
Number projected_updated_theta = 0;
5324 *
Number projected_previous_theta = 0;
5325 *
Number projected_J_time_rate = 0;
5327 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5328 *
projected_updated_J +=
5329 *
mixed_values(i) * weighted_updated_J_vec.at(i);
5330 *
projected_J_time_rate +=
5331 *
mixed_values(i) * weighted_J_time_rate_vec.at(i);
5332 *
projected_updated_theta +=
5333 *
mixed_values(i) * weighted_updated_theta_vec.at(i);
5334 *
projected_previous_J +=
5335 *
mixed_values(i) * weighted_previous_J_vec.at(i);
5336 *
projected_previous_theta +=
5337 *
mixed_values(i) * weighted_previous_theta_vec.at(i);
5339 *
projected_shape_values(j) +=
5340 *
mixed_values(i) * weighted_shape_values.at(j).at(i);
5344 *
const Number d_theta_dt_n_plus_1 = temperature_values_increment[q_point] /
time_increment;
5348 *
heating_request.set_deformation_Jacobian(projected_updated_J);
5349 *
heating_request.set_deformation_Jacobian_time_rate(projected_J_time_rate);
5350 *
heating_request.set_temperature(projected_updated_theta);
5351 *
heating_request.set_previous_deformation_Jacobian(projected_previous_J);
5352 *
heating_request.set_previous_temperature(projected_previous_theta);
5353 *
heating_request.set_time_increment(time_increment);
5355 *
const auto current_F = get_deformation_gradient(
5356 *
current_displacement_gradients[q_point],
5357 *
current_displacement_values[q_point][0]/fe_mech_values.quadrature_point(q_point)[0]
5359 *
const auto updated_F = get_deformation_gradient(
5360 *
current_displacement_gradients[q_point]
5361 *
+ displacement_gradient_increments[q_point],
5362 *
(current_displacement_values[q_point][0]
5363 *
+ displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5365 *
const auto inv_updated_F =
invert(updated_F);
5370 *
const Number
radius = fe_values.quadrature_point(q_point)[0];
5373 *
-angular_velocity_increments[q_point],
5374 *
-angular_velocity_gradient_increments[q_point],
5379 *
-angular_velocity_increments[q_point],
5385 *
const auto f_m_n_plus_1 = inv_d_X_prime_d_X * rotation_to_X_prime_frame;
5389 * std::cout <<
"f_r: " << inv_d_X_prime_d_X << std::endl;
5390 * std::cout <<
"R: " << previous_elastic_deformation_transformation_tensor << std::endl;
5391 * std::cout <<
"f_m_n+1: " << f_m_n_plus_1 << std::endl;
5397 *
const auto unnormalized_deformation_gradient_increment = updated_F * f_m_n_plus_1 *
invert(current_F);
5399 *
const auto deformation_gradient_increment =
5401 *
-Constants<dim, Number>::one_third()) * unnormalized_deformation_gradient_increment;
5403 *
const Number previous_temperature = current_temperature_values[q_point];
5404 *
const Number updated_temperature = previous_temperature + temperature_values_increment[q_point];
5405 *
const auto thermal_gradient =
5406 *
postprocess_tensor_dimension(current_thermal_gradient[q_point] + thermal_gradient_increment[q_point]) * inv_updated_F;
5408 *
constitutive_request.set_deformation_gradient(deformation_gradient_increment);
5409 *
constitutive_request.set_temperature_time_rate(d_theta_dt_n_plus_1);
5410 *
constitutive_request.set_temperature(updated_temperature);
5411 *
constitutive_request.set_thermal_gradient(thermal_gradient);
5412 *
constitutive_request.set_time_increment(time_increment);
5414 *
material.compute_constitutive_request(
5415 *
constitutive_request,
5416 *
quadrature_point_index);
5417 *
material.compute_constitutive_request(
5419 *
quadrature_point_index);
5421 *
std::vector<Tensor<1, dim+1, Number>> rate_gradients(
dofs_per_cell);
5424 *
rate_gradients[i] = postprocess_tensor_dimension(fe_values[temperature].
gradient(i, q_point)) * inv_updated_F;
5425 *
rate_temperatures[i] =fe_values[
temperature].value(i, q_point);
5428 *
const Number RJxW = fe_values.quadrature_point(q_point)[0] /
material_Jacobian * fe_values.JxW(q_point);
5437 *
const auto heat_flux = constitutive_request.get_heat_flux();
5448 *
* constitutive_request.get_stored_heat_rate()
5453 * mechanical dissipation term
5457 *
* constitutive_request.get_mechanical_dissipation()
5462 * elastoplastic heating term
5466 *
* heating_request.get_thermo_elastic_heating()
5469 *
for (
typename std::vector<BodyForceApplier<dim, Number> >
::const_iterator
5470 *
bodyHeatSourceApplier = thermal_lbc_system.bodyLoadAppliers.cbegin();
5471 *
bodyHeatSourceApplier != thermal_lbc_system.bodyLoadAppliers.cend();
5472 *
++bodyHeatSourceApplier) {
5474 *
0, rate_temperatures[i],
5475 *
fe_values.quadrature_point(q_point)[0] * fe_values.JxW(q_point));
5479 *
if (fill_system_matrix) {
5488 *
const Number f_int_q =
5490 *
* constitutive_request.get_heat_flux_tangent(rate_gradients[j]);
5495 * stored heat rate tangent
5498 *
const Number f_int_cThetaDot =
5499 *
rate_temperatures[i]
5500 *
* constitutive_request.get_stored_heat_rate_tangent(d_theta_dt_tangent*rate_temperatures[j]);
5505 * mechanical dissipation tangent
5508 *
const Number f_int_mech_dissipation =
5509 *
rate_temperatures[i]
5510 *
* constitutive_request.get_mechanical_dissipation_tangent(rate_temperatures[j]);
5511 *
cell_matrix(i, j) -= f_int_mech_dissipation * RJxW;
5515 * elastoplastic heating tangent
5518 *
const Number f_int_elastoplastic_heating =
5519 *
(projected_shape_values(i))
5520 *
* heating_request.get_thermo_elastic_heating_tangent(projected_shape_values(j));
5521 *
cell_matrix(i, j) += f_int_elastoplastic_heating * RJxW;
5527 *
for (
unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
5529 *
mech_fe_face_values.reinit(mechanical_cell, face);
5532 *
Newton_system.previous_deformation,
5533 *
current_face_temperature_values);
5535 *
Newton_system.current_increment,
5536 *
face_temperature_values_increment);
5538 *
mech_fe_face_values[displacements].get_function_gradients(
5539 *
mechanical_nonlinear_system.previous_deformation,
5540 *
current_face_displacement_gradients);
5541 *
mech_fe_face_values[displacements].get_function_gradients(
5542 *
mechanical_nonlinear_system.current_increment,
5543 *
face_displacement_gradient_increments);
5545 *
mech_fe_face_values[displacements].get_function_values(
5546 *
mechanical_nonlinear_system.previous_deformation,
5547 *
current_face_displacement_values);
5548 *
mech_fe_face_values[displacements].get_function_values(
5549 *
mechanical_nonlinear_system.current_increment,
5550 *
face_displacement_value_increments);
5553 *
for (
typename std::vector<std::pair<
int, BodyForceApplier<dim, Number> > >
::const_iterator
5554 *
boundaryHeatSource = thermal_lbc_system.boundaryLoadAppliers.cbegin();
5555 *
boundaryHeatSource != thermal_lbc_system.boundaryLoadAppliers.cend();
5556 *
++boundaryHeatSource) {
5557 *
if (cell->face(face)->boundary_id() ==
static_cast<types::boundary_id>(boundaryHeatSource->first)) {
5559 *
for (
unsigned int q_point = 0;
5560 *
q_point < face_quadrature_formula.size();
5564 *
const auto updated_F = get_deformation_gradient(
5565 *
current_face_displacement_gradients[q_point]
5566 *
+ face_displacement_gradient_increments[q_point],
5567 *
(current_face_displacement_values[q_point][0]
5568 *
+ face_displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5573 *
const Tensor<1, dim+1, Number> reference_normal = postprocess_tensor_dimension(mech_fe_face_values.normal_vector(q_point), 0);
5575 *
const Number norm_F_inv_transpose_N = (F_inv_transpose_N).
norm();
5578 *
boundaryHeatSource->second.apply(
5581 *
norm_F_inv_transpose_N * J *
5588 *
for (
typename std::vector<std::pair<
int, ConvectionBoundaryConditionApplier<dim, Number> > >
::const_iterator
5589 *
convectionBC = thermal_lbc_system.convection_BC_appliers.cbegin();
5590 *
convectionBC != thermal_lbc_system.convection_BC_appliers.cend();
5592 *
if (cell->face(face)->boundary_id() ==
static_cast<types::boundary_id>(convectionBC->first)) {
5593 *
for (
unsigned int q_point = 0;
5594 *
q_point < face_quadrature_formula.size();
5597 *
const unsigned int cell_index = cell->user_index() / quadrature_formula.size();
5598 *
const unsigned int surface_point_key =
5600 *
+ face * n_face_q_points
5603 *
const auto updated_F = get_deformation_gradient(
5604 *
current_face_displacement_gradients[q_point]
5605 *
+ face_displacement_gradient_increments[q_point],
5606 *
(current_face_displacement_values[q_point][0]
5607 *
+ face_displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5609 *
[[maybe_unused]]
const Number
J =
determinant(updated_F);
5611 *
const Tensor<1, dim+1, Number> reference_normal = postprocess_tensor_dimension(mech_fe_face_values.normal_vector(q_point), 0);
5613 *
[[maybe_unused]]
const Number norm_F_inv_transpose_N = (F_inv_transpose_N).
norm();
5615 *
const Number RJxW =
fe_face_values.quadrature_point(q_point)[0] / material_area_factors.at(surface_point_key).norm() *
fe_face_values.JxW(q_point);
5617 *
const Number updated_face_temperature_value =
5618 *
current_face_temperature_values[q_point] +
5619 *
face_temperature_values_increment[q_point];
5622 *
convectionBC->second.apply(
5625 *
updated_face_temperature_value,
5627 *
if (fill_system_matrix) {
5630 *
convectionBC->second.apply_gradient(
5644 *
std::vector<types::global_dof_index> local_dof_indices (
dofs_per_cell);
5645 *
cell->get_dof_indices (local_dof_indices);
5646 *
if (fill_system_matrix) {
5647 *
thermal_dof_system.nodal_constraints.distribute_local_to_global(
5650 *
local_dof_indices,
5651 *
Newton_system.Newton_step_matrix,
5652 *
Newton_system.Newton_step_residual,
5655 *
thermal_dof_system.nodal_constraints.distribute_local_to_global(
5656 *
cell_residual, local_dof_indices,
5657 *
Newton_system.Newton_step_residual);
5666 *
template <
int dim,
typename Number>
5667 *
void PlasticityLabProg<dim, Number>::assemble_mesh_motion_system(
5668 *
NewtonStepSystem &mesh_motion_nonlinear_system,
5669 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
5670 *
const LBCSystem<dim, Number, dim> &,
5671 *
const NewtonStepSystem &deformation_nonlinear_system,
5672 *
const DoFSystem<dim, Number> &deformation_dof_system,
5673 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
5674 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
5675 *
const bool fill_system_matrix) {
5678 *
const Number mesh_motion_mu = 1.0;
5679 *
const Number mesh_motion_kappa = 5.0;
5680 *
const Number cell_jacobian_exponent = -0.0;
5686 *
quadrature_formula,
5692 *
quadrature_formula,
5699 *
quadrature_formula,
5702 *
const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
5703 *
const unsigned int n_q_points = quadrature_formula.size();
5704 *
const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
5706 *
std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(
n_q_points);
5707 *
std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(
n_q_points);
5709 *
std::vector< Tensor<2, dim, Number> > current_deformation_gradients(
n_q_points);
5710 *
std::vector< Tensor<2, dim, Number> > deformation_gradient_increments(
n_q_points);
5712 *
std::vector< Tensor<1, dim, Number> > current_deformation_values(
n_q_points);
5713 *
std::vector< Tensor<1, dim, Number> > deformation_value_increments(
n_q_points);
5715 *
std::vector< Number > mesh_motion_jacobians(
n_q_points);
5719 *
std::vector< std::vector< std::vector < Number> > > strain_divergence_tangents(
5723 *
std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
5724 *
std::vector<std::vector<Number> > projected_strain_divergence_coefficients(
5726 *
std::vector<Number>(mixed_dofs_per_cell));
5727 *
std::vector<std::vector<Number> > projected_jacobian_tangent_coefficients(
5729 *
std::vector<Number>(mixed_dofs_per_cell));
5730 *
std::vector<std::vector<std::vector<Number> > > projected_strain_divergence_tangent_coefficients(
5733 *
std::vector<Number>(mixed_dofs_per_cell)));
5735 *
std::vector<Number> projected_strain_divergence(
dofs_per_cell);
5736 *
std::vector<Number> projected_jacobian_tangent(
dofs_per_cell);
5748 *
mesh_motion_nonlinear_system.Newton_step_matrix = 0;
5749 *
mesh_motion_nonlinear_system.Newton_step_residual = 0;
5751 *
bool kinematic_domains_are_valid =
true;
5753 *
auto cell = mesh_motion_dof_system.dof_handler.begin_active();
5754 *
auto endc = mesh_motion_dof_system.dof_handler.end();
5755 *
auto deformation_cell = deformation_dof_system.dof_handler.begin_active();
5756 *
auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
5758 *
for (; cell != endc; ++cell, ++deformation_cell, ++mixed_fe_cell) {
5759 *
if (cell->is_locally_owned()) {
5764 *
mesh_motion_fe_values.reinit (cell);
5765 *
deformation_fe_values.reinit (deformation_cell);
5766 *
mixed_fe_values.reinit (mixed_fe_cell);
5768 *
deformation_fe_values[displacements].get_function_gradients(
5769 *
deformation_nonlinear_system.previous_deformation,
5770 *
current_deformation_gradients);
5772 *
deformation_fe_values[displacements].get_function_gradients(
5773 *
deformation_nonlinear_system.current_increment,
5774 *
deformation_gradient_increments);
5776 *
deformation_fe_values[displacements].get_function_values(
5777 *
deformation_nonlinear_system.previous_deformation,
5778 *
current_deformation_values);
5780 *
deformation_fe_values[displacements].get_function_values(
5781 *
deformation_nonlinear_system.current_increment,
5782 *
deformation_value_increments);
5784 *
mesh_motion_fe_values[displacements].get_function_gradients(
5785 *
mesh_motion_nonlinear_system.current_increment,
5786 *
mesh_motion_gradient_increments);
5788 *
mesh_motion_fe_values[displacements].get_function_values(
5789 *
mesh_motion_nonlinear_system.current_increment,
5790 *
mesh_motion_value_increments);
5794 * get vectors
for projection onto mixed fe values
5797 *
for (
unsigned int q_point = 0; q_point <
n_q_points;
5800 *
const auto mesh_motion_gradient = get_deformation_gradient(
5801 *
-mesh_motion_gradient_increments[q_point],
5802 *
-mesh_motion_value_increments[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
5804 *
const Number Jacobian =
determinant(mesh_motion_gradient);
5805 *
mesh_motion_jacobians.at(q_point) = Jacobian;
5807 *
const auto inv_mesh_motion_gradient =
invert(mesh_motion_gradient);
5808 *
std::vector<Tensor<2, dim+1, Number>> rate_gradients(
dofs_per_cell);
5810 *
rate_gradients[i] = postprocess_tensor_dimension(
5811 *
-mesh_motion_fe_values[displacements].
gradient(i, q_point),
5812 *
-mesh_motion_fe_values[displacements].
value(i, q_point)[0]
5813 *
/mesh_motion_fe_values.quadrature_point(q_point)[0]) * inv_mesh_motion_gradient;
5817 *
const Number strain_divergence_i =
trace(rate_gradients[i]);
5818 *
strain_divergences[i].at(q_point) = Jacobian * strain_divergence_i;
5819 *
if (fill_system_matrix) {
5820 *
jacobian_tangents[i].at(q_point) = Jacobian * strain_divergence_i;
5822 *
strain_divergence_tangents[i][j].at(q_point) = Jacobian * (
trace(rate_gradients[i]) *
trace(rate_gradients[j]) -
trace(rate_gradients[i] * rate_gradients[j]));
5828 *
const unsigned int cell_index = cell->user_index() /
n_q_points;
5830 *
mixed_fe_projector[cell_index].project(
5831 *
&projected_Jacobian_coefficients,
5832 *
mesh_motion_jacobians);
5834 *
mixed_fe_projector[cell_index].project(
5835 *
&projected_strain_divergence_coefficients[i],
5836 *
strain_divergences[i]);
5837 *
if (fill_system_matrix) {
5838 *
mixed_fe_projector[cell_index].project(
5839 *
&projected_jacobian_tangent_coefficients[i],
5840 *
jacobian_tangents[i]);
5842 *
mixed_fe_projector[cell_index].project(
5843 *
&projected_strain_divergence_tangent_coefficients[i][j],
5844 *
strain_divergence_tangents[i][j]);
5849 *
for (
unsigned int q_point = 0; q_point <
n_q_points; ++q_point) {
5851 *
[[maybe_unused]]
const point_index_t quadrature_point_index = cell->user_index() + q_point;
5853 *
const Number cell_jacobian =
determinant(
static_cast<Tensor <2, dim, Number>
>(mesh_motion_fe_values.jacobian(q_point)));
5855 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5856 *
mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
5859 *
const auto mesh_motion_gradient = get_deformation_gradient(
5860 *
-mesh_motion_gradient_increments[q_point],
5861 *
-mesh_motion_value_increments[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
5863 *
const auto deformation_gradient = get_deformation_gradient(
5864 *
current_deformation_gradients[q_point] + deformation_gradient_increments[q_point],
5865 *
(current_deformation_values[q_point][0] + deformation_value_increments[q_point][0])
5866 *
/ mesh_motion_fe_values.quadrature_point(q_point)[0]);
5868 *
const auto inv_mesh_motion_gradient =
invert(mesh_motion_gradient);
5869 *
const auto inv_deformation_gradient =
invert(deformation_gradient);
5871 *
[[maybe_unused]]
const Number deformation_Jacobian =
determinant(deformation_gradient);
5872 *
const Number mesh_motion_Jacobian =
determinant(mesh_motion_gradient);
5874 *
Number projected_jacobian = 0;
5875 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5876 *
projected_jacobian +=
5877 *
mixed_values(i) * projected_Jacobian_coefficients.at(i);
5881 *
projected_strain_divergence[j] =
5882 *
mixed_values(0) * projected_strain_divergence_coefficients[j][0];
5883 *
if (fill_system_matrix) {
5884 *
projected_jacobian_tangent[j] =
5885 *
mixed_values(0) * projected_jacobian_tangent_coefficients[j][0];
5887 *
projected_strain_divergence_tangent[j][k] =
5889 *
* projected_strain_divergence_tangent_coefficients[j][k][0];
5894 *
for (
unsigned int i = 1; i < mixed_dofs_per_cell; ++i) {
5896 *
projected_strain_divergence[j] +=
5897 *
mixed_values(i) * projected_strain_divergence_coefficients[j][i];
5898 *
if (fill_system_matrix) {
5899 *
projected_jacobian_tangent[j] +=
5900 *
mixed_values(i) * projected_jacobian_tangent_coefficients[j][i];
5902 *
projected_strain_divergence_tangent[j][k] +=
5904 *
* projected_strain_divergence_tangent_coefficients[j][k][i];
5910 *
std::vector<Tensor<2, dim+1, Number>> rate_gradients(
dofs_per_cell);
5912 *
rate_gradients[i] = postprocess_tensor_dimension(
5913 *
-mesh_motion_fe_values[displacements].
gradient(i, q_point),
5914 *
-mesh_motion_fe_values[displacements].
value(i, q_point)[0]
5915 *
/mesh_motion_fe_values.quadrature_point(q_point)[0]) * inv_mesh_motion_gradient;
5919 *
std::pow(cell_jacobian, cell_jacobian_exponent) * mesh_motion_mu
5920 *
*
std::pow(mesh_motion_Jacobian, -Constants<dim, Number>::two_thirds())
5923 *
(deformation_gradient * mesh_motion_gradient)
5924 *
*
transpose(deformation_gradient * mesh_motion_gradient)));
5926 *
const Number pressure = mesh_motion_kappa *
std::log(projected_jacobian);
5929 *
const auto strain_i = deformation_gradient * rate_gradients[i] * inv_deformation_gradient;
5937 *
* mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5944 *
cell_residual(i) += (projected_strain_divergence.at(i) * pressure)
5945 *
* mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5947 *
if (fill_system_matrix) {
5950 *
const auto strain_j = deformation_gradient * rate_gradients[j] * inv_deformation_gradient;
5958 *
std::pow(cell_jacobian, cell_jacobian_exponent) * mesh_motion_mu
5959 *
*
std::pow(mesh_motion_Jacobian, -Constants<dim, Number>::two_thirds())
5963 *
* (deformation_gradient * mesh_motion_gradient)
5964 *
*
transpose(deformation_gradient * mesh_motion_gradient)));
5967 *
* mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5974 *
const Number pressure_tangent_j = mesh_motion_kappa * (1.0 / projected_jacobian) * projected_jacobian_tangent[j];
5975 *
cell_matrix(i, j) += (projected_strain_divergence.at(i) * pressure_tangent_j + projected_strain_divergence_tangent[i][j] * pressure)
5976 *
* mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5985 *
const Number relative_symmetry_norm2 =
cell_matrix.relative_symmetry_norm2();
5986 *
if(relative_symmetry_norm2 > 1e-8)
5987 * std::cout <<
"relative_symmetry_norm2: " <<
cell_matrix.relative_symmetry_norm2() << std::endl;
5993 *
std::vector<types::global_dof_index> local_dof_indices (
dofs_per_cell);
5994 *
cell->get_dof_indices (local_dof_indices);
5995 *
if (fill_system_matrix) {
5996 *
mesh_motion_dof_system.nodal_constraints.distribute_local_to_global(
5999 *
local_dof_indices,
6000 *
mesh_motion_nonlinear_system.Newton_step_matrix,
6001 *
mesh_motion_nonlinear_system.Newton_step_residual,
6004 *
mesh_motion_dof_system.nodal_constraints.distribute_local_to_global(
6005 *
cell_residual, local_dof_indices,
6006 *
mesh_motion_nonlinear_system.Newton_step_residual);
6011 *
const unsigned short local_domain_is_valid = kinematic_domains_are_valid ? 1 : 0;
6012 *
unsigned short all_kinematic_domains_are_valid;
6016 * did any of the processes fail to
assemble?
6020 *
&local_domain_is_valid,
6021 *
&all_kinematic_domains_are_valid, 1, MPI_UNSIGNED_SHORT,
6022 *
MPI_MIN, mpi_communicator);
6024 *
if (all_kinematic_domains_are_valid < 1) {
6025 *
throw std::runtime_error(
"The domain is not valid...");
6028 *
if (fill_system_matrix) {
6035 *
template<
typename BlockType>
6039 *
const BlockType &m1,
6040 *
const BlockType &m2):
6045 *
template<
typename VectorType>
6046 *
void vmult(VectorType &dst,
const VectorType &src)
const {
6047 *
m1.vmult(dst, src);
6048 *
m2.vmult_add(dst, src);
6052 *
const BlockType &m1;
6053 *
const BlockType &m2;
6058 * TODO encorporate mechanical and thermal subsystems into structs and include
functions in them
6061 *
template <
int dim,
typename Number>
6062 *
void PlasticityLabProg<dim, Number>::solve_system(
6063 *
const DoFSystem<dim, Number> &dof_system,
6064 *
NewtonStepSystem &nonlinear_system,
6065 *
const bool reset_solution) {
6069 *
const std::vector<std::vector<bool> > constant_modes
6073 *
std::vector<std::vector<bool> > constant_modes;
6079 *
additional_data.constant_modes = constant_modes;
6080 *
additional_data.elliptic =
true;
6081 *
additional_data.n_cycles = 1;
6082 *
additional_data.w_cycle =
false;
6083 *
additional_data.output_details =
false;
6084 *
additional_data.smoother_sweeps = 2;
6085 *
additional_data.aggregation_threshold = 1
e-2;
6086 *
preconditioner.initialize(nonlinear_system.Newton_step_matrix, additional_data);
6089 *
const Number relative_accuracy = 1
e-08;
6090 *
const Number solver_tolerance = relative_accuracy
6091 *
* nonlinear_system.Newton_step_matrix.residual(tmp, nonlinear_system.Newton_step_solution,
6092 *
nonlinear_system.Newton_step_residual);
6093 *
SolverControl solver_control(nonlinear_system.Newton_step_matrix.m(),
6094 *
solver_tolerance);
6098 *
if (reset_solution) {
6099 *
nonlinear_system.Newton_step_solution = 0;
6103 *
solver.solve(nonlinear_system.Newton_step_matrix, nonlinear_system.Newton_step_solution,
6104 *
nonlinear_system.Newton_step_residual, preconditioner);
6106 *
pcout <<
"solved in " << solver_control.last_step() <<
" steps to residual value of " << solver_control.last_value() << endl;
6107 *
pcout <<
"solution norm is: " << nonlinear_system.Newton_step_solution.l2_norm() << endl;
6109 *
dof_system.nodal_constraints.distribute (nonlinear_system.Newton_step_solution);
6113 *
template <
int dim,
typename Number>
6114 *
void PlasticityLabProg<dim, Number>::get_plastic_strain(
6118 *
const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors) {
6122 *
const unsigned int n_q_points = quadrature_formula.size();
6123 *
const unsigned int disc_dofs_per_cell = fe.dofs_per_cell;
6125 *
std::vector<Number> plastic_strain_qp_values(
n_q_points);
6126 *
std::vector<Number> projected_plastic_strains(disc_dofs_per_cell);
6128 *
auto cell = discontinuous_dof_handler.begin_active();
6129 *
auto endc = discontinuous_dof_handler.end();
6130 *
for (; cell != endc; ++cell) {
6131 *
if (cell->is_locally_owned()) {
6132 *
for (
unsigned int q_point = 0; q_point <
n_q_points; ++q_point) {
6133 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
6134 *
plastic_strain_qp_values[q_point] =
std::exp(material.get_state_parameters(quadrature_point_index).at(0)) - 1;
6137 *
const unsigned int cell_index = cell->user_index() /
n_q_points;
6138 *
qp_values_projectors[cell_index].project(
6139 *
&projected_plastic_strains,
6140 *
plastic_strain_qp_values);
6142 *
std::vector<types::global_dof_index> local_dof_indices (disc_dofs_per_cell);
6143 *
cell->get_dof_indices (local_dof_indices);
6144 *
for (
unsigned int dof_i = 0; dof_i < disc_dofs_per_cell; ++dof_i) {
6145 *
plastic_strain(local_dof_indices[dof_i]) = projected_plastic_strains.at(dof_i);
6152 *
template <
int dim,
typename Number>
6153 *
void PlasticityLabProg<dim, Number>::get_pressure(
6158 *
NewtonStepSystem &Newton_system,
6159 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6160 *
const NewtonStepSystem &thermal_Newton_system,
6161 *
const DoFSystem<dim, Number> &thermal_dof_system,
6163 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6164 *
const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors) {
6169 *
quadrature_formula,
6175 *
quadrature_formula,
6181 *
quadrature_formula,
6184 *
const unsigned int n_q_points = quadrature_formula.size();
6185 *
const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
6186 *
const unsigned int disc_dofs_per_cell = discontinuous_dof_handler.get_fe().dofs_per_cell;
6189 *
std::vector< Tensor<2, dim, Number> > current_displacement_gradients(
n_q_points);
6190 *
std::vector< Tensor<2, dim, Number> > displacement_gradient_increments(
n_q_points);
6191 *
std::vector< Tensor<1, dim, Number> > current_displacement_values(
n_q_points);
6192 *
std::vector< Tensor<1, dim, Number> > displacement_value_increments(
n_q_points);
6194 *
std::vector< Number > current_temperature_values(
n_q_points);
6195 *
std::vector< Number > updated_temperature_increments(
n_q_points);
6196 *
std::vector< Number > deformation_jacobians(
n_q_points);
6197 *
std::vector< Number > pressure_values(
n_q_points);
6198 *
std::vector< Number > von_mises_stress_values(
n_q_points);
6200 *
std::vector<Number> projected_temperature_coefficients(mixed_dofs_per_cell);
6201 *
std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
6202 *
std::vector<Number> projected_pressure_coefficients(mixed_dofs_per_cell);
6203 *
std::vector<Number> projected_von_mises_stress_coefficients(disc_dofs_per_cell);
6210 *
auto cell = mechanical_dof_system.dof_handler.begin_active();
6211 *
auto endc = mechanical_dof_system.dof_handler.end();
6212 *
auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
6213 *
auto mixed_fe_cell = mixed_fe_dof_handler.begin_active();
6214 *
auto discontinuous_fe_cell = discontinuous_dof_handler.begin_active();
6215 *
for (; cell != endc; ++cell, ++thermal_cell, ++mixed_fe_cell, ++discontinuous_fe_cell) {
6216 *
if (cell->is_locally_owned()) {
6218 *
fe_values.reinit (cell);
6219 *
fe_therm_values.reinit (thermal_cell);
6220 *
mixed_fe_values.reinit (mixed_fe_cell);
6222 *
fe_values[displacements].get_function_gradients(
6223 *
Newton_system.current_increment,
6224 *
displacement_gradient_increments);
6226 *
fe_values[displacements].get_function_gradients(
6227 *
Newton_system.previous_deformation,
6228 *
current_displacement_gradients);
6230 *
fe_values[displacements].get_function_values(
6231 *
Newton_system.current_increment,
6232 *
displacement_value_increments);
6234 *
fe_values[displacements].get_function_values(
6235 *
Newton_system.previous_deformation,
6236 *
current_displacement_values);
6238 *
fe_therm_values[
temperature].get_function_values (
6239 *
thermal_Newton_system.previous_deformation,
6240 *
current_temperature_values);
6242 *
fe_therm_values[
temperature].get_function_values (
6243 *
thermal_Newton_system.current_increment,
6244 *
updated_temperature_increments);
6248 * get vectors
for projection onto mixed fe values
6251 *
for (
unsigned int q_point = 0; q_point <
n_q_points;
6253 *
updated_temperature_increments.at(q_point) += current_temperature_values.at(q_point);
6255 *
const auto current_F = get_deformation_gradient(
6256 *
current_displacement_gradients[q_point],
6257 *
current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
6259 *
const auto updated_F = get_deformation_gradient(
6260 *
current_displacement_gradients[q_point]
6261 *
+ displacement_gradient_increments[q_point],
6262 *
(current_displacement_values[q_point][0]
6263 *
+ displacement_value_increments[q_point][0])/fe_values.quadrature_point(q_point)[0]);
6265 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
6271 *
const unsigned int cell_index = cell->user_index() /
n_q_points;
6273 *
mixed_fe_projector[cell_index].project(
6274 *
&projected_temperature_coefficients,
6275 *
updated_temperature_increments);
6276 *
mixed_fe_projector[cell_index].project(
6277 *
&projected_Jacobian_coefficients,
6278 *
deformation_jacobians);
6280 *
for (
unsigned int q_point = 0; q_point <
n_q_points; ++q_point) {
6282 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
6283 *
ConstitutiveModelRequest<dim+1, Number> constitutive_request(update_pressure | update_stress_deviator);
6285 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
6286 *
mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
6289 *
const auto current_F = get_deformation_gradient(
6290 *
current_displacement_gradients[q_point],
6291 *
current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
6293 *
const auto updated_F = get_deformation_gradient(
6294 *
current_displacement_gradients[q_point]
6295 *
+ displacement_gradient_increments[q_point],
6296 *
(current_displacement_values[q_point][0]
6297 *
+ displacement_value_increments[q_point][0])/fe_values.quadrature_point(q_point)[0]);
6299 *
[[maybe_unused]]
const auto inv_updated_F =
invert(updated_F);
6301 *
const Number previous_Jacobian =
determinant(current_F);
6303 *
const auto deformation_gradient_increment =
std::pow(Jacobian / previous_Jacobian, -Constants<dim, Number>::one_third()) * updated_F *
invert(current_F);
6305 *
Number projected_jacobian = 0;
6306 *
Number projected_temperature = 0;
6307 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
6308 *
projected_jacobian +=
6309 *
mixed_values(i) * projected_Jacobian_coefficients.at(i);
6310 *
projected_temperature +=
6311 *
mixed_values(i) * projected_temperature_coefficients.at(i);
6314 *
constitutive_request.set_deformation_Jacobian(projected_jacobian);
6315 *
constitutive_request.set_temperature(projected_temperature);
6316 *
constitutive_request.set_deformation_gradient(deformation_gradient_increment);
6317 *
constitutive_request.set_time_increment(time_increment);
6319 *
material.compute_constitutive_request(constitutive_request,
6320 *
quadrature_point_index);
6327 *
pressure_values.at(q_point) = constitutive_request.get_pressure();
6328 *
von_mises_stress_values.at(q_point) =
6329 *
constitutive_request.get_stress_deviator().norm() / Constants<dim, Number>::sqrt2thirds();
6332 *
mixed_fe_projector[cell_index].project(
6333 *
&projected_pressure_coefficients,
6336 *
qp_values_projectors[cell_index].project(
6337 *
&projected_von_mises_stress_coefficients,
6338 *
von_mises_stress_values);
6340 *
std::vector<types::global_dof_index> local_dof_indices (mixed_dofs_per_cell);
6341 *
mixed_fe_cell->get_dof_indices (local_dof_indices);
6342 *
for (
unsigned int dof_i = 0; dof_i < mixed_dofs_per_cell; ++dof_i) {
6343 *
pressure(local_dof_indices[dof_i]) = projected_pressure_coefficients.at(dof_i);
6346 *
std::vector<types::global_dof_index> local_discontinuous_dof_indices(disc_dofs_per_cell);
6347 *
discontinuous_fe_cell->get_dof_indices (local_discontinuous_dof_indices);
6348 *
for (
unsigned int dof_i = 0; dof_i < disc_dofs_per_cell; ++dof_i) {
6349 *
von_mises_stress(local_discontinuous_dof_indices[dof_i]) =
6350 *
projected_von_mises_stress_coefficients.at(dof_i);
6357 *
template <
int dim,
typename Number>
6358 *
void PlasticityLabProg<dim, Number>::prepare_output_results(
6360 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6361 *
const NewtonStepSystem &mechanical_nonlinear_system,
6362 *
const DoFSystem<dim, Number> &thermal_dof_system,
6363 *
const NewtonStepSystem &thermal_nonlinear_system,
6364 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6365 *
const NewtonStepSystem &mesh_motion_nonlinear_system)
const {
6367 *
std::vector<std::string> displacement_names(dim,
"displacement");
6368 *
displacement_names.emplace_back(
"angular_displacement");
6369 *
std::vector<std::string> velocity_names(dim,
"displacement_time_rate");
6370 *
velocity_names.emplace_back(
"angular_velocity");
6371 *
std::vector<DataComponentInterpretation::DataComponentInterpretation>
6372 *
data_component_interpretation(
6374 *
data_component_interpretation.push_back(
6377 *
std::vector<DataComponentInterpretation::DataComponentInterpretation>
6378 *
mesh_motion_data_component_interpretation(
6381 *
data_out.add_data_vector(mechanical_dof_system.dof_handler,
6382 *
mechanical_nonlinear_system.previous_deformation,
6383 *
displacement_names,
6384 *
data_component_interpretation);
6385 *
data_out.add_data_vector(mechanical_dof_system.dof_handler,
6386 *
mechanical_nonlinear_system.previous_time_derivative,
6388 *
data_component_interpretation);
6389 *
data_out.add_data_vector(thermal_dof_system.dof_handler,
6390 *
thermal_nonlinear_system.previous_deformation,
6392 *
data_out.add_data_vector(mesh_motion_dof_system.dof_handler,
6393 *
mesh_motion_nonlinear_system.previous_deformation,
6394 *
std::vector<std::string>(dim,
"mesh_motion"),
6395 *
mesh_motion_data_component_interpretation);
6396 *
data_out.add_data_vector(mesh_motion_dof_system.dof_handler,
6397 *
mesh_motion_nonlinear_system.previous_time_derivative,
6398 *
std::vector<std::string>(dim,
"mesh_velocity"),
6399 *
mesh_motion_data_component_interpretation);
6400 *
data_out.build_patches(
mapping, 2);
6403 *
template <
int dim,
typename Number>
6404 *
template <
typename TriangulationType>
6405 *
void PlasticityLabProg<dim, Number>::write_output_results(
6407 *
const TriangulationType &tria,
6408 *
const std::string &filename_base)
const {
6410 *
const std::string filename =
6411 *
(filename_base +
"-"
6414 *
std::ofstream output_vtu((filename +
".vtu").c_str());
6415 *
data_out.write_vtu(output_vtu);
6418 *
std::vector<std::string> filenames;
6419 *
for (
unsigned int i = 0;
6421 *
filenames.push_back(filename_base +
"-"
6424 *
std::ofstream pvtu_master_output((filename_base +
".pvtu").c_str());
6425 *
data_out.write_pvtu_record(pvtu_master_output, filenames);
6426 *
std::ofstream visit_master_output((filename_base +
".visit").c_str());
6431 *
template class PlasticityLabProg<2, double>;
6437<a name=
"ann-src/PlasticityLabProg.h"></a>
6438<h1>Annotated version of src/PlasticityLabProg.h</h1>
6451 *
#ifndef PLASTICITYLABPROG_H_
6452 *
#define PLASTICITYLABPROG_H_
6454 *
#include <deal.II/fe/fe_q.h>
6455 *
#include <deal.II/fe/fe_dgp.h>
6456 *
#include <deal.II/fe/fe_system.h>
6457 *
#include <deal.II/fe/mapping_q.h>
6459 *
#include <deal.II/distributed/tria.h>
6461 *
#include <deal.II/numerics/data_out.h>
6462 *
#include <deal.II/base/function.h>
6463 *
#include <stdexcept>
6465 *
#include
"DoFSystem.h"
6466 *
#include
"LBCSystem.h"
6467 *
#include
"MixedFEProjector.h"
6468 *
#include
"Material.h"
6469 *
#include
"NewtonStepSystem.h"
6472 *
using namespace dealii;
6474 *
template <
int dim,
typename Number =
double>
6475 *
class PlasticityLabProg {
6477 *
PlasticityLabProg(Material<dim+1, Number> &);
6478 *
virtual ~PlasticityLabProg();
6482 *
void make_grid (
int);
6483 *
void make_cylindrical_grid(
6484 *
Triangulation<dim> &triangulation,
6485 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6486 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6487 *
int n_initial_global_refinements);
6488 *
void make_grid_();
6489 *
void make_necking_grid(
6490 *
Triangulation<dim> &triangulation,
6491 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6492 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6493 *
int n_initial_global_refinements);
6494 *
void make_interference_cylinder_grid(
6495 *
Triangulation<dim> &triangulation,
6496 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6497 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6498 *
int n_initial_global_refinements);
6499 *
void make_cylindrical_impact_grid(
6500 *
Triangulation<dim> &triangulation,
6501 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6502 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6503 *
int n_initial_global_refinements);
6504 *
void make_ball_in_hypershell_grid(
6505 *
Triangulation<dim> &triangulation,
6506 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6507 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6508 *
int n_initial_global_refinements);
6509 *
void make_hook_membrane_grid(
int);
6511 *
void set_mesh_motion_LBCs(
6512 *
Triangulation<dim> &triangulation,
6513 *
LBCSystem<dim, Number, dim> &mesh_motion_lbc_system);
6516 *
Tensor<2, dim+1, Number> get_rotation_tensor(
const Tensor<2, dim+1, Number> &skew_symmetric_rotation)
const;
6517 *
Tensor<2, dim+1, Number> get_rotation_tensor_variation(
6518 *
const Tensor<2, dim+1, Number> &skew_symmetric_rotation,
6519 *
const Tensor<2, dim+1, Number> &skew_symmetric_rotation_variation)
const;
6522 *
void remap_material_state_variables(
6523 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6524 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6525 *
const NewtonStepSystem &mechanical_nonlinear_system,
6526 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6527 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6528 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6529 *
Material<dim+1, Number> &material,
6530 *
std::unordered_map<point_index_t, Tensor<2, dim+1, Number>> &remapped_deformation_gradients);
6533 *
void remap_thermal_field(
6534 *
NewtonStepSystem &thermal_nonlinear_system,
6535 *
const DoFSystem<dim, Number> &thermal_dof_system,
6536 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6537 *
const DoFSystem<dim, Number> &mesh_motion_dof_system);
6540 *
void remap_mechanical_fields(
6541 *
NewtonStepSystem &mechanical_nonlinear_system,
6542 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6543 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6544 *
const DoFSystem<dim, Number> &mesh_motion_dof_system);
6547 *
template <
typename TriangulationType,
typename MaterialType>
6548 *
void setup_material_data(TriangulationType &triangulation,
6549 *
MaterialType &material);
6551 *
void setup_material_area_factors(
6552 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6553 *
std::unordered_map<
size_t, Tensor<1, dim+1, Number>> &material_area_factors);
6555 *
void update_material_area_factors(
6556 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6557 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6558 *
std::unordered_map<
size_t, Tensor<1, dim+1, Number>> &material_area_factors);
6560 *
template <
typename TriangulationType>
6561 *
void setup_mixed_fe_projection_data(
6562 *
const TriangulationType &triangulation,
6563 *
std::vector< MixedFEProjector<dim, Number> > &MixedFeProjectors,
6564 *
const FiniteElement<dim> &MixedFE,
6565 *
const Quadrature<dim> &quadrature_formula);
6567 *
void assemble_mechanical_system(
6568 *
NewtonStepSystem &Newton_system,
6569 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6570 *
const LBCSystem<dim, Number, dim+1> &mechanical_lbc_system,
6571 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6572 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6573 *
const NewtonStepSystem &thermal_Newton_system,
6574 *
const DoFSystem<dim, Number> &thermal_dof_system,
6575 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6576 *
Material<dim+1, Number> &material,
6577 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6578 *
const bool fill_system_matrix =
true,
6579 *
const bool update_material_state =
false);
6581 *
void assemble_thermal_system(
6582 *
NewtonStepSystem &Newton_system,
6583 *
NewtonStepSystem &mechanical_nonlinear_system,
6584 *
const DoFSystem<dim, Number> &thermal_dof_system,
6585 *
const LBCSystem<dim, Number, 1> &thermal_lbc_system,
6586 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6587 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6588 *
Material<dim+1, Number> &material,
6589 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6590 *
const std::unordered_map<
size_t, Tensor<1, dim+1, Number>> &material_area_factors,
6591 *
const bool fill_system_matrix =
true);
6593 *
void assemble_mesh_motion_system(
6594 *
NewtonStepSystem &mesh_motion_nonlinear_system,
6595 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6596 *
const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
6597 *
const NewtonStepSystem &deformation_nonlinear_system,
6598 *
const DoFSystem<dim, Number> &deformation_dof_system,
6599 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6600 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6601 *
const bool fill_system_matrix =
true);
6603 *
void solve_system(
const DoFSystem<dim, Number> &dof_system,
6604 *
NewtonStepSystem &nonlinear_system,
6605 *
const bool reset_solution=
true);
6607 *
void prepare_output_results(DataOut<dim> &data_out,
6608 *
const DoFSystem<dim, Number> &dof_system,
6609 *
const NewtonStepSystem &nonlinear_system,
6610 *
const DoFSystem<dim, Number> &thermal_dof_system,
6611 *
const NewtonStepSystem &thermal_nonlinear_system,
6612 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6613 *
const NewtonStepSystem &mesh_motion_nonlinear_system)
const;
6615 *
template <
typename TriangulationType>
6616 *
void write_output_results(DataOut<dim> &data_out,
6617 *
const TriangulationType &tria,
6618 *
const std::string &filename_base)
const;
6620 *
void get_plastic_strain(
6621 *
TrilinosWrappers::MPI::Vector &plastic_strain,
6622 *
const DoFHandler<dim> &discontinuous_dof_handler,
6623 *
const Material<dim+1, Number> &material,
6624 *
const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors);
6626 *
void get_pressure(
6627 *
TrilinosWrappers::MPI::Vector &pressure,
6628 *
const DoFHandler<dim> &mixed_fe_dof_handler,
6629 *
TrilinosWrappers::MPI::Vector &von_mises_stress,
6630 *
const DoFHandler<dim> &discontinuous_dof_handler,
6631 *
NewtonStepSystem &Newton_system,
6632 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6633 *
const NewtonStepSystem &thermal_Newton_system,
6634 *
const DoFSystem<dim, Number> &thermal_dof_system,
6635 *
Material<dim+1, Number> &material,
6636 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6637 *
const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors);
6639 *
void solve_mechanical_step(
int time_step);
6640 *
void solve_thermal_step(
int time_step);
6642 *
void solve_mesh_motion_step(
6643 *
NewtonStepSystem &mesh_motion_nonlinear_system,
6644 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6645 *
const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
6646 *
const NewtonStepSystem &deformation_nonlinear_system,
6647 *
const DoFSystem<dim, Number> &deformation_dof_system,
6648 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6649 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6650 *
const int time_step);
6652 *
Tensor<2, dim+1, Number> get_deformation_gradient(
6653 *
const Tensor<2, dim, Number> &increment_gradient,
6654 *
const Number increment_0_over_rho) {
6656 *
for(
unsigned int i=0; i<dim; ++i){
6657 *
for(
unsigned int j=0; j<dim; ++j) {
6658 *
deformation_gradient[i][j] += increment_gradient[i][j];
6661 *
deformation_gradient[dim][dim] += increment_0_over_rho;
6662 *
return deformation_gradient;
6665 *
Tensor<2, dim+1, Number> postprocess_tensor_dimension(
6666 *
const Tensor<2, dim, Number> &dimension_short_tensor,
6667 *
const Number entry_0_over_rho) {
6668 *
Tensor<2, dim+1, Number> postprocessed_tensor;
6669 *
for(
unsigned int i=0; i<dim; ++i){
6670 *
for(
unsigned int j=0; j<dim; ++j) {
6671 *
postprocessed_tensor[i][j] = dimension_short_tensor[i][j];
6674 *
postprocessed_tensor[dim][dim] = entry_0_over_rho;
6675 *
return postprocessed_tensor;
6678 *
Tensor<1, dim+1, Number> postprocess_tensor_dimension(
6679 *
const Tensor<1, dim, Number> &dimension_short_tensor,
6680 *
const Number entry_at_dim=
static_cast<Number>(0.0)) {
6681 *
Tensor<1, dim+1, Number> postprocessed_tensor;
6682 *
for(
unsigned int i=0; i<dim; ++i){
6683 *
postprocessed_tensor[i] += dimension_short_tensor[i];
6685 *
postprocessed_tensor[dim] = entry_at_dim;
6686 *
return postprocessed_tensor;
6689 *
Tensor<1, dim+1, Number> scalar_to_angular_tensor(
const Number angular_value) {
6690 *
Tensor<1, dim+1, Number> postprocessed_tensor = Tensor<1, dim+1, Number>();
6691 *
postprocessed_tensor[dim] = angular_value;
6692 *
return postprocessed_tensor;
6695 *
Tensor<2, dim+1, Number> order_1_tensor_to_angular_gradient(
6696 *
const Tensor<1, dim, Number> &in_plane_gradient,
6697 *
const Number minus_entry_over_rho) {
6698 *
Tensor<2, dim+1, Number> postprocessed_tensor;
6699 *
for(
unsigned int i=0; i<dim; ++i) {
6700 *
postprocessed_tensor[dim][i] = in_plane_gradient[i];
6702 *
postprocessed_tensor[0][dim] = minus_entry_over_rho;
6703 *
return postprocessed_tensor;
6706 *
Tensor<2, dim+1, Number> deformation_gradient_from_angular_displacement_gradient(
6707 *
const Number angular_displacement,
6708 *
const Tensor<1, dim, Number> &angular_displacement_gradient,
6712 *
throw std::logic_error(
"Radial deformation gradient not implemented for dim!=2");
6715 *
Tensor<2, dim+1, Number> result;
6717 *
Tensor<1, dim, Number> angular_displacmenet_over_r_squared;
6718 *
angular_displacmenet_over_r_squared[0] = angular_displacement / (
radius *
radius);
6719 *
const Tensor<1, dim, Number> theta_gradient = angular_displacement_gradient /
radius - angular_displacmenet_over_r_squared;
6736 *
Tensor<2, dim+1, Number> deformation_gradient_from_angular_displacement_gradient_variations(
6737 *
const Number angular_displacement,
6738 *
const Tensor<1, dim, Number> &angular_displacement_gradient,
6740 *
const Number angular_displacement_variation,
6741 *
const Tensor<1, dim, Number> &angular_displacement_gradient_variation
6744 *
throw std::logic_error(
"Radial deformation gradient not implemented for dim!=2");
6747 *
Tensor<2, dim+1, Number> result;
6749 *
const Number theta_variation = angular_displacement_variation /
radius;
6751 *
Tensor<1, dim, Number> angular_displacmenet_over_r_squared;
6752 *
angular_displacmenet_over_r_squared[0] = angular_displacement / (
radius *
radius);
6753 *
const Tensor<1, dim, Number> theta_gradient = angular_displacement_gradient /
radius - angular_displacmenet_over_r_squared;
6755 *
Tensor<1, dim, Number> angular_displacmenet_variation_over_r_squared;
6756 *
angular_displacmenet_variation_over_r_squared[0] = angular_displacement_variation / (
radius *
radius);
6757 *
const Tensor<1, dim, Number> theta_gradient_variation = angular_displacement_gradient_variation /
radius - angular_displacmenet_variation_over_r_squared;
6759 *
result[0][0] = -
std::sin(theta) * theta_variation
6760 *
-
radius *
std::cos(theta) * theta_variation * theta_gradient[0]
6763 *
result[0][1] = -
radius *
std::cos(theta) * theta_variation * theta_gradient[1]
6766 *
result[0][2] = -
std::cos(theta) * theta_variation;
6772 *
result[2][0] =
std::cos(theta) * theta_variation
6773 *
-
radius *
std::sin(theta) * theta_variation * theta_gradient[0]
6776 *
result[2][1] = -
radius *
std::sin(theta) * theta_variation * theta_gradient[1]
6779 *
result[2][2] = -
std::sin(theta) * theta_variation;
6784 *
Tensor<2, dim+1, Number> rotation_tensor_to_transform_B_e(
6785 *
const Number angular_displacement,
6789 *
throw std::logic_error(
"Radial deformation gradient not implemented for dim!=2");
6792 *
Tensor<2, dim+1, Number> result;
6810 *
Tensor<2, dim+1, Number> rotation_tensor_variation_to_transform_B_e(
6811 *
const Number angular_displacement,
6812 *
const Number angular_displacement_variation,
6816 *
throw std::logic_error(
"Radial deformation gradient not implemented for dim!=2");
6819 *
Tensor<2, dim+1, Number> result;
6821 *
const Number theta_variation = angular_displacement_variation /
radius;
6823 *
result[0][0] = -
std::sin(theta) * theta_variation;
6825 *
result[0][2] = -
std::cos(theta) * theta_variation;
6831 *
result[2][0] =
std::cos(theta) * theta_variation;
6833 *
result[2][2] = -
std::sin(theta) * theta_variation;
6839 *
ConditionalOStream pcout;
6842 *
FESystem<dim> mech_fe;
6843 *
FE_Q<dim> therm_fe;
6844 *
FE_DGP<dim> mixed_var_fe;
6845 *
FESystem<dim> mesh_motion_fe;
6848 *
parallel::distributed::Triangulation<dim> triangulation;
6850 *
DoFSystem<dim, Number> mech_dof_system;
6851 *
DoFSystem<dim, Number> therm_dof_system;
6852 *
DoFSystem<dim, Number> mixed_fe_dof_system;
6854 *
LBCSystem<dim, Number, dim+1> mech_lbc_system;
6855 *
LBCSystem<dim, Number, 1> therm_lbc_system;
6857 *
NewtonStepSystem mech_nonlinear_system;
6858 *
NewtonStepSystem therm_nonlinear_system;
6860 *
NewtonStepSystem mesh_motion_nonlinear_system;
6861 *
DoFSystem<dim, Number> mesh_motion_dof_system;
6862 *
LBCSystem<dim, Number, dim> mesh_motion_lbc_system;
6864 *
NewtonStepSystem deformation_remapping_nonlinear_system;
6866 *
QGauss<dim> quadrature_formula;
6867 *
QGauss<dim-1> face_quadrature_formula;
6869 *
Material<dim+1, Number> &material;
6871 *
std::vector< MixedFEProjector<dim, Number> > mixed_FE_projectors;
6873 *
std::unordered_map<size_t, Tensor<1, dim+1, Number>> material_area_factors;
6876 *
unsigned int output_rate = 1;
6877 *
Number time_since_start = 0;
6879 *
const Number ambient_temperature = 293.0;
6880 *
const Number rho_infty = 0.0;
6882 *
const unsigned int surface_boundary_id = 2;
6884 *
const bool COMPUTE_FORCES_PER_UNIT_AREA_IN_CURRENT_CONFIGURATION =
false;
6885 *
const bool use_sigmoid_friction_law =
true;
6887 *
Number global_lagrangian_penalty_factor = 1.0;
6891 *
struct NewtonIterationDivergenceException : std::exception {
6892 *
const char *what() const _GLIBCXX_USE_NOEXCEPT
override {
6893 *
return "Newton step solution diverged!\n";
6903<a name=
"ann-src/PlasticityLabProgDrivers.cpp"></a>
6904<h1>Annotated version of src/PlasticityLabProgDrivers.cpp</h1>
6910 *
#include <sstream>
6912 *
#include <deal.II/grid/tria.h>
6913 *
#include <deal.II/grid/grid_generator.h>
6914 *
#include <deal.II/grid/grid_in.h>
6915 *
#include <deal.II/grid/manifold_lib.h>
6916 *
#include <deal.II/grid/grid_tools.h>
6919 *
#include <deal.II/fe/fe_dgq.h>
6921 *
#include
"RotationFunction.h"
6922 *
#include
"ScaleZFunction.h"
6923 *
#include
"ScaleComponentFunction.h"
6924 *
#include
"PlasticityLabProg.h"
6926 *
using namespace dealii;
6931 *
template <
int dim,
typename Number>
6932 *
void PlasticityLabProg<dim, Number>::run() {
6936 * make_ball_in_hypershell_grid(
6937 * make_cylindrical_grid(
6938 * make_cylindrical_impact_grid(
6941 *
make_necking_grid(
6952 * make_hook_membrane_grid(1);
6958 *
set_mesh_motion_LBCs(triangulation, mesh_motion_lbc_system);
6964 *
mech_dof_system.setup_dof_system(mech_fe);
6965 *
mech_lbc_system.apply_constraints(mech_dof_system);
6966 *
mech_nonlinear_system.setup(mech_dof_system);
6968 *
therm_dof_system.setup_dof_system(therm_fe);
6969 *
therm_lbc_system.apply_constraints(therm_dof_system);
6970 *
therm_nonlinear_system.setup(therm_dof_system);
6974 * Initialize the
temperature solution vector. Because we are
6975 * initializing with a possibly non-
zero value, we can
't just
6976 * assign that value to the vector in a parallel setting because
6977 * the solution vector has ghost entries and so is
6978 * read-only. Rather, we create a completely distributed vector,
6979 * assign the value to it, and then copy that into the solution
6984 * TrilinosWrappers::MPI::Vector tmp (therm_dof_system.locally_owned_dofs,
6985 * mpi_communicator);
6986 * tmp = ambient_temperature;
6987 * therm_nonlinear_system.previous_deformation = tmp;
6990 * mixed_fe_dof_system.setup_dof_system(mixed_var_fe);
6992 * mesh_motion_dof_system.setup_dof_system(mesh_motion_fe);
6993 * mesh_motion_lbc_system.apply_constraints(mesh_motion_dof_system);
6994 * mesh_motion_nonlinear_system.setup(mesh_motion_dof_system);
6996 * deformation_remapping_nonlinear_system.setup(mech_dof_system);
6998 * setup_material_data(triangulation, material);
6999 * setup_material_area_factors(mesh_motion_dof_system, material_area_factors);
7001 * setup_mixed_fe_projection_data(
7002 * triangulation, mixed_FE_projectors,
7003 * mixed_var_fe, quadrature_formula);
7005 * std::vector< MixedFEProjector<dim, Number> > discontinuous_projectors;
7006 * FE_DGQ<dim> discontinuous_fe(1);
7008 * setup_mixed_fe_projection_data(
7009 * triangulation, discontinuous_projectors,
7010 * discontinuous_fe, quadrature_formula);
7012 * TrilinosWrappers::MPI::Vector pressure(
7013 * mixed_fe_dof_system.locally_owned_dofs,
7014 * mpi_communicator);
7016 * DoFSystem<dim, Number> discontinuous_dof_system(triangulation, mapping);
7017 * discontinuous_dof_system.setup_dof_system(discontinuous_fe);
7018 * TrilinosWrappers::MPI::Vector plastic_strain(
7019 * discontinuous_dof_system.locally_owned_dofs,
7020 * mpi_communicator);
7021 * TrilinosWrappers::MPI::Vector von_mises_stress(
7022 * discontinuous_dof_system.locally_owned_dofs,
7023 * mpi_communicator);
7026 * TrilinosWrappers::MPI::Vector initial_velocity(
7027 * mech_dof_system.locally_owned_dofs,
7028 * mpi_communicator);
7030 * MPI_Barrier(mpi_communicator);
7032 * for(const auto initial_velocity_interpolation_handler: mech_lbc_system.initial_velocity_interpolation_handlers) {
7033 * initial_velocity_interpolation_handler->interpolate(initial_velocity, mech_dof_system);
7038 * Assigning the locally-owned vector into the ghosted vector performs
7039 * the necessary ghost import; compress() must not be called on a
7040 * vector that has ghost elements (it is read-only).
7043 * mech_nonlinear_system.previous_time_derivative = initial_velocity;
7048 * TrilinosWrappers::MPI::Vector initial_deformation(
7049 * mech_dof_system.locally_owned_dofs,
7050 * mpi_communicator);
7052 * MPI_Barrier(mpi_communicator);
7054 * for(const auto initial_deformation_interpolation_handler: mech_lbc_system.initial_deformation_interpolation_handlers) {
7055 * initial_deformation_interpolation_handler->interpolate(initial_deformation, mech_dof_system);
7058 * mech_nonlinear_system.previous_deformation = initial_deformation;
7062 * for (unsigned int timeStep = 0; timeStep < n_steps + 1; ++timeStep) {
7063 * for(const auto increment_interpolation_handler: mech_lbc_system.increment_interpolation_handlers) {
7064 * increment_interpolation_handler->advance_time(time_increment);
7067 * get_plastic_strain(
7069 * discontinuous_dof_system.dof_handler,
7071 * discontinuous_projectors);
7075 * mixed_fe_dof_system.dof_handler,
7077 * discontinuous_dof_system.dof_handler,
7078 * mech_nonlinear_system,
7080 * therm_nonlinear_system,
7083 * mixed_FE_projectors,
7084 * discontinuous_projectors);
7086 * if(0==timeStep % output_rate) {
7087 * pcout << "\nOutputting results..." << endl;
7088 * DataOut<dim> data_out;
7090 * data_out.add_data_vector(
7091 * discontinuous_dof_system.dof_handler,
7093 * "plastic_strain");
7094 * data_out.build_patches();
7096 * data_out.add_data_vector(
7097 * mixed_fe_dof_system.dof_handler,
7100 * data_out.build_patches();
7102 * data_out.add_data_vector(
7103 * discontinuous_dof_system.dof_handler,
7105 * "von_mises_stress");
7107 * prepare_output_results(
7110 * mech_nonlinear_system,
7112 * therm_nonlinear_system,
7113 * mesh_motion_dof_system,
7114 * mesh_motion_nonlinear_system);
7116 * std::ostringstream oss;
7117 * oss << "step_" << timeStep;
7118 * const std::string output_name = oss.str();
7119 * write_output_results(data_out, triangulation, output_name);
7122 * if (timeStep == n_steps) break;
7124 * pcout << "\n\nStarting time step " << timeStep << ":\n\n" << endl;
7127 * TrilinosWrappers::MPI::Vector step_increment(
7128 * mech_dof_system.locally_owned_dofs,
7129 * mpi_communicator);
7131 * MPI_Barrier(mpi_communicator);
7133 * for(const auto increment_interpolation_handler: mech_lbc_system.increment_interpolation_handlers) {
7134 * increment_interpolation_handler->interpolate(step_increment, mech_dof_system);
7137 * mech_nonlinear_system.current_increment = step_increment;
7140 * solve_mesh_motion_step(
7141 * mesh_motion_nonlinear_system,
7142 * mesh_motion_dof_system,
7143 * mesh_motion_lbc_system,
7144 * mech_nonlinear_system,
7146 * mixed_fe_dof_system,
7147 * mixed_FE_projectors,
7150 * mesh_motion_nonlinear_system.advance_time(time_increment, rho_infty, false);
7153 * The mesh-motion deformation is the negative of the just-computed
7154 * increment. 'previous_deformation
' is a ghosted (read-only) vector, so
7155 * this negation is delegated to the nonlinear system, which performs the
7156 * arithmetic in fully-distributed temporaries.
7159 * mesh_motion_nonlinear_system.set_previous_deformation_to_negative_current_increment();
7161 * std::unordered_map<point_index_t, Tensor<2, dim+1, Number>> remapped_deformation_gradients;
7162 * remap_material_state_variables(
7163 * mesh_motion_nonlinear_system,
7164 * mesh_motion_dof_system,
7165 * mech_nonlinear_system,
7167 * mixed_fe_dof_system,
7168 * mixed_FE_projectors,
7170 * remapped_deformation_gradients);
7172 * remap_thermal_field(
7173 * therm_nonlinear_system,
7175 * mesh_motion_nonlinear_system,
7176 * mesh_motion_dof_system);
7178 * remap_mechanical_fields(
7179 * mech_nonlinear_system,
7181 * mesh_motion_nonlinear_system,
7182 * mesh_motion_dof_system);
7184 * update_material_area_factors(
7185 * mesh_motion_nonlinear_system,
7186 * mesh_motion_dof_system,
7187 * material_area_factors);
7189 * solve_mechanical_step(timeStep);
7191 * solve_thermal_step(timeStep);
7193 * solve_mechanical_step(timeStep);
7197 * udpate material state
7200 * pcout << "\n\t\tassembling mechanical system updating material state..." << endl;
7201 * assemble_mechanical_system(
7202 * mech_nonlinear_system,
7205 * mesh_motion_nonlinear_system,
7206 * mesh_motion_dof_system,
7207 * therm_nonlinear_system,
7209 * mixed_fe_dof_system,
7211 * mixed_FE_projectors,
7215 * mech_nonlinear_system.advance_time(time_increment, rho_infty, true);
7218 * Accumulate the thermal increment into the (ghosted, read-only)
7219 * temperature field. The nonlinear system performs the addition in
7220 * fully-distributed temporaries and assigns the result back.
7223 * therm_nonlinear_system.add_current_increment_to_previous_deformation();
7225 * therm_nonlinear_system.current_increment = 0;
7227 * pcout << "Next timestep..." << std::endl;
7229 * } /*for(timeStep)*/
7232 * template<int dim, typename Number>
7233 * void PlasticityLabProg<dim, Number>::solve_mechanical_step(int time_step) {
7235 * TrilinosWrappers::MPI::Vector total_residual;
7237 * for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7239 * pcout << "\n\ttime step " << time_step
7240 * << ", Newton step " << NewtonStep << "..."
7241 * << "\n\t\tassembling mechanical system with tangents..." << endl;
7243 * assemble_mechanical_system(
7244 * mech_nonlinear_system,
7247 * mesh_motion_nonlinear_system,
7248 * mesh_motion_dof_system,
7249 * therm_nonlinear_system,
7251 * mixed_fe_dof_system,
7253 * mixed_FE_projectors,
7256 * total_residual = mech_nonlinear_system.Newton_step_residual;
7257 * total_residual.compress(VectorOperation::insert);
7259 * pcout << "-------------------------------------------------------------------" << endl;
7261 * pcout << "Normalized system residual: "
7262 * << std::sqrt(total_residual.norm_sqr())
7263 * << " ..." << endl;
7264 * pcout << "-------------------------------------------------------------------" << endl;
7266 * if (std::sqrt(total_residual.norm_sqr()) <= 1e-5) {
7270 * const Number old_residual = total_residual.norm_sqr();
7271 * Number previous_residual = old_residual;
7273 * pcout << "solving system..." << endl;
7275 * solve_system(mech_dof_system, mech_nonlinear_system);
7277 * if (std::isnan(mech_nonlinear_system.Newton_step_solution.norm_sqr())) {
7280 * pcout << "System solution falied. Continuing with partial solution..." << endl;
7282 * mech_dof_system.nodal_constraints.distribute(
7283 * mech_nonlinear_system.Newton_step_solution);
7284 * const Number solution_norm = std::sqrt(
7285 * mech_nonlinear_system.Newton_step_solution.norm_sqr());
7286 * TrilinosWrappers::MPI::Vector full_step_increment(mech_nonlinear_system.current_increment);
7287 * TrilinosWrappers::MPI::Vector temp_locally_owned_increment(mech_dof_system.locally_owned_dofs);
7289 * Number clip_factor =
7290 * (solution_norm <= std::sqrt(old_residual)) ?
7291 * 1.0 : sqrt(old_residual) / solution_norm;
7292 * if (clip_factor < 1.0) pcout << "clip factor: " << clip_factor << endl;
7294 * pcout << "doing line search..." << endl;
7295 * [[maybe_unused]] bool hit_line_search_limit = false;
7296 * for (unsigned int i = 0; true/*i < 18*/; ++i) {
7297 * const Number alpha = std::pow(0.5, static_cast<Number>(i));
7298 * if (i > 5 && clip_factor * alpha * solution_norm < 1e-1) {
7299 * hit_line_search_limit = true;
7302 * if (i > 0) pcout << "\tline search step " << i << "..." << endl;
7305 * temp_locally_owned_increment = full_step_increment;
7306 * temp_locally_owned_increment.sadd(1, -alpha * clip_factor, mech_nonlinear_system.Newton_step_solution);
7307 * temp_locally_owned_increment.compress(VectorOperation::insert);
7308 * mech_nonlinear_system.current_increment = temp_locally_owned_increment;
7311 * assemble_mechanical_system(
7312 * mech_nonlinear_system,
7315 * mesh_motion_nonlinear_system,
7316 * mesh_motion_dof_system,
7317 * therm_nonlinear_system,
7319 * mixed_fe_dof_system,
7321 * mixed_FE_projectors,
7323 * } catch (const std::runtime_error &) {
7324 * clip_factor *= 0.125; // using a power of 0.5; better for binary arithmetic
7325 * pcout << "\t-------------------------------------------------------------------" << endl;
7326 * pcout << "\tDeformation too large, causing degenerate mesh..." << endl;
7327 * pcout << "\tupdated clip factor: " << clip_factor << endl;
7328 * pcout << "\t-------------------------------------------------------------------" << endl;
7334 * total_residual = mech_nonlinear_system.Newton_step_residual;
7335 * total_residual.compress(VectorOperation::insert);
7337 * const Number current_residual = total_residual.norm_sqr();
7339 * pcout << "\t-------------------------------------------------------------------" << endl;
7341 * pcout << "\tNormalized system residual: "
7342 * << std::sqrt(current_residual)
7343 * << " ..." << endl;
7344 * pcout << "\t-------------------------------------------------------------------" << endl;
7346 * if (previous_residual < old_residual and current_residual >= previous_residual) {
7347 * pcout << "\t---Accepting previous residual: " << std::sqrt(previous_residual)
7348 * << " ..." << endl;
7350 * temp_locally_owned_increment = full_step_increment;
7351 * temp_locally_owned_increment.sadd(1, -2 * alpha * clip_factor, mech_nonlinear_system.Newton_step_solution);
7352 * temp_locally_owned_increment.compress(VectorOperation::insert);
7353 * mech_nonlinear_system.current_increment = temp_locally_owned_increment;
7356 * previous_residual = current_residual;
7363 * template<int dim, typename Number>
7364 * void PlasticityLabProg<dim, Number>::solve_thermal_step(int time_step) {
7366 * TrilinosWrappers::MPI::Vector total_therm_residual;
7367 * const Number starting_thermal_residual_squared_norm = 1.0;
7369 * for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7371 * pcout << "\n\ttime step " << time_step
7372 * << ", Newton step " << NewtonStep << "..."
7373 * << "\n\t\tassembling thermal system with tangents..." << endl;
7375 * assemble_thermal_system(
7376 * therm_nonlinear_system,
7377 * mech_nonlinear_system,
7381 * mixed_fe_dof_system,
7383 * mixed_FE_projectors,
7384 * material_area_factors,
7387 * total_therm_residual = therm_nonlinear_system.Newton_step_residual;
7388 * total_therm_residual.compress(VectorOperation::insert);
7390 * pcout << "-------------------------------------------------------------------" << endl;
7391 * pcout << "Normalized system residual (contactor): "
7392 * << std::sqrt(total_therm_residual.norm_sqr()
7393 * / starting_thermal_residual_squared_norm)
7394 * << " ..." << endl;
7395 * pcout << "-------------------------------------------------------------------" << endl;
7397 * if (std::sqrt(total_therm_residual.norm_sqr()
7398 * / starting_thermal_residual_squared_norm) <= 1e-6) {
7402 * const Number old_residual = total_therm_residual.norm_sqr();
7404 * pcout << "solving system..." << endl;
7406 * solve_system(therm_dof_system, therm_nonlinear_system);
7408 * therm_dof_system.nodal_constraints.distribute(therm_nonlinear_system.Newton_step_solution);
7409 * TrilinosWrappers::MPI::Vector full_step_increment(therm_nonlinear_system.current_increment);
7411 * TrilinosWrappers::MPI::Vector temp_locally_owned_increment(therm_dof_system.locally_owned_dofs);
7414 * pcout << "doing line search..." << endl;
7415 * for (unsigned int i = 0; i < (NewtonStep > 0 ? 6 : 1); ++i) {
7416 * const Number alpha = std::pow(0.5, static_cast<Number>(i));
7418 * temp_locally_owned_increment = full_step_increment;
7419 * temp_locally_owned_increment.sadd(1, -alpha, therm_nonlinear_system.Newton_step_solution);
7420 * therm_dof_system.nodal_constraints.distribute(temp_locally_owned_increment);
7421 * temp_locally_owned_increment.compress(VectorOperation::insert);
7422 * therm_nonlinear_system.current_increment = temp_locally_owned_increment;
7424 * assemble_thermal_system(
7425 * therm_nonlinear_system,
7426 * mech_nonlinear_system,
7430 * mixed_fe_dof_system,
7432 * mixed_FE_projectors,
7433 * material_area_factors,
7436 * total_therm_residual = therm_nonlinear_system.Newton_step_residual;
7437 * total_therm_residual.compress(VectorOperation::insert);
7439 * const Number current_residual = total_therm_residual.norm_sqr();
7440 * if (current_residual < old_residual)
7448 * template<int dim, typename Number>
7449 * void PlasticityLabProg<dim, Number>::solve_mesh_motion_step(
7450 * NewtonStepSystem &mesh_motion_nonlinear_system,
7451 * const DoFSystem<dim, Number> &mesh_motion_dof_system,
7452 * const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
7453 * const NewtonStepSystem &deformation_nonlinear_system,
7454 * const DoFSystem<dim, Number> &deformation_dof_system,
7455 * const DoFSystem<dim, Number> &mixed_fe_dof_system,
7456 * const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
7457 * const int time_step) {
7459 * TrilinosWrappers::MPI::Vector total_residual;
7461 * for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7463 * pcout << "\n\ttime step " << time_step
7464 * << ", Newton step " << NewtonStep << "..."
7465 * << "\n\t\tassembling mesh motion system with tangents..." << endl;
7467 * assemble_mesh_motion_system(
7468 * mesh_motion_nonlinear_system,
7469 * mesh_motion_dof_system,
7470 * mesh_motion_lbc_system,
7471 * deformation_nonlinear_system,
7472 * deformation_dof_system,
7473 * mixed_fe_dof_system,
7474 * mixed_fe_projector,
7477 * total_residual = mesh_motion_nonlinear_system.Newton_step_residual;
7478 * total_residual.compress(VectorOperation::insert);
7480 * pcout << "-------------------------------------------------------------------" << endl;
7482 * pcout << "Normalized system residual: "
7483 * << std::sqrt(total_residual.norm_sqr())
7484 * << " ..." << endl;
7485 * pcout << "-------------------------------------------------------------------" << endl;
7487 * if (std::sqrt(total_residual.norm_sqr()) <= 1e-4) {
7491 * const Number old_residual = total_residual.norm_sqr();
7492 * Number previous_residual = old_residual;
7494 * pcout << "solving system..." << endl;
7496 * solve_system(mesh_motion_dof_system, mesh_motion_nonlinear_system);
7498 * if (std::isnan(mesh_motion_nonlinear_system.Newton_step_solution.norm_sqr())) {
7501 * pcout << "System solution falied. Continuing with partial solution..." << endl;
7503 * mesh_motion_dof_system.nodal_constraints.distribute(mesh_motion_nonlinear_system.Newton_step_solution);
7504 * const Number solution_norm = std::sqrt(mesh_motion_nonlinear_system.Newton_step_solution.norm_sqr());
7505 * TrilinosWrappers::MPI::Vector full_step_increment(mesh_motion_nonlinear_system.current_increment);
7506 * TrilinosWrappers::MPI::Vector temp_locally_owned_increment(mesh_motion_dof_system.locally_owned_dofs);
7508 * Number clip_factor =
7509 * (solution_norm <= std::sqrt(old_residual)) ? 1.0 : sqrt(old_residual) / solution_norm;
7510 * if (clip_factor < 1.0) pcout << "clip factor: " << clip_factor << endl;
7512 * pcout << "doing line search..." << endl;
7513 * [[maybe_unused]] bool hit_line_search_limit = false;
7514 * for (unsigned int i = 0; true/*i < 18*/; ++i) {
7515 * const Number alpha = std::pow(0.5, static_cast<Number>(i));
7516 * if (i > 5 && clip_factor * alpha * solution_norm < 1e-1) {
7517 * hit_line_search_limit = true;
7520 * if (i > 0) pcout << "\tline search step " << i << "..." << endl;
7523 * temp_locally_owned_increment = full_step_increment;
7524 * temp_locally_owned_increment.sadd(1, -alpha * clip_factor, mesh_motion_nonlinear_system.Newton_step_solution);
7525 * temp_locally_owned_increment.compress(VectorOperation::insert);
7526 * mesh_motion_nonlinear_system.current_increment = temp_locally_owned_increment;
7529 * assemble_mesh_motion_system(
7530 * mesh_motion_nonlinear_system,
7531 * mesh_motion_dof_system,
7532 * mesh_motion_lbc_system,
7533 * deformation_nonlinear_system,
7534 * deformation_dof_system,
7535 * mixed_fe_dof_system,
7536 * mixed_fe_projector,
7538 * } catch (const std::runtime_error &) {
7539 * clip_factor *= 0.125; // using a power of 0.5; better for binary arithmetic
7540 * pcout << "\t-------------------------------------------------------------------" << endl;
7541 * pcout << "\tDeformation too large, causing degenerate mesh..." << endl;
7542 * pcout << "\tupdated clip factor: " << clip_factor << endl;
7543 * pcout << "\t-------------------------------------------------------------------" << endl;
7549 * total_residual = mesh_motion_nonlinear_system.Newton_step_residual;
7550 * total_residual.compress(VectorOperation::insert);
7552 * const Number current_residual = total_residual.norm_sqr();
7554 * pcout << "\t-------------------------------------------------------------------" << endl;
7556 * pcout << "\tNormalized system residual: "
7557 * << std::sqrt(current_residual)
7558 * << " ..." << endl;
7559 * pcout << "\t-------------------------------------------------------------------" << endl;
7561 * if (previous_residual < old_residual and current_residual >= previous_residual) {
7562 * pcout << "\t---Accepting previous residual: " << std::sqrt(previous_residual)
7563 * << " ..." << endl;
7565 * temp_locally_owned_increment = full_step_increment;
7566 * temp_locally_owned_increment.sadd(1, -2 * alpha * clip_factor, mesh_motion_nonlinear_system.Newton_step_solution);
7567 * temp_locally_owned_increment.compress(VectorOperation::insert);
7568 * mesh_motion_nonlinear_system.current_increment = temp_locally_owned_increment;
7571 * previous_residual = current_residual;
7577 * template <int dim>
7578 * struct RefiningTransform
7580 * RefiningTransform(
7582 * double refining_fraction,
7584 * size_t dimension=1) :
7586 * refining_fraction(refining_fraction),
7588 * dimension(dimension) {}
7590 * Point<dim> operator()(const Point<dim> &p) const
7593 * if ((p[dimension]-base)/(height-base) <= 0.5) {
7594 * q[dimension] = base + refining_fraction/0.5 * (p[dimension]-base);
7595 * } else if ((p[dimension]-base)/(height-base) > 0.5) {
7596 * q[dimension] = base + refining_fraction * (height - base) + (1.0 - refining_fraction) / 0.5 * (p[dimension] - 0.5 * (height + base));
7602 * double refining_fraction;
7608 * template <int dim, typename Number>
7609 * void PlasticityLabProg<dim, Number>::set_mesh_motion_LBCs(
7610 * Triangulation<dim> &triangulation,
7611 * LBCSystem<dim, Number, dim> &mesh_motion_lbc_system) {
7613 * std::set<types::boundary_id> all_boundary_ids;
7614 * for(types::boundary_id id: triangulation.get_boundary_ids()) {
7615 * all_boundary_ids.insert(id);
7618 * mesh_motion_lbc_system.no_normal_flux_constraints.push_back(std::make_pair(0, all_boundary_ids));
7622 * template <int dim, typename Number>
7623 * void PlasticityLabProg<dim, Number>::make_cylindrical_grid(
7624 * Triangulation<dim> &triangulation,
7625 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
7626 * LBCSystem<dim, Number, 1> &therm_lbc_system,
7627 * int n_initial_global_refinements) {
7629 * [[maybe_unused]] const Number initial_velocity = 1.9e5; // [mm/s]
7630 * const Number height = 2.5*25.4; // [mm]
7631 * const Number inner_radius = 12.5; // [mm]
7632 * const Number radius = 12.5; // [mm]
7634 * const Number top_coordinate = height/2;
7635 * const Number base_coordinate = 0.0;
7637 * const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
7638 * const unsigned int aspect_ratio = std::ceil(0.25 * height / radius);
7640 * GridGenerator::subdivided_hyper_rectangle(
7642 * std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
7643 * Point<dim>(inner_radius, base_coordinate),
7644 * Point<dim>(inner_radius + radius, top_coordinate),
7648 * for (auto &cell: triangulation.active_cell_iterators()) {
7649 * for (const auto &face : cell->face_iterators()) {
7650 * if(face->boundary_id() == 0 || face->boundary_id() == 1) {
7651 * if(face->center()[1] > 0.95 * height/2) {
7652 * face->set_boundary_id(4);
7660 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.3, base_coordinate), triangulation);
7661 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.4, base_coordinate), triangulation);
7662 * GridTools::transform(RefiningTransform<dim>/(inner_radius, 0.35, inner_radius + radius, 0), triangulation);
7666 * for(unsigned int i=0; i<2; i++) {
7667 * for (auto &cell : triangulation.active_cell_iterators()) {
7668 * for (const auto &face : cell->face_iterators()) {
7669 * if (face->boundary_id() == 2) {
7670 * cell->set_refine_flag();
7675 * triangulation.execute_coarsening_and_refinement();
7682 * ComponentMask x_component_mask(dim+1, false);
7683 * x_component_mask.set(0, true);
7684 * ComponentMask y_component_mask(dim+1, false);
7685 * y_component_mask.set(1, true);
7686 * ComponentMask x_and_y_component_mask(dim+1, false);
7687 * x_and_y_component_mask.set(0, true);
7688 * x_and_y_component_mask.set(1, true);
7689 * ComponentMask z_component_mask(dim+1, false);
7690 * z_component_mask.set(dim-1, true);
7691 * ComponentMask rho_component_mask(dim+1, false);
7692 * rho_component_mask.set(dim, true);
7696 * std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
7697 * base_constraint_function_map.insert(
7698 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7699 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7700 * InterpolatoryConstraintApplier<dim, Number>(
7701 * base_constraint_function_map,
7702 * y_component_mask));
7708 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7709 * top_constraint_function_map.insert(
7710 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7711 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7712 * InterpolatoryConstraintApplier<dim, Number>(
7713 * top_constraint_function_map,
7714 * x_component_mask));
7716 * std::map< types::boundary_id, const Function< dim, Number > * > clamp_constraint_function_map;
7717 * clamp_constraint_function_map.insert(
7718 * std::pair<types::boundary_id, Function<dim, Number>*>(4, &mech_lbc_system.zero_function));
7719 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7720 * InterpolatoryConstraintApplier<dim, Number>(
7721 * clamp_constraint_function_map,
7722 * x_component_mask));
7724 * if(std::abs(inner_radius) < 1e-16) {
7725 * std::map< types::boundary_id, const Function< dim, Number > * > axial_constraint_function_map;
7726 * axial_constraint_function_map.insert(
7727 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7728 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7729 * InterpolatoryConstraintApplier<dim, Number>(
7730 * axial_constraint_function_map,
7731 * x_component_mask));
7733 * std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
7734 * axial_rotation_constraint_function_map.insert(
7735 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7736 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7737 * InterpolatoryConstraintApplier<dim, Number>(
7738 * axial_rotation_constraint_function_map,
7739 * rho_component_mask));
7744 * therm_lbc_system.boundaryLoadAppliers.push_back(
7745 * std::pair<int,BodyForceApplier<dim,Number> >(
7746 * 2, BodyForceApplier<dim,Number>(0, 22e0)));
7752 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
7753 * top_rotation_constraint_function_map.insert(
7754 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7755 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7756 * InterpolatoryConstraintApplier<dim, Number>(
7757 * top_rotation_constraint_function_map,
7758 * rho_component_mask));
7762 * std::map< types::boundary_id, const Function< dim, Number > * > base_rotation_constraint_function_map;
7763 * base_rotation_constraint_function_map.insert(
7764 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7765 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7766 * InterpolatoryConstraintApplier<dim, Number>(
7767 * base_rotation_constraint_function_map,
7768 * rho_component_mask));
7772 * Thermal constraints
7775 * const Number convection_coefficient = /*17.5e-6*/ 100e-6; // [J.mm^-2.s^-1.K^-1]
7776 * therm_lbc_system.convection_BC_appliers.push_back(
7777 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7779 * ConvectionBoundaryConditionApplier<dim, Number>(
7780 * 0, convection_coefficient, ambient_temperature)));
7781 * therm_lbc_system.convection_BC_appliers.push_back(
7782 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7784 * ConvectionBoundaryConditionApplier<dim, Number>(
7785 * 0, convection_coefficient, ambient_temperature)));
7786 * therm_lbc_system.convection_BC_appliers.push_back(
7787 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7789 * ConvectionBoundaryConditionApplier<dim, Number>(
7790 * 0, convection_coefficient, ambient_temperature)));
7791 * therm_lbc_system.convection_BC_appliers.push_back(
7792 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7794 * ConvectionBoundaryConditionApplier<dim, Number>(
7795 * 0, convection_coefficient, ambient_temperature)));
7799 * therm_lbc_system.convection_BC_appliers.push_back(
7800 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7802 * ConvectionBoundaryConditionApplier<dim, Number>(
7803 * 0, 3000*convection_coefficient, 1350.0 /*a little less than melting*/)));
7807 * const Number total_elongation = 2 * 80.0; // mm
7808 * const Number elongation_rate = time_since_start < 6.0? 0.05 : 1.75; // [mm/s]
7809 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
7810 * auto scale_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7811 * new ConstantFunction<dim, Number>({0, -total_elongation/(static_cast<Number>(n_steps)/**height*/), 0}),
7815 * ComponentMask(dim+1, false),
7821 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_z_handler);
7827 * mech_lbc_system.boundaryLoadAppliers.push_back(
7828 * std::pair<int,BodyForceApplier<dim,Number> >(
7829 * 3, BodyForceApplier<dim,Number>(dim-1, -40)));
7831 * auto top_surface_unidirectional_penalty_spec = new BoundaryUnidirectionalPenaltySpec<Number>(3, 1e-2, 0, 1e4 / (time_increment * time_increment) );
7832 * mech_lbc_system.boundary_unidirectional_penalty_specs.push_back(top_surface_unidirectional_penalty_spec);
7836 * auto constant_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7837 * new ScaleZFunction<dim, Number, dim+1>(-total_elongation/(static_cast<Number>(n_steps)*time_increment/**height*/), dim-1),
7841 * ComponentMask(dim+1, false),
7844 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_velocity_handler);
7845 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7846 * top_constraint_function_map.insert(
7847 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7848 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7849 * InterpolatoryConstraintApplier<dim, Number>(
7850 * top_constraint_function_map,
7851 * y_component_mask));
7857 * const Number drive_speed = 0.8*314.159/3.0; // [rad/s]
7859 * auto scale_rotation_increment = new IncrementInterpolationHandler<dim, Number, dim+1>(
7860 * new ScaleComponentFunction<dim, Number, dim+1>(drive_speed * time_increment, 0, dim),
7862 * rho_component_mask,
7864 * ComponentMask(dim+1, false),
7867 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_rotation_increment);
7869 * auto constant_angular_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7870 * new ScaleComponentFunction<dim, Number, dim+1>(drive_speed, 0, dim),
7872 * rho_component_mask,
7874 * ComponentMask(dim+1, false),
7877 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_angular_velocity_handler);
7881 * mech_lbc_system.boundaryLoadAppliers.push_back(
7882 * std::pair<int,BodyForceApplier<dim,Number> >(
7883 * 1, BodyForceApplier<dim,Number>(dim, 3.750e0)));
7889 * } /* make_cylindrical_grid() */
7892 * template <int dim, typename Number>
7893 * void PlasticityLabProg<dim, Number>::make_grid_() {
7895 * } /*make_grid_()*/
7897 * template <int dim>
7898 * struct InterferenceTaperTransform
7900 * Point<dim> operator()(const Point<dim> &p) const
7903 * if (p[0]>=35 && p[0]<=300 && p[1]<=0 && p[1]>=-150)
7905 * q[0] += 5 * ((p[1] + 150) / 150) * ((p[0]-300) / (35-300));
7911 * template <int dim>
7912 * struct NeckingTaperTransform
7915 * NeckingTaperTransform(double factor) : factor(factor) {}
7917 * Point<dim> operator()(const Point<dim> &p) const
7920 * q[0] += factor * q[0] * q[1];
7926 * template <int dim, typename Number>
7927 * void PlasticityLabProg<dim, Number>::make_necking_grid(
7928 * Triangulation<dim> &triangulation,
7929 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
7930 * LBCSystem<dim, Number, 1> &therm_lbc_system,
7931 * int n_initial_global_refinements) {
7933 * const Number height = 53.334; // [mm]
7934 * const Number radius = 6.413; // [mm]
7936 * const Number top_coordinate = height/2;
7937 * const Number base_coordinate = 0.0;
7938 * const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
7939 * const unsigned int aspect_ratio = std::ceil(0.5 * height / radius);
7941 * GridGenerator::subdivided_hyper_rectangle(
7943 * std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
7944 * Point<dim>(0, base_coordinate),
7945 * Point<dim>(radius, top_coordinate),
7951 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.15, base_coordinate), triangulation);
7957 * ComponentMask x_component_mask(dim+1, false);
7958 * x_component_mask.set(0, true);
7959 * ComponentMask y_component_mask(dim+1, false);
7960 * y_component_mask.set(1, true);
7961 * ComponentMask z_component_mask(dim+1, false);
7962 * z_component_mask.set(dim-1, true);
7963 * ComponentMask rho_component_mask(dim+1, false);
7964 * rho_component_mask.set(dim, true);
7966 * std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
7967 * base_constraint_function_map.insert(
7968 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7969 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7970 * InterpolatoryConstraintApplier<dim, Number>(
7971 * base_constraint_function_map,
7972 * y_component_mask));
7974 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7975 * top_constraint_function_map.insert(
7976 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7977 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7978 * InterpolatoryConstraintApplier<dim, Number>(
7979 * top_constraint_function_map,
7980 * y_component_mask));
7982 * std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
7983 * yz_constraint_function_map.insert(
7984 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7985 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7986 * InterpolatoryConstraintApplier<dim, Number>(
7987 * yz_constraint_function_map,
7988 * x_component_mask));
7991 * const Number total_elongation = 2*8.0; // mm
7992 * const Number elongation_rate = 2*1.0; // [mm/s]
7993 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
7995 * auto scale_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7996 * new ScaleZFunction<dim, Number, dim+1>(total_elongation/(static_cast<Number>(n_steps)*height), dim-1),
8000 * ComponentMask(dim+1, false),
8004 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_z_handler);
8006 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8007 * top_rotation_constraint_function_map.insert(
8008 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8009 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8010 * InterpolatoryConstraintApplier<dim, Number>(
8011 * top_rotation_constraint_function_map,
8012 * rho_component_mask));
8014 * std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8015 * axial_rotation_constraint_function_map.insert(
8016 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8017 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8018 * InterpolatoryConstraintApplier<dim, Number>(
8019 * axial_rotation_constraint_function_map,
8020 * rho_component_mask));
8024 * Thermal constraints
8027 * const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8028 * therm_lbc_system.convection_BC_appliers.push_back(
8029 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8031 * ConvectionBoundaryConditionApplier<dim, Number>(
8032 * 0, convection_coefficient, ambient_temperature)));
8033 * therm_lbc_system.convection_BC_appliers.push_back(
8034 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8036 * ConvectionBoundaryConditionApplier<dim, Number>(
8037 * 0, convection_coefficient, ambient_temperature)));
8038 * } /* make_necking_grid() */
8041 * template <int dim, typename Number>
8042 * void PlasticityLabProg<dim, Number>::make_interference_cylinder_grid(
8043 * Triangulation<dim> &triangulation,
8044 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8045 * LBCSystem<dim, Number, 1> &therm_lbc_system,
8046 * int n_initial_global_refinements) {
8048 * const Number height = 300.0; // [mm]
8049 * const Number radius = 40.0; // [mm]
8051 * const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
8052 * const unsigned int aspect_ratio = std::ceil(0.5 * height / radius);
8054 * GridGenerator::subdivided_hyper_rectangle(
8056 * std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
8058 * Point<dim>(radius, height),
8064 * mech_lbc_system.boundaryLoadAppliers.push_back(
8065 * std::pair<int,BodyForceApplier<dim,Number> >(
8066 * 1, BodyForceApplier<dim,Number>(dim, 0.8*4.50e1)));
8072 * ComponentMask x_component_mask(dim+1, false);
8073 * x_component_mask.set(0, true);
8074 * ComponentMask y_component_mask(dim+1, false);
8075 * y_component_mask.set(1, true);
8076 * ComponentMask z_component_mask(dim+1, false);
8077 * z_component_mask.set(dim-1, true);
8078 * ComponentMask rho_component_mask(dim+1, false);
8079 * rho_component_mask.set(dim, true);
8081 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
8082 * top_constraint_function_map.insert(
8083 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8084 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8085 * InterpolatoryConstraintApplier<dim, Number>(
8086 * top_constraint_function_map,
8087 * y_component_mask));
8089 * std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
8090 * yz_constraint_function_map.insert(
8091 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8092 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8093 * InterpolatoryConstraintApplier<dim, Number>(
8094 * yz_constraint_function_map,
8095 * x_component_mask));
8098 * const Number total_elongation = 300.0; // mm
8099 * const Number elongation_rate = 1.0; // [mm/s]
8100 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
8102 * auto push_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8103 * new ConstantFunction<dim, Number>(std::vector< Number >{0, -total_elongation/static_cast<Number>(n_steps), 0}),
8107 * ComponentMask(dim+1, false),
8111 * mech_lbc_system.increment_interpolation_handlers.push_back(push_z_handler);
8113 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8114 * top_rotation_constraint_function_map.insert(
8115 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8116 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8117 * InterpolatoryConstraintApplier<dim, Number>(
8118 * top_rotation_constraint_function_map,
8119 * rho_component_mask));
8121 * std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8122 * axial_rotation_constraint_function_map.insert(
8123 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8124 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8125 * InterpolatoryConstraintApplier<dim, Number>(
8126 * axial_rotation_constraint_function_map,
8127 * rho_component_mask));
8129 * const Number drive_speed = 0.2; // [rad/s]
8131 * auto scale_rotation_increment = new IncrementInterpolationHandler<dim, Number, dim+1>(
8132 * new ScaleComponentFunction<dim, Number, dim+1>(drive_speed * time_increment, 0, dim),
8134 * rho_component_mask,
8136 * ComponentMask(dim+1, false),
8139 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_rotation_increment);
8140 * auto constant_angular_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8141 * new ScaleComponentFunction<dim, Number, dim+1>(drive_speed, 0, dim),
8143 * rho_component_mask,
8145 * ComponentMask(dim+1, false),
8148 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_angular_velocity_handler);
8152 * auto constant_velocity_angular_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8153 * new ScaleComponentFunction<dim, Number, dim+1>(0.0e-3, 0, dim),
8155 * rho_component_mask,
8157 * ComponentMask(dim+1, false),
8163 * mech_lbc_system.initial_deformation_interpolation_handlers.push_back(constant_velocity_angular_handler);
8167 * Thermal constraints
8170 * const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8171 * therm_lbc_system.convection_BC_appliers.push_back(
8172 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8174 * ConvectionBoundaryConditionApplier<dim, Number>(
8175 * 0, convection_coefficient, ambient_temperature)));
8176 * therm_lbc_system.convection_BC_appliers.push_back(
8177 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8179 * ConvectionBoundaryConditionApplier<dim, Number>(
8180 * 0, convection_coefficient, ambient_temperature)));
8181 * therm_lbc_system.convection_BC_appliers.push_back(
8182 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8184 * ConvectionBoundaryConditionApplier<dim, Number>(
8185 * 0, convection_coefficient, ambient_temperature)));
8189 * std::map< types::boundary_id, const Function< dim, Number > * > thermal_constraint_function_map;
8190 * thermal_constraint_function_map.insert(
8191 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &therm_lbc_system.zero_function));
8192 * thermal_constraint_function_map.insert(
8193 * std::pair<types::boundary_id, Function<dim, Number>*>(8, &therm_lbc_system.zero_function));
8194 * therm_dof_system.interpolatoryConstraintAppliers.push_back(
8195 * InterpolatoryConstraintApplier<dim,Number>(
8196 * thermal_constraint_function_map,ComponentMask(1, true)));
8199 * } /* make_interference_cylinder_grid() */
8202 * template <int dim, typename Number>
8203 * void PlasticityLabProg<dim, Number>::make_ball_in_hypershell_grid(
8204 * Triangulation<dim> &triangulation,
8205 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8206 * LBCSystem<dim, Number, 1> &therm_lbc_system,
8207 * int n_initial_global_refinements) {
8209 * const unsigned int INNER_BOUNDARY_ID = 0;
8211 * const Number outer_radius = 60.0; // [mm]
8213 * GridGenerator::half_hyper_ball(
8215 * Point<dim>(0, -10),
8219 * for (const auto &cell : triangulation.active_cell_iterators()) {
8220 * cell->set_boundary_id(INNER_BOUNDARY_ID);
8223 * triangulation.refine_global(n_initial_global_refinements);
8225 * mech_lbc_system.boundaryLoadAppliers.push_back(
8226 * std::pair<int,BodyForceApplier<dim,Number> >(
8227 * 1, BodyForceApplier<dim,Number>(dim, 0.8*4.50e1)));
8229 * ComponentMask x_component_mask(dim+1, false);
8230 * x_component_mask.set(0, true);
8231 * ComponentMask y_component_mask(dim+1, false);
8232 * y_component_mask.set(1, true);
8233 * ComponentMask z_component_mask(dim+1, false);
8234 * z_component_mask.set(dim-1, true);
8235 * ComponentMask rho_component_mask(dim+1, false);
8236 * rho_component_mask.set(dim, true);
8237 * ComponentMask all_component_mask(dim+1, true);
8239 * std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
8240 * yz_constraint_function_map.insert(
8241 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &mech_lbc_system.zero_function));
8242 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8243 * InterpolatoryConstraintApplier<dim, Number>(
8244 * yz_constraint_function_map,
8245 * x_component_mask));
8247 * std::map< types::boundary_id, const Function< dim, Number > * > down_constraint_function_map;
8248 * down_constraint_function_map.insert(
8249 * std::pair<types::boundary_id, Function<dim, Number>*>(INNER_BOUNDARY_ID, &mech_lbc_system.zero_function));
8250 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8251 * InterpolatoryConstraintApplier<dim, Number>(
8252 * down_constraint_function_map,
8253 * y_component_mask));
8255 * const Number total_elongation = 300.0; // mm
8256 * const Number elongation_rate = 225.0e-2; // [mm/s]
8257 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
8259 * auto push_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8260 * new ConstantFunction<dim, Number>(std::vector< Number >{0, -total_elongation/static_cast<Number>(n_steps), 0}),
8264 * ComponentMask(dim+1, false),
8265 * INNER_BOUNDARY_ID,
8268 * mech_lbc_system.increment_interpolation_handlers.push_back(push_z_handler);
8270 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8271 * top_rotation_constraint_function_map.insert(
8272 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8273 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8274 * InterpolatoryConstraintApplier<dim, Number>(
8275 * top_rotation_constraint_function_map,
8276 * rho_component_mask));
8280 * Thermal constraints
8283 * const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8284 * therm_lbc_system.convection_BC_appliers.push_back(
8285 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8287 * ConvectionBoundaryConditionApplier<dim, Number>(
8288 * 0, convection_coefficient, ambient_temperature)));
8289 * therm_lbc_system.convection_BC_appliers.push_back(
8290 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8292 * ConvectionBoundaryConditionApplier<dim, Number>(
8293 * 0, convection_coefficient, ambient_temperature)));
8294 * therm_lbc_system.convection_BC_appliers.push_back(
8295 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8297 * ConvectionBoundaryConditionApplier<dim, Number>(
8298 * 0, convection_coefficient, ambient_temperature)));
8299 * } /* make_ball_in_hypershell_grid() */
8305 * template <int dim, typename Number>
8306 * void PlasticityLabProg<dim, Number>::make_cylindrical_impact_grid(
8307 * Triangulation<dim> &triangulation,
8308 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8309 * LBCSystem<dim, Number, 1> &therm_lbc_system,
8310 * int n_initial_global_refinements) {
8312 * const Number initial_velocity = 1.9e5; // [mm/s]
8313 * const Number height = 25.4; // [mm]
8314 * const Number radius = 3.81; // [mm]
8316 * const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
8317 * const unsigned int aspect_ratio = std::ceil(0.25 * height / radius);
8319 * GridGenerator::subdivided_hyper_rectangle(
8321 * std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
8323 * Point<dim>(radius, height),
8329 * mech_lbc_system.boundaryLoadAppliers.push_back(
8330 * std::pair<int,BodyForceApplier<dim,Number> >(
8331 * 6, BodyForceApplier<dim,Number>(2, -4.50)));
8337 * ComponentMask x_component_mask(dim, false);
8338 * x_component_mask.set(0, true);
8339 * ComponentMask y_component_mask(3, false);
8340 * y_component_mask.set(1, true);
8341 * ComponentMask z_component_mask(dim, false);
8342 * z_component_mask.set(dim-1, true);
8343 * ComponentMask rho_component_mask(dim+1, false);
8344 * rho_component_mask.set(dim, true);
8346 * std::map< types::boundary_id, const Function< dim, Number > * > axial_constraint_function_map;
8347 * axial_constraint_function_map.insert(
8348 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8349 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8350 * InterpolatoryConstraintApplier<dim, Number>(
8351 * axial_constraint_function_map,
8352 * x_component_mask));
8354 * std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
8355 * base_constraint_function_map.insert(
8356 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
8357 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8358 * InterpolatoryConstraintApplier<dim, Number>(
8359 * base_constraint_function_map,
8360 * y_component_mask));
8362 * auto constant_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8363 * new ConstantFunction<dim, Number>(std::vector< Number >{0, -initial_velocity, 0}),
8367 * ComponentMask(dim, false),
8371 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_velocity_handler);
8373 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8374 * top_rotation_constraint_function_map.insert(
8375 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8376 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8377 * InterpolatoryConstraintApplier<dim, Number>(
8378 * top_rotation_constraint_function_map,
8379 * rho_component_mask));
8381 * std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8382 * axial_rotation_constraint_function_map.insert(
8383 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8384 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8385 * InterpolatoryConstraintApplier<dim, Number>(
8386 * axial_rotation_constraint_function_map,
8387 * rho_component_mask));
8389 * auto constant_velocity_angular_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8390 * new ScaleComponentFunction<dim, Number, dim+1>(0.0e2, 0, dim),
8392 * rho_component_mask,
8394 * ComponentMask(dim+1, false),
8398 * mech_lbc_system.initial_deformation_interpolation_handlers.push_back(constant_velocity_angular_handler);
8402 * Thermal constraints
8405 * const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8406 * therm_lbc_system.convection_BC_appliers.push_back(
8407 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8409 * ConvectionBoundaryConditionApplier<dim, Number>(
8410 * 0, convection_coefficient, ambient_temperature)));
8411 * therm_lbc_system.convection_BC_appliers.push_back(
8412 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8414 * ConvectionBoundaryConditionApplier<dim, Number>(
8415 * 0, convection_coefficient, ambient_temperature)));
8419 * std::map< types::boundary_id, const Function< dim, Number > * > thermal_constraint_function_map;
8420 * thermal_constraint_function_map.insert(
8421 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &therm_lbc_system.zero_function));
8422 * thermal_constraint_function_map.insert(
8423 * std::pair<types::boundary_id, Function<dim, Number>*>(8, &therm_lbc_system.zero_function));
8424 * therm_dof_system.interpolatoryConstraintAppliers.push_back(
8425 * InterpolatoryConstraintApplier<dim,Number>(
8426 * thermal_constraint_function_map,ComponentMask(1, true)));
8432 * } /* make_cylindrical_impact_grid() */
8435 * template <int dim, typename Number>
8436 * void PlasticityLabProg<dim, Number>::make_hook_membrane_grid(
8437 * int /*n_initial_global_refinements*/) {
8439 * } /* make_necking_grid() */
8443 * template <int dim, typename Number>
8444 * Tensor<2, dim+1, Number> PlasticityLabProg<dim, Number>::get_rotation_tensor(
8445 * const Tensor<2, dim+1, Number> &skew_symmetric_rotation) const {
8446 * const Number theta = Constants<dim, Number>::sqrt_half() * skew_symmetric_rotation.norm();
8447 * if (theta > 1e-8) {
8448 * const Number h1 = (1./(theta*theta)*(1.-std::cos(theta)));
8449 * const Number h2 = (1./theta*std::sin(theta));
8450 * return static_cast<Tensor<2, dim+1, Number>>(unit_symmetric_tensor<dim+1, Number>())
8451 * + h1 * skew_symmetric_rotation * skew_symmetric_rotation
8452 * + h2 * skew_symmetric_rotation;
8454 * return static_cast<Tensor<2, dim+1, Number>>(unit_symmetric_tensor<dim+1, Number>());
8459 * template <int dim, typename Number>
8460 * Tensor<2, dim+1, Number> PlasticityLabProg<dim, Number>::get_rotation_tensor_variation(
8461 * const Tensor<2, dim+1, Number> &skew_symmetric_rotation,
8462 * const Tensor<2, dim+1, Number> &skew_symmetric_rotation_variation) const {
8464 * const Number theta = Constants<dim, Number>::sqrt_half() * skew_symmetric_rotation.norm();
8465 * if (theta > 1e-8) {
8466 * const Number h1 = (1./(theta*theta)*(1.-std::cos(theta)));
8467 * const Number h2 = (1./theta*std::sin(theta));
8468 * const Number delta_theta = 1./(2.*theta) * scalar_product(skew_symmetric_rotation, skew_symmetric_rotation_variation);
8469 * const Number delta_h1 = (-2./theta * (h1 - 0.5 * h2)) * delta_theta;
8470 * const Number delta_h2 = (-1./theta * h2 + 1./theta * std::cos(theta)) * delta_theta;
8471 * const Tensor<2, dim+1, Number> rotation_tensor_variation = delta_h1 * skew_symmetric_rotation * skew_symmetric_rotation
8472 * + h1 * skew_symmetric_rotation_variation * skew_symmetric_rotation
8473 * + h1 * skew_symmetric_rotation * skew_symmetric_rotation_variation
8474 * + delta_h2 * skew_symmetric_rotation
8475 * + h2 * skew_symmetric_rotation_variation;
8476 * return rotation_tensor_variation;
8478 * return Tensor<2, dim+1, Number>();
8487<a name="ann-src/PointHistory.h"></a>
8488<h1>Annotated version of src/PointHistory.h</h1>
8497 * * Created on: 21 Jul 2014
8501 * #ifndef POINTHISTORY_H_
8502 * #define POINTHISTORY_H_
8504 * #include <deal.II/base/utilities.h>
8505 * #include <deal.II/base/function.h>
8507 * #include <deal.II/numerics/vector_tools.h>
8508 * #include <deal.II/numerics/matrix_tools.h>
8509 * #include <deal.II/numerics/data_out.h>
8511 * #include <deal.II/lac/trilinos_vector.h>
8513 * namespace PlasticityLab {
8515 * template <int dim, typename Number = double>
8516 * class PointHistory {
8519 * virtual ~PointHistory();
8521 * struct HardeningParameters {
8522 * HardeningParameters(
8523 * Number equivalent_plastic_strain,
8524 * ::SymmetricTensor<2, dim, Number> kinematic_hardening):
8525 * equivalent_plastic_strain(equivalent_plastic_strain),
8526 * kinematic_hardening(kinematic_hardening) { }
8527 * HardeningParameters() {}
8529 * Number equivalent_plastic_strain;
8530 * ::SymmetricTensor<2, dim, Number> kinematic_hardening;
8533 * PointHistory(const ::SymmetricTensor<2, dim, Number> &,
8534 * const HardeningParameters &,
8535 * Number plastic_entropy,
8536 * Number material_Jacobian);
8538 * ::SymmetricTensor<2, dim, Number> plastic_strain;
8539 * HardeningParameters hardening_parameters;
8540 * Number plastic_entropy;
8541 * Number material_Jacobian;
8545 * template <int dim, typename Number>
8546 * PointHistory<dim, Number>::PointHistory()
8548 * plastic_strain (::unit_symmetric_tensor<dim, Number>()),
8549 * hardening_parameters(Number(0.0), Number(0.0) * ::unit_symmetric_tensor<dim, Number>()),
8550 * plastic_entropy(Number(0.0)),
8551 * material_Jacobian(1.0) {
8554 * template <int dim, typename Number>
8555 * PointHistory<dim, Number>::
8556 * PointHistory(const ::SymmetricTensor<2, dim, Number> &plastic_strain,
8557 * const HardeningParameters &hardening_parameters,
8558 * const Number plastic_entropy,
8559 * const Number material_Jacobian):
8560 * plastic_strain(plastic_strain),
8561 * hardening_parameters(hardening_parameters),
8562 * plastic_entropy(plastic_entropy),
8563 * material_Jacobian(material_Jacobian) {
8566 * template <int dim, typename Number>
8567 * PointHistory<dim, Number>::~PointHistory() {
8570 * } /* namespace PlasticityLab */
8572 * #endif /* POINTHISTORY_H_ */
8576<a name="ann-src/ReferencePoint.h"></a>
8577<h1>Annotated version of src/ReferencePoint.h</h1>
8584 * * ReferencePoint.h
8586 * * Created on: 29 Nov 2020
8590 * #ifndef REFERENCEPOINT_H_
8591 * #define REFERENCEPOINT_H_
8594 * #include <deal.II/dofs/dof_handler.h>
8595 * #include <deal.II/base/point.h>
8597 * using namespace dealii;
8599 * namespace PlasticityLab {
8600 * template <int dim, typename Number>
8601 * class ReferencePoint {
8604 * virtual ~ReferencePoint();
8606 * typename DoFHandler<dim>::active_cell_iterator mesh_motion_cell;
8607 * typename DoFHandler<dim>::active_cell_iterator field_cell;
8608 * unsigned int q_point;
8609 * Point<dim, Number> reference_point;
8610 * Point<dim, Number> remapped_point;
8613 * template <int dim, typename Number>
8614 * ReferencePoint<dim, Number>::ReferencePoint() {
8617 * template <int dim, typename Number>
8618 * ReferencePoint<dim, Number>::~ReferencePoint() {}
8620 * } /* namespace PlasticityLab */
8622 * #endif /* REFERENCEPOINT_H_ */
8626<a name="ann-src/RemappedPoint.h"></a>
8627<h1>Annotated version of src/RemappedPoint.h</h1>
8636 * * Created on: 29 Nov 2020
8640 * #ifndef REMAPPEDPOINT_H_
8641 * #define REMAPPEDPOINT_H_
8644 * #include <deal.II/dofs/dof_handler.h>
8645 * #include <deal.II/base/point.h>
8647 * using namespace dealii;
8649 * namespace PlasticityLab {
8650 * template <int dim, typename Number>
8651 * class RemappedPoint {
8654 * virtual ~RemappedPoint();
8656 * typename DoFHandler<dim>::active_cell_iterator mesh_motion_cell;
8657 * typename DoFHandler<dim>::active_cell_iterator field_cell;
8658 * typename DoFHandler<dim>::active_cell_iterator mixed_fe_cell;
8659 * Point<dim, Number> unit_cell_point;
8660 * Point<dim, Number> remapped_point;
8663 * template <int dim, typename Number>
8664 * RemappedPoint<dim, Number>::RemappedPoint() {
8667 * template <int dim, typename Number>
8668 * RemappedPoint<dim, Number>::~RemappedPoint() {}
8670 * } /* namespace PlasticityLab */
8672 * #endif /* REMAPPEDPOINT_H_ */
8676<a name="ann-src/RotationFunction.h"></a>
8677<h1>Annotated version of src/RotationFunction.h</h1>
8684 * * RotationFunction.h
8686 * * Created on: 06 Dec 2016
8690 * #ifndef ROTATIONFUNCTION_H_
8691 * #define ROTATIONFUNCTION_H_
8694 * #include <deal.II/base/function.h>
8695 * #include <deal.II/base/utilities.h>
8697 * using namespace dealii;
8699 * namespace PlasticityLab {
8701 * template<int dim, typename Number = double>
8702 * class RotationFunction: public Function<dim, Number> {
8705 * const Number angular_frequency,
8706 * const Number axial_velocity,
8707 * const Number current_angle = 0.0);
8708 * virtual ~RotationFunction();
8710 * virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const;
8711 * virtual void set_time (const Number new_time);
8714 * void update_rotation_matrix();
8715 * Tensor<2, dim, Number> previousRotationMatrix, currentRotationMatrix;
8716 * Number current_angle;
8717 * Number previous_displacement, current_displacement;
8718 * Number angular_frequency;
8719 * Number axial_velocity;
8722 * template<int dim, typename Number = double>
8723 * class AngularVelocityFunction: public Function<dim, Number> {
8725 * AngularVelocityFunction(const Number angular_frequency) : Function<dim, Number>(dim) {
8726 * this->angular_frequency = angular_frequency;
8728 * virtual ~AngularVelocityFunction() {}
8730 * virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const {
8731 * values[0] = - 2 * 3.14159 * angular_frequency * p[1];
8732 * values[1] = 2 * 3.14159 * angular_frequency * p[0];
8739 * Number angular_frequency;
8742 * template<int dim, typename Number>
8743 * RotationFunction<dim, Number>::~RotationFunction() {}
8745 * template<int dim, typename Number>
8746 * RotationFunction<dim, Number>::RotationFunction(
8747 * const Number angular_frequency,
8748 * const Number axial_velocity,
8749 * const Number current_angle) : Function<dim, Number>(dim) {
8750 * this->angular_frequency = angular_frequency;
8751 * this->axial_velocity = axial_velocity;
8752 * this->current_angle = current_angle;
8753 * this->set_time(0.0);
8754 * current_displacement = 0.0;
8757 * template<int dim, typename Number>
8758 * void RotationFunction<dim, Number>::vector_value (const Point< dim > &p, Vector< Number > &values) const {
8759 * const auto p_prev = previousRotationMatrix * p;
8760 * const auto res = currentRotationMatrix * p;
8761 * for (unsigned int i = 0; i < dim; ++i)
8762 * values[i] = res[i] - p_prev[i] + (i == 2 ? current_displacement - previous_displacement : 0.0);
8765 * template<int dim, typename Number>
8766 * void RotationFunction<dim, Number>::update_rotation_matrix () {
8767 * previousRotationMatrix = currentRotationMatrix;
8768 * const Number c_theta = std::cos(current_angle);
8769 * const Number s_theta = std::sin(current_angle);
8770 * currentRotationMatrix[0][0] = c_theta;
8771 * currentRotationMatrix[0][1] = -s_theta;
8772 * currentRotationMatrix[1][0] = s_theta;
8773 * currentRotationMatrix[1][1] = c_theta;
8775 * currentRotationMatrix[2][2] = 1.0;
8778 * template<int dim, typename Number>
8779 * void RotationFunction<dim, Number>::set_time (const Number new_time) {
8780 * Function<dim, Number>::set_time(new_time);
8781 * current_angle = angular_frequency * Function<dim, Number>::get_time();
8782 * update_rotation_matrix();
8783 * previous_displacement = current_displacement;
8784 * current_displacement = axial_velocity * Function<dim, Number>::get_time();
8787 * } /* namespace PlasticityLab */
8789 * #endif /* ROTATIONFUNCTION_H_ */
8793<a name="ann-src/ScaleComponentFunction.h"></a>
8794<h1>Annotated version of src/ScaleComponentFunction.h</h1>
8801 * * ScaleComponentFunction.h
8803 * * Created on: 28 Dec 2019
8807 * #ifndef SCALECOMPONENTFUNCTION_H_
8808 * #define SCALECOMPONENTFUNCTION_H_
8811 * #include <deal.II/base/function.h>
8812 * #include <deal.II/base/utilities.h>
8814 * using namespace dealii;
8816 * namespace PlasticityLab {
8818 * template<int dim, typename Number = double, int components=dim>
8819 * class ScaleComponentFunction: public Function<dim, Number> {
8821 * ScaleComponentFunction(
8822 * const Number scale_factor,
8823 * const unsigned int in_component=2,
8824 * const unsigned int out_component=2);
8825 * virtual ~ScaleComponentFunction();
8826 * virtual void vector_value(const Point<dim> &p, Vector<Number> &values) const override;
8829 * Number scale_factor;
8830 * const unsigned int in_component;
8831 * const unsigned int out_component;
8834 * template<int dim, typename Number, int components>
8835 * ScaleComponentFunction<dim, Number, components>::ScaleComponentFunction(
8836 * const Number scale_factor,
8837 * const unsigned int in_component,
8838 * const unsigned int out_component) :
8839 * Function<dim, Number>(components),
8840 * scale_factor(scale_factor),
8841 * in_component(in_component),
8842 * out_component(out_component) { }
8844 * template<int dim, typename Number, int components>
8845 * ScaleComponentFunction<dim, Number, components>::~ScaleComponentFunction() {}
8847 * template<int dim, typename Number, int components>
8848 * void ScaleComponentFunction<dim, Number, components>::vector_value(const Point<dim> &p, Vector<Number> &values) const {
8850 * values[out_component] = scale_factor * p[in_component];
8853 * } /* namespace PlasticityLab */
8855 * #endif /* SCALECOMPONENTFUNCTION_H_ */
8859<a name="ann-src/ScaleZFunction.h"></a>
8860<h1>Annotated version of src/ScaleZFunction.h</h1>
8867 * * ScaleZFunction.h
8869 * * Created on: 06 Dec 2016
8873 * #ifndef SCALEZFUNCTION_H_
8874 * #define SCALEZFUNCTION_H_
8877 * #include <deal.II/base/function.h>
8878 * #include <deal.II/base/utilities.h>
8880 * using namespace dealii;
8882 * namespace PlasticityLab {
8884 * template<int dim, typename Number = double, int components=dim>
8885 * class ScaleZFunction: public Function<dim, Number> {
8887 * ScaleZFunction(const Number scale_factor, const unsigned int component=2);
8888 * virtual ~ScaleZFunction();
8889 * virtual void vector_value(const Point<dim> &p, Vector<Number> &values) const override;
8892 * Number scale_factor;
8893 * const unsigned int component;
8896 * template<int dim, typename Number, int components>
8897 * ScaleZFunction<dim, Number, components>::ScaleZFunction(
8898 * const Number scale_factor,
8899 * const unsigned int component) :
8900 * Function<dim, Number>(components),
8901 * component(component) {
8902 * this->scale_factor = scale_factor;
8905 * template<int dim, typename Number, int components>
8906 * ScaleZFunction<dim, Number, components>::~ScaleZFunction() {}
8908 * template<int dim, typename Number, int components>
8909 * void ScaleZFunction<dim, Number, components>::vector_value(const Point<dim> &p, Vector<Number> &values) const {
8911 * values[component] = scale_factor * p[component];
8914 * } /* namespace PlasticityLab */
8916 * #endif /* SCALEZFUNCTION_H_ */
8920<a name="ann-src/TensorUtilities.h"></a>
8921<h1>Annotated version of src/TensorUtilities.h</h1>
8928 * * TensorUtilities.h
8930 * * Created on: 06 Nov 2020
8934 * #ifndef TENSOR_UTILITIES_H_
8935 * #define TENSOR_UTILITIES_H_
8937 * #include<exception>
8939 * #include <deal.II/base/tensor.h>
8940 * #include <deal.II/base/symmetric_tensor.h>
8943 * using namespace dealii;
8945 * namespace PlasticityLab {
8946 * template <int dim, typename Number>
8947 * SymmetricTensor<2, dim, Number> get_log_of_tensor(
8948 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate) {
8950 * const auto eig_vals_vecs = eigenvectors(symmetric_stretch_rate);
8951 * SymmetricTensor<2, dim, Number> result =
8952 * std::log(eig_vals_vecs[0].first)
8955 * eig_vals_vecs[0].second,
8956 * eig_vals_vecs[0].second));
8957 * for(unsigned int d=1; d<dim; ++d) {
8959 * std::log(eig_vals_vecs[d].first)
8962 * eig_vals_vecs[d].second,
8963 * eig_vals_vecs[d].second));
8966 * } catch(std::exception& e) {
8967 * std::cout << "Could not get log of tensor: " << symmetric_stretch_rate << std::endl;
8968 * return symmetric_stretch_rate;
8973 * template <int dim, typename Number>
8974 * SymmetricTensor<2, dim, Number> get_log_of_tensor_variation(
8975 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate,
8976 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate_variation) {
8977 * const double epsilon = 1e-10;
8978 * return (1./epsilon) * (get_log_of_tensor(symmetric_stretch_rate + epsilon * symmetric_stretch_rate_variation) - get_log_of_tensor(symmetric_stretch_rate));
8981 * template <int dim, typename Number>
8982 * SymmetricTensor<2, dim, Number> get_exp_of_tensor(
8983 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate) {
8985 * const auto eig_vals_vecs = eigenvectors(symmetric_stretch_rate);
8986 * SymmetricTensor<2, dim, Number> result =
8987 * std::exp(eig_vals_vecs[0].first)
8990 * eig_vals_vecs[0].second,
8991 * eig_vals_vecs[0].second));
8992 * for(unsigned int d=1; d<dim; ++d) {
8994 * std::exp(eig_vals_vecs[d].first)
8997 * eig_vals_vecs[d].second,
8998 * eig_vals_vecs[d].second));
9001 * } catch(std::exception& e) {
9002 * std::cout << "Could not get exp of tensor: " << symmetric_stretch_rate << std::endl;
9003 * return symmetric_stretch_rate;
9007 * template <int dim, typename Number>
9008 * SymmetricTensor<2, dim, Number> get_exp_of_tensor_variation(
9009 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate,
9010 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate_variation) {
9011 * const Number epsilon = 1e-10;
9012 * return (1./epsilon) * (get_exp_of_tensor(symmetric_stretch_rate + epsilon * symmetric_stretch_rate_variation) - get_exp_of_tensor(symmetric_stretch_rate));
9016 * #endif // TENSOR_UTILITIES_H_ * @endcode
9019<a name="ann-src/ThermoPlasticMaterial.cpp"></a>
9020<h1>Annotated version of src/ThermoPlasticMaterial.cpp</h1>
9027 * * ThermoPlasticMaterial.cpp
9029 * * Created on: 05 Jan 2015
9034 * #include <sstream>
9036 * #include <deal.II/base/tensor.h>
9037 * #include <deal.II/base/symmetric_tensor.h>
9039 * #include "symmetric_tensor_entries.h"
9041 * #include "ExponentialHardeningThermoviscoplasticYieldLaw.h"
9042 * #include "JohnsonCookThermoviscoplasticYieldLaw.h"
9044 * #include "ThermoPlasticMaterial.h"
9045 * #include "Constants.h"
9046 * #include "TensorUtilities.h"
9048 * namespace PlasticityLab {
9050 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9051 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9052 * ThermoPlasticMaterial(
9053 * const Number kappa,
9055 * const Number thermal_expansion_coefficient,
9056 * const Number thermal_conductivity,
9057 * const Number heat_capacity,
9058 * const Number dissipation_factor,
9059 * const ViscoplasticYieldLaw &viscoplastic_yield_law) :
9062 * thermal_expansion_coefficient(thermal_expansion_coefficient),
9063 * thermal_conductivity(thermal_conductivity),
9064 * heat_capacity(heat_capacity),
9065 * reference_temperature(293.15),
9066 * dissipation_factor(dissipation_factor),
9067 * viscoplastic_yield_law(viscoplastic_yield_law) { }
9069 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9070 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::~ThermoPlasticMaterial() {
9073 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9074 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::compute_constitutive_request(
9075 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9076 * const point_index_t &point_index) {
9077 * const ConstitutiveModelUpdateFlags update_flags = constitutive_request.get_update_flags();
9079 * if (update_pressure & update_flags)
9080 * compute_pressure(constitutive_request, point_index);
9082 * if ((update_stress_deviator | update_mechanical_dissipation) & update_flags)
9083 * compute_stress_deviator_and_d_gamma(constitutive_request, point_index);
9085 * if (update_heat_flux & update_flags)
9086 * compute_heat_flux(constitutive_request, point_index);
9088 * if (update_thermoelastic_heating & update_flags)
9089 * compute_thermo_elastic_heating(constitutive_request, point_index);
9091 * if (update_stored_heat & update_flags)
9092 * compute_stored_heat_rate(constitutive_request, point_index);
9095 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9096 * std::vector<Number> ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_state_parameters(
9097 * const point_index_t &point_index,
9098 * const Tensor<2, dim, Number> &reference_transformation) const {
9099 * std::vector<Number> state_parameters;
9100 * state_parameters.reserve(get_material_parameter_count());
9102 * const PointHistory<dim, Number> &point_history = material_point_history.at(point_index);
9103 * state_parameters.push_back(std::log(1 + point_history.hardening_parameters.equivalent_plastic_strain));
9105 * const Number reference_transformation_Jacobian = determinant(reference_transformation);
9106 * const auto isochoric_reference_transformation =
9107 * std::pow(reference_transformation_Jacobian, -Constants<dim, Number>::one_third()) * reference_transformation;
9109 * const SymmetricTensor<2, dim, Number> log_of_b_e =
9110 * get_log_of_tensor(
9112 * isochoric_reference_transformation
9113 * * static_cast<Tensor<2, dim, Number>>(point_history.plastic_strain)
9114 * * transpose(isochoric_reference_transformation)));
9116 * for (const auto &element :
9117 * dealii_utils::symmetric_tensor_entries(log_of_b_e)) {
9118 * state_parameters.push_back(element);
9121 * for (const auto &element :
9122 * dealii_utils::symmetric_tensor_entries(
9123 * point_history.hardening_parameters.kinematic_hardening)
9125 * state_parameters.push_back(element);
9128 * state_parameters.push_back(std::log(std::pow(reference_transformation_Jacobian, 1) * point_history.material_Jacobian));
9130 * return state_parameters;
9133 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9134 * size_t ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>:: get_material_parameter_count() const {
9135 * return 1 + 2 * (dim * (dim + 1) / 2) + 1; // one scalar and two symmetric tensors and one more scalar
9138 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9139 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::set_state_parameters(
9140 * const point_index_t &point_index,
9141 * const std::vector<Number> &state_parameters,
9142 * const Tensor<2, dim, Number> &reference_transformation) {
9143 * PointHistory<dim, Number> &point_history = material_point_history.at(point_index);
9144 * size_t cursor = 0;
9146 * point_history.hardening_parameters.equivalent_plastic_strain = std::exp(state_parameters[cursor++]) - 1;
9148 * SymmetricTensor<2, dim, Number> log_of_b_e;
9150 * for (auto &element :
9151 * dealii_utils::symmetric_tensor_entries(log_of_b_e)) {
9152 * element = state_parameters[cursor++];
9155 * const Number reference_transformation_Jacobian = determinant(reference_transformation);
9156 * const auto inverse_isochoric_reference_transformation =
9157 * std::pow(reference_transformation_Jacobian, Constants<dim, Number>::one_third()) * invert(reference_transformation);
9159 * point_history.plastic_strain = symmetrize(
9160 * inverse_isochoric_reference_transformation
9161 * * static_cast<Tensor<2, dim, Number>>(get_exp_of_tensor(log_of_b_e))
9162 * * transpose(inverse_isochoric_reference_transformation));
9164 * for (auto &element :
9165 * dealii_utils::symmetric_tensor_entries(
9166 * point_history.hardening_parameters.kinematic_hardening
9168 * element = state_parameters[cursor++];
9171 * point_history.material_Jacobian = std::pow(reference_transformation_Jacobian, -1) * std::exp(state_parameters[cursor++]);
9174 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9175 * Number ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_material_Jacobian(const point_index_t &point_index) const {
9176 * return material_point_history.at(point_index).material_Jacobian;
9180 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9181 * ::SymmetricTensor<2, dim, Number> ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_plastic_strain(const point_index_t &point_index) const {
9182 * return material_point_history.at(point_index).plastic_strain;
9188 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9190 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::setup_point_history (const point_index_t point_count) {
9192 * std::vector< PointHistory<dim, Number> > tmp;
9193 * tmp.swap (material_point_history);
9195 * const typename PointHistory<dim, Number>::HardeningParameters hardening_parameters(
9197 * Number(0.0)*::unit_symmetric_tensor<dim, Number>());
9198 * const PointHistory< dim, Number> point_history(unit_symmetric_tensor<dim, Number>(),
9199 * hardening_parameters,
9202 * material_point_history.resize (point_count, point_history);
9205 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9207 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9208 * compute_pressure(ConstitutiveModelRequest<dim, Number> &constitutive_request,
9209 * const point_index_t &) {
9210 * const Number J = constitutive_request.get_deformation_Jacobian();
9211 * const Number temperature = constitutive_request.get_temperature();
9213 * const Number p = kappa * (J-1.0/J) - 3 * kappa * thermal_expansion_coefficient * (temperature - reference_temperature) * (1 + 1./(J*J));
9214 * constitutive_request.set_pressure(p);
9220 * const Number dp = kappa * (1 + 1/(J*J)) - 3 * kappa * thermal_expansion_coefficient * (temperature - reference_temperature) * (-2 * 1./(J*J*J));
9221 * constitutive_request.set_pressure_tangent_modulus(dp);
9223 * std::ostringstream convert;
9224 * convert << "Encountered deformation gradient with non-positive determinant! " << J;
9225 * throw MaterialDomainException(convert.str());
9229 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9230 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::compute_stress_deviator_and_d_gamma(
9231 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9232 * const point_index_t &point_index) {
9233 * const ConstitutiveModelUpdateFlags update_flags = constitutive_request.get_update_flags();
9234 * const Tensor<2, dim, Number> b_e = material_point_history[point_index].plastic_strain;
9235 * typename PointHistory<dim, Number>::HardeningParameters hardening_parameters =
9236 * material_point_history[point_index].hardening_parameters;
9237 * const Tensor<2, dim, Number> isochoric_deformation_gradient = constitutive_request.get_deformation_gradient();
9238 * const Number temperature = constitutive_request.get_temperature();
9239 * const auto b_e_bar_next = static_cast<SymmetricTensor<2, dim, Number> >(
9240 * symmetrize(isochoric_deformation_gradient * b_e
9241 * * transpose(isochoric_deformation_gradient)));
9242 * if(std::isnan(b_e_bar_next.norm())) {
9243 * std::cout << "b_e_bar_next is nan: " << b_e_bar_next << std::endl;
9244 * std::cout << "b_e: " << b_e << std::endl;
9245 * std::cout << "isochoric_deformation_gradient: " << isochoric_deformation_gradient << std::endl;
9246 * std::ostringstream convert;
9247 * convert << "Encountered an elastic deviatoric tensor with NaN values! ";
9248 * throw MaterialDomainException(convert.str());
9250 * const auto epsilon_e_bar_next = get_log_of_tensor<>(b_e_bar_next);
9251 * const SymmetricTensor<2, dim, Number> dev_stress_trial = deviator((0.5 * mu) * epsilon_e_bar_next);
9254 * const SymmetricTensor<2, dim, Number> dev_stress_trial = deviator((0.5 * mu) * b_e_bar_next);
9257 * const SymmetricTensor<2, dim, Number> ksi_trial = dev_stress_trial
9258 * - hardening_parameters.kinematic_hardening;
9259 * const Number norm_ksi_trial = ksi_trial.norm();
9260 * const Number mu_bar = (0.5 * mu);
9263 * const Number mu_bar = (0.5 * mu) * Constants<dim, Number>::one_third()
9264 * * trace(b_e_bar_next);
9267 * const SymmetricTensor<2, dim, Number> stress_flow_direction = ksi_trial
9269 * constitutive_request.set_b_e_bar(b_e_bar_next);
9270 * constitutive_request.set_mu((0.5 * mu));
9271 * const Number time_increment = constitutive_request.get_time_increment();
9273 * const Number trial_yield_criterion = viscoplastic_yield_law.trial_yield_criterion(norm_ksi_trial,
9274 * hardening_parameters.equivalent_plastic_strain,
9279 * if (0 < trial_yield_criterion && constitutive_request.get_is_plastic()) {
9280 * constitutive_request.set_is_plastic(true);
9281 * Number delta_gamma, alpha_n_plus_1;
9283 * determine_delta_gamma(delta_gamma, alpha_n_plus_1, norm_ksi_trial,
9284 * mu_bar, hardening_parameters.equivalent_plastic_strain, temperature,
9285 * time_increment, 1e-04, 300);
9286 * } catch(const MaterialDomainException &exc) {
9287 * std::cout << "isochoric_deformation_gradient: " << isochoric_deformation_gradient
9288 * << "\nb_e: " << b_e
9289 * << "\nb_e_bar_next: " << b_e_bar_next
9290 * << "\nmu_bar: " << mu_bar
9292 * std::cerr << exc.what() << std::endl;
9299 * constitutive_request.set_delta_gamma(delta_gamma);
9303 * 4. Update back stress, plastic strain and stress
9306 * Number K_alpha_n_plus_1, K_alpha_n, H_alpha_n_plus_1, H_alpha_n;
9307 * Number DK_alpha_n_plus_1, DH_alpha_n_plus_1;
9308 * viscoplastic_yield_law.hardening_values(H_alpha_n,
9310 * hardening_parameters.equivalent_plastic_strain,
9314 * const Number y_alpha = viscoplastic_yield_law.hardening_values(
9321 * [[maybe_unused]] const Number d_y_alpha_d_alpha = viscoplastic_yield_law.hardening_alpha_derivatives(
9322 * DH_alpha_n_plus_1,
9323 * DK_alpha_n_plus_1,
9329 * if (update_stress_deviator & update_flags) {
9330 * const SymmetricTensor<2, dim, Number> stress = deviator(dev_stress_trial
9331 * - 2 * mu_bar * delta_gamma
9332 * * stress_flow_direction);
9333 * constitutive_request.set_stress_deviator(stress);
9334 * constitutive_request.set_dH(DH_alpha_n_plus_1);
9335 * constitutive_request.set_dK(DK_alpha_n_plus_1);
9336 * if (update_material_point_history & update_flags) {
9337 * material_point_history[point_index].hardening_parameters.equivalent_plastic_strain =
9339 * material_point_history[point_index].hardening_parameters.kinematic_hardening =
9340 * hardening_parameters.kinematic_hardening
9341 * + Constants<dim, Number>::sqrt2thirds()
9342 * * (K_alpha_n_plus_1 - K_alpha_n)
9343 * * stress_flow_direction;
9347 * // compute one_third_I_bar_e (c.f. Simo, Miehe 1992 pp 64)
9348 * const auto stress_over_mu = stress / (0.5 * mu);
9349 * const Number norm_stress_over_mu = stress_over_mu.norm();
9350 * const Number J_e2 = 0.5 * norm_stress_over_mu * norm_stress_over_mu;
9351 * const Number J_e3 = determinant(stress_over_mu);
9352 * const Number q = 0.5*(1-J_e3);
9353 * const Number sqrt_d = std::sqrt(-std::pow(Constants<dim, Number>::one_third()*J_e2, 3) + q*q);
9354 * const Number one_third_I_bar_e = std::pow(q + sqrt_d, Constants<dim, Number>::one_third())
9355 * + std::pow(q - sqrt_d, Constants<dim, Number>::one_third());
9359 * auto b_e_bar = stress / (0.5 * mu)
9360 * + Constants<dim, Number>::one_third() * trace(b_e_bar_next)
9361 * * unit_symmetric_tensor<dim, Number>();
9364 * auto b_e_bar = get_exp_of_tensor(stress / (0.5 * mu));
9368 * correct volumetric component so that return mapping does not change volume
9371 * const Number det_b_e_bar_trial = determinant(b_e_bar_next);
9372 * Number det_plastic_strain = determinant(b_e_bar);
9373 * if(std::abs(det_plastic_strain - 1) > 1e-7) {
9374 * std::cout << "det_plastic_strain: " << det_plastic_strain << std::endl;
9376 * while (std::abs(det_plastic_strain-det_b_e_bar_trial) > 1e-10) {
9377 * const Number u = (det_b_e_bar_trial - det_plastic_strain) / (det_plastic_strain * trace(invert(b_e_bar)));
9378 * b_e_bar += u*unit_symmetric_tensor<dim, Number>();
9379 * det_plastic_strain = determinant(b_e_bar);
9382 * [[maybe_unused]] const Tensor<2, dim, Number> inverse_isochoric_deformation_gradient = invert(isochoric_deformation_gradient);
9383 * material_point_history[point_index].plastic_strain = b_e_bar;
9385 * } /*if(update_stress_deviator & update_flags)*/
9386 * if (update_mechanical_dissipation & update_flags) {
9387 * const Number time_increment = constitutive_request.get_time_increment();
9388 * const Number mechanical_dissipation =
9389 * dissipation_factor
9390 * * Constants<dim, Number>::sqrt2thirds()
9391 * * y_alpha * delta_gamma
9392 * / (1000. * time_increment); // [J.mm^-3.s^-1]
9393 * constitutive_request.set_mechanical_dissipation(mechanical_dissipation);
9394 * Number DH_theta, DK_theta;
9395 * const Number d_y_alpha_d_theta =
9396 * viscoplastic_yield_law.hardening_temperature_derivatives(DH_theta, DK_theta,
9401 * const Number mechanical_dissipation_temperature_tangent =
9402 * dissipation_factor
9403 * * d_y_alpha_d_theta
9404 * * (Constants<dim, Number>::sqrt2thirds() * delta_gamma
9405 * - y_alpha / (3 * mu_bar))
9406 * / (1000. * time_increment); // [J.mm^-3.s^-3.K^-1]
9407 * constitutive_request.set_mechanical_dissipation_tangent_modulus(
9408 * mechanical_dissipation_temperature_tangent);
9409 * } /*if (update_mechanical_dissipation & updateFlags)*/
9410 * } /*if ( trial yield criterion test )*/
9412 * constitutive_request.set_delta_gamma(0.0);
9413 * constitutive_request.set_is_plastic(false);
9414 * if (update_stress_deviator & update_flags) {
9415 * constitutive_request.set_stress_deviator(dev_stress_trial);
9416 * constitutive_request.set_dK(0.0);
9417 * constitutive_request.set_dH(0.0);
9419 * if (update_mechanical_dissipation & update_flags) {
9420 * constitutive_request.set_mechanical_dissipation(0.0);
9421 * constitutive_request.set_mechanical_dissipation_tangent_modulus(0.0);
9425 * The following is only necessary for the elastic case when b_e is tracked instead of G_p
9428 * if (update_stress_deviator & update_flags) {
9429 * if (update_material_point_history & update_flags) {
9430 * material_point_history[point_index].plastic_strain = b_e_bar_next;
9436 * The following is only necessary if the total Jacobian is tracked (J_c * J_m), rather than just J_m
9439 * if (update_material_point_history & update_flags) {
9440 * material_point_history.at(point_index).material_Jacobian = constitutive_request.get_unprojected_deformation_Jacobian();
9442 * } /*computeStressDeviatorAndDGamma()*/
9444 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9445 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9446 * compute_heat_flux(
9447 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9448 * const point_index_t &) {
9449 * const Tensor<1, dim, Number> thermal_gradient = constitutive_request.get_thermal_gradient();
9450 * constitutive_request.set_heat_flux(thermal_conductivity * thermal_gradient);
9451 * constitutive_request.set_heat_flux_tangent_moduli(thermal_conductivity * unit_symmetric_tensor<dim, Number>());
9454 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9455 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9456 * compute_thermo_elastic_heating(
9457 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9458 * const point_index_t &point_index) {
9459 * const auto point_history = material_point_history.at(point_index);
9460 * const Number J = constitutive_request.get_deformation_Jacobian();
9461 * const Number previous_J = constitutive_request.get_previous_deformation_Jacobian();
9462 * [[maybe_unused]] const Number J_time_rate = constitutive_request.get_deformation_Jacobian_time_rate();
9463 * const Number theta = constitutive_request.get_temperature();
9464 * [[maybe_unused]] const Number previous_theta = constitutive_request.get_previous_temperature();
9465 * const Number time_increment = constitutive_request.get_time_increment();
9466 * if (J != 0 and previous_J != 0) {
9467 * const Number eta = (3.0/1000.0) * kappa * thermal_expansion_coefficient * (J - 1.0/J);
9468 * const Number previous_eta = (3.0/1000.0) * kappa * thermal_expansion_coefficient * (previous_J - 1.0/previous_J);
9469 * constitutive_request.set_thermo_elastic_heating(-theta * (eta - previous_eta) / time_increment);
9470 * constitutive_request.set_thermo_elastic_heating_tangent_modulus(-(eta - previous_eta) / time_increment);
9474 * TODO define and throw appropriate exception: bad deformation gradient!
9477 * constitutive_request.set_thermo_elastic_heating(0);
9478 * constitutive_request.set_thermo_elastic_heating_tangent_modulus(0);
9482 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9483 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9484 * compute_stored_heat_rate(
9485 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9486 * const point_index_t &) {
9487 * const Number stored_heat_rate = heat_capacity * constitutive_request.get_temperature_time_rate();
9488 * constitutive_request.set_stored_heat_rate(stored_heat_rate);
9489 * constitutive_request.set_stored_heat_rate_tangent_modulus(heat_capacity);
9492 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9494 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9495 * determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
9496 * const Number norm_ksi_trial,
9497 * const Number mu_bar,
9498 * const Number alpha_n,
9499 * const Number temperature,
9500 * const Number time_increment,
9502 * const unsigned int max_iter) const {
9503 * unsigned int k = 0;
9504 * const Number sqrt2thirds = Constants<dim, Number>::sqrt2thirds();
9505 * const Number two_thirds = Constants<dim, Number>::two_thirds();
9506 * Number g_of_gamma_k, Dg_of_gamma_k;
9507 * Number H_alpha_n, H_alpha_n_plus_1, K_alpha_n, K_alpha_n_plus_1;
9508 * Number DK_alpha_n_plus_1, DH_alpha_n_plus_1;
9511 * alpha_n_plus_1 = alpha_n;
9513 * viscoplastic_yield_law.hardening_values(H_alpha_n, K_alpha_n, alpha_n, 0.0, time_increment, temperature);
9515 * viscoplastic_yield_law.hardening_values(H_alpha_n_plus_1, K_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9516 * g_of_gamma_k = norm_ksi_trial
9517 * - 2 * mu_bar * delta_gamma
9518 * - sqrt2thirds * H_alpha_n_plus_1
9519 * - sqrt2thirds * (K_alpha_n_plus_1 - K_alpha_n);
9521 * viscoplastic_yield_law.hardening_alpha_derivatives(DH_alpha_n_plus_1, DK_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9522 * Dg_of_gamma_k = -2 * mu_bar - two_thirds * (DK_alpha_n_plus_1 + DH_alpha_n_plus_1);
9524 * delta_gamma = delta_gamma - g_of_gamma_k / Dg_of_gamma_k;
9525 * alpha_n_plus_1 = alpha_n + sqrt2thirds * delta_gamma;
9527 * viscoplastic_yield_law.hardening_values(H_alpha_n_plus_1, K_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9528 * g_of_gamma_k = norm_ksi_trial
9529 * - 2 * mu_bar * delta_gamma
9530 * - sqrt2thirds * H_alpha_n_plus_1
9531 * - sqrt2thirds * (K_alpha_n_plus_1 - K_alpha_n);
9532 * } while (std::fabs(g_of_gamma_k) > tol && ++k < max_iter);
9533 * if (std::fabs(g_of_gamma_k) > tol) {
9534 * std::ostringstream convert;
9535 * convert << "Did not converge after " << k << " iterations. g: " << g_of_gamma_k
9536 * << ", norm_ksi_trial: " << norm_ksi_trial
9537 * << ", mu_bar: " << mu_bar
9538 * << ", H_alpha_n_plus_1: " << H_alpha_n_plus_1
9539 * << ", alpha: " << alpha_n_plus_1
9540 * << ", delta_gamma: " << delta_gamma
9541 * << ", temperature: " << temperature
9542 * << ", gradient: " << Dg_of_gamma_k;
9543 * throw MaterialDomainException(convert.str());
9547 * template class ThermoPlasticMaterial<3, ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>;
9548 * template class ThermoPlasticMaterial<2, ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>;
9550 * template class ThermoPlasticMaterial<3, JohnsonCookThermoviscoplasticYieldLaw<double>, double>;
9551 * template class ThermoPlasticMaterial<2, JohnsonCookThermoviscoplasticYieldLaw<double>, double>;
9553 * } /* namespace PlasticityLab */
9557<a name="ann-src/ThermoPlasticMaterial.h"></a>
9558<h1>Annotated version of src/ThermoPlasticMaterial.h</h1>
9565 * * ThermoPlasticMaterial.h
9567 * * Created on: 05 Jan 2015
9571 * #ifndef THERMOPLASTICMATERIAL_H_
9572 * #define THERMOPLASTICMATERIAL_H_
9574 * #include "PointHistory.h"
9575 * #include "Material.h"
9576 * #include "ConstitutiveModelRequest.h"
9578 * using namespace dealii;
9580 * namespace PlasticityLab {
9582 * template <int dim, typename ViscoplasticYieldLaw, typename Number = double>
9583 * class ThermoPlasticMaterial : public Material<dim, Number> {
9585 * ThermoPlasticMaterial(const Number kappa,
9587 * const Number thermal_expansion_coefficient,
9588 * const Number thermal_conductivity,
9589 * const Number heat_capacity,
9590 * const Number dissipation_factor,
9591 * const ViscoplasticYieldLaw &viscoplastic_yield_law);
9593 * virtual ~ThermoPlasticMaterial();
9595 * void compute_constitutive_request(
9596 * ConstitutiveModelRequest <dim, Number> &constitutive_request,
9597 * const point_index_t &point_index) override;
9599 * Number get_material_Jacobian(const point_index_t &point_index) const override;
9600 * ::SymmetricTensor<2, dim, Number> get_plastic_strain(const point_index_t &point_index) const override;
9602 * std::vector<Number> get_state_parameters(
9603 * const point_index_t &point_index,
9604 * const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) const override;
9606 * void set_state_parameters(
9607 * const point_index_t &point_index,
9608 * const std::vector<Number> &state_parameters,
9609 * const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) override;
9610 * size_t get_material_parameter_count() const override;
9613 * void setup_point_history (const point_index_t point_count) override;
9616 * const Number kappa;
9619 * const Number thermal_expansion_coefficient;
9620 * const Number thermal_conductivity;
9621 * const Number heat_capacity;
9622 * const Number reference_temperature;
9624 * const Number dissipation_factor;
9625 * const ViscoplasticYieldLaw viscoplastic_yield_law;
9627 * std::vector< PointHistory<dim, Number> > material_point_history;
9631 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9632 * const point_index_t &point_index);
9635 * determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
9636 * const Number norm_ksi_trial,
9637 * const Number mu_bar,
9638 * const Number alpha_n,
9639 * const Number temperature,
9640 * const Number time_increment,
9641 * const Number tol, unsigned int max_iter) const;
9643 * void compute_stress_deviator_and_d_gamma(
9644 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9645 * const point_index_t &point_index);
9647 * void compute_heat_flux(
9648 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9649 * const point_index_t &point_index);
9651 * void compute_thermo_elastic_heating(
9652 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9653 * const point_index_t &point_index);
9655 * void compute_stored_heat_rate(
9656 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9657 * const point_index_t &point_index);
9661 * } /* namespace PlasticityLab */
9663 * #endif /* THERMOPLASTICMATERIAL_H_ */
9667<a name="ann-src/TimeRateRequest.h"></a>
9668<h1>Annotated version of src/TimeRateRequest.h</h1>
9675 * * TimeRateRequest.h
9677 * * Created on: 27 Nov 2019
9681 * #ifndef TIMERATEREQUEST_H_
9682 * #define TIMERATEREQUEST_H_
9684 * #include <deal.II/base/tensor.h>
9686 * #include "Constants.h"
9687 * #include "TimeRateUpdateFlags.h"
9689 * namespace PlasticityLab {
9691 * template <typename ValueType, int dim, typename Number=double>
9692 * class TimeRateRequest {
9694 * TimeRateRequest(TimeRateUpdateFlags);
9695 * virtual ~TimeRateRequest();
9699 * Interface to be used by request client (FE system assembler)
9700 * --request configuration stage--
9703 * void set_value(const ValueType &value);
9704 * void set_previous_value(const ValueType &previous_value);
9705 * void set_second_previous_value(const ValueType &second_previous_value);
9707 * void set_time_increment(const Number time_increment);
9708 * void set_previous_time_increment(const Number previous_time_increment);
9710 * void set_previous_partial_time_rate(const ValueType &previous_partial_time_rate);
9711 * void set_previous_total_time_rate(const ValueType &previous_total_time_rate);
9713 * void set_velocity(const ::Tensor<1, dim, Number> &velocity);
9717 * Interface to be used by request client (FE system assembler)
9718 * --request response retrieval and interrogation stage--
9721 * ValueType get_partial_time_rate() const;
9722 * ValueType get_total_time_rate() const;
9723 * ValueType get_partial_second_time_rate() const;
9724 * ValueType get_total_second_time_rate() const;
9726 * ValueType get_partial_time_rate_tangent(const ValueType &value_increment) const;
9727 * ValueType get_partial_second_time_rate_tangent(const ValueType &value_increment) const;
9729 * template<typename GradientType>
9730 * ValueType get_total_time_rate_tangent(
9731 * const ValueType &value_increment,
9732 * const ValueType &gradient_increment) const;
9734 * template<typename GradientType>
9735 * ValueType get_total_second_time_rate_tangent(
9736 * const ValueType &value_increment,
9737 * const ValueType &gradient_increment) const;
9741 * interface used by constitutive model object to perform computation
9742 * TODO consider hiding this interface and exposing it through adapter
9745 * TimeRateUpdateFlags get_update_flags() const;
9746 * ValueType get_value() const;
9747 * ValueType get_previous_value() const;
9748 * ValueType get_second_previous_value() const;
9750 * Number get_time_increment() const;
9751 * Number get_previous_time_increment() const;
9753 * ValueType get_previous_partial_time_rate() const;
9754 * ValueType get_previous_total_time_rate() const;
9756 * ::Tensor<1, dim, Number> get_velocity() const;
9763 * void set_partial_time_rate(const ValueType &partial_time_rate);
9764 * void set_total_time_rate(const ValueType &total_time_rate);
9765 * void set_partial_second_time_rate(const ValueType &partial_second_time_rate);
9766 * void set_total_second_time_rate(const ValueType &total_second_time_rate);
9768 * void set_partial_time_rate_tangent(const ValueType &partial_time_rate_tangent);
9769 * void set_total_time_rate_tangent(const ValueType &total_time_rate_tangent);
9770 * void set_partial_second_time_rate_tangent(const ValueType &partial_second_time_rate_tangent);
9771 * void set_total_second_time_rate_tangent(const ValueType &total_second_time_rate_tangent);
9779 * TimeRateUpdateFlags update_flags;
9782 * ValueType previous_value;
9783 * ValueType second_previous_value;
9785 * Number time_increment;
9786 * Number previous_time_increment;
9788 * ValueType previous_partial_time_rate;
9789 * ValueType previous_total_time_rate;
9791 * ::Tensor<1, dim, Number> velocity;
9798 * ValueType partial_time_rate;
9799 * ValueType total_time_rate;
9800 * ValueType partial_second_time_rate;
9801 * ValueType total_second_time_rate;
9803 * ValueType partial_time_rate_tangent;
9804 * ValueType total_time_rate_tangent;
9805 * ValueType partial_second_time_rate_tangent;
9806 * ValueType total_second_time_rate_tangent;
9810 * template <typename ValueType, int dim, typename Number>
9811 * TimeRateRequest<ValueType, dim, Number>::
9812 * TimeRateRequest(TimeRateUpdateFlags update_flags):
9813 * update_flags(update_flags) {
9816 * template <typename ValueType, int dim, typename Number>
9817 * TimeRateRequest<ValueType, dim, Number>::~TimeRateRequest() { }
9820 * template <typename ValueType, int dim, typename Number>
9821 * void TimeRateRequest<ValueType, dim, Number>::
9822 * set_value(const ValueType &value) {
9823 * this->value = value;
9827 * template <typename ValueType, int dim, typename Number>
9828 * void TimeRateRequest<ValueType, dim, Number>::
9829 * set_previous_value(const ValueType &previous_value) {
9830 * this->previous_value = previous_value;
9834 * template <typename ValueType, int dim, typename Number>
9835 * void TimeRateRequest<ValueType, dim, Number>::
9836 * set_second_previous_value(const ValueType &second_previous_value) {
9837 * this->second_previous_value = second_previous_value;
9841 * template <typename ValueType, int dim, typename Number>
9842 * void TimeRateRequest<ValueType, dim, Number>::
9843 * set_time_increment(const Number time_increment) {
9844 * this->time_increment = time_increment;
9848 * template <typename ValueType, int dim, typename Number>
9849 * void TimeRateRequest<ValueType, dim, Number>::
9850 * set_previous_time_increment(const Number previous_time_increment) {
9851 * this->previous_time_increment = previous_time_increment;
9855 * template <typename ValueType, int dim, typename Number>
9856 * void TimeRateRequest<ValueType, dim, Number>::
9857 * set_previous_partial_time_rate(const ValueType &previous_partial_time_rate) {
9858 * this->previous_partial_time_rate = previous_partial_time_rate;
9862 * template <typename ValueType, int dim, typename Number>
9863 * void TimeRateRequest<ValueType, dim, Number>::
9864 * set_previous_total_time_rate(const ValueType &previous_total_time_rate) {
9865 * this->previous_total_time_rate = previous_total_time_rate;
9869 * template <typename ValueType, int dim, typename Number>
9870 * void TimeRateRequest<ValueType, dim, Number>::
9871 * set_velocity(const ::Tensor<1, dim, Number> &velocity) {
9872 * this->velocity = velocity;
9878 * template <typename ValueType, int dim, typename Number>
9879 * ValueType TimeRateRequest<ValueType, dim, Number>::
9880 * get_partial_time_rate() const {
9881 * return partial_time_rate;
9885 * template <typename ValueType, int dim, typename Number>
9886 * ValueType TimeRateRequest<ValueType, dim, Number>::
9887 * get_total_time_rate() const {
9888 * return total_time_rate;
9892 * template <typename ValueType, int dim, typename Number>
9893 * ValueType TimeRateRequest<ValueType, dim, Number>::
9894 * get_partial_second_time_rate() const {
9895 * return partial_second_time_rate;
9899 * template <typename ValueType, int dim, typename Number>
9900 * ValueType TimeRateRequest<ValueType, dim, Number>::
9901 * get_total_second_time_rate() const {
9902 * return total_second_time_rate;
9906 * template <typename ValueType, int dim, typename Number>
9907 * ValueType TimeRateRequest<ValueType, dim, Number>::
9908 * get_partial_time_rate_tangent(const ValueType &value_increment) const {
9909 * return partial_time_rate_tangent;
9913 * template <typename ValueType, int dim, typename Number>
9914 * ValueType TimeRateRequest<ValueType, dim, Number>::
9915 * get_partial_second_time_rate_tangent(const ValueType &value_increment) const {
9916 * return partial_second_time_rate_tangent;
9920 * template <typename ValueType, int dim, typename Number>
9921 * template<typename GradientType>
9922 * ValueType TimeRateRequest<ValueType, dim, Number>::
9923 * get_total_time_rate_tangent(
9924 * const ValueType &value_increment,
9925 * const ValueType &gradient_increment) const {
9930 * template <typename ValueType, int dim, typename Number>
9931 * template<typename GradientType>
9932 * ValueType TimeRateRequest<ValueType, dim, Number>::
9933 * get_total_second_time_rate_tangent(
9934 * const ValueType &value_increment,
9935 * const ValueType &gradient_increment) const {
9943 * template <typename ValueType, int dim, typename Number>
9944 * TimeRateUpdateFlags TimeRateRequest<ValueType, dim, Number>::
9945 * get_update_flags() const {
9946 * return update_flags;
9950 * template <typename ValueType, int dim, typename Number>
9951 * ValueType TimeRateRequest<ValueType, dim, Number>::
9952 * get_value() const {
9957 * template <typename ValueType, int dim, typename Number>
9958 * ValueType TimeRateRequest<ValueType, dim, Number>::
9959 * get_previous_value() const {
9960 * return previous_value;
9964 * template <typename ValueType, int dim, typename Number>
9965 * ValueType TimeRateRequest<ValueType, dim, Number>::
9966 * get_second_previous_value() const {
9967 * return second_previous_value;
9971 * template <typename ValueType, int dim, typename Number>
9972 * Number TimeRateRequest<ValueType, dim, Number>::
9973 * get_time_increment() const {
9974 * return time_increment;
9978 * template <typename ValueType, int dim, typename Number>
9979 * Number TimeRateRequest<ValueType, dim, Number>::
9980 * get_previous_time_increment() const {
9981 * return previous_time_increment;
9985 * template <typename ValueType, int dim, typename Number>
9986 * ValueType TimeRateRequest<ValueType, dim, Number>::
9987 * get_previous_partial_time_rate() const {
9988 * return previous_partial_time_rate;
9992 * template <typename ValueType, int dim, typename Number>
9993 * ValueType TimeRateRequest<ValueType, dim, Number>::
9994 * get_previous_total_time_rate() const {
9995 * return previous_total_time_rate;
9999 * template <typename ValueType, int dim, typename Number>
10000 * ::Tensor<1, dim, Number> TimeRateRequest<ValueType, dim, Number>::
10001 * get_velocity() const {
10009 * template <typename ValueType, int dim, typename Number>
10010 * void TimeRateRequest<ValueType, dim, Number>::
10011 * set_partial_time_rate(const ValueType &partial_time_rate) {
10012 * this->partial_time_rate = partial_time_rate;
10016 * template <typename ValueType, int dim, typename Number>
10017 * void TimeRateRequest<ValueType, dim, Number>::
10018 * set_total_time_rate(const ValueType &total_time_rate) {
10019 * this->total_time_rate = total_time_rate;
10023 * template <typename ValueType, int dim, typename Number>
10024 * void TimeRateRequest<ValueType, dim, Number>::
10025 * set_partial_second_time_rate(const ValueType &partial_second_time_rate) {
10026 * this->partial_second_time_rate = partial_second_time_rate;
10030 * template <typename ValueType, int dim, typename Number>
10031 * void TimeRateRequest<ValueType, dim, Number>::
10032 * set_total_second_time_rate(const ValueType &total_second_time_rate) {
10033 * this->total_second_time_rate = total_second_time_rate;
10037 * template <typename ValueType, int dim, typename Number>
10038 * void TimeRateRequest<ValueType, dim, Number>::
10039 * set_partial_time_rate_tangent(const ValueType &partial_time_rate_tangent) {
10040 * this->partial_time_rate_tangent = partial_time_rate_tangent;
10044 * template <typename ValueType, int dim, typename Number>
10045 * void TimeRateRequest<ValueType, dim, Number>::
10046 * set_total_time_rate_tangent(const ValueType &total_time_rate_tangent) {
10047 * this->total_time_rate_tangent = total_time_rate_tangent;
10051 * template <typename ValueType, int dim, typename Number>
10052 * void TimeRateRequest<ValueType, dim, Number>::
10053 * set_partial_second_time_rate_tangent(const ValueType &partial_second_time_rate_tangent) {
10054 * this->partial_second_time_rate_tangent = partial_second_time_rate_tangent;
10058 * template <typename ValueType, int dim, typename Number>
10059 * void TimeRateRequest<ValueType, dim, Number>::
10060 * set_total_second_time_rate_tangent(const ValueType &total_second_time_rate_tangent) {
10061 * this->total_second_time_rate_tangent = total_second_time_rate_tangent;
10065 * } /* namespace PlasticityLab */
10067 * #endif /* TIMERATEREQUEST_H_ */
10071<a name="ann-src/TimeRateUpdateFlags.h"></a>
10072<h1>Annotated version of src/TimeRateUpdateFlags.h</h1>
10079 * * TimeRateUpdateFlags.h
10081 * * Created on: 27 Nov 2019
10085 * #ifndef TIMERATEUPDATEFLAGS_H_
10086 * #define TIMERATEUPDATEFLAGS_H_
10088 * namespace PlasticityLab {
10090 * enum TimeRateUpdateFlags {
10091 * default_timerate_update_flags = 0x0000,
10092 * update_partial_time_rate = 0x0001,
10093 * update_total_time_rate = 0x0002,
10094 * update_partial_second_time_rate=0x0004,
10095 * update_total_second_time_rate=0x0008,
10096 * update_partial_time_rate_tangent=0x0010,
10097 * update_total_time_rate_tangent=0x0020,
10098 * update_partial_second_time_rate_tangent=0x0040,
10099 * update_total_second_time_rate_tangent=0x0080
10103 * TimeRateUpdateFlags
10104 * operator | (TimeRateUpdateFlags f1, TimeRateUpdateFlags f2) {
10105 * return static_cast<TimeRateUpdateFlags> (
10106 * static_cast<unsigned int> (f1) |
10107 * static_cast<unsigned int> (f2));
10111 * const TimeRateUpdateFlags &
10112 * operator |= (TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2) {
10118 * TimeRateUpdateFlags
10119 * operator & (TimeRateUpdateFlags f1, TimeRateUpdateFlags f2) {
10120 * return static_cast<TimeRateUpdateFlags> (
10121 * static_cast<unsigned int> (f1) &
10122 * static_cast<unsigned int> (f2));
10126 * const TimeRateUpdateFlags &
10127 * operator &= (TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2) {
10132 * } /* namespace PlasticityLab */
10134 * #endif /*TIMERATEUPDATEFLAGS_H_*/
10138<a name="ann-src/main.cpp"></a>
10139<h1>Annotated version of src/main.cpp</h1>
10143 * ============================================================================
10145 * Author : Maien Hamed
10148 * Description : Hello World in C++, Ansi-style
10149 * ============================================================================
10155 * #include <iostream>
10157 * #include "utilities.h"
10158 * #include "ThermoPlasticMaterial.h"
10159 * #include "ExponentialHardeningThermoviscoplasticYieldLaw.h"
10160 * #include "JohnsonCookThermoviscoplasticYieldLaw.h"
10161 * #include "ExponentialHardeningElastoplasticMaterial.h"
10162 * #include "PlasticityLabProg.h"
10166 * PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10167 * getExponentialHardeningThermoPlasticMaterial();
10169 * PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10170 * getJohnsonCookThermoPlasticMaterial();
10172 * int main(int argc, char **argv) {
10174 * Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv);
10176 * deallog.depth_console(0);
10177 * auto material = getExponentialHardeningThermoPlasticMaterial();
10178 * PlasticityLab::PlasticityLabProg<DIM> plasticityLab(material);
10179 * plasticityLab.run();
10180 * if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
10181 * std::cout << "Finished." << std::endl; // prints
10183 * } catch (std::exception &exc) {
10184 * std::cerr << std::endl << std::endl
10185 * << "----------------------------------------------------"
10187 * std::cerr << "Exception on processing: " << std::endl
10188 * << exc.what() << std::endl
10189 * << "Aborting!" << std::endl
10190 * << "----------------------------------------------------"
10194 * std::cerr << std::endl << std::endl
10195 * << "----------------------------------------------------"
10197 * std::cerr << "Unknown exception!" << std::endl
10198 * << "Aborting!" << std::endl
10199 * << "----------------------------------------------------"
10206 * PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10207 * getExponentialHardeningThermoPlasticMaterial() {
10208 * double kappa (164206.0), // [MPa]
10209 * mu (801938.0), // [MPa]
10210 * thermal_expansion_coefficient(1.0e-5), // [K^-1]
10211 * thermal_conductivity(4.5e-2), // [J/mm.K.s]
10212 * heat_capacity(3.588e-3), // cp*rho: [J.mm^-3.K^-1]
10213 * K_0(450.0/*std::numeric_limits<double>::max()*/), // [MPa]
10214 * K_infty(715.0/*std::numeric_limits<double>::max()*/), // [MPa]
10215 * delta(16.93), // dimensionless
10216 * H_bar(129.24), // [MPa]
10217 * beta(1.0), // dimensionless (1.0 for isotropic hardening, 0.0 for kinematic hardening)
10218 * flow_stress_softening(0.002), // [K^-1]
10219 * hardening_softening(0.002), // [K^-1]
10220 * dissipation_factor(0.9); // dimensionless
10222 * PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double> thermo_viscoplastic_yield_law(
10228 * flow_stress_softening,
10229 * hardening_softening);
10231 * return PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10234 * thermal_expansion_coefficient,
10235 * thermal_conductivity,
10237 * dissipation_factor,
10238 * thermo_viscoplastic_yield_law);
10241 * PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10242 * getJohnsonCookThermoPlasticMaterial() {
10243 * double kappa (103300.0), // [MPa]
10244 * mu (47690.0), // [MPa]
10245 * A(89.7), // [MPa]
10246 * B(291.87), // [MPa]
10247 * C(0.025), // dimensionless
10248 * m(1.09), // dimensionless
10249 * n(0.31), // dimensionless
10250 * melting_temperature(1356), // [K]
10251 * reference_temperature(293.15), // [K]
10252 * reference_strain_rate(1.0), // [s^-1]
10253 * thermal_expansion_coefficient(1.0e-5), // [K^-1]
10254 * thermal_conductivity(4.5e-2), // [J/mm.K.s] // http://www.matweb.com/search/datasheet_print.aspx?matguid=193434cf42e343fab880e1dabdb143ba
10255 * heat_capacity(3.588e-3), // cp*rho: [J.mm^-3.K^-1]
10256 * dissipation_factor(0.9); // dimensionless
10258 * PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double> thermo_viscoplastic_yield_law(
10261 * melting_temperature,
10262 * reference_strain_rate,
10263 * reference_temperature);
10265 * return PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10268 * thermal_expansion_coefficient,
10269 * thermal_conductivity,
10271 * dissipation_factor,
10272 * thermo_viscoplastic_yield_law);
10277<a name="ann-src/symmetric_tensor_entries.h"></a>
10278<h1>Annotated version of src/symmetric_tensor_entries.h</h1>
10286 * #include <deal.II/base/symmetric_tensor.h>
10288 * #include <cstddef>
10289 * #include <iterator>
10291 * namespace dealii_utils
10295 * ---------------- Const view ----------------
10298 * template <int rank, int dim, typename Number>
10299 * class SymmetricTensorConstEntriesView
10302 * using tensor_type = ::SymmetricTensor<rank, dim, Number>;
10304 * explicit SymmetricTensorConstEntriesView(const tensor_type &t) : t_(&t) {}
10306 * class const_iterator
10309 * using iterator_category = std::forward_iterator_tag;
10310 * using value_type = Number;
10311 * using difference_type = std::ptrdiff_t;
10312 * using pointer = const Number *;
10313 * using reference = const Number &;
10315 * const_iterator() = default;
10316 * const_iterator(const tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10318 * reference operator*() const { return t_->access_raw_entry(i_); }
10320 * const_iterator &operator++() { ++i_; return *this; }
10321 * const_iterator operator++(int) { const_iterator tmp(*this); ++(*this); return tmp; }
10323 * friend bool operator==(const const_iterator &a, const const_iterator &b)
10325 * return a.t_ == b.t_ && a.i_ == b.i_;
10327 * friend bool operator!=(const const_iterator &a, const const_iterator &b) { return !(a == b); }
10330 * const tensor_type *t_ = nullptr;
10331 * unsigned int i_ = 0;
10334 * const_iterator begin() const { return const_iterator(t_, 0u); }
10335 * const_iterator end() const { return const_iterator(t_, tensor_type::n_independent_components); }
10336 * const_iterator cbegin() const { return begin(); }
10337 * const_iterator cend() const { return end(); }
10340 * const tensor_type *t_;
10346 * ---------------- Mutable view ----------------
10349 * template <int rank, int dim, typename Number>
10350 * class SymmetricTensorMutableEntriesView
10353 * using tensor_type = ::SymmetricTensor<rank, dim, Number>;
10355 * explicit SymmetricTensorMutableEntriesView(tensor_type &t) : t_(&t) {}
10360 * using iterator_category = std::forward_iterator_tag;
10361 * using value_type = Number;
10362 * using difference_type = std::ptrdiff_t;
10363 * using pointer = Number *;
10364 * using reference = Number &;
10366 * iterator() = default;
10367 * iterator(tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10369 * reference operator*() const { return t_->access_raw_entry(i_); }
10371 * iterator &operator++() { ++i_; return *this; }
10372 * iterator operator++(int) { iterator tmp(*this); ++(*this); return tmp; }
10374 * friend bool operator==(const iterator &a, const iterator &b)
10376 * return a.t_ == b.t_ && a.i_ == b.i_;
10378 * friend bool operator!=(const iterator &a, const iterator &b) { return !(a == b); }
10381 * tensor_type *t_ = nullptr;
10382 * unsigned int i_ = 0;
10385 * class const_iterator
10388 * using iterator_category = std::forward_iterator_tag;
10389 * using value_type = Number;
10390 * using difference_type = std::ptrdiff_t;
10391 * using pointer = const Number *;
10392 * using reference = const Number &;
10394 * const_iterator() = default;
10395 * const_iterator(const tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10397 * reference operator*() const { return t_->access_raw_entry(i_); }
10399 * const_iterator &operator++() { ++i_; return *this; }
10400 * const_iterator operator++(int) { const_iterator tmp(*this); ++(*this); return tmp; }
10402 * friend bool operator==(const const_iterator &a, const const_iterator &b)
10404 * return a.t_ == b.t_ && a.i_ == b.i_;
10406 * friend bool operator!=(const const_iterator &a, const const_iterator &b) { return !(a == b); }
10409 * const tensor_type *t_ = nullptr;
10410 * unsigned int i_ = 0;
10413 * iterator begin() { return iterator(t_, 0u); }
10414 * iterator end() { return iterator(t_, tensor_type::n_independent_components); }
10416 * const_iterator begin() const { return const_iterator(t_, 0u); }
10417 * const_iterator end() const { return const_iterator(t_, tensor_type::n_independent_components); }
10418 * const_iterator cbegin() const { return begin(); }
10419 * const_iterator cend() const { return end(); }
10428 * ---------------- Factories ----------------
10431 * template <int rank, int dim, typename Number>
10432 * SymmetricTensorConstEntriesView<rank, dim, Number>
10433 * symmetric_tensor_entries(const ::SymmetricTensor<rank, dim, Number> &t)
10435 * return SymmetricTensorConstEntriesView<rank, dim, Number>(t);
10438 * template <int rank, int dim, typename Number>
10439 * SymmetricTensorMutableEntriesView<rank, dim, Number>
10440 * symmetric_tensor_entries(::SymmetricTensor<rank, dim, Number> &t)
10442 * return SymmetricTensorMutableEntriesView<rank, dim, Number>(t);
10444 * } // namespace dealii_utils
10448<a name="ann-src/utilities.h"></a>
10449<h1>Annotated version of src/utilities.h</h1>
10455 * #ifndef _UTILITIES_H
10456 * #define _UTILITIES_H
10458 * #include <deal.II/base/utilities.h>
10461 * namespace PlasticityLab {
10463 * [[maybe_unused]] static MPI_Comm mpi_communicator(MPI_COMM_WORLD);
10465 * struct NotImplementedException : std::exception {
10466 * const char *what() const _GLIBCXX_USE_NOEXCEPT override {
10467 * return "Not Implemented.!\n";
10471 * } /*namespace PlasticityLab*/
10474 * #endif /*_UTILITIES_H*/
*const Number elongation_rate
*mech_lbc_system interpolatoryConstraintAppliers push_back * InterpolatoryConstraintApplier(*top_constraint_function_map, *y_component_mask)
* * const_iterator()=default
* * * struct InterferenceTaperTransform *
*const unsigned int n_steps
***const Number total_elongation
* x_component_mask set(0, true)
* *endcode **Thermal constraints **code * const Number convection_coefficient
#define DEAL_II_VERSION_GTE(major, minor, subminor)
EnableObserverPointer Subscriptor
TriaActiveIterator< CellAccessor< dim, spacedim > > active_cell_iterator
const bool IsBlockVector< VectorType >::value
void make_hanging_node_constraints(const DoFHandler< dim, spacedim > &dof_handler, AffineConstraints< number > &constraints)
void make_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternBase &sparsity_pattern, const AffineConstraints< number > &constraints={}, const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)
void compute_no_normal_flux_constraints(const DoFHandler< dim, spacedim > &dof_handler, const unsigned int first_vector_component, const std::set< types::boundary_id > &boundary_ids, AffineConstraints< number > &constraints, const Mapping< dim, spacedim > &mapping=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< spacedim >()), const bool use_manifold_for_normal=true)
@ update_values
Shape function values.
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_jacobians
Volume element.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
@ update_default
No update.
MappingQ< dim, spacedim > StaticMappingQ1< dim, spacedim >::mapping
@ component_is_part_of_vector
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
Expression ceil(const Expression &x)
@ valid
Iterator points to a valid object.
constexpr types::blas_int zero
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.)
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.)
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
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 time_increment
* * const Number trial_yield_criterion
* constitutive_request set_mu((0.5 *mu))
* * point_history plastic_strain
* const Number norm_ksi_trial
* * * RotationFunction< dim, Number >::RotationFunction Number(dim)
* * * ThermoPlasticMaterial< dim, ViscoplasticYieldLaw, Number > ThermoPlasticMaterial * * * * * reference_temperature(293.15)
* * * * * * TimeRateUpdateFlags TimeRateRequest< ValueType, dim, Number > get_update_flags() const
* const Number temperature
* * * 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)
* * return state_parameters
**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)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
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)
::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 > &)
* const unsigned int dofs_per_cell
* * FEFaceValues< 2 > fe_face_values(fe, face_quadrature_formula, update_values|update_quadrature_points| * update_normal_vectors|update_JxW_values)
* const unsigned int n_q_points
static constexpr unsigned int faces_per_cell
constexpr SymmetricTensor< 2, dim, Number > deviator(const SymmetricTensor< 2, dim, Number > &)
constexpr SymmetricTensor< 2, dim, Number > symmetrize(const Tensor< 2, dim, Number > &t)
constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)
constexpr SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
constexpr Number trace(const SymmetricTensor< 2, dim2, Number > &)
constexpr SymmetricTensor< 4, dim, Number > outer_product(const SymmetricTensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, Number > &t2)
constexpr SymmetricTensor< 4, dim, Number > identity_tensor()
constexpr SymmetricTensor< 2, dim, Number > unit_symmetric_tensor()