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--
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);
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);
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
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;
515 *
void set_pressure(Number pressure);
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);
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;
546 *
Number deformation_Jacobian, previous_deformation_Jacobian, deformation_Jacobian_time_rate;
547 *
Number unprojected_deformation_Jacobian;
554 *
Number stored_heat_rate;
556 *
Number mechanical_dissipation;
557 *
Number thermo_elastic_heating;
562 *
Number pressure_tangent_modulus;
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>::
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>::
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>
661 *
get_stress_deviator()
const {
662 *
return stress_deviator;
665 *
template <
int dim,
typename Number>
668 *
const Number twothirds = Constants<dim, Number>::two_thirds();
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);
691 *
const auto epsilon_e_bar = get_log_of_tensor(b_e_bar);
692 *
Number norm_dev_b_e_bar = (epsilon_e_bar).
norm();
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>
710 *
ConstitutiveModelRequest<dim, Number>::get_heat_flux()
const {
714 *
template <
int dim,
typename Number>
716 *
ConstitutiveModelRequest<dim, Number>::
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>
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>
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>::
844 *
this->stress_deviator = stress_deviator;
847 *
template <
int dim,
typename Number>
848 *
void ConstitutiveModelRequest<dim, Number>::
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);
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),
1097 *
mapping(mapping) {
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
1142 *
(
const Number kappa,
1145 *
const Number K_infty,
1146 *
const Number delta,
1147 *
const Number H_bar,
1148 *
const Number beta) :
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 &,
1176 *
throw NotImplementedException();
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> &,
1185 *
throw NotImplementedException();
1188 *
template <
int dim,
typename Number>
1189 *
size_t ExponentialHardeningElastoplasticMaterial<dim, Number>::
1190 *
get_material_parameter_count()
const {
1191 *
throw NotImplementedException();
1195 *
template <
int dim,
typename Number>
1196 *
Number ExponentialHardeningElastoplasticMaterial<dim, Number>::get_material_Jacobian(
const point_index_t &)
const {
1197 *
throw NotImplementedException();
1200 *
template <
int dim,
typename Number>
1201 * ::SymmetricTensor<2, dim, Number> ExponentialHardeningElastoplasticMaterial<dim, Number>::get_plastic_strain(
const point_index_t &)
const {
1202 *
throw NotImplementedException();
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
1224 *
Number delta_gamma, alpha_n_plus_1;
1233 * 4. Update back stress, plastic strain and stress
1236 *
const Number sqrt2thirds =
sqrt((Number)2 / (Number)3);
1237 *
Number H_alpha_n_plus_1, H_alpha_n, K_alpha_n_plus_1, K_alpha_n;
1238 *
Number DH_alpha_n_plus_1, DK_alpha_n_plus_1;
1239 *
exponential_hardening_values(K_alpha_n, H_alpha_n,
hardening_parameters.equivalent_plastic_strain);
1240 *
exponential_hardening_values(K_alpha_n_plus_1, H_alpha_n_plus_1, alpha_n_plus_1);
1241 *
exponential_hardening_derivatives(DK_alpha_n_plus_1, DH_alpha_n_plus_1, alpha_n_plus_1);
1242 *
if (update_material_point_history & constitutive_request.get_update_flags()) {
1243 *
material_point_history[
point_index].hardening_parameters.equivalent_plastic_strain = alpha_n_plus_1;
1244 *
material_point_history[
point_index].hardening_parameters.kinematic_hardening =
1247 *
* (H_alpha_n_plus_1 - H_alpha_n)
1249 *
material_point_history[
point_index].plastic_strain =
1254 *
stress = kappa *
trace(deformation_gradient) * unit_symmetric_tensor<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);
1262 *
outer_product(unit_symmetric_tensor<dim, Number>(), unit_symmetric_tensor<dim, Number>());
1263 *
elastoplastic_tangent_moduli = kappa * one_prod_one
1264 *
+ 2 *
mu * theta_n_plus_1 * (identity_tensor<dim, Number>() - 1 / 3 * one_prod_one)
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;
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>::
1307 *
const Number alpha_n,
1308 *
Number tol,
unsigned int max_iter)
const {
1309 *
unsigned int k = 0;
1310 *
const Number sqrt2thirds =
sqrt((Number)2 / (Number)3);
1311 *
Number g_of_gamma_k, Dg_of_gamma_k;
1312 *
Number K_alpha_n, K_alpha_n_plus_1, H_alpha_n, H_alpha_n_plus_1;
1313 *
Number DH_alpha_n_plus_1, DK_alpha_n_plus_1;
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);
1364 *
const Number sqrt2thirds =
sqrt((Number)2 / (Number)3);
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,
1431 *
size_t get_material_parameter_count()
const override;
1437 *
const Number K_0, K_infty, delta, H_bar;
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(
1611 *
bool do_interpolate,
1613 *
bool do_constrain,
1617 *
: increment_interpolation_function(increment_interpolation_function),
1618 *
do_interpolate(do_interpolate),
1619 *
interpolation_component_mask(interpolation_component_mask),
1620 *
do_constrain(do_constrain),
1621 *
constrain_component_mask(constrain_component_mask),
1622 *
constrain_boundary_id(constrain_boundary_id),
1623 *
mapping(mapping) { }
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();
1663 *
const bool do_interpolate;
1665 *
const bool do_constrain;
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);
1717 *
void apply(const ::Mapping<dim> &mapping,
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);
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;
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>
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,
2265 *
virtual size_t get_material_parameter_count()
const = 0;
2269 *
template <
int dim,
typename Number>
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;
2326 *
unsigned int n_q_points;
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);
2348 *
std::vector<::Vector<Number> > ksi(n_q_points,
::Vector<Number>(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) {
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) {
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;
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;
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(
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)) {
2702 *
fe_face_values.reinit(cell, 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)) {
2743 *
fe_face_values.reinit(cell, face);
2745 *
fe_face_values[displacements].get_function_gradients(
2746 *
mesh_motion_nonlinear_system.current_increment,
2747 *
mesh_motion_gradient_increments);
2749 *
fe_face_values[displacements].get_function_values(
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]
2763 *
/fe_face_values.quadrature_point(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(),
2790 *
n_q_points = quadrature_formula.size(),
2791 *
mixed_dofs_per_cell = MixedFE.dofs_per_cell;
2792 *
MixedFeProjectors.clear();
2793 *
MixedFeProjectors.resize(num_cells);
2795 *
cell = triangulation.begin_active();
2796 *
cell != triangulation.end(); ++cell) {
2797 *
mixed_fe_values.reinit(cell);
2798 *
MixedFeProjectors.at(cell->user_index() / n_q_points) =
2799 *
MixedFEProjector<dim, Number>(mixed_dofs_per_cell,
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,
3120 *
std::vector<Number>(n_q_points));
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]);
3130 *
std::vector<Number>
state_parameters = material.get_state_parameters(quadrature_point_index, unit_symmetric_tensor<dim+1, Number>());
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++) {
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;
3272 *
material.set_state_parameters(quadrature_point_index, remapped_state_parameters, unit_symmetric_tensor<dim+1, Number>());
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 * const std::vector<std::vector<bool> > constant_modes
3628 * = DoFTools::extract_constant_modes(thermal_dof_system.dof_handler,
3631 * TrilinosWrappers::PreconditionAMG::AdditionalData additional_data;
3632 * additional_data.constant_modes = constant_modes;
3633 * additional_data.elliptic = true;
3634 * additional_data.n_cycles = 1;
3635 * additional_data.w_cycle = false;
3636 * additional_data.output_details = false;
3637 * additional_data.smoother_sweeps = 2;
3638 * additional_data.aggregation_threshold = 1e-2;
3639 * preconditioner.initialize(projection_matrix, additional_data);
3641 * TrilinosWrappers::MPI::Vector tmp(thermal_dof_system.locally_owned_dofs, mpi_communicator);
3642 * const Number relative_accuracy = 1e-08;
3643 * const Number solver_tolerance = relative_accuracy
3644 * * projection_matrix.residual(tmp, thermal_nonlinear_system.Newton_step_solution,
3645 * projection_residual);
3646 * SolverControl solver_control(projection_matrix.m(),
3647 * solver_tolerance);
3649 * SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
3651 * thermal_nonlinear_system.Newton_step_solution = 0;
3653 * solver.solve(projection_matrix, thermal_nonlinear_system.Newton_step_solution,
3654 * projection_residual, preconditioner);
3656 * thermal_nonlinear_system.previous_deformation = thermal_nonlinear_system.Newton_step_solution;
3663 * template<int dim, typename Number>
3664 * void PlasticityLabProg<dim, Number>::remap_mechanical_fields(
3665 * NewtonStepSystem &mechanical_nonlinear_system,
3666 * const DoFSystem<dim, Number> &mechanical_dof_system,
3667 * const NewtonStepSystem &mesh_motion_nonlinear_system,
3668 * const DoFSystem<dim, Number> &mesh_motion_dof_system) {
3670 * const Quadrature<dim> mechanical_fe_support_point_quadrature(mech_fe.base_element(0).get_unit_support_points());
3672 * const unsigned int n_q_points = mechanical_fe_support_point_quadrature.size();
3673 * [[maybe_unused]] const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
3674 * const unsigned int mechanical_dofs_per_cell = mech_fe.dofs_per_cell;
3676 * FEValues<dim> mesh_motion_fe_values(
3679 * mechanical_fe_support_point_quadrature,
3680 * update_values | update_quadrature_points);
3682 * FEValues<dim> mechanical_fe_values(
3685 * mechanical_fe_support_point_quadrature,
3686 * update_values | update_quadrature_points);
3688 * std::vector< Tensor<1, dim, Number> > previous_remapped_deformations(1);
3689 * std::vector< Tensor<1, dim, Number> > previous_remapped_velocity(1);
3690 * std::vector< Tensor<1, dim, Number> > previous_remapped_second_time_rate(1);
3691 * std::vector< Number > previous_remapped_twist_deformations(1);
3692 * std::vector< Number > previous_remapped_twist_velocity(1);
3693 * std::vector< Number > previous_remapped_twist_second_time_rate(1);
3694 * std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
3695 * std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
3697 * const FEValuesExtractors::Vector displacements(0);
3698 * const FEValuesExtractors::Scalar angular_velocities(dim);
3700 * std::vector<ReferencePoint<dim, Number>> reference_points;
3701 * std::vector<Point<dim, Number>> remapped_point_positions;
3702 * std::unordered_map<point_index_t, unsigned int> quadrature_point_reference_point_id;
3703 * auto cell = mesh_motion_dof_system.dof_handler.begin_active();
3704 * auto mechanical_cell = mechanical_dof_system.dof_handler.begin_active();
3705 * for (; cell != mesh_motion_dof_system.dof_handler.end(); ++cell, ++mechanical_cell) {
3706 * if (cell->is_locally_owned()) {
3707 * mesh_motion_fe_values.reinit(cell);
3709 * mesh_motion_fe_values[displacements].get_function_values(
3710 * mesh_motion_nonlinear_system.current_increment,
3711 * mesh_motion_value_increments);
3713 * for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
3714 * const Point<dim, Number> reference_point_position = mesh_motion_fe_values.quadrature_point(q_point);
3715 * const Point<dim, Number> remapped_point_position = reference_point_position - mesh_motion_value_increments[q_point];
3717 * ReferencePoint<dim, Number> reference_point;
3718 * reference_point.mesh_motion_cell = cell;
3719 * reference_point.field_cell = mechanical_cell;
3720 * reference_point.q_point = q_point;
3721 * reference_point.reference_point = reference_point_position;
3722 * reference_point.remapped_point = remapped_point_position;
3724 * reference_points.push_back(reference_point);
3725 * remapped_point_positions.push_back(remapped_point_position);
3727 * const point_index_t quadrature_point_index = cell->user_index() + q_point;
3728 * quadrature_point_reference_point_id[quadrature_point_index] = reference_points.size() - 1;
3735 * MPI_Datatype PointType;
3736 * MPI_Type_contiguous(dim, MPI_DOUBLE, &PointType);
3737 * MPI_Type_commit(&PointType);
3738 * std::vector<int> displs;
3739 * std::vector< Point<dim, Number>> received_remapped_positions;
3740 * std::vector<RemappedPoint<dim, Number>> remapped_points;
3741 * int nprocesses, this_process;
3742 * int num_reference_points = reference_points.size();
3743 * MPI_Comm_size(mpi_communicator, &nprocesses);
3744 * std::vector<int> reference_point_counts(nprocesses);
3746 * &num_reference_points,
3748 * &reference_point_counts[0],
3750 * mpi_communicator);
3751 * MPI_Comm_rank(mpi_communicator, &this_process);
3752 * displs.resize(nprocesses);
3754 * for (int i = 1; i < nprocesses; ++i) {
3755 * displs[i] = displs[i - 1] + reference_point_counts[i - 1];
3758 * const unsigned int count_received_reference_points = displs[nprocesses - 1] + reference_point_counts[nprocesses - 1];
3759 * received_remapped_positions.resize(count_received_reference_points);
3760 * remapped_points.resize(count_received_reference_points);
3761 * std::vector<char> this_process_owns_remapped_point(count_received_reference_points);
3764 * &remapped_point_positions[0],
3765 * num_reference_points,
3767 * &received_remapped_positions[0],
3768 * &reference_point_counts[0],
3771 * mpi_communicator);
3774 * for(unsigned int received_point_id=0; received_point_id < count_received_reference_points; received_point_id++) {
3775 * auto point = received_remapped_positions[received_point_id];
3776 * auto remapped_cell_and_point = GridTools::find_active_cell_around_point(
3778 * mechanical_dof_system.dof_handler,
3780 * auto mechanical_cell = remapped_cell_and_point.first;
3781 * auto mechanical_unit_cell_point = remapped_cell_and_point.second;
3782 * remapped_points[received_point_id].field_cell = mechanical_cell;
3783 * remapped_points[received_point_id].unit_cell_point = mechanical_unit_cell_point;
3784 * remapped_points[received_point_id].remapped_point = point;
3785 * this_process_owns_remapped_point[received_point_id] = mechanical_cell.state() == IteratorState::valid && mechanical_cell->is_locally_owned()? 1 : 0;
3788 * std::vector<char> remapped_point_candidates(num_reference_points * nprocesses);
3789 * for (int process = 0; process < nprocesses; ++process) {
3790 * if (reference_point_counts[process] > 0)
3792 * &this_process_owns_remapped_point[displs[process]],
3793 * reference_point_counts[process],
3795 * &remapped_point_candidates[0],
3796 * reference_point_counts[process],
3799 * mpi_communicator);
3802 * std::vector<unsigned int> remapped_point_owning_process(num_reference_points);
3803 * for (int i = 0; i < num_reference_points; ++i) {
3804 * remapped_point_owning_process[i] = 0;
3805 * for (int j = 1; j < nprocesses; ++j) {
3806 * if (remapped_point_candidates[j * num_reference_points + i] == 1) {
3807 * remapped_point_owning_process[i] = j;
3813 * std::vector<RemappedPoint<dim, Number>> mapping_remapped_points;
3814 * std::vector<unsigned int> reference_point_owning_process;
3815 * std::vector<unsigned int> reference_point_index_at_remote_process;
3819 * This should really be a vector<bool>, but addresses of individual elements of
3820 * vector<bool> cannot be taken. It's a
template specialization to
save space
3823 *
std::vector<char> remote_remapped_point_is_accepted(num_reference_points * nprocesses);
3824 *
std::vector<char> local_remapped_point_is_accepted(count_received_reference_points);
3825 *
for (
int i = 0; i < num_reference_points; ++i) {
3826 *
for (
unsigned int j = 0; j < static_cast<unsigned int>(nprocesses); ++j) {
3827 *
remote_remapped_point_is_accepted[j * num_reference_points + i] = (remapped_point_owning_process[i] == j) ? 1 : 0;
3831 *
for (
int process = 0; process < nprocesses; ++process) {
3832 *
if (reference_point_counts[process] > 0) {
3834 *
&remote_remapped_point_is_accepted[0],
3835 *
reference_point_counts[process],
3837 *
&local_remapped_point_is_accepted[displs[process]],
3838 *
reference_point_counts[process],
3841 *
mpi_communicator);
3845 *
std::vector<unsigned int> remote_reference_point_counts(nprocesses, 0);
3846 *
for (
int process = 0; process < nprocesses; ++process) {
3847 *
for (
int i = 0; i < reference_point_counts[process]; ++i) {
3848 *
if (local_remapped_point_is_accepted[displs[process] + i]) {
3849 *
RemappedPoint<dim, Number> accepted_remapped_point = remapped_points[displs[process] + i];
3851 *
mapping_remapped_points.push_back(accepted_remapped_point);
3852 *
reference_point_owning_process.push_back(process);
3853 *
reference_point_index_at_remote_process.push_back(i);
3854 *
++remote_reference_point_counts[process];
3859 *
MPI_Barrier(mpi_communicator);
3861 *
std::vector<unsigned int> remote_remapped_point_counts(nprocesses);
3862 *
for (
int i = 0; i < nprocesses; ++i) {
3864 *
&remote_reference_point_counts[0],
3866 *
&remote_remapped_point_counts[i],
3868 *
i, mpi_communicator);
3871 *
std::vector<std::vector<Number> > local_previous_deformation_groups(nprocesses);
3872 *
std::vector<std::vector<Number> > local_previous_velocity_groups(nprocesses);
3873 *
std::vector<std::vector<Number> > local_previous_second_time_rate_groups(nprocesses);
3874 *
std::vector<std::vector<Number> > remote_previous_deformation_groups(nprocesses);
3875 *
std::vector<std::vector<Number> > remote_previous_velocity_groups(nprocesses);
3876 *
std::vector<std::vector<Number> > remote_previous_second_time_rate_groups(nprocesses);
3878 *
for (
int i = 0; i < nprocesses; ++i) {
3879 *
local_previous_deformation_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3880 *
local_previous_velocity_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3881 *
local_previous_second_time_rate_groups.at(i).resize((dim+1) * remote_reference_point_counts.at(i));
3882 *
remote_previous_deformation_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3883 *
remote_previous_velocity_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3884 *
remote_previous_second_time_rate_groups.at(i).resize((dim+1) * remote_remapped_point_counts.at(i));
3887 *
std::vector<unsigned int> next_to_process(nprocesses, 0);
3888 *
for (
unsigned int i = 0; i < mapping_remapped_points.size(); ++i) {
3889 *
const unsigned int group = reference_point_owning_process.at(i);
3890 *
const RemappedPoint<dim, Number> remapped_point = mapping_remapped_points.at(i);
3898 *
remapped_point_quadrature,
3901 *
remapped_point_fe_values.reinit(remapped_point.field_cell);
3903 *
remapped_point_fe_values[displacements].get_function_values(
3904 *
mechanical_nonlinear_system.previous_deformation,
3905 *
previous_remapped_deformations);
3907 *
remapped_point_fe_values[displacements].get_function_values(
3908 *
mechanical_nonlinear_system.previous_time_derivative,
3909 *
previous_remapped_velocity);
3911 *
remapped_point_fe_values[displacements].get_function_values(
3912 *
mechanical_nonlinear_system.previous_second_time_derivative,
3913 *
previous_remapped_second_time_rate);
3915 *
remapped_point_fe_values[angular_velocities].get_function_values(
3916 *
mechanical_nonlinear_system.previous_deformation,
3917 *
previous_remapped_twist_deformations);
3919 *
remapped_point_fe_values[angular_velocities].get_function_values(
3920 *
mechanical_nonlinear_system.previous_time_derivative,
3921 *
previous_remapped_twist_velocity);
3923 *
remapped_point_fe_values[angular_velocities].get_function_values(
3924 *
mechanical_nonlinear_system.previous_second_time_derivative,
3925 *
previous_remapped_twist_second_time_rate);
3927 *
for(
unsigned int dim_i=0; dim_i<dim; dim_i++) {
3928 *
local_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3929 *
previous_remapped_deformations[0][dim_i];
3930 *
local_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3931 *
previous_remapped_velocity[0][dim_i];
3932 *
local_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i) =
3933 *
previous_remapped_second_time_rate[0][dim_i];
3936 *
local_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3937 *
previous_remapped_twist_deformations[0];
3938 *
local_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3939 *
previous_remapped_twist_velocity[0];
3940 *
local_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim) =
3941 *
previous_remapped_twist_second_time_rate[0];
3943 *
++next_to_process.at(group);
3946 *
enum MessageFlag {
3947 *
PREVIOUS_DEFORMATION,
3948 *
PREVIOUS_VELOCITY,
3949 *
PREVIOUS_SECOND_TIME_RATE
3952 *
const unsigned int
3953 *
previous_deformation_requests_offset = 0,
3954 *
previous_velocity_requests_offset = 1,
3955 *
previous_second_time_rate_requests_offset = 2,
3956 *
request_array_size = 3;
3958 *
std::vector<MPI_Request> requests_vector(2 * nprocesses * request_array_size);
3960 *
for (
int i = 0; i < nprocesses; ++i) {
3962 *
local_previous_deformation_groups.at(i).data(),
3963 *
(dim+1) * remote_reference_point_counts.at(i),
3964 *
MPI_DOUBLE, i, PREVIOUS_DEFORMATION,
3966 *
&requests_vector[i + nprocesses * previous_deformation_requests_offset]);
3969 *
local_previous_velocity_groups.at(i).data(),
3970 *
(dim+1) * remote_reference_point_counts.at(i),
3971 *
MPI_DOUBLE, i, PREVIOUS_VELOCITY,
3973 *
&requests_vector[i + nprocesses * previous_velocity_requests_offset]);
3976 *
local_previous_second_time_rate_groups.at(i).data(),
3977 *
(dim+1) * remote_reference_point_counts.at(i),
3978 *
MPI_DOUBLE, i, PREVIOUS_SECOND_TIME_RATE,
3980 *
&requests_vector[i + nprocesses * previous_second_time_rate_requests_offset]);
3983 *
for (
int i = 0; i < nprocesses; ++i) {
3984 *
const unsigned int row_start = i + nprocesses * request_array_size;
3987 *
remote_previous_deformation_groups.at(i).data(),
3988 *
(dim+1) * remote_remapped_point_counts.at(i),
3989 *
MPI_DOUBLE, i, PREVIOUS_DEFORMATION,
3991 *
&requests_vector[row_start + nprocesses * previous_deformation_requests_offset]);
3994 *
remote_previous_velocity_groups.at(i).data(),
3995 *
(dim+1) * remote_remapped_point_counts.at(i),
3996 *
MPI_DOUBLE, i, PREVIOUS_VELOCITY,
3998 *
&requests_vector[row_start + nprocesses * previous_velocity_requests_offset]);
4001 *
remote_previous_second_time_rate_groups.at(i).data(),
4002 *
(dim+1) * remote_remapped_point_counts.at(i),
4003 *
MPI_DOUBLE, i, PREVIOUS_SECOND_TIME_RATE,
4005 *
&requests_vector[row_start + nprocesses * previous_second_time_rate_requests_offset]);
4009 *
std::vector<MPI_Status> statuses_vector(2 * request_array_size * nprocesses);
4011 *
2 * request_array_size * nprocesses,
4012 *
&requests_vector[0],
4013 *
&statuses_vector[0]);
4016 *
mechanical_dof_system.locally_owned_dofs,
4017 *
mpi_communicator);
4020 *
mechanical_dof_system.dof_handler, sparsity_pattern,
4024 *
sparsity_pattern.compress();
4032 *
projection_matrix = 0;
4033 *
projection_residual = 0;
4034 *
projection_velocity_residual = 0;
4035 *
projection_second_time_rate_residual = 0;
4039 *
Vector<Number> cell_velocity_residual(mechanical_dofs_per_cell);
4040 *
Vector<Number> cell_second_time_rate_residual(mechanical_dofs_per_cell);
4042 *
next_to_process.clear();
4043 *
next_to_process.resize(nprocesses, 0);
4044 *
for (
unsigned int i = 0; i < reference_points.size(); ++i) {
4045 *
unsigned int group = remapped_point_owning_process.at(i);
4049 *
cell_velocity_residual = 0;
4050 *
cell_second_time_rate_residual = 0;
4052 *
ReferencePoint<dim, Number> &reference_point = reference_points[i];
4054 *
mechanical_fe_values.reinit(reference_point.field_cell);
4060 *
for(
unsigned int dim_i=0; dim_i<dim; dim_i++) {
4061 *
remapped_previous_deformation[dim_i] =
4062 *
reference_point.remapped_point[dim_i]
4063 *
- reference_point.reference_point[dim_i]
4064 *
+ remote_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4065 *
remapped_previous_velocity[dim_i] = remote_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4066 *
remapped_previous_second_time_rate[dim_i] = remote_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim_i);
4069 *
const Number remapped_previous_twist_deformation = remote_previous_deformation_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4070 *
const Number remapped_previous_twist_velocity = remote_previous_velocity_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4071 *
const Number remapped_previous_twist_second_time_rate = remote_previous_second_time_rate_groups.at(group).at(next_to_process.at(group) * (dim+1) + dim);
4073 *
for(
unsigned int dof_i=0; dof_i<mechanical_dofs_per_cell; dof_i++) {
4074 *
const auto shape_value_i = postprocess_tensor_dimension(
4075 *
mechanical_fe_values[displacements].
value(dof_i, reference_point.q_point),
4076 *
mechanical_fe_values[angular_velocities].value(dof_i, reference_point.q_point));
4079 *
shape_value_i * postprocess_tensor_dimension(remapped_previous_deformation, remapped_previous_twist_deformation);
4081 *
cell_velocity_residual(dof_i) +=
4082 *
shape_value_i * postprocess_tensor_dimension(remapped_previous_velocity, remapped_previous_twist_velocity);
4084 *
cell_second_time_rate_residual(dof_i) +=
4085 *
shape_value_i * postprocess_tensor_dimension(remapped_previous_second_time_rate, remapped_previous_twist_second_time_rate);
4087 *
for(
unsigned int dof_j=0; dof_j<mechanical_dofs_per_cell; dof_j++) {
4088 *
const auto shape_value_j = postprocess_tensor_dimension(
4089 *
mechanical_fe_values[displacements].
value(dof_j, reference_point.q_point),
4090 *
mechanical_fe_values[angular_velocities].value(dof_j, reference_point.q_point));
4092 *
cell_matrix(dof_i, dof_j) += shape_value_i * shape_value_j;
4097 *
std::vector<types::global_dof_index> local_dof_indices(mechanical_dofs_per_cell);
4098 *
reference_point.field_cell->get_dof_indices(local_dof_indices);
4099 *
projection_residual.add(local_dof_indices, cell_residual);
4100 *
projection_velocity_residual.add(local_dof_indices, cell_velocity_residual);
4101 *
projection_second_time_rate_residual.add(local_dof_indices, cell_second_time_rate_residual);
4102 *
for(
unsigned int dof_i=0; dof_i<mechanical_dofs_per_cell; dof_i++) {
4103 *
for(
unsigned int dof_j=0; dof_j<mechanical_dofs_per_cell; dof_j++) {
4104 *
projection_matrix.add(local_dof_indices[dof_i], local_dof_indices[dof_j],
cell_matrix(dof_i, dof_j));
4108 *
++next_to_process.at(group);
4118 * solve the projection system
4123 *
const std::vector<std::vector<bool> > constant_modes
4129 *
additional_data.elliptic =
true;
4130 *
additional_data.n_cycles = 1;
4131 *
additional_data.w_cycle =
false;
4132 *
additional_data.output_details =
false;
4133 *
additional_data.smoother_sweeps = 2;
4134 *
additional_data.aggregation_threshold = 1
e-2;
4135 *
preconditioner.initialize(projection_matrix, additional_data);
4138 *
const Number relative_accuracy = 1
e-08;
4139 *
const Number solver_tolerance = relative_accuracy
4140 *
* projection_matrix.residual(tmp, projection_solution,
4141 *
projection_residual);
4143 *
solver_tolerance);
4147 *
projection_solution = 0;
4149 *
solver.solve(projection_matrix, projection_solution,
4150 *
projection_residual, preconditioner);
4152 *
mechanical_nonlinear_system.previous_deformation = projection_solution;
4154 *
projection_solution = 0;
4155 *
solver.solve(projection_matrix, projection_solution,
4156 *
projection_velocity_residual, preconditioner);
4157 *
mechanical_nonlinear_system.previous_time_derivative = projection_solution;
4159 *
projection_solution = 0;
4160 *
solver.solve(projection_matrix, projection_solution,
4161 *
projection_second_time_rate_residual, preconditioner);
4162 *
mechanical_nonlinear_system.previous_second_time_derivative = projection_solution;
4167 *
template <
int dim,
typename Number>
4168 *
void PlasticityLabProg<dim, Number>::assemble_mechanical_system(
4169 *
NewtonStepSystem &Newton_system,
4170 *
const DoFSystem<dim, Number> &mechanical_dof_system,
4171 *
const LBCSystem<dim, Number, dim+1> &mechanical_lbc_system,
4172 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
4173 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
4174 *
const NewtonStepSystem &thermal_Newton_system,
4175 *
const DoFSystem<dim, Number> &thermal_dof_system,
4176 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
4178 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
4179 *
const bool fill_system_matrix,
4180 *
const bool update_material_state) {
4184 *
quadrature_formula,
4190 *
face_quadrature_formula,
4196 *
quadrature_formula,
4202 *
quadrature_formula,
4208 *
quadrature_formula,
4211 *
const unsigned int dofs_per_cell = mech_fe.dofs_per_cell;
4212 *
const unsigned int n_q_points = quadrature_formula.size();
4213 *
const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
4214 *
const unsigned int n_face_q_points = face_quadrature_formula.size();
4216 *
std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points);
4217 *
std::vector< Tensor<2, dim, Number> > displacement_gradient_increments(n_q_points);
4219 *
std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points);
4220 *
std::vector< Tensor<1, dim, Number> > displacement_value_increments(n_q_points);
4222 *
std::vector< Tensor<2, dim, Number> > displacement_gradient_previous_time_rates(n_q_points);
4223 *
std::vector< Tensor<2, dim, Number> > displacement_gradient_previous_second_time_rates(n_q_points);
4225 *
std::vector< Tensor<1, dim, Number> > displacement_increments(n_q_points);
4226 *
std::vector< Tensor<1, dim, Number> > displacement_previous_time_rates(n_q_points);
4227 *
std::vector< Tensor<1, dim, Number> > displacement_previous_second_time_rates(n_q_points);
4229 *
std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_increments(n_q_points);
4230 *
std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_previous_time_rates(n_q_points);
4231 *
std::vector< Tensor<1, dim, Number> > angular_velocity_gradient_previous_second_time_rates(n_q_points);
4233 *
std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
4234 *
std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
4236 *
std::vector< Number > angular_velocity_increments(n_q_points);
4237 *
std::vector< Number > angular_velocity_previous_time_rates(n_q_points);
4238 *
std::vector< Number > angular_velocity_previous_second_time_rates(n_q_points);
4240 *
std::vector< Number > current_temperature_values(n_q_points);
4241 *
std::vector< Number > updated_temperature_increments(n_q_points);
4242 *
std::vector< Number > updated_temperature_values(n_q_points);
4244 *
std::vector< Tensor<1, dim, Number> > face_displacement_value_increments(n_face_q_points);
4246 *
std::vector< Number > deformation_jacobians(n_q_points);
4247 *
std::vector< Number > previous_deformation_jacobian(n_q_points);
4248 *
std::vector< std::vector<Number> > strain_divergences(
4250 *
std::vector<Number>(n_q_points));
4251 *
std::vector< std::vector<Number> > jacobian_tangents(
4253 *
std::vector<Number>(n_q_points));
4255 *
std::vector< std::vector< std::vector < Number> > > strain_divergence_tangents(
4257 *
std::vector< std::vector< Number> >(
4259 *
std::vector<Number>(n_q_points)));
4261 *
std::vector<Number> projected_temperature_coefficients(mixed_dofs_per_cell);
4262 *
std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
4263 *
std::vector<Number> projected_previous_temperature_coefficients(mixed_dofs_per_cell);
4264 *
std::vector<Number> projected_previous_Jacobian_coefficients(mixed_dofs_per_cell);
4265 *
std::vector<std::vector<Number> > projected_strain_divergence_coefficients(
4267 *
std::vector<Number>(mixed_dofs_per_cell));
4268 *
std::vector<std::vector<Number> > projected_jacobian_tangent_coefficients(
4270 *
std::vector<Number>(mixed_dofs_per_cell));
4271 *
std::vector<std::vector<std::vector<Number> > > projected_strain_divergence_tangent_coefficients(
4272 *
dofs_per_cell, std::vector< std::vector< Number> >(
4274 *
std::vector<Number>(mixed_dofs_per_cell)));
4276 *
std::vector<Number> projected_strain_divergence(dofs_per_cell);
4277 *
std::vector<Number> projected_jacobian_tangent(dofs_per_cell);
4278 *
std::vector<std::vector<Number> > projected_strain_divergence_tangent(
4280 *
std::vector<Number>(dofs_per_cell));
4291 *
Newton_system.Newton_step_matrix = 0;
4292 *
Newton_system.Newton_step_residual = 0;
4294 *
double alpha_m, alpha_f,
gamma, beta;
4295 *
get_generalized_alpha_method_params(
4296 *
&alpha_m, &alpha_f, &gamma, &beta, rho_infty);
4301 *
bool kinematic_domains_are_valid =
true;
4303 *
auto cell = mechanical_dof_system.dof_handler.begin_active();
4304 *
auto endc = mechanical_dof_system.dof_handler.end();
4305 *
auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
4306 *
auto mesh_motion_cell = mesh_motion_dof_system.dof_handler.begin_active();
4307 *
auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
4308 *
for (; cell != endc; ++cell, ++thermal_cell, ++mesh_motion_cell, ++mixed_fe_cell) {
4309 *
if (cell->is_locally_owned()) {
4313 *
fe_values.reinit (cell);
4314 *
fe_therm_values.reinit (thermal_cell);
4315 *
mixed_fe_values.reinit (mixed_fe_cell);
4316 *
mesh_motion_fe_values.reinit (mesh_motion_cell);
4318 *
fe_values[displacements].get_function_gradients(
4319 *
Newton_system.current_increment,
4320 *
displacement_gradient_increments);
4322 *
fe_values[displacements].get_function_gradients(
4323 *
Newton_system.previous_deformation,
4324 *
current_displacement_gradients);
4326 *
fe_values[displacements].get_function_values(
4327 *
Newton_system.current_increment,
4328 *
displacement_value_increments);
4330 *
fe_values[displacements].get_function_values(
4331 *
Newton_system.previous_deformation,
4332 *
current_displacement_values);
4334 *
fe_values[displacements].get_function_gradients(
4335 *
Newton_system.previous_time_derivative,
4336 *
displacement_gradient_previous_time_rates);
4338 *
fe_values[displacements].get_function_gradients(
4339 *
Newton_system.previous_second_time_derivative,
4340 *
displacement_gradient_previous_second_time_rates);
4342 *
fe_values[displacements].get_function_values(
4343 *
Newton_system.current_increment,
4344 *
displacement_increments);
4346 *
fe_values[displacements].get_function_values(
4347 *
Newton_system.previous_time_derivative,
4348 *
displacement_previous_time_rates);
4350 *
fe_values[displacements].get_function_values(
4351 *
Newton_system.previous_second_time_derivative,
4352 *
displacement_previous_second_time_rates);
4359 *
fe_values[angular_velocity].get_function_gradients(
4360 *
Newton_system.current_increment,
4361 *
angular_velocity_gradient_increments);
4363 *
fe_values[angular_velocity].get_function_gradients(
4364 *
Newton_system.previous_time_derivative,
4365 *
angular_velocity_gradient_previous_time_rates);
4367 *
fe_values[angular_velocity].get_function_gradients(
4368 *
Newton_system.previous_second_time_derivative,
4369 *
angular_velocity_gradient_previous_second_time_rates);
4371 *
fe_values[angular_velocity].get_function_values(
4372 *
Newton_system.current_increment,
4373 *
angular_velocity_increments);
4375 *
fe_values[angular_velocity].get_function_values(
4376 *
Newton_system.previous_time_derivative,
4377 *
angular_velocity_previous_time_rates);
4379 *
fe_values[angular_velocity].get_function_values(
4380 *
Newton_system.previous_second_time_derivative,
4381 *
angular_velocity_previous_second_time_rates);
4388 *
mesh_motion_fe_values[displacements].get_function_gradients(
4389 *
mesh_motion_nonlinear_system.current_increment,
4390 *
mesh_motion_gradient_increments);
4392 *
mesh_motion_fe_values[displacements].get_function_gradients(
4393 *
mesh_motion_nonlinear_system.current_increment,
4394 *
mesh_motion_gradient_increments);
4401 *
fe_therm_values[
temperature].get_function_values (
4402 *
thermal_Newton_system.previous_deformation,
4403 *
current_temperature_values);
4404 *
fe_therm_values[
temperature].get_function_values (
4405 *
thermal_Newton_system.current_increment,
4406 *
updated_temperature_increments);
4410 * get vectors
for projection onto mixed fe
values
4413 *
for (
unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
4414 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
4415 *
updated_temperature_values.at(q_point) =
4416 *
current_temperature_values.at(q_point)
4417 *
+ updated_temperature_increments.at(q_point);
4419 *
const auto current_F = get_deformation_gradient(
4420 *
current_displacement_gradients[q_point],
4421 *
current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
4425 *
[[maybe_unused]]
const auto mesh_motion_gradient = get_deformation_gradient(
4426 *
-mesh_motion_gradient_increments[q_point],
4427 *
-mesh_motion_value_increments[q_point][0]/fe_values.quadrature_point(q_point)[0]);
4430 *
current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
4431 *
(current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])
4432 *
/fe_values.quadrature_point(q_point)[0]
4437 *
deformation_jacobians.at(q_point) = Jacobian;
4440 *
const auto inv_updated_F =
invert(updated_F);
4441 *
std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
4442 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4443 *
rate_gradients[i] = postprocess_tensor_dimension(
4444 *
fe_values[displacements].
gradient(i, q_point),
4445 *
fe_values[displacements].
value(i, q_point)[0]/fe_values.quadrature_point(q_point)[0]) * inv_updated_F;
4448 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4449 *
const Number strain_divergence_i =
trace(rate_gradients[i]);
4450 *
strain_divergences[i].at(q_point) = Jacobian * strain_divergence_i;
4451 *
if (fill_system_matrix) {
4452 *
jacobian_tangents[i].at(q_point) = Jacobian * strain_divergence_i;
4453 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
4454 *
strain_divergence_tangents[i][j].at(q_point) =
4456 *
* (
trace(rate_gradients[i]) *
trace(rate_gradients[j])
4457 *
-
trace(rate_gradients[i] * rate_gradients[j]));
4463 *
const unsigned int cell_index = cell->user_index() / n_q_points;
4466 *
&projected_temperature_coefficients,
4467 *
updated_temperature_values);
4469 *
&projected_Jacobian_coefficients,
4470 *
deformation_jacobians);
4472 *
&projected_previous_Jacobian_coefficients,
4473 *
previous_deformation_jacobian);
4475 *
&projected_previous_temperature_coefficients,
4476 *
current_temperature_values);
4477 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4479 *
&projected_strain_divergence_coefficients[i],
4480 *
strain_divergences[i]);
4481 *
if (fill_system_matrix) {
4483 *
&projected_jacobian_tangent_coefficients[i],
4484 *
jacobian_tangents[i]);
4485 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
4487 *
&projected_strain_divergence_tangent_coefficients[i][j],
4488 *
strain_divergence_tangents[i][j]);
4493 *
for (
unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
4494 *
ConstitutiveModelUpdateFlags materialUpdateFlags =
4495 *
(update_pressure | update_stress_deviator);
4497 *
if (fill_system_matrix) {
4498 *
materialUpdateFlags |=
4499 *
(update_pressure_tangent | update_stress_deviator_tangent);
4502 *
ConstitutiveModelRequest<dim+1, Number> previous_constitutive_request(materialUpdateFlags);
4504 *
if (update_material_state) {
4505 *
materialUpdateFlags |= update_material_point_history;
4508 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
4509 *
ConstitutiveModelRequest<dim+1, Number> constitutive_request(materialUpdateFlags);
4511 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
4512 *
mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
4515 *
const Number radius = fe_values.quadrature_point(q_point)[0];
4516 *
const auto current_F = get_deformation_gradient(
4517 *
current_displacement_gradients[q_point],
4518 *
current_displacement_values[q_point][0]/
radius
4521 *
const auto mesh_motion_gradient = get_deformation_gradient(
4522 *
-mesh_motion_gradient_increments[q_point],
4523 *
-mesh_motion_value_increments[q_point][0]/
radius);
4526 *
current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
4527 *
(current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/
radius);
4530 *
[[maybe_unused]]
const Number mesh_motion_Jacobian =
determinant(mesh_motion_gradient);
4532 *
const auto inv_updated_F =
invert(updated_F);
4537 *
const Number DENSITY = 8.96e-9;
4539 *
const Tensor<1, dim+1, Number> displacement_increment = postprocess_tensor_dimension(displacement_increments[q_point]);
4540 *
const Tensor<1, dim+1, Number> displacement_previous_time_rate = postprocess_tensor_dimension(displacement_previous_time_rates[q_point]);
4541 *
const Tensor<1, dim+1, Number> displacement_previous_second_time_rate = postprocess_tensor_dimension(displacement_previous_second_time_rates[q_point]);
4543 *
displacement_gradient_previous_time_rates[q_point], displacement_previous_time_rates[q_point][0]/
radius);
4545 *
displacement_gradient_previous_second_time_rates[q_point], displacement_previous_second_time_rates[q_point][0]/
radius);
4549 *
const Tensor<1, dim+1, Number> d_vc_d_t_n = scalar_to_angular_tensor(angular_velocity_previous_second_time_rates[q_point]);
4552 *
(1./(beta*time_increment*time_increment))
4553 *
* (displacement_increment
4558 *
displacement_previous_time_rate +
time_increment * ((1-
gamma) * displacement_previous_second_time_rate + gamma * d2_x_dt_2_n_plus_1);
4561 *
(1./(beta*time_increment*time_increment))
4562 *
* (postprocess_tensor_dimension(
4563 *
displacement_gradient_increments[q_point],
4564 *
displacement_value_increments[q_point][0]/
radius)
4569 *
displacement_gradient_previous_time_rate
4571 *
(1.-gamma) * displacement_gradient_previous_second_time_rate
4572 *
+
gamma * Grad_d_2_x_d_t_2_n_plus_1);
4575 *
(1./(beta*time_increment*time_increment))
4583 *
const Number thR_increment = angular_velocity_increments[q_point];
4584 *
const Number d_thR_d_t_n = angular_velocity_previous_time_rates[q_point];
4585 *
const Number d2_thR_d_t2_n = angular_velocity_previous_second_time_rates[q_point];
4587 *
const Number d2_thR_d_t2_n_plus_1 =
4588 *
(1./(beta*time_increment*time_increment))
4593 *
const Number d_thR_d_t_n_plus_1 =
4594 *
d_thR_d_t_n +
time_increment * ((1-
gamma) * d2_thR_d_t2_n + gamma * d2_thR_d_t2_n_plus_1);
4596 *
const Number one_plus_r_over_R_n = 1.0 + current_displacement_values[q_point][0]/
radius;
4597 *
const Number one_plus_r_over_R_n_plus_1 = 1.0 + (current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/
radius;
4598 *
const Number d_r_d_t_n_over_R = displacement_previous_time_rate[0] /
radius;
4599 *
const Number d_r_d_t_n_plus_one_over_R = d_x_dt_n_plus_1[0] /
radius;
4605 *
d2_x_dt_2_n_plus_1
4606 *
+ scalar_to_angular_tensor(
4607 *
d_r_d_t_n_plus_one_over_R * d_thR_d_t_n_plus_1
4608 *
+ one_plus_r_over_R_n_plus_1 * d2_thR_d_t2_n_plus_1)
4609 *
- (1.0/
radius) * one_plus_r_over_R_n_plus_1 *
std::pow(d_thR_d_t_n_plus_1, 2) * e_hat_R;
4612 *
displacement_previous_second_time_rate
4613 *
+ scalar_to_angular_tensor(
4614 *
d_r_d_t_n_over_R * d_thR_d_t_n
4615 *
+ one_plus_r_over_R_n * d2_thR_d_t2_n)
4616 *
- (1.0/
radius) * one_plus_r_over_R_n *
std::pow(d_thR_d_t_n, 2) * e_hat_R;
4619 *
alpha_m * acceleration_n + (1-alpha_m) * acceleration_n_plus_1;
4622 *
for(
unsigned int i=0; i<dim; i++) {
4623 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[i][i] += (1-alpha_m) * d_second_time_rate_d_increment;
4625 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[dim][0] +=
4626 *
(1-alpha_m) * (d_time_rate_d_increment/
radius * d_thR_d_t_n_plus_1 + 1.0/
radius * d2_thR_d_t2_n_plus_1);
4627 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[0][0] +=
4630 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[dim][dim] +=
4632 *
* (d_r_d_t_n_plus_one_over_R * d_time_rate_d_increment
4633 *
+ one_plus_r_over_R_n_plus_1 * d_second_time_rate_d_increment);
4634 *
acceleration_n_plus_1_minus_alpha_m_tangent_modulus[0][dim] +=
4636 *
* (-(1.0/
radius) * one_plus_r_over_R_n * 2 * d_thR_d_t_n * d_time_rate_d_increment);
4639 *
[[maybe_unused]]
const auto d2_x_dt_2_n_plus_1_minus_alpha_m =
4640 *
alpha_m * displacement_previous_second_time_rate + (1-alpha_m)*d2_x_dt_2_n_plus_1;
4641 *
[[maybe_unused]]
const Number d2_x_dt_2_tangent_1_minus_alpha_m = (1-alpha_m)*d_second_time_rate_d_increment;
4643 *
[[maybe_unused]]
const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f =
4644 *
alpha_m * displacement_gradient_previous_time_rate * vc_n
4645 *
+ (1-alpha_m) * Grad_d_x_d_t_n_plus_1 * vc_n_plus_1;
4647 *
[[maybe_unused]]
const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f_F_tangent = (1-alpha_m) * d_time_rate_d_increment * vc_n_plus_1;
4648 *
[[maybe_unused]]
const auto d_Fc_dt_vc_n_plus_1_minus_alpha_f_v_tangent = (1-alpha_m) * Grad_d_x_d_t_n_plus_1;
4650 *
[[maybe_unused]]
const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m =
4651 *
alpha_m * current_F * d_vc_d_t_n
4652 *
+ (1-alpha_m) * updated_F * d_vc_d_t_n_plus_1;
4654 *
[[maybe_unused]]
const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m_F_tangent = (1-alpha_m) * d_vc_d_t_n_plus_1;
4655 *
[[maybe_unused]]
const auto F_c_d_vc_d_t_n_plus_1_minus_alpha_m_V_tangent = (1-alpha_m) * updated_F * d_second_time_rate_d_increment;
4657 *
std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
4658 *
std::vector<Tensor<2, dim+1, Number>> angular_rate_gradients(dofs_per_cell);
4659 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4660 *
rate_gradients[i] =
4661 *
postprocess_tensor_dimension(
4662 *
fe_values[displacements].
gradient(i, q_point),
4663 *
fe_values[displacements].
value(i, q_point)[0]/
radius) * inv_updated_F;
4664 *
angular_rate_gradients[i] =
4665 *
order_1_tensor_to_angular_gradient(
4666 *
fe_values[angular_velocity].
gradient(i, q_point),
4667 *
-fe_values[angular_velocity].
value(i, q_point)/
radius);
4671 *
-angular_velocity_increments[q_point],
4672 *
-angular_velocity_gradient_increments[q_point],
4677 *
-angular_velocity_increments[q_point],
4683 *
const auto f_m_n_plus_1 = inv_d_X_prime_d_X * rotation_to_X_prime_frame;
4687 * std::cout <<
"f_r: " << inv_d_X_prime_d_X << std::endl;
4688 * std::cout <<
"R: " << previous_elastic_deformation_transformation_tensor << std::endl;
4689 * std::cout <<
"f_m_n+1: " << f_m_n_plus_1 << std::endl;
4695 *
Number projected_jacobian = 0;
4696 *
Number projected_previous_jacobian = 0;
4697 *
Number projected_temperature = 0;
4698 *
Number projected_previous_temperature = 0;
4699 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
4700 *
projected_jacobian +=
4701 *
mixed_values(i) * projected_Jacobian_coefficients.at(i);
4702 *
projected_previous_jacobian +=
4703 *
mixed_values(i) * projected_previous_Jacobian_coefficients.at(i);
4704 *
projected_temperature +=
4705 *
mixed_values(i) * projected_temperature_coefficients.at(i);
4706 *
projected_previous_temperature +=
4707 *
mixed_values(i) * projected_previous_temperature_coefficients.at(i);
4710 *
const auto unnormalized_deformation_gradient_increment = updated_F * f_m_n_plus_1 *
invert(current_F);
4712 *
const auto deformation_gradient_increment =
4714 *
-Constants<dim, Number>::one_third()) * unnormalized_deformation_gradient_increment;
4717 *
std::cout <<
"determinant(deformation_gradient_increment): " <<
determinant(deformation_gradient_increment) << std::endl;
4719 *
if(
false && std::isnan(deformation_gradient_increment.norm())) {
4720 *
std::cout <<
"deformation_gradient_increment is nan: " << deformation_gradient_increment << std::endl;
4721 *
std::cout <<
"Jacobian: " << Jacobian
4722 *
<<
"\nf_m_n_plus_1: " << f_m_n_plus_1
4723 *
<<
"\ndet(f_m_n_plus_1): " <<
determinant(f_m_n_plus_1)
4724 *
<<
"\nprevious_Jacobian: " << previous_Jacobian
4725 *
<<
"\nupdated_F: " << updated_F
4726 *
<<
"\ncurrent_F: " << current_F
4727 *
<<
"\ninvert(current_F): " <<
invert(current_F)
4731 *
constitutive_request.set_deformation_Jacobian(projected_jacobian);
4732 *
constitutive_request.set_unprojected_deformation_Jacobian(
determinant(updated_F) * material_Jacobian);
4733 *
constitutive_request.set_temperature(projected_temperature);
4734 *
constitutive_request.set_deformation_gradient(deformation_gradient_increment);
4735 *
constitutive_request.set_time_increment(time_increment);
4738 *
material.compute_constitutive_request(constitutive_request,
4739 *
quadrature_point_index);
4740 *
}
catch (
const MaterialDomainException &exc) {
4743 * std::cerr <<
"projected_jacobian: " << projected_jacobian
4744 * <<
"\ndeformation_gradient_increment: " << deformation_gradient_increment
4745 * <<
"\nupdated_F: " << updated_F
4746 * <<
"\nf_m_n_plus_1: " << f_m_n_plus_1
4747 * <<
"\ncurrent_F: " << current_F
4748 * <<
"\ninvert(current_F): " <<
invert(current_F)
4749 * <<
"\nJacobian: " << Jacobian
4750 * <<
"\ndeterminant(f_m_n_plus_1): " <<
determinant(f_m_n_plus_1)
4751 * <<
"\nprevious_Jacobian: " << previous_Jacobian
4752 * <<
"\n-------------------\n"
4754 * std::cerr << exc.what() << std::endl;
4757 *
kinematic_domains_are_valid =
false;
4761 *
previous_constitutive_request.set_deformation_Jacobian(projected_previous_jacobian);
4762 *
previous_constitutive_request.set_temperature(projected_previous_temperature);
4763 *
previous_constitutive_request.set_deformation_gradient(unit_symmetric_tensor<dim+1, Number>());
4764 *
previous_constitutive_request.set_time_increment(time_increment);
4765 *
previous_constitutive_request.set_is_plastic(
false);
4767 *
material.compute_constitutive_request(previous_constitutive_request,
4768 *
quadrature_point_index);
4770 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
4771 *
projected_strain_divergence[j] =
4772 *
mixed_values(0) * projected_strain_divergence_coefficients[j][0];
4773 *
if (fill_system_matrix) {
4774 *
projected_jacobian_tangent[j] =
4775 *
mixed_values(0) * projected_jacobian_tangent_coefficients[j][0];
4776 *
for (
unsigned int k = 0; k < dofs_per_cell; ++k) {
4777 *
projected_strain_divergence_tangent[j][k] =
4779 *
* projected_strain_divergence_tangent_coefficients[j][k][0];
4784 *
for (
unsigned int i = 1; i < mixed_dofs_per_cell; ++i) {
4785 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
4786 *
projected_strain_divergence[j] +=
4787 *
mixed_values(i) * projected_strain_divergence_coefficients[j][i];
4788 *
if (fill_system_matrix) {
4789 *
projected_jacobian_tangent[j] +=
4790 *
mixed_values(i) * projected_jacobian_tangent_coefficients[j][i];
4791 *
for (
unsigned int k = 0; k < dofs_per_cell; ++k) {
4792 *
projected_strain_divergence_tangent[j][k] +=
4794 *
* projected_strain_divergence_tangent_coefficients[j][k][i];
4802 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4803 *
const auto strain_i =
symmetrize(rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F);
4811 *
alpha_f * previous_constitutive_request.get_stress_deviator()
4812 *
+ (1-alpha_f) * constitutive_request.get_stress_deviator();
4813 *
const Number pressure =
4814 *
alpha_f * previous_constitutive_request.get_pressure()
4815 *
+ (1-alpha_f) * constitutive_request.get_pressure();
4824 *
(projected_strain_divergence.at(i)) * pressure * RJxW;
4831 *
const unsigned int
4832 *
component_i = mech_fe.system_to_component_index(i).first;
4833 *
for (
typename std::vector<BodyForceApplier<dim, Number> >
::const_iterator
4834 *
bodyForceApplier = mechanical_lbc_system.bodyLoadAppliers.begin();
4835 *
bodyForceApplier != mechanical_lbc_system.bodyLoadAppliers.end();
4836 *
++bodyForceApplier) {
4838 *
bodyForceApplier->apply(
4840 *
fe_values.shape_value (i, q_point),
4850 *
(postprocess_tensor_dimension(fe_values[displacements].
value(i, q_point)) + scalar_to_angular_tensor(fe_values[angular_velocity].
value(i, q_point)))
4852 *
* acceleration_n_plus_1_minus_alpha_m * RJxW;
4855 *
if (fill_system_matrix) {
4856 *
std::vector<SymmetricTensor<2, dim+1, Number> > stress_deviator_tangents(dofs_per_cell);
4857 *
std::vector<Number> pressure_tangents(dofs_per_cell);
4858 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4861 *
deformation_gradient_from_angular_displacement_gradient_variations(
4862 *
-angular_velocity_increments[q_point],
4863 *
-angular_velocity_gradient_increments[q_point],
4865 *
-fe_values[angular_velocity].
value(i, q_point),
4866 *
-fe_values[angular_velocity].
gradient(i, q_point)
4870 *
-angular_velocity_increments[q_point],
4871 *
-fe_values[angular_velocity].
value(i, q_point),
4875 *
const auto f_m_n_plus_1_variation_inv_f_m_n_plus_1 =
4876 *
(- inv_d_X_prime_d_X * d_X_prime_d_X_variation * inv_d_X_prime_d_X * rotation_to_X_prime_frame
4877 *
+ inv_d_X_prime_d_X * rotation_to_X_prime_frame_variation) *
invert(f_m_n_plus_1);
4879 *
stress_deviator_tangents[i] = (1-alpha_f) * constitutive_request.get_stress_deviator_tangent(
4881 *
- Constants<dim+1, Number>::one_third()
4882 *
*
trace(rate_gradients[i])
4883 *
* unit_symmetric_tensor<dim+1, Number>()
4884 *
+ updated_F * f_m_n_plus_1_variation_inv_f_m_n_plus_1 * inv_updated_F
4885 *
- Constants<dim+1, Number>::one_third()
4886 *
*
trace(f_m_n_plus_1_variation_inv_f_m_n_plus_1)
4887 *
* unit_symmetric_tensor<dim+1, Number>());
4889 *
pressure_tangents[i] = (1-alpha_f) * constitutive_request.get_pressure_tangent(
4890 *
projected_jacobian_tangent[i]);
4892 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4893 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
4899 *
const Number f_int_dev_tau =
symmetrize(rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F) * stress_deviator_tangents[j];
4906 *
const Number f_int_pressure =
4907 *
projected_strain_divergence.at(i)
4908 *
* pressure_tangents[j];
4915 *
const Tensor<2, dim+1, Number> grad_ui_grad_uj = (rate_gradients[i] + angular_rate_gradients[i] * inv_updated_F) * rate_gradients[j];
4917 *
const Number f_int_geom =
4918 *
projected_strain_divergence_tangent[i][j]
4919 *
* constitutive_request.get_pressure()
4920 *
- sym_grad_ui_grad_uj
4921 *
* constitutive_request.get_stress_deviator();
4930 *
(postprocess_tensor_dimension(fe_values[displacements].
value(i, q_point))
4931 *
+ scalar_to_angular_tensor(fe_values[angular_velocity].
value(i, q_point)))
4933 *
* (acceleration_n_plus_1_minus_alpha_m_tangent_modulus
4934 *
* (postprocess_tensor_dimension(fe_values[displacements].
value(j, q_point))
4935 *
+ scalar_to_angular_tensor(fe_values[angular_velocity].
value(j, q_point))))
4942 *
for (
unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
4943 *
for (
auto boundaryForceSpec: mechanical_lbc_system.boundaryLoadAppliers) {
4944 *
if (cell->face(face)->boundary_id() ==
static_cast<types::boundary_id>(boundaryForceSpec.first)) {
4945 *
fe_face_values.reinit(cell, face);
4946 *
for (
unsigned int q_point = 0; q_point < n_face_q_points; ++q_point) {
4947 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4948 *
const unsigned int component_i = mech_fe.system_to_component_index(i).first;
4950 *
boundaryForceSpec.second.apply(
4952 *
fe_face_values.shape_value(i, q_point),
4953 *
fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point));
4959 *
for(
const auto boundary_unidirectional_penalty_spec: mechanical_lbc_system.boundary_unidirectional_penalty_specs) {
4960 *
if (cell->face(face)->boundary_id() == boundary_unidirectional_penalty_spec->get_boundary_id()) {
4961 *
const Number reference_displacement_increment = boundary_unidirectional_penalty_spec->get_reference_displacement_increment();
4962 *
const Number residual_force = boundary_unidirectional_penalty_spec->get_residual_force();
4963 *
const Number quadratic_spring_factor = boundary_unidirectional_penalty_spec->get_quadratic_spring_factor();
4965 *
fe_face_values.reinit(cell, face);
4966 *
fe_face_values[displacements].get_function_values(
4967 *
Newton_system.current_increment,
4968 *
face_displacement_value_increments);
4969 *
for (
unsigned int q_point = 0; q_point < n_face_q_points; ++q_point) {
4971 *
const Number surface_displacement = face_displacement_value_increments[q_point] * surface_normal;
4972 *
const Number surface_force =
4974 *
+ surface_displacement < -reference_displacement_increment?
4976 *
-0.5 * quadratic_spring_factor *
std::pow(surface_displacement + reference_displacement_increment, 2);
4977 *
const Number surface_force_tangent_modulus =
4978 *
surface_displacement < -reference_displacement_increment?
4980 *
-quadratic_spring_factor * (surface_displacement + reference_displacement_increment);
4981 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
4983 *
fe_face_values[displacements].value(i, q_point)
4984 *
* surface_force * surface_normal
4985 *
* fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point);
4986 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
4988 *
fe_face_values[displacements].value(i, q_point)
4989 *
* surface_force_tangent_modulus * (fe_face_values[displacements].value(j, q_point) * surface_normal) * surface_normal
4990 *
* fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point);
5001 *
if(relative_symmetry_norm2 > 1e-8)
5002 * std::cout <<
"relative_symmetry_norm2: " <<
cell_matrix.relative_symmetry_norm2() << std::endl;
5008 *
std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5009 *
cell->get_dof_indices (local_dof_indices);
5010 *
if (fill_system_matrix) {
5011 *
mechanical_dof_system.nodal_constraints.distribute_local_to_global(
5014 *
local_dof_indices,
5015 *
Newton_system.Newton_step_matrix,
5016 *
Newton_system.Newton_step_residual,
5019 *
mechanical_dof_system.nodal_constraints.distribute_local_to_global(
5020 *
cell_residual, local_dof_indices,
5021 *
Newton_system.Newton_step_residual);
5026 *
const unsigned short local_domain_is_valid = kinematic_domains_are_valid ? 1 : 0;
5027 *
unsigned short all_kinematic_domains_are_valid;
5031 * did any of the processes fail to
assemble?
5035 *
&local_domain_is_valid,
5036 *
&all_kinematic_domains_are_valid, 1, MPI_UNSIGNED_SHORT,
5037 *
MPI_MIN, mpi_communicator);
5039 *
if (all_kinematic_domains_are_valid < 1) {
5040 *
throw std::runtime_error(
"The domain is not valid...");
5043 *
if (fill_system_matrix) {
5051 *
template <
int dim,
typename Number>
5052 *
void PlasticityLabProg<dim, Number>::assemble_thermal_system(
5053 *
NewtonStepSystem &Newton_system,
5054 *
NewtonStepSystem &mechanical_nonlinear_system,
5055 *
const DoFSystem<dim, Number> &thermal_dof_system,
5056 *
const LBCSystem<dim, Number, 1> &thermal_lbc_system,
5057 *
const DoFSystem<dim, Number> &mechanical_dof_system,
5058 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
5060 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
5062 *
const bool fill_system_matrix) {
5067 *
quadrature_formula,
5073 *
face_quadrature_formula,
5081 *
quadrature_formula,
5087 *
face_quadrature_formula,
5097 *
quadrature_formula,
5100 *
const unsigned int dofs_per_cell = therm_fe.dofs_per_cell;
5101 *
const unsigned int n_q_points = quadrature_formula.size();
5102 *
const unsigned int n_face_q_points = face_quadrature_formula.size();
5103 *
const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
5109 *
std::vector<Number> weighted_updated_J_vec(mixed_dofs_per_cell),
5110 *
weighted_current_J_vec(mixed_dofs_per_cell),
5111 *
weighted_previous_J_vec(mixed_dofs_per_cell),
5112 *
weighted_updated_theta_vec(mixed_dofs_per_cell),
5113 *
weighted_previous_theta_vec(mixed_dofs_per_cell),
5114 *
weighted_J_time_rate_vec(mixed_dofs_per_cell);
5115 *
std::vector< std::vector<Number> > weighted_shape_values(
5117 *
std::vector<Number>(mixed_dofs_per_cell) );
5119 *
std::vector<Number> qp_updated_J_values(n_q_points),
5120 *
qp_previous_J_values(n_q_points),
5121 *
qp_updated_theta_values(n_q_points),
5122 *
qp_previous_theta_values(n_q_points),
5123 *
qp_J_time_rates(n_q_points);
5124 *
std::vector<std::vector<Number> > qp_shape_values(
5126 *
std::vector<Number>(n_q_points));
5128 *
std::vector< Tensor<1, dim, Number> > thermal_gradient_increment(n_q_points),
5129 *
current_thermal_gradient(n_q_points);
5131 *
std::vector< Number > current_temperature_values(n_q_points),
5132 *
temperature_values_increment(n_q_points);
5134 *
std::vector< Number > current_face_temperature_values(n_face_q_points),
5135 *
face_temperature_values_increment(n_face_q_points);
5137 *
std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points),
5138 *
displacement_gradient_increments(n_q_points);
5139 *
std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points),
5140 *
displacement_value_increments(n_q_points);
5142 *
std::vector< Tensor<1, dim, Number> > current_angular_velocity_gradients(n_q_points),
5143 *
angular_velocity_gradient_increments(n_q_points),
5144 *
angular_velocity_gradient_previous_time_rates(n_q_points);
5146 *
std::vector< Number > angular_velocity_increments(n_q_points),
5147 *
current_angular_velocities(n_q_points),
5148 *
angular_velocity_previous_time_rates(n_q_points);
5150 *
std::vector< Tensor<2, dim, Number> > current_face_displacement_gradients(n_face_q_points);
5151 *
std::vector< Tensor<2, dim, Number> > face_displacement_gradient_increments(n_face_q_points);
5153 *
std::vector< Tensor<1, dim, Number> > current_face_displacement_values(n_face_q_points);
5154 *
std::vector< Tensor<1, dim, Number> > face_displacement_value_increments(n_face_q_points);
5159 *
Newton_system.Newton_step_matrix = 0;
5160 *
Newton_system.Newton_step_residual = 0;
5164 *
auto cell = thermal_dof_system.dof_handler.begin_active();
5165 *
auto endc = thermal_dof_system.dof_handler.end();
5166 *
auto mechanical_cell = mechanical_dof_system.dof_handler.begin_active();
5167 *
auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
5168 *
for (; cell != endc; ++cell, ++mechanical_cell, ++mixed_fe_cell) {
5169 *
if (cell->is_locally_owned()) {
5173 *
fe_values.reinit (cell);
5174 *
fe_mech_values.reinit (mechanical_cell);
5175 *
mixed_fe_values.reinit (mixed_fe_cell);
5178 *
Newton_system.current_increment,
5179 *
thermal_gradient_increment);
5182 *
Newton_system.previous_deformation,
5183 *
current_thermal_gradient);
5186 *
Newton_system.current_increment,
5187 *
temperature_values_increment);
5190 *
Newton_system.previous_deformation,
5191 *
current_temperature_values);
5193 *
fe_mech_values[displacements].get_function_gradients(
5194 *
mechanical_nonlinear_system.current_increment,
5195 *
displacement_gradient_increments);
5197 *
fe_mech_values[displacements].get_function_gradients(
5198 *
mechanical_nonlinear_system.previous_deformation,
5199 *
current_displacement_gradients);
5201 *
fe_mech_values[displacements].get_function_values(
5202 *
mechanical_nonlinear_system.current_increment,
5203 *
displacement_value_increments);
5205 *
fe_mech_values[displacements].get_function_values(
5206 *
mechanical_nonlinear_system.previous_deformation,
5207 *
current_displacement_values);
5214 *
fe_mech_values[angular_velocity].get_function_gradients(
5215 *
mechanical_nonlinear_system.current_increment,
5216 *
angular_velocity_gradient_increments);
5218 *
fe_mech_values[angular_velocity].get_function_values(
5219 *
mechanical_nonlinear_system.current_increment,
5220 *
angular_velocity_increments);
5224 * get vectors
for projection onto mixed fe
values
5227 *
for (
unsigned int q_point = 0; q_point < n_q_points;
5230 *
const Number radius = fe_mech_values.quadrature_point(q_point)[0];
5232 *
const auto previous_F = get_deformation_gradient(
5233 *
current_displacement_gradients[q_point],
5234 *
current_displacement_values[q_point][0]/
radius);
5236 *
const auto updated_F = get_deformation_gradient(
5237 *
current_displacement_gradients[q_point] + displacement_gradient_increments[q_point],
5238 *
(current_displacement_values[q_point][0] + displacement_value_increments[q_point][0])/
radius);
5240 *
const auto deformation_gradient_increment = postprocess_tensor_dimension(
5241 *
displacement_gradient_increments[q_point],
5242 *
displacement_value_increments[q_point][0]/
radius);
5244 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
5250 *
qp_previous_J_values.at(q_point) = previous_Jacobian;
5251 *
qp_updated_J_values.at(q_point) = Jacobian;
5254 *
qp_previous_theta_values.at(q_point) = current_temperature_values.at(q_point);
5255 *
qp_updated_theta_values.at(q_point) = current_temperature_values.at(q_point) + temperature_values_increment.at(q_point);
5256 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5257 *
qp_shape_values.at(i).at(q_point) = fe_values[
temperature].value(i, q_point);
5261 *
const unsigned int cell_index = cell->user_index() / n_q_points;
5264 *
&weighted_updated_J_vec,
5265 *
qp_updated_J_values);
5267 *
&weighted_J_time_rate_vec,
5270 *
&weighted_updated_theta_vec,
5271 *
qp_updated_theta_values);
5273 *
&weighted_previous_J_vec,
5274 *
qp_previous_J_values);
5276 *
&weighted_previous_theta_vec,
5277 *
qp_previous_theta_values);
5278 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5280 *
&weighted_shape_values.at(i),
5281 *
qp_shape_values.at(i));
5284 *
for (
unsigned int q_point = 0; q_point < n_q_points;
5286 *
const ConstitutiveModelUpdateFlags material_update_flags =
5287 *
fill_system_matrix ?
5288 *
(update_heat_flux | update_heat_flux_tangent
5289 *
| update_mechanical_dissipation
5290 *
| update_mechanical_dissipation_tangent
5291 *
| update_stored_heat | update_stored_heat_tangent)
5293 *
(update_heat_flux | update_mechanical_dissipation
5294 *
| update_stored_heat);
5296 *
const ConstitutiveModelUpdateFlags heating_update_flags =
5297 *
fill_system_matrix ?
5298 *
(update_thermoelastic_heating
5299 *
| update_thermoelastic_heating_tangent)
5301 *
(update_thermoelastic_heating);
5303 *
point_index_t quadrature_point_index = cell->user_index() + q_point;
5304 *
ConstitutiveModelRequest<dim+1, Number> constitutive_request(material_update_flags);
5305 *
ConstitutiveModelRequest<dim+1, Number> heating_request(heating_update_flags);
5307 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5308 *
mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
5311 *
Number projected_updated_J = 0;
5312 *
Number projected_previous_J = 0;
5313 *
Number projected_updated_theta = 0;
5314 *
Number projected_previous_theta = 0;
5315 *
Number projected_J_time_rate = 0;
5317 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5318 *
projected_updated_J +=
5319 *
mixed_values(i) * weighted_updated_J_vec.at(i);
5320 *
projected_J_time_rate +=
5321 *
mixed_values(i) * weighted_J_time_rate_vec.at(i);
5322 *
projected_updated_theta +=
5323 *
mixed_values(i) * weighted_updated_theta_vec.at(i);
5324 *
projected_previous_J +=
5325 *
mixed_values(i) * weighted_previous_J_vec.at(i);
5326 *
projected_previous_theta +=
5327 *
mixed_values(i) * weighted_previous_theta_vec.at(i);
5328 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
5329 *
projected_shape_values(j) +=
5330 *
mixed_values(i) * weighted_shape_values.at(j).at(i);
5338 *
heating_request.set_deformation_Jacobian(projected_updated_J);
5339 *
heating_request.set_deformation_Jacobian_time_rate(projected_J_time_rate);
5340 *
heating_request.set_temperature(projected_updated_theta);
5341 *
heating_request.set_previous_deformation_Jacobian(projected_previous_J);
5342 *
heating_request.set_previous_temperature(projected_previous_theta);
5343 *
heating_request.set_time_increment(time_increment);
5345 *
const auto current_F = get_deformation_gradient(
5346 *
current_displacement_gradients[q_point],
5347 *
current_displacement_values[q_point][0]/fe_mech_values.quadrature_point(q_point)[0]
5349 *
const auto updated_F = get_deformation_gradient(
5350 *
current_displacement_gradients[q_point]
5351 *
+ displacement_gradient_increments[q_point],
5352 *
(current_displacement_values[q_point][0]
5353 *
+ displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5355 *
const auto inv_updated_F =
invert(updated_F);
5360 *
const Number radius = fe_values.quadrature_point(q_point)[0];
5363 *
-angular_velocity_increments[q_point],
5364 *
-angular_velocity_gradient_increments[q_point],
5369 *
-angular_velocity_increments[q_point],
5375 *
const auto f_m_n_plus_1 = inv_d_X_prime_d_X * rotation_to_X_prime_frame;
5379 * std::cout <<
"f_r: " << inv_d_X_prime_d_X << std::endl;
5380 * std::cout <<
"R: " << previous_elastic_deformation_transformation_tensor << std::endl;
5381 * std::cout <<
"f_m_n+1: " << f_m_n_plus_1 << std::endl;
5387 *
const auto unnormalized_deformation_gradient_increment = updated_F * f_m_n_plus_1 *
invert(current_F);
5389 *
const auto deformation_gradient_increment =
5391 *
-Constants<dim, Number>::one_third()) * unnormalized_deformation_gradient_increment;
5393 *
const Number previous_temperature = current_temperature_values[q_point];
5394 *
const Number updated_temperature = previous_temperature + temperature_values_increment[q_point];
5395 *
const auto thermal_gradient =
5396 *
postprocess_tensor_dimension(current_thermal_gradient[q_point] + thermal_gradient_increment[q_point]) * inv_updated_F;
5398 *
constitutive_request.set_deformation_gradient(deformation_gradient_increment);
5399 *
constitutive_request.set_temperature_time_rate(d_theta_dt_n_plus_1);
5400 *
constitutive_request.set_temperature(updated_temperature);
5401 *
constitutive_request.set_thermal_gradient(thermal_gradient);
5402 *
constitutive_request.set_time_increment(time_increment);
5404 *
material.compute_constitutive_request(
5405 *
constitutive_request,
5406 *
quadrature_point_index);
5407 *
material.compute_constitutive_request(
5409 *
quadrature_point_index);
5411 *
std::vector<Tensor<1, dim+1, Number>> rate_gradients(dofs_per_cell);
5412 *
std::vector<Number> rate_temperatures(dofs_per_cell);
5413 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5414 *
rate_gradients[i] = postprocess_tensor_dimension(fe_values[temperature].
gradient(i, q_point)) * inv_updated_F;
5415 *
rate_temperatures[i] =fe_values[
temperature].value(i, q_point);
5420 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5427 *
const auto heat_flux = constitutive_request.get_heat_flux();
5438 *
* constitutive_request.get_stored_heat_rate()
5443 * mechanical dissipation term
5447 *
* constitutive_request.get_mechanical_dissipation()
5452 * elastoplastic heating term
5456 *
* heating_request.get_thermo_elastic_heating()
5459 *
for (
typename std::vector<BodyForceApplier<dim, Number> >
::const_iterator
5460 *
bodyHeatSourceApplier = thermal_lbc_system.bodyLoadAppliers.cbegin();
5461 *
bodyHeatSourceApplier != thermal_lbc_system.bodyLoadAppliers.cend();
5462 *
++bodyHeatSourceApplier) {
5464 *
0, rate_temperatures[i],
5465 *
fe_values.quadrature_point(q_point)[0] * fe_values.JxW(q_point));
5469 *
if (fill_system_matrix) {
5470 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5471 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
5480 *
* constitutive_request.get_heat_flux_tangent(rate_gradients[j]);
5485 * stored heat rate tangent
5488 *
const Number f_int_cThetaDot =
5489 *
rate_temperatures[i]
5490 *
* constitutive_request.get_stored_heat_rate_tangent(d_theta_dt_tangent*rate_temperatures[j]);
5495 * mechanical dissipation tangent
5498 *
const Number f_int_mech_dissipation =
5499 *
rate_temperatures[i]
5500 *
* constitutive_request.get_mechanical_dissipation_tangent(rate_temperatures[j]);
5501 *
cell_matrix(i, j) -= f_int_mech_dissipation * RJxW;
5505 * elastoplastic heating tangent
5508 *
const Number f_int_elastoplastic_heating =
5509 *
(projected_shape_values(i))
5510 *
* heating_request.get_thermo_elastic_heating_tangent(projected_shape_values(j));
5511 *
cell_matrix(i, j) += f_int_elastoplastic_heating * RJxW;
5517 *
for (
unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face) {
5518 *
fe_face_values.reinit(cell, face);
5519 *
mech_fe_face_values.reinit(mechanical_cell, face);
5521 *
fe_face_values[
temperature].get_function_values(
5522 *
Newton_system.previous_deformation,
5523 *
current_face_temperature_values);
5524 *
fe_face_values[
temperature].get_function_values(
5525 *
Newton_system.current_increment,
5526 *
face_temperature_values_increment);
5528 *
mech_fe_face_values[displacements].get_function_gradients(
5529 *
mechanical_nonlinear_system.previous_deformation,
5530 *
current_face_displacement_gradients);
5531 *
mech_fe_face_values[displacements].get_function_gradients(
5532 *
mechanical_nonlinear_system.current_increment,
5533 *
face_displacement_gradient_increments);
5535 *
mech_fe_face_values[displacements].get_function_values(
5536 *
mechanical_nonlinear_system.previous_deformation,
5537 *
current_face_displacement_values);
5538 *
mech_fe_face_values[displacements].get_function_values(
5539 *
mechanical_nonlinear_system.current_increment,
5540 *
face_displacement_value_increments);
5543 *
for (
typename std::vector<std::pair<
int, BodyForceApplier<dim, Number> > >
::const_iterator
5544 *
boundaryHeatSource = thermal_lbc_system.boundaryLoadAppliers.cbegin();
5545 *
boundaryHeatSource != thermal_lbc_system.boundaryLoadAppliers.cend();
5546 *
++boundaryHeatSource) {
5547 *
if (cell->face(face)->boundary_id() ==
static_cast<types::boundary_id>(boundaryHeatSource->first)) {
5548 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5549 *
for (
unsigned int q_point = 0;
5550 *
q_point < face_quadrature_formula.size();
5554 *
const auto updated_F = get_deformation_gradient(
5555 *
current_face_displacement_gradients[q_point]
5556 *
+ face_displacement_gradient_increments[q_point],
5557 *
(current_face_displacement_values[q_point][0]
5558 *
+ face_displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5563 *
const Tensor<1, dim+1, Number> reference_normal = postprocess_tensor_dimension(mech_fe_face_values.normal_vector(q_point), 0);
5565 *
const Number norm_F_inv_transpose_N = (F_inv_transpose_N).
norm();
5568 *
boundaryHeatSource->second.apply(
5570 *
fe_face_values.shape_value(i, q_point),
5571 *
norm_F_inv_transpose_N * J *
5572 *
fe_face_values.quadrature_point(q_point)[0] * fe_face_values.JxW(q_point));
5578 *
for (
typename std::vector<std::pair<
int, ConvectionBoundaryConditionApplier<dim, Number> > >
::const_iterator
5579 *
convectionBC = thermal_lbc_system.convection_BC_appliers.cbegin();
5580 *
convectionBC != thermal_lbc_system.convection_BC_appliers.cend();
5582 *
if (cell->face(face)->boundary_id() ==
static_cast<types::boundary_id>(convectionBC->first)) {
5583 *
for (
unsigned int q_point = 0;
5584 *
q_point < face_quadrature_formula.size();
5587 *
const unsigned int cell_index = cell->user_index() / quadrature_formula.size();
5588 *
const unsigned int surface_point_key =
5590 *
+ face * n_face_q_points
5593 *
const auto updated_F = get_deformation_gradient(
5594 *
current_face_displacement_gradients[q_point]
5595 *
+ face_displacement_gradient_increments[q_point],
5596 *
(current_face_displacement_values[q_point][0]
5597 *
+ face_displacement_value_increments[q_point][0])/fe_mech_values.quadrature_point(q_point)[0]);
5601 *
const Tensor<1, dim+1, Number> reference_normal = postprocess_tensor_dimension(mech_fe_face_values.normal_vector(q_point), 0);
5603 *
[[maybe_unused]]
const Number norm_F_inv_transpose_N = (F_inv_transpose_N).
norm();
5605 *
const Number RJxW = fe_face_values.quadrature_point(q_point)[0] / material_area_factors.at(surface_point_key).norm() * fe_face_values.JxW(q_point);
5607 *
const Number updated_face_temperature_value =
5608 *
current_face_temperature_values[q_point] +
5609 *
face_temperature_values_increment[q_point];
5610 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5612 *
convectionBC->second.apply(
5614 *
fe_face_values.shape_value(i, q_point),
5615 *
updated_face_temperature_value,
5617 *
if (fill_system_matrix) {
5618 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
5620 *
convectionBC->second.apply_gradient(
5622 *
fe_face_values.shape_value(i, q_point),
5623 *
fe_face_values.shape_value(j, q_point),
5634 *
std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5635 *
cell->get_dof_indices (local_dof_indices);
5636 *
if (fill_system_matrix) {
5637 *
thermal_dof_system.nodal_constraints.distribute_local_to_global(
5640 *
local_dof_indices,
5641 *
Newton_system.Newton_step_matrix,
5642 *
Newton_system.Newton_step_residual,
5645 *
thermal_dof_system.nodal_constraints.distribute_local_to_global(
5646 *
cell_residual, local_dof_indices,
5647 *
Newton_system.Newton_step_residual);
5656 *
template <
int dim,
typename Number>
5657 *
void PlasticityLabProg<dim, Number>::assemble_mesh_motion_system(
5658 *
NewtonStepSystem &mesh_motion_nonlinear_system,
5659 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
5660 *
const LBCSystem<dim, Number, dim> &,
5661 *
const NewtonStepSystem &deformation_nonlinear_system,
5662 *
const DoFSystem<dim, Number> &deformation_dof_system,
5663 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
5664 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
5665 *
const bool fill_system_matrix) {
5668 *
const Number mesh_motion_mu = 1.0;
5669 *
const Number mesh_motion_kappa = 5.0;
5670 *
const Number cell_jacobian_exponent = -0.0;
5676 *
quadrature_formula,
5682 *
quadrature_formula,
5689 *
quadrature_formula,
5692 *
const unsigned int dofs_per_cell = mesh_motion_fe.dofs_per_cell;
5693 *
const unsigned int n_q_points = quadrature_formula.size();
5694 *
const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
5696 *
std::vector< Tensor<2, dim, Number> > mesh_motion_gradient_increments(n_q_points);
5697 *
std::vector< Tensor<1, dim, Number> > mesh_motion_value_increments(n_q_points);
5699 *
std::vector< Tensor<2, dim, Number> > current_deformation_gradients(n_q_points);
5700 *
std::vector< Tensor<2, dim, Number> > deformation_gradient_increments(n_q_points);
5702 *
std::vector< Tensor<1, dim, Number> > current_deformation_values(n_q_points);
5703 *
std::vector< Tensor<1, dim, Number> > deformation_value_increments(n_q_points);
5705 *
std::vector< Number > mesh_motion_jacobians(n_q_points);
5706 *
std::vector< std::vector<Number> > strain_divergences(dofs_per_cell, std::vector<Number>(n_q_points));
5707 *
std::vector< std::vector<Number> > jacobian_tangents(dofs_per_cell, std::vector<Number>(n_q_points));
5709 *
std::vector< std::vector< std::vector < Number> > > strain_divergence_tangents(
5711 *
std::vector< std::vector< Number> >(dofs_per_cell,std::vector<Number>(n_q_points)));
5713 *
std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
5714 *
std::vector<std::vector<Number> > projected_strain_divergence_coefficients(
5716 *
std::vector<Number>(mixed_dofs_per_cell));
5717 *
std::vector<std::vector<Number> > projected_jacobian_tangent_coefficients(
5719 *
std::vector<Number>(mixed_dofs_per_cell));
5720 *
std::vector<std::vector<std::vector<Number> > > projected_strain_divergence_tangent_coefficients(
5721 *
dofs_per_cell, std::vector< std::vector< Number> >(
5723 *
std::vector<Number>(mixed_dofs_per_cell)));
5725 *
std::vector<Number> projected_strain_divergence(dofs_per_cell);
5726 *
std::vector<Number> projected_jacobian_tangent(dofs_per_cell);
5727 *
std::vector<std::vector<Number> > projected_strain_divergence_tangent(dofs_per_cell, std::vector<Number>(dofs_per_cell));
5738 *
mesh_motion_nonlinear_system.Newton_step_matrix = 0;
5739 *
mesh_motion_nonlinear_system.Newton_step_residual = 0;
5741 *
bool kinematic_domains_are_valid =
true;
5743 *
auto cell = mesh_motion_dof_system.dof_handler.begin_active();
5744 *
auto endc = mesh_motion_dof_system.dof_handler.end();
5745 *
auto deformation_cell = deformation_dof_system.dof_handler.begin_active();
5746 *
auto mixed_fe_cell = mixed_fe_dof_system.dof_handler.begin_active();
5748 *
for (; cell != endc; ++cell, ++deformation_cell, ++mixed_fe_cell) {
5749 *
if (cell->is_locally_owned()) {
5754 *
mesh_motion_fe_values.reinit (cell);
5755 *
deformation_fe_values.reinit (deformation_cell);
5756 *
mixed_fe_values.reinit (mixed_fe_cell);
5758 *
deformation_fe_values[displacements].get_function_gradients(
5759 *
deformation_nonlinear_system.previous_deformation,
5760 *
current_deformation_gradients);
5762 *
deformation_fe_values[displacements].get_function_gradients(
5763 *
deformation_nonlinear_system.current_increment,
5764 *
deformation_gradient_increments);
5766 *
deformation_fe_values[displacements].get_function_values(
5767 *
deformation_nonlinear_system.previous_deformation,
5768 *
current_deformation_values);
5770 *
deformation_fe_values[displacements].get_function_values(
5771 *
deformation_nonlinear_system.current_increment,
5772 *
deformation_value_increments);
5774 *
mesh_motion_fe_values[displacements].get_function_gradients(
5775 *
mesh_motion_nonlinear_system.current_increment,
5776 *
mesh_motion_gradient_increments);
5778 *
mesh_motion_fe_values[displacements].get_function_values(
5779 *
mesh_motion_nonlinear_system.current_increment,
5780 *
mesh_motion_value_increments);
5784 * get vectors
for projection onto mixed fe
values
5787 *
for (
unsigned int q_point = 0; q_point < n_q_points;
5790 *
const auto mesh_motion_gradient = get_deformation_gradient(
5791 *
-mesh_motion_gradient_increments[q_point],
5792 *
-mesh_motion_value_increments[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
5795 *
mesh_motion_jacobians.at(q_point) = Jacobian;
5797 *
const auto inv_mesh_motion_gradient =
invert(mesh_motion_gradient);
5798 *
std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
5799 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5800 *
rate_gradients[i] = postprocess_tensor_dimension(
5801 *
-mesh_motion_fe_values[displacements].
gradient(i, q_point),
5802 *
-mesh_motion_fe_values[displacements].
value(i, q_point)[0]
5803 *
/mesh_motion_fe_values.quadrature_point(q_point)[0]) * inv_mesh_motion_gradient;
5806 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5807 *
const Number strain_divergence_i =
trace(rate_gradients[i]);
5808 *
strain_divergences[i].at(q_point) = Jacobian * strain_divergence_i;
5809 *
if (fill_system_matrix) {
5810 *
jacobian_tangents[i].at(q_point) = Jacobian * strain_divergence_i;
5811 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
5812 *
strain_divergence_tangents[i][j].at(q_point) = Jacobian * (
trace(rate_gradients[i]) *
trace(rate_gradients[j]) -
trace(rate_gradients[i] * rate_gradients[j]));
5818 *
const unsigned int cell_index = cell->user_index() / n_q_points;
5821 *
&projected_Jacobian_coefficients,
5822 *
mesh_motion_jacobians);
5823 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5825 *
&projected_strain_divergence_coefficients[i],
5826 *
strain_divergences[i]);
5827 *
if (fill_system_matrix) {
5829 *
&projected_jacobian_tangent_coefficients[i],
5830 *
jacobian_tangents[i]);
5831 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
5833 *
&projected_strain_divergence_tangent_coefficients[i][j],
5834 *
strain_divergence_tangents[i][j]);
5839 *
for (
unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
5841 *
[[maybe_unused]]
const point_index_t quadrature_point_index = cell->user_index() + q_point;
5843 *
const Number cell_jacobian =
determinant(
static_cast<Tensor <2, dim, Number>
>(mesh_motion_fe_values.jacobian(q_point)));
5845 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5846 *
mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
5849 *
const auto mesh_motion_gradient = get_deformation_gradient(
5850 *
-mesh_motion_gradient_increments[q_point],
5851 *
-mesh_motion_value_increments[q_point][0]/mesh_motion_fe_values.quadrature_point(q_point)[0]);
5853 *
const auto deformation_gradient = get_deformation_gradient(
5854 *
current_deformation_gradients[q_point] + deformation_gradient_increments[q_point],
5855 *
(current_deformation_values[q_point][0] + deformation_value_increments[q_point][0])
5856 *
/ mesh_motion_fe_values.quadrature_point(q_point)[0]);
5858 *
const auto inv_mesh_motion_gradient =
invert(mesh_motion_gradient);
5859 *
const auto inv_deformation_gradient =
invert(deformation_gradient);
5861 *
[[maybe_unused]]
const Number deformation_Jacobian =
determinant(deformation_gradient);
5864 *
Number projected_jacobian = 0;
5865 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
5866 *
projected_jacobian +=
5867 *
mixed_values(i) * projected_Jacobian_coefficients.at(i);
5870 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
5871 *
projected_strain_divergence[j] =
5872 *
mixed_values(0) * projected_strain_divergence_coefficients[j][0];
5873 *
if (fill_system_matrix) {
5874 *
projected_jacobian_tangent[j] =
5875 *
mixed_values(0) * projected_jacobian_tangent_coefficients[j][0];
5876 *
for (
unsigned int k = 0; k < dofs_per_cell; ++k) {
5877 *
projected_strain_divergence_tangent[j][k] =
5879 *
* projected_strain_divergence_tangent_coefficients[j][k][0];
5884 *
for (
unsigned int i = 1; i < mixed_dofs_per_cell; ++i) {
5885 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
5886 *
projected_strain_divergence[j] +=
5887 *
mixed_values(i) * projected_strain_divergence_coefficients[j][i];
5888 *
if (fill_system_matrix) {
5889 *
projected_jacobian_tangent[j] +=
5890 *
mixed_values(i) * projected_jacobian_tangent_coefficients[j][i];
5891 *
for (
unsigned int k = 0; k < dofs_per_cell; ++k) {
5892 *
projected_strain_divergence_tangent[j][k] +=
5894 *
* projected_strain_divergence_tangent_coefficients[j][k][i];
5900 *
std::vector<Tensor<2, dim+1, Number>> rate_gradients(dofs_per_cell);
5901 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5902 *
rate_gradients[i] = postprocess_tensor_dimension(
5903 *
-mesh_motion_fe_values[displacements].
gradient(i, q_point),
5904 *
-mesh_motion_fe_values[displacements].
value(i, q_point)[0]
5905 *
/mesh_motion_fe_values.quadrature_point(q_point)[0]) * inv_mesh_motion_gradient;
5909 *
std::pow(cell_jacobian, cell_jacobian_exponent) * mesh_motion_mu
5910 *
*
std::pow(mesh_motion_Jacobian, -Constants<dim, Number>::two_thirds())
5913 *
(deformation_gradient * mesh_motion_gradient)
5914 *
*
transpose(deformation_gradient * mesh_motion_gradient)));
5916 *
const Number pressure = mesh_motion_kappa *
std::log(projected_jacobian);
5918 *
for (
unsigned int i = 0; i < dofs_per_cell; ++i) {
5919 *
const auto strain_i = deformation_gradient * rate_gradients[i] * inv_deformation_gradient;
5927 *
* mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5934 *
cell_residual(i) += (projected_strain_divergence.at(i) * pressure)
5935 *
* mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5937 *
if (fill_system_matrix) {
5939 *
for (
unsigned int j = 0; j < dofs_per_cell; ++j) {
5940 *
const auto strain_j = deformation_gradient * rate_gradients[j] * inv_deformation_gradient;
5948 *
std::pow(cell_jacobian, cell_jacobian_exponent) * mesh_motion_mu
5949 *
*
std::pow(mesh_motion_Jacobian, -Constants<dim, Number>::two_thirds())
5952 *
2 * (strain_j - Constants<dim, Number>::one_third() *
trace(strain_j) * unit_symmetric_tensor<dim+1, Number>())
5953 *
* (deformation_gradient * mesh_motion_gradient)
5954 *
*
transpose(deformation_gradient * mesh_motion_gradient)));
5957 *
* mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5964 *
const Number pressure_tangent_j = mesh_motion_kappa * (1.0 / projected_jacobian) * projected_jacobian_tangent[j];
5965 *
cell_matrix(i, j) += (projected_strain_divergence.at(i) * pressure_tangent_j + projected_strain_divergence_tangent[i][j] * pressure)
5966 *
* mesh_motion_fe_values.quadrature_point(q_point)[0] * mesh_motion_fe_values.JxW(q_point);
5976 *
if(relative_symmetry_norm2 > 1e-8)
5977 * std::cout <<
"relative_symmetry_norm2: " <<
cell_matrix.relative_symmetry_norm2() << std::endl;
5983 *
std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
5984 *
cell->get_dof_indices (local_dof_indices);
5985 *
if (fill_system_matrix) {
5986 *
mesh_motion_dof_system.nodal_constraints.distribute_local_to_global(
5989 *
local_dof_indices,
5990 *
mesh_motion_nonlinear_system.Newton_step_matrix,
5991 *
mesh_motion_nonlinear_system.Newton_step_residual,
5994 *
mesh_motion_dof_system.nodal_constraints.distribute_local_to_global(
5995 *
cell_residual, local_dof_indices,
5996 *
mesh_motion_nonlinear_system.Newton_step_residual);
6001 *
const unsigned short local_domain_is_valid = kinematic_domains_are_valid ? 1 : 0;
6002 *
unsigned short all_kinematic_domains_are_valid;
6006 * did any of the processes fail to
assemble?
6010 *
&local_domain_is_valid,
6011 *
&all_kinematic_domains_are_valid, 1, MPI_UNSIGNED_SHORT,
6012 *
MPI_MIN, mpi_communicator);
6014 *
if (all_kinematic_domains_are_valid < 1) {
6015 *
throw std::runtime_error(
"The domain is not valid...");
6018 *
if (fill_system_matrix) {
6025 *
template<
typename BlockType>
6029 *
const BlockType &m1,
6030 *
const BlockType &m2):
6035 *
template<
typename VectorType>
6036 *
void vmult(VectorType &dst,
const VectorType &src)
const {
6037 *
m1.vmult(dst, src);
6038 *
m2.vmult_add(dst, src);
6042 *
const BlockType &m1;
6043 *
const BlockType &m2;
6048 * TODO encorporate mechanical and thermal subsystems into structs and include
functions in them
6051 *
template <
int dim,
typename Number>
6052 *
void PlasticityLabProg<dim, Number>::solve_system(
6053 *
const DoFSystem<dim, Number> &dof_system,
6054 *
NewtonStepSystem &nonlinear_system,
6055 *
const bool reset_solution) {
6058 *
const std::vector<std::vector<bool> > constant_modes
6064 *
additional_data.elliptic =
true;
6065 *
additional_data.n_cycles = 1;
6066 *
additional_data.w_cycle =
false;
6067 *
additional_data.output_details =
false;
6068 *
additional_data.smoother_sweeps = 2;
6069 *
additional_data.aggregation_threshold = 1
e-2;
6070 *
preconditioner.initialize(nonlinear_system.Newton_step_matrix, additional_data);
6073 *
const Number relative_accuracy = 1
e-08;
6074 *
const Number solver_tolerance = relative_accuracy
6075 *
* nonlinear_system.Newton_step_matrix.residual(tmp, nonlinear_system.Newton_step_solution,
6076 *
nonlinear_system.Newton_step_residual);
6077 *
SolverControl solver_control(nonlinear_system.Newton_step_matrix.m(),
6078 *
solver_tolerance);
6082 *
if (reset_solution) {
6083 *
nonlinear_system.Newton_step_solution = 0;
6087 *
solver.solve(nonlinear_system.Newton_step_matrix, nonlinear_system.Newton_step_solution,
6088 *
nonlinear_system.Newton_step_residual, preconditioner);
6090 *
pcout <<
"solved in " << solver_control.last_step() <<
" steps to residual value of " << solver_control.last_value() << endl;
6091 *
pcout <<
"solution norm is: " << nonlinear_system.Newton_step_solution.l2_norm() << endl;
6093 *
dof_system.nodal_constraints.distribute (nonlinear_system.Newton_step_solution);
6097 *
template <
int dim,
typename Number>
6098 *
void PlasticityLabProg<dim, Number>::get_plastic_strain(
6102 *
const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors) {
6106 *
const unsigned int n_q_points = quadrature_formula.size();
6109 *
std::vector<Number> plastic_strain_qp_values(n_q_points);
6110 *
std::vector<Number> projected_plastic_strains(disc_dofs_per_cell);
6112 *
auto cell = discontinuous_dof_handler.begin_active();
6113 *
auto endc = discontinuous_dof_handler.end();
6114 *
for (; cell != endc; ++cell) {
6115 *
if (cell->is_locally_owned()) {
6116 *
for (
unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
6117 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
6118 *
plastic_strain_qp_values[q_point] =
std::exp(material.get_state_parameters(quadrature_point_index).at(0)) - 1;
6121 *
const unsigned int cell_index = cell->user_index() / n_q_points;
6123 *
&projected_plastic_strains,
6124 *
plastic_strain_qp_values);
6126 *
std::vector<types::global_dof_index> local_dof_indices (disc_dofs_per_cell);
6127 *
cell->get_dof_indices (local_dof_indices);
6128 *
for (
unsigned int dof_i = 0; dof_i < disc_dofs_per_cell; ++dof_i) {
6129 *
plastic_strain(local_dof_indices[dof_i]) = projected_plastic_strains.at(dof_i);
6136 *
template <
int dim,
typename Number>
6137 *
void PlasticityLabProg<dim, Number>::get_pressure(
6142 *
NewtonStepSystem &Newton_system,
6143 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6144 *
const NewtonStepSystem &thermal_Newton_system,
6145 *
const DoFSystem<dim, Number> &thermal_dof_system,
6147 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6148 *
const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors) {
6153 *
quadrature_formula,
6159 *
quadrature_formula,
6165 *
quadrature_formula,
6168 *
const unsigned int n_q_points = quadrature_formula.size();
6169 *
const unsigned int mixed_dofs_per_cell = mixed_var_fe.dofs_per_cell;
6170 *
const unsigned int disc_dofs_per_cell = discontinuous_dof_handler.get_fe().dofs_per_cell;
6173 *
std::vector< Tensor<2, dim, Number> > current_displacement_gradients(n_q_points);
6174 *
std::vector< Tensor<2, dim, Number> > displacement_gradient_increments(n_q_points);
6175 *
std::vector< Tensor<1, dim, Number> > current_displacement_values(n_q_points);
6176 *
std::vector< Tensor<1, dim, Number> > displacement_value_increments(n_q_points);
6178 *
std::vector< Number > current_temperature_values(n_q_points);
6179 *
std::vector< Number > updated_temperature_increments(n_q_points);
6180 *
std::vector< Number > deformation_jacobians(n_q_points);
6181 *
std::vector< Number > pressure_values(n_q_points);
6182 *
std::vector< Number > von_mises_stress_values(n_q_points);
6184 *
std::vector<Number> projected_temperature_coefficients(mixed_dofs_per_cell);
6185 *
std::vector<Number> projected_Jacobian_coefficients(mixed_dofs_per_cell);
6186 *
std::vector<Number> projected_pressure_coefficients(mixed_dofs_per_cell);
6187 *
std::vector<Number> projected_von_mises_stress_coefficients(disc_dofs_per_cell);
6194 *
auto cell = mechanical_dof_system.dof_handler.begin_active();
6195 *
auto endc = mechanical_dof_system.dof_handler.end();
6196 *
auto thermal_cell = thermal_dof_system.dof_handler.begin_active();
6197 *
auto mixed_fe_cell = mixed_fe_dof_handler.begin_active();
6198 *
auto discontinuous_fe_cell = discontinuous_dof_handler.begin_active();
6199 *
for (; cell != endc; ++cell, ++thermal_cell, ++mixed_fe_cell, ++discontinuous_fe_cell) {
6200 *
if (cell->is_locally_owned()) {
6202 *
fe_values.reinit (cell);
6203 *
fe_therm_values.reinit (thermal_cell);
6204 *
mixed_fe_values.reinit (mixed_fe_cell);
6206 *
fe_values[displacements].get_function_gradients(
6207 *
Newton_system.current_increment,
6208 *
displacement_gradient_increments);
6210 *
fe_values[displacements].get_function_gradients(
6211 *
Newton_system.previous_deformation,
6212 *
current_displacement_gradients);
6214 *
fe_values[displacements].get_function_values(
6215 *
Newton_system.current_increment,
6216 *
displacement_value_increments);
6218 *
fe_values[displacements].get_function_values(
6219 *
Newton_system.previous_deformation,
6220 *
current_displacement_values);
6222 *
fe_therm_values[
temperature].get_function_values (
6223 *
thermal_Newton_system.previous_deformation,
6224 *
current_temperature_values);
6226 *
fe_therm_values[
temperature].get_function_values (
6227 *
thermal_Newton_system.current_increment,
6228 *
updated_temperature_increments);
6232 * get vectors
for projection onto mixed fe
values
6235 *
for (
unsigned int q_point = 0; q_point < n_q_points;
6237 *
updated_temperature_increments.at(q_point) += current_temperature_values.at(q_point);
6239 *
const auto current_F = get_deformation_gradient(
6240 *
current_displacement_gradients[q_point],
6241 *
current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
6243 *
const auto updated_F = get_deformation_gradient(
6244 *
current_displacement_gradients[q_point]
6245 *
+ displacement_gradient_increments[q_point],
6246 *
(current_displacement_values[q_point][0]
6247 *
+ displacement_value_increments[q_point][0])/fe_values.quadrature_point(q_point)[0]);
6249 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
6255 *
const unsigned int cell_index = cell->user_index() / n_q_points;
6258 *
&projected_temperature_coefficients,
6259 *
updated_temperature_increments);
6261 *
&projected_Jacobian_coefficients,
6262 *
deformation_jacobians);
6264 *
for (
unsigned int q_point = 0; q_point < n_q_points; ++q_point) {
6266 *
const point_index_t quadrature_point_index = cell->user_index() + q_point;
6267 *
ConstitutiveModelRequest<dim+1, Number> constitutive_request(update_pressure | update_stress_deviator);
6269 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
6270 *
mixed_values(i) = mixed_fe_values.shape_value(i, q_point);
6273 *
const auto current_F = get_deformation_gradient(
6274 *
current_displacement_gradients[q_point],
6275 *
current_displacement_values[q_point][0]/fe_values.quadrature_point(q_point)[0]
6277 *
const auto updated_F = get_deformation_gradient(
6278 *
current_displacement_gradients[q_point]
6279 *
+ displacement_gradient_increments[q_point],
6280 *
(current_displacement_values[q_point][0]
6281 *
+ displacement_value_increments[q_point][0])/fe_values.quadrature_point(q_point)[0]);
6283 *
[[maybe_unused]]
const auto inv_updated_F =
invert(updated_F);
6287 *
const auto deformation_gradient_increment =
std::pow(Jacobian / previous_Jacobian, -Constants<dim, Number>::one_third()) * updated_F *
invert(current_F);
6289 *
Number projected_jacobian = 0;
6290 *
Number projected_temperature = 0;
6291 *
for (
unsigned int i = 0; i < mixed_dofs_per_cell; ++i) {
6292 *
projected_jacobian +=
6293 *
mixed_values(i) * projected_Jacobian_coefficients.at(i);
6294 *
projected_temperature +=
6295 *
mixed_values(i) * projected_temperature_coefficients.at(i);
6298 *
constitutive_request.set_deformation_Jacobian(projected_jacobian);
6299 *
constitutive_request.set_temperature(projected_temperature);
6300 *
constitutive_request.set_deformation_gradient(deformation_gradient_increment);
6301 *
constitutive_request.set_time_increment(time_increment);
6303 *
material.compute_constitutive_request(constitutive_request,
6304 *
quadrature_point_index);
6311 *
pressure_values.at(q_point) = constitutive_request.get_pressure();
6312 *
von_mises_stress_values.at(q_point) =
6313 *
constitutive_request.get_stress_deviator().norm() / Constants<dim, Number>::sqrt2thirds();
6317 *
&projected_pressure_coefficients,
6321 *
&projected_von_mises_stress_coefficients,
6322 *
von_mises_stress_values);
6324 *
std::vector<types::global_dof_index> local_dof_indices (mixed_dofs_per_cell);
6325 *
mixed_fe_cell->get_dof_indices (local_dof_indices);
6326 *
for (
unsigned int dof_i = 0; dof_i < mixed_dofs_per_cell; ++dof_i) {
6327 *
pressure(local_dof_indices[dof_i]) = projected_pressure_coefficients.at(dof_i);
6330 *
std::vector<types::global_dof_index> local_discontinuous_dof_indices(disc_dofs_per_cell);
6331 *
discontinuous_fe_cell->get_dof_indices (local_discontinuous_dof_indices);
6332 *
for (
unsigned int dof_i = 0; dof_i < disc_dofs_per_cell; ++dof_i) {
6333 *
von_mises_stress(local_discontinuous_dof_indices[dof_i]) =
6334 *
projected_von_mises_stress_coefficients.at(dof_i);
6341 *
template <
int dim,
typename Number>
6342 *
void PlasticityLabProg<dim, Number>::prepare_output_results(
6344 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6345 *
const NewtonStepSystem &mechanical_nonlinear_system,
6346 *
const DoFSystem<dim, Number> &thermal_dof_system,
6347 *
const NewtonStepSystem &thermal_nonlinear_system,
6348 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6349 *
const NewtonStepSystem &mesh_motion_nonlinear_system)
const {
6351 *
std::vector<std::string> displacement_names(dim,
"displacement");
6352 *
displacement_names.emplace_back(
"angular_displacement");
6353 *
std::vector<std::string> velocity_names(dim,
"displacement_time_rate");
6354 *
velocity_names.emplace_back(
"angular_velocity");
6355 *
std::vector<DataComponentInterpretation::DataComponentInterpretation>
6356 *
data_component_interpretation(
6358 *
data_component_interpretation.push_back(
6361 *
std::vector<DataComponentInterpretation::DataComponentInterpretation>
6362 *
mesh_motion_data_component_interpretation(
6365 *
data_out.add_data_vector(mechanical_dof_system.dof_handler,
6366 *
mechanical_nonlinear_system.previous_deformation,
6367 *
displacement_names,
6368 *
data_component_interpretation);
6369 *
data_out.add_data_vector(mechanical_dof_system.dof_handler,
6370 *
mechanical_nonlinear_system.previous_time_derivative,
6372 *
data_component_interpretation);
6373 *
data_out.add_data_vector(thermal_dof_system.dof_handler,
6374 *
thermal_nonlinear_system.previous_deformation,
6376 *
data_out.add_data_vector(mesh_motion_dof_system.dof_handler,
6377 *
mesh_motion_nonlinear_system.previous_deformation,
6378 *
std::vector<std::string>(dim,
"mesh_motion"),
6379 *
mesh_motion_data_component_interpretation);
6380 *
data_out.add_data_vector(mesh_motion_dof_system.dof_handler,
6381 *
mesh_motion_nonlinear_system.previous_time_derivative,
6382 *
std::vector<std::string>(dim,
"mesh_velocity"),
6383 *
mesh_motion_data_component_interpretation);
6384 *
data_out.build_patches(mapping, 2);
6387 *
template <
int dim,
typename Number>
6388 *
template <
typename TriangulationType>
6389 *
void PlasticityLabProg<dim, Number>::write_output_results(
6391 *
const TriangulationType &tria,
6392 *
const std::string &filename_base)
const {
6394 *
const std::string filename =
6395 *
(filename_base +
"-"
6398 *
std::ofstream output_vtu((filename +
".vtu").c_str());
6399 *
data_out.write_vtu(output_vtu);
6402 *
std::vector<std::string> filenames;
6403 *
for (
unsigned int i = 0;
6405 *
filenames.push_back(filename_base +
"-"
6408 *
std::ofstream pvtu_master_output((filename_base +
".pvtu").c_str());
6409 *
data_out.write_pvtu_record(pvtu_master_output, filenames);
6410 *
std::ofstream visit_master_output((filename_base +
".visit").c_str());
6415 *
template class PlasticityLabProg<2, double>;
6421<a name=
"ann-src/PlasticityLabProg.h"></a>
6422<h1>Annotated version of src/PlasticityLabProg.h</h1>
6435 *
#ifndef PLASTICITYLABPROG_H_
6436 *
#define PLASTICITYLABPROG_H_
6438 *
#include <deal.II/fe/fe_q.h>
6439 *
#include <deal.II/fe/fe_dgp.h>
6440 *
#include <deal.II/fe/fe_system.h>
6441 *
#include <deal.II/fe/mapping_q.h>
6443 *
#include <deal.II/distributed/tria.h>
6445 *
#include <deal.II/numerics/data_out.h>
6446 *
#include <deal.II/base/function.h>
6447 *
#include <stdexcept>
6449 *
#include
"DoFSystem.h"
6450 *
#include
"LBCSystem.h"
6451 *
#include
"MixedFEProjector.h"
6452 *
#include
"Material.h"
6453 *
#include
"NewtonStepSystem.h"
6456 *
using namespace dealii;
6458 *
template <
int dim,
typename Number =
double>
6459 *
class PlasticityLabProg {
6462 *
virtual ~PlasticityLabProg();
6466 *
void make_grid (
int);
6467 *
void make_cylindrical_grid(
6469 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6470 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6471 *
int n_initial_global_refinements);
6472 *
void make_grid_();
6473 *
void make_necking_grid(
6475 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6476 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6477 *
int n_initial_global_refinements);
6478 *
void make_interference_cylinder_grid(
6480 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6481 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6482 *
int n_initial_global_refinements);
6483 *
void make_cylindrical_impact_grid(
6485 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6486 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6487 *
int n_initial_global_refinements);
6488 *
void make_ball_in_hypershell_grid(
6490 *
LBCSystem<dim, Number, dim+1> &mech_lbc_system,
6491 *
LBCSystem<dim, Number, 1> &therm_lbc_system,
6492 *
int n_initial_global_refinements);
6493 *
void make_hook_membrane_grid(
int);
6495 *
void set_mesh_motion_LBCs(
6497 *
LBCSystem<dim, Number, dim> &mesh_motion_lbc_system);
6506 *
void remap_material_state_variables(
6507 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6508 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6509 *
const NewtonStepSystem &mechanical_nonlinear_system,
6510 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6511 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6512 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6517 *
void remap_thermal_field(
6518 *
NewtonStepSystem &thermal_nonlinear_system,
6519 *
const DoFSystem<dim, Number> &thermal_dof_system,
6520 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6521 *
const DoFSystem<dim, Number> &mesh_motion_dof_system);
6524 *
void remap_mechanical_fields(
6525 *
NewtonStepSystem &mechanical_nonlinear_system,
6526 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6527 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6528 *
const DoFSystem<dim, Number> &mesh_motion_dof_system);
6531 *
template <
typename TriangulationType,
typename MaterialType>
6532 *
void setup_material_data(TriangulationType &triangulation,
6533 *
MaterialType &material);
6535 *
void setup_material_area_factors(
6536 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6539 *
void update_material_area_factors(
6540 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6541 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6544 *
template <
typename TriangulationType>
6545 *
void setup_mixed_fe_projection_data(
6546 *
const TriangulationType &triangulation,
6547 *
std::vector< MixedFEProjector<dim, Number> > &MixedFeProjectors,
6551 *
void assemble_mechanical_system(
6552 *
NewtonStepSystem &Newton_system,
6553 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6554 *
const LBCSystem<dim, Number, dim+1> &mechanical_lbc_system,
6555 *
const NewtonStepSystem &mesh_motion_nonlinear_system,
6556 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6557 *
const NewtonStepSystem &thermal_Newton_system,
6558 *
const DoFSystem<dim, Number> &thermal_dof_system,
6559 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6561 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6562 *
const bool fill_system_matrix =
true,
6563 *
const bool update_material_state =
false);
6565 *
void assemble_thermal_system(
6566 *
NewtonStepSystem &Newton_system,
6567 *
NewtonStepSystem &mechanical_nonlinear_system,
6568 *
const DoFSystem<dim, Number> &thermal_dof_system,
6569 *
const LBCSystem<dim, Number, 1> &thermal_lbc_system,
6570 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6571 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6573 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6575 *
const bool fill_system_matrix =
true);
6577 *
void assemble_mesh_motion_system(
6578 *
NewtonStepSystem &mesh_motion_nonlinear_system,
6579 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6580 *
const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
6581 *
const NewtonStepSystem &deformation_nonlinear_system,
6582 *
const DoFSystem<dim, Number> &deformation_dof_system,
6583 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6584 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6585 *
const bool fill_system_matrix =
true);
6587 *
void solve_system(
const DoFSystem<dim, Number> &dof_system,
6588 *
NewtonStepSystem &nonlinear_system,
6589 *
const bool reset_solution=
true);
6592 *
const DoFSystem<dim, Number> &dof_system,
6593 *
const NewtonStepSystem &nonlinear_system,
6594 *
const DoFSystem<dim, Number> &thermal_dof_system,
6595 *
const NewtonStepSystem &thermal_nonlinear_system,
6596 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6597 *
const NewtonStepSystem &mesh_motion_nonlinear_system)
const;
6599 *
template <
typename TriangulationType>
6601 *
const TriangulationType &tria,
6602 *
const std::string &filename_base)
const;
6604 *
void get_plastic_strain(
6608 *
const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors);
6610 *
void get_pressure(
6615 *
NewtonStepSystem &Newton_system,
6616 *
const DoFSystem<dim, Number> &mechanical_dof_system,
6617 *
const NewtonStepSystem &thermal_Newton_system,
6618 *
const DoFSystem<dim, Number> &thermal_dof_system,
6620 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6621 *
const std::vector< MixedFEProjector<dim, Number> > &qp_values_projectors);
6623 *
void solve_mechanical_step(
int time_step);
6624 *
void solve_thermal_step(
int time_step);
6626 *
void solve_mesh_motion_step(
6627 *
NewtonStepSystem &mesh_motion_nonlinear_system,
6628 *
const DoFSystem<dim, Number> &mesh_motion_dof_system,
6629 *
const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
6630 *
const NewtonStepSystem &deformation_nonlinear_system,
6631 *
const DoFSystem<dim, Number> &deformation_dof_system,
6632 *
const DoFSystem<dim, Number> &mixed_fe_dof_system,
6633 *
const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
6634 *
const int time_step);
6638 *
const Number increment_0_over_rho) {
6640 *
for(
unsigned int i=0; i<dim; ++i){
6641 *
for(
unsigned int j=0; j<dim; ++j) {
6642 *
deformation_gradient[i][j] += increment_gradient[i][j];
6645 *
deformation_gradient[dim][dim] += increment_0_over_rho;
6646 *
return deformation_gradient;
6651 *
const Number entry_0_over_rho) {
6653 *
for(
unsigned int i=0; i<dim; ++i){
6654 *
for(
unsigned int j=0; j<dim; ++j) {
6655 *
postprocessed_tensor[i][j] = dimension_short_tensor[i][j];
6658 *
postprocessed_tensor[dim][dim] = entry_0_over_rho;
6659 *
return postprocessed_tensor;
6664 *
const Number entry_at_dim=
static_cast<Number>(0.0)) {
6666 *
for(
unsigned int i=0; i<dim; ++i){
6667 *
postprocessed_tensor[i] += dimension_short_tensor[i];
6669 *
postprocessed_tensor[dim] = entry_at_dim;
6670 *
return postprocessed_tensor;
6675 *
postprocessed_tensor[dim] = angular_value;
6676 *
return postprocessed_tensor;
6681 *
const Number minus_entry_over_rho) {
6683 *
for(
unsigned int i=0; i<dim; ++i) {
6684 *
postprocessed_tensor[dim][i] = in_plane_gradient[i];
6686 *
postprocessed_tensor[0][dim] = minus_entry_over_rho;
6687 *
return postprocessed_tensor;
6691 *
const Number angular_displacement,
6696 *
throw std::logic_error(
"Radial deformation gradient not implemented for dim!=2");
6702 *
angular_displacmenet_over_r_squared[0] = angular_displacement / (
radius *
radius);
6721 *
const Number angular_displacement,
6724 *
const Number angular_displacement_variation,
6728 *
throw std::logic_error(
"Radial deformation gradient not implemented for dim!=2");
6733 *
const Number theta_variation = angular_displacement_variation /
radius;
6736 *
angular_displacmenet_over_r_squared[0] = angular_displacement / (
radius *
radius);
6740 *
angular_displacmenet_variation_over_r_squared[0] = angular_displacement_variation / (
radius *
radius);
6741 *
const Tensor<1, dim, Number> theta_gradient_variation = angular_displacement_gradient_variation /
radius - angular_displacmenet_variation_over_r_squared;
6743 *
result[0][0] = -
std::sin(theta) * theta_variation
6744 *
-
radius *
std::cos(theta) * theta_variation * theta_gradient[0]
6747 *
result[0][1] = -
radius *
std::cos(theta) * theta_variation * theta_gradient[1]
6750 *
result[0][2] = -
std::cos(theta) * theta_variation;
6756 *
result[2][0] =
std::cos(theta) * theta_variation
6757 *
-
radius *
std::sin(theta) * theta_variation * theta_gradient[0]
6760 *
result[2][1] = -
radius *
std::sin(theta) * theta_variation * theta_gradient[1]
6763 *
result[2][2] = -
std::sin(theta) * theta_variation;
6769 *
const Number angular_displacement,
6773 *
throw std::logic_error(
"Radial deformation gradient not implemented for dim!=2");
6795 *
const Number angular_displacement,
6796 *
const Number angular_displacement_variation,
6800 *
throw std::logic_error(
"Radial deformation gradient not implemented for dim!=2");
6805 *
const Number theta_variation = angular_displacement_variation /
radius;
6807 *
result[0][0] = -
std::sin(theta) * theta_variation;
6809 *
result[0][2] = -
std::cos(theta) * theta_variation;
6815 *
result[2][0] =
std::cos(theta) * theta_variation;
6817 *
result[2][2] = -
std::sin(theta) * theta_variation;
6834 *
DoFSystem<dim, Number> mech_dof_system;
6835 *
DoFSystem<dim, Number> therm_dof_system;
6836 *
DoFSystem<dim, Number> mixed_fe_dof_system;
6838 *
LBCSystem<dim, Number, dim+1> mech_lbc_system;
6839 *
LBCSystem<dim, Number, 1> therm_lbc_system;
6841 *
NewtonStepSystem mech_nonlinear_system;
6842 *
NewtonStepSystem therm_nonlinear_system;
6844 *
NewtonStepSystem mesh_motion_nonlinear_system;
6845 *
DoFSystem<dim, Number> mesh_motion_dof_system;
6846 *
LBCSystem<dim, Number, dim> mesh_motion_lbc_system;
6848 *
NewtonStepSystem deformation_remapping_nonlinear_system;
6851 *
QGauss<dim-1> face_quadrature_formula;
6855 *
std::vector< MixedFEProjector<dim, Number> > mixed_FE_projectors;
6857 *
std::unordered_map<size_t, Tensor<1, dim+1, Number>> material_area_factors;
6860 *
unsigned int output_rate = 1;
6861 *
Number time_since_start = 0;
6863 *
const Number ambient_temperature = 293.0;
6864 *
const Number rho_infty = 0.0;
6866 *
const unsigned int surface_boundary_id = 2;
6868 *
const bool COMPUTE_FORCES_PER_UNIT_AREA_IN_CURRENT_CONFIGURATION =
false;
6869 *
const bool use_sigmoid_friction_law =
true;
6871 *
Number global_lagrangian_penalty_factor = 1.0;
6875 *
struct NewtonIterationDivergenceException : std::exception {
6876 *
const char *what() const _GLIBCXX_USE_NOEXCEPT
override {
6877 *
return "Newton step solution diverged!\n";
6887<a name=
"ann-src/PlasticityLabProgDrivers.cpp"></a>
6888<h1>Annotated version of src/PlasticityLabProgDrivers.cpp</h1>
6894 *
#include <sstream>
6896 *
#include <deal.II/grid/tria.h>
6897 *
#include <deal.II/grid/grid_generator.h>
6898 *
#include <deal.II/grid/grid_in.h>
6899 *
#include <deal.II/grid/manifold_lib.h>
6900 *
#include <deal.II/grid/grid_tools.h>
6903 *
#include <deal.II/fe/fe_dgq.h>
6905 *
#include
"RotationFunction.h"
6906 *
#include
"ScaleZFunction.h"
6907 *
#include
"ScaleComponentFunction.h"
6908 *
#include
"PlasticityLabProg.h"
6910 *
using namespace dealii;
6915 *
template <
int dim,
typename Number>
6916 *
void PlasticityLabProg<dim, Number>::run() {
6920 * make_ball_in_hypershell_grid(
6921 * make_cylindrical_grid(
6922 * make_cylindrical_impact_grid(
6925 *
make_necking_grid(
6936 * make_hook_membrane_grid(1);
6942 *
set_mesh_motion_LBCs(triangulation, mesh_motion_lbc_system);
6948 *
mech_dof_system.setup_dof_system(mech_fe);
6949 *
mech_lbc_system.apply_constraints(mech_dof_system);
6950 *
mech_nonlinear_system.setup(mech_dof_system);
6952 *
therm_dof_system.setup_dof_system(therm_fe);
6953 *
therm_lbc_system.apply_constraints(therm_dof_system);
6954 *
therm_nonlinear_system.setup(therm_dof_system);
6958 * Initialize the
temperature solution vector. Because we are
6959 * initializing with a possibly non-
zero value, we can
't just
6960 * assign that value to the vector in a parallel setting because
6961 * the solution vector has ghost entries and so is
6962 * read-only. Rather, we create a completely distributed vector,
6963 * assign the value to it, and then copy that into the solution
6968 * TrilinosWrappers::MPI::Vector tmp (therm_dof_system.locally_owned_dofs,
6969 * mpi_communicator);
6970 * tmp = ambient_temperature;
6971 * therm_nonlinear_system.previous_deformation = tmp;
6974 * mixed_fe_dof_system.setup_dof_system(mixed_var_fe);
6976 * mesh_motion_dof_system.setup_dof_system(mesh_motion_fe);
6977 * mesh_motion_lbc_system.apply_constraints(mesh_motion_dof_system);
6978 * mesh_motion_nonlinear_system.setup(mesh_motion_dof_system);
6980 * deformation_remapping_nonlinear_system.setup(mech_dof_system);
6982 * setup_material_data(triangulation, material);
6983 * setup_material_area_factors(mesh_motion_dof_system, material_area_factors);
6985 * setup_mixed_fe_projection_data(
6986 * triangulation, mixed_FE_projectors,
6987 * mixed_var_fe, quadrature_formula);
6989 * std::vector< MixedFEProjector<dim, Number> > discontinuous_projectors;
6990 * FE_DGQ<dim> discontinuous_fe(1);
6992 * setup_mixed_fe_projection_data(
6993 * triangulation, discontinuous_projectors,
6994 * discontinuous_fe, quadrature_formula);
6996 * TrilinosWrappers::MPI::Vector pressure(
6997 * mixed_fe_dof_system.locally_owned_dofs,
6998 * mpi_communicator);
7000 * DoFSystem<dim, Number> discontinuous_dof_system(triangulation, mapping);
7001 * discontinuous_dof_system.setup_dof_system(discontinuous_fe);
7002 * TrilinosWrappers::MPI::Vector plastic_strain(
7003 * discontinuous_dof_system.locally_owned_dofs,
7004 * mpi_communicator);
7005 * TrilinosWrappers::MPI::Vector von_mises_stress(
7006 * discontinuous_dof_system.locally_owned_dofs,
7007 * mpi_communicator);
7010 * TrilinosWrappers::MPI::Vector initial_velocity(
7011 * mech_dof_system.locally_owned_dofs,
7012 * mpi_communicator);
7014 * MPI_Barrier(mpi_communicator);
7016 * for(const auto initial_velocity_interpolation_handler: mech_lbc_system.initial_velocity_interpolation_handlers) {
7017 * initial_velocity_interpolation_handler->interpolate(initial_velocity, mech_dof_system);
7022 * Assigning the locally-owned vector into the ghosted vector performs
7023 * the necessary ghost import; compress() must not be called on a
7024 * vector that has ghost elements (it is read-only).
7027 * mech_nonlinear_system.previous_time_derivative = initial_velocity;
7032 * TrilinosWrappers::MPI::Vector initial_deformation(
7033 * mech_dof_system.locally_owned_dofs,
7034 * mpi_communicator);
7036 * MPI_Barrier(mpi_communicator);
7038 * for(const auto initial_deformation_interpolation_handler: mech_lbc_system.initial_deformation_interpolation_handlers) {
7039 * initial_deformation_interpolation_handler->interpolate(initial_deformation, mech_dof_system);
7042 * mech_nonlinear_system.previous_deformation = initial_deformation;
7046 * for (unsigned int timeStep = 0; timeStep < n_steps + 1; ++timeStep) {
7047 * for(const auto increment_interpolation_handler: mech_lbc_system.increment_interpolation_handlers) {
7048 * increment_interpolation_handler->advance_time(time_increment);
7051 * get_plastic_strain(
7053 * discontinuous_dof_system.dof_handler,
7055 * discontinuous_projectors);
7059 * mixed_fe_dof_system.dof_handler,
7061 * discontinuous_dof_system.dof_handler,
7062 * mech_nonlinear_system,
7064 * therm_nonlinear_system,
7067 * mixed_FE_projectors,
7068 * discontinuous_projectors);
7070 * if(0==timeStep % output_rate) {
7071 * pcout << "\nOutputting results..." << endl;
7072 * DataOut<dim> data_out;
7074 * data_out.add_data_vector(
7075 * discontinuous_dof_system.dof_handler,
7077 * "plastic_strain");
7078 * data_out.build_patches();
7080 * data_out.add_data_vector(
7081 * mixed_fe_dof_system.dof_handler,
7084 * data_out.build_patches();
7086 * data_out.add_data_vector(
7087 * discontinuous_dof_system.dof_handler,
7089 * "von_mises_stress");
7091 * prepare_output_results(
7094 * mech_nonlinear_system,
7096 * therm_nonlinear_system,
7097 * mesh_motion_dof_system,
7098 * mesh_motion_nonlinear_system);
7100 * std::ostringstream oss;
7101 * oss << "step_" << timeStep;
7102 * const std::string output_name = oss.str();
7103 * write_output_results(data_out, triangulation, output_name);
7106 * if (timeStep == n_steps) break;
7108 * pcout << "\n\nStarting time step " << timeStep << ":\n\n" << endl;
7111 * TrilinosWrappers::MPI::Vector step_increment(
7112 * mech_dof_system.locally_owned_dofs,
7113 * mpi_communicator);
7115 * MPI_Barrier(mpi_communicator);
7117 * for(const auto increment_interpolation_handler: mech_lbc_system.increment_interpolation_handlers) {
7118 * increment_interpolation_handler->interpolate(step_increment, mech_dof_system);
7121 * mech_nonlinear_system.current_increment = step_increment;
7124 * solve_mesh_motion_step(
7125 * mesh_motion_nonlinear_system,
7126 * mesh_motion_dof_system,
7127 * mesh_motion_lbc_system,
7128 * mech_nonlinear_system,
7130 * mixed_fe_dof_system,
7131 * mixed_FE_projectors,
7134 * mesh_motion_nonlinear_system.advance_time(time_increment, rho_infty, false);
7137 * The mesh-motion deformation is the negative of the just-computed
7138 * increment. 'previous_deformation
' is a ghosted (read-only) vector, so
7139 * this negation is delegated to the nonlinear system, which performs the
7140 * arithmetic in fully-distributed temporaries.
7143 * mesh_motion_nonlinear_system.set_previous_deformation_to_negative_current_increment();
7145 * std::unordered_map<point_index_t, Tensor<2, dim+1, Number>> remapped_deformation_gradients;
7146 * remap_material_state_variables(
7147 * mesh_motion_nonlinear_system,
7148 * mesh_motion_dof_system,
7149 * mech_nonlinear_system,
7151 * mixed_fe_dof_system,
7152 * mixed_FE_projectors,
7154 * remapped_deformation_gradients);
7156 * remap_thermal_field(
7157 * therm_nonlinear_system,
7159 * mesh_motion_nonlinear_system,
7160 * mesh_motion_dof_system);
7162 * remap_mechanical_fields(
7163 * mech_nonlinear_system,
7165 * mesh_motion_nonlinear_system,
7166 * mesh_motion_dof_system);
7168 * update_material_area_factors(
7169 * mesh_motion_nonlinear_system,
7170 * mesh_motion_dof_system,
7171 * material_area_factors);
7173 * solve_mechanical_step(timeStep);
7175 * solve_thermal_step(timeStep);
7177 * solve_mechanical_step(timeStep);
7181 * udpate material state
7184 * pcout << "\n\t\tassembling mechanical system updating material state..." << endl;
7185 * assemble_mechanical_system(
7186 * mech_nonlinear_system,
7189 * mesh_motion_nonlinear_system,
7190 * mesh_motion_dof_system,
7191 * therm_nonlinear_system,
7193 * mixed_fe_dof_system,
7195 * mixed_FE_projectors,
7199 * mech_nonlinear_system.advance_time(time_increment, rho_infty, true);
7202 * Accumulate the thermal increment into the (ghosted, read-only)
7203 * temperature field. The nonlinear system performs the addition in
7204 * fully-distributed temporaries and assigns the result back.
7207 * therm_nonlinear_system.add_current_increment_to_previous_deformation();
7209 * therm_nonlinear_system.current_increment = 0;
7211 * pcout << "Next timestep..." << std::endl;
7213 * } /*for(timeStep)*/
7216 * template<int dim, typename Number>
7217 * void PlasticityLabProg<dim, Number>::solve_mechanical_step(int time_step) {
7219 * TrilinosWrappers::MPI::Vector total_residual;
7221 * for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7223 * pcout << "\n\ttime step " << time_step
7224 * << ", Newton step " << NewtonStep << "..."
7225 * << "\n\t\tassembling mechanical system with tangents..." << endl;
7227 * assemble_mechanical_system(
7228 * mech_nonlinear_system,
7231 * mesh_motion_nonlinear_system,
7232 * mesh_motion_dof_system,
7233 * therm_nonlinear_system,
7235 * mixed_fe_dof_system,
7237 * mixed_FE_projectors,
7240 * total_residual = mech_nonlinear_system.Newton_step_residual;
7241 * total_residual.compress(VectorOperation::insert);
7243 * pcout << "-------------------------------------------------------------------" << endl;
7245 * pcout << "Normalized system residual: "
7246 * << std::sqrt(total_residual.norm_sqr())
7247 * << " ..." << endl;
7248 * pcout << "-------------------------------------------------------------------" << endl;
7250 * if (std::sqrt(total_residual.norm_sqr()) <= 1e-5) {
7254 * const Number old_residual = total_residual.norm_sqr();
7255 * Number previous_residual = old_residual;
7257 * pcout << "solving system..." << endl;
7259 * solve_system(mech_dof_system, mech_nonlinear_system);
7261 * if (std::isnan(mech_nonlinear_system.Newton_step_solution.norm_sqr())) {
7264 * pcout << "System solution falied. Continuing with partial solution..." << endl;
7266 * mech_dof_system.nodal_constraints.distribute(
7267 * mech_nonlinear_system.Newton_step_solution);
7268 * const Number solution_norm = std::sqrt(
7269 * mech_nonlinear_system.Newton_step_solution.norm_sqr());
7270 * TrilinosWrappers::MPI::Vector full_step_increment(mech_nonlinear_system.current_increment);
7271 * TrilinosWrappers::MPI::Vector temp_locally_owned_increment(mech_dof_system.locally_owned_dofs);
7273 * Number clip_factor =
7274 * (solution_norm <= std::sqrt(old_residual)) ?
7275 * 1.0 : sqrt(old_residual) / solution_norm;
7276 * if (clip_factor < 1.0) pcout << "clip factor: " << clip_factor << endl;
7278 * pcout << "doing line search..." << endl;
7279 * [[maybe_unused]] bool hit_line_search_limit = false;
7280 * for (unsigned int i = 0; true/*i < 18*/; ++i) {
7281 * const Number alpha = std::pow(0.5, static_cast<Number>(i));
7282 * if (i > 5 && clip_factor * alpha * solution_norm < 1e-1) {
7283 * hit_line_search_limit = true;
7286 * if (i > 0) pcout << "\tline search step " << i << "..." << endl;
7289 * temp_locally_owned_increment = full_step_increment;
7290 * temp_locally_owned_increment.sadd(1, -alpha * clip_factor, mech_nonlinear_system.Newton_step_solution);
7291 * temp_locally_owned_increment.compress(VectorOperation::insert);
7292 * mech_nonlinear_system.current_increment = temp_locally_owned_increment;
7295 * assemble_mechanical_system(
7296 * mech_nonlinear_system,
7299 * mesh_motion_nonlinear_system,
7300 * mesh_motion_dof_system,
7301 * therm_nonlinear_system,
7303 * mixed_fe_dof_system,
7305 * mixed_FE_projectors,
7307 * } catch (const std::runtime_error &) {
7308 * clip_factor *= 0.125; // using a power of 0.5; better for binary arithmetic
7309 * pcout << "\t-------------------------------------------------------------------" << endl;
7310 * pcout << "\tDeformation too large, causing degenerate mesh..." << endl;
7311 * pcout << "\tupdated clip factor: " << clip_factor << endl;
7312 * pcout << "\t-------------------------------------------------------------------" << endl;
7318 * total_residual = mech_nonlinear_system.Newton_step_residual;
7319 * total_residual.compress(VectorOperation::insert);
7321 * const Number current_residual = total_residual.norm_sqr();
7323 * pcout << "\t-------------------------------------------------------------------" << endl;
7325 * pcout << "\tNormalized system residual: "
7326 * << std::sqrt(current_residual)
7327 * << " ..." << endl;
7328 * pcout << "\t-------------------------------------------------------------------" << endl;
7330 * if (previous_residual < old_residual and current_residual >= previous_residual) {
7331 * pcout << "\t---Accepting previous residual: " << std::sqrt(previous_residual)
7332 * << " ..." << endl;
7334 * temp_locally_owned_increment = full_step_increment;
7335 * temp_locally_owned_increment.sadd(1, -2 * alpha * clip_factor, mech_nonlinear_system.Newton_step_solution);
7336 * temp_locally_owned_increment.compress(VectorOperation::insert);
7337 * mech_nonlinear_system.current_increment = temp_locally_owned_increment;
7340 * previous_residual = current_residual;
7347 * template<int dim, typename Number>
7348 * void PlasticityLabProg<dim, Number>::solve_thermal_step(int time_step) {
7350 * TrilinosWrappers::MPI::Vector total_therm_residual;
7351 * const Number starting_thermal_residual_squared_norm = 1.0;
7353 * for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7355 * pcout << "\n\ttime step " << time_step
7356 * << ", Newton step " << NewtonStep << "..."
7357 * << "\n\t\tassembling thermal system with tangents..." << endl;
7359 * assemble_thermal_system(
7360 * therm_nonlinear_system,
7361 * mech_nonlinear_system,
7365 * mixed_fe_dof_system,
7367 * mixed_FE_projectors,
7368 * material_area_factors,
7371 * total_therm_residual = therm_nonlinear_system.Newton_step_residual;
7372 * total_therm_residual.compress(VectorOperation::insert);
7374 * pcout << "-------------------------------------------------------------------" << endl;
7375 * pcout << "Normalized system residual (contactor): "
7376 * << std::sqrt(total_therm_residual.norm_sqr()
7377 * / starting_thermal_residual_squared_norm)
7378 * << " ..." << endl;
7379 * pcout << "-------------------------------------------------------------------" << endl;
7381 * if (std::sqrt(total_therm_residual.norm_sqr()
7382 * / starting_thermal_residual_squared_norm) <= 1e-6) {
7386 * const Number old_residual = total_therm_residual.norm_sqr();
7388 * pcout << "solving system..." << endl;
7390 * solve_system(therm_dof_system, therm_nonlinear_system);
7392 * therm_dof_system.nodal_constraints.distribute(therm_nonlinear_system.Newton_step_solution);
7393 * TrilinosWrappers::MPI::Vector full_step_increment(therm_nonlinear_system.current_increment);
7395 * TrilinosWrappers::MPI::Vector temp_locally_owned_increment(therm_dof_system.locally_owned_dofs);
7398 * pcout << "doing line search..." << endl;
7399 * for (unsigned int i = 0; i < (NewtonStep > 0 ? 6 : 1); ++i) {
7400 * const Number alpha = std::pow(0.5, static_cast<Number>(i));
7402 * temp_locally_owned_increment = full_step_increment;
7403 * temp_locally_owned_increment.sadd(1, -alpha, therm_nonlinear_system.Newton_step_solution);
7404 * therm_dof_system.nodal_constraints.distribute(temp_locally_owned_increment);
7405 * temp_locally_owned_increment.compress(VectorOperation::insert);
7406 * therm_nonlinear_system.current_increment = temp_locally_owned_increment;
7408 * assemble_thermal_system(
7409 * therm_nonlinear_system,
7410 * mech_nonlinear_system,
7414 * mixed_fe_dof_system,
7416 * mixed_FE_projectors,
7417 * material_area_factors,
7420 * total_therm_residual = therm_nonlinear_system.Newton_step_residual;
7421 * total_therm_residual.compress(VectorOperation::insert);
7423 * const Number current_residual = total_therm_residual.norm_sqr();
7424 * if (current_residual < old_residual)
7432 * template<int dim, typename Number>
7433 * void PlasticityLabProg<dim, Number>::solve_mesh_motion_step(
7434 * NewtonStepSystem &mesh_motion_nonlinear_system,
7435 * const DoFSystem<dim, Number> &mesh_motion_dof_system,
7436 * const LBCSystem<dim, Number, dim> &mesh_motion_lbc_system,
7437 * const NewtonStepSystem &deformation_nonlinear_system,
7438 * const DoFSystem<dim, Number> &deformation_dof_system,
7439 * const DoFSystem<dim, Number> &mixed_fe_dof_system,
7440 * const std::vector< MixedFEProjector<dim, Number> > &mixed_fe_projector,
7441 * const int time_step) {
7443 * TrilinosWrappers::MPI::Vector total_residual;
7445 * for (unsigned int NewtonStep = 0; true; NewtonStep++) {
7447 * pcout << "\n\ttime step " << time_step
7448 * << ", Newton step " << NewtonStep << "..."
7449 * << "\n\t\tassembling mesh motion system with tangents..." << endl;
7451 * assemble_mesh_motion_system(
7452 * mesh_motion_nonlinear_system,
7453 * mesh_motion_dof_system,
7454 * mesh_motion_lbc_system,
7455 * deformation_nonlinear_system,
7456 * deformation_dof_system,
7457 * mixed_fe_dof_system,
7458 * mixed_fe_projector,
7461 * total_residual = mesh_motion_nonlinear_system.Newton_step_residual;
7462 * total_residual.compress(VectorOperation::insert);
7464 * pcout << "-------------------------------------------------------------------" << endl;
7466 * pcout << "Normalized system residual: "
7467 * << std::sqrt(total_residual.norm_sqr())
7468 * << " ..." << endl;
7469 * pcout << "-------------------------------------------------------------------" << endl;
7471 * if (std::sqrt(total_residual.norm_sqr()) <= 1e-4) {
7475 * const Number old_residual = total_residual.norm_sqr();
7476 * Number previous_residual = old_residual;
7478 * pcout << "solving system..." << endl;
7480 * solve_system(mesh_motion_dof_system, mesh_motion_nonlinear_system);
7482 * if (std::isnan(mesh_motion_nonlinear_system.Newton_step_solution.norm_sqr())) {
7485 * pcout << "System solution falied. Continuing with partial solution..." << endl;
7487 * mesh_motion_dof_system.nodal_constraints.distribute(mesh_motion_nonlinear_system.Newton_step_solution);
7488 * const Number solution_norm = std::sqrt(mesh_motion_nonlinear_system.Newton_step_solution.norm_sqr());
7489 * TrilinosWrappers::MPI::Vector full_step_increment(mesh_motion_nonlinear_system.current_increment);
7490 * TrilinosWrappers::MPI::Vector temp_locally_owned_increment(mesh_motion_dof_system.locally_owned_dofs);
7492 * Number clip_factor =
7493 * (solution_norm <= std::sqrt(old_residual)) ? 1.0 : sqrt(old_residual) / solution_norm;
7494 * if (clip_factor < 1.0) pcout << "clip factor: " << clip_factor << endl;
7496 * pcout << "doing line search..." << endl;
7497 * [[maybe_unused]] bool hit_line_search_limit = false;
7498 * for (unsigned int i = 0; true/*i < 18*/; ++i) {
7499 * const Number alpha = std::pow(0.5, static_cast<Number>(i));
7500 * if (i > 5 && clip_factor * alpha * solution_norm < 1e-1) {
7501 * hit_line_search_limit = true;
7504 * if (i > 0) pcout << "\tline search step " << i << "..." << endl;
7507 * temp_locally_owned_increment = full_step_increment;
7508 * temp_locally_owned_increment.sadd(1, -alpha * clip_factor, mesh_motion_nonlinear_system.Newton_step_solution);
7509 * temp_locally_owned_increment.compress(VectorOperation::insert);
7510 * mesh_motion_nonlinear_system.current_increment = temp_locally_owned_increment;
7513 * assemble_mesh_motion_system(
7514 * mesh_motion_nonlinear_system,
7515 * mesh_motion_dof_system,
7516 * mesh_motion_lbc_system,
7517 * deformation_nonlinear_system,
7518 * deformation_dof_system,
7519 * mixed_fe_dof_system,
7520 * mixed_fe_projector,
7522 * } catch (const std::runtime_error &) {
7523 * clip_factor *= 0.125; // using a power of 0.5; better for binary arithmetic
7524 * pcout << "\t-------------------------------------------------------------------" << endl;
7525 * pcout << "\tDeformation too large, causing degenerate mesh..." << endl;
7526 * pcout << "\tupdated clip factor: " << clip_factor << endl;
7527 * pcout << "\t-------------------------------------------------------------------" << endl;
7533 * total_residual = mesh_motion_nonlinear_system.Newton_step_residual;
7534 * total_residual.compress(VectorOperation::insert);
7536 * const Number current_residual = total_residual.norm_sqr();
7538 * pcout << "\t-------------------------------------------------------------------" << endl;
7540 * pcout << "\tNormalized system residual: "
7541 * << std::sqrt(current_residual)
7542 * << " ..." << endl;
7543 * pcout << "\t-------------------------------------------------------------------" << endl;
7545 * if (previous_residual < old_residual and current_residual >= previous_residual) {
7546 * pcout << "\t---Accepting previous residual: " << std::sqrt(previous_residual)
7547 * << " ..." << endl;
7549 * temp_locally_owned_increment = full_step_increment;
7550 * temp_locally_owned_increment.sadd(1, -2 * alpha * clip_factor, mesh_motion_nonlinear_system.Newton_step_solution);
7551 * temp_locally_owned_increment.compress(VectorOperation::insert);
7552 * mesh_motion_nonlinear_system.current_increment = temp_locally_owned_increment;
7555 * previous_residual = current_residual;
7561 * template <int dim>
7562 * struct RefiningTransform
7564 * RefiningTransform(
7566 * double refining_fraction,
7568 * size_t dimension=1) :
7570 * refining_fraction(refining_fraction),
7572 * dimension(dimension) {}
7574 * Point<dim> operator()(const Point<dim> &p) const
7577 * if ((p[dimension]-base)/(height-base) <= 0.5) {
7578 * q[dimension] = base + refining_fraction/0.5 * (p[dimension]-base);
7579 * } else if ((p[dimension]-base)/(height-base) > 0.5) {
7580 * q[dimension] = base + refining_fraction * (height - base) + (1.0 - refining_fraction) / 0.5 * (p[dimension] - 0.5 * (height + base));
7586 * double refining_fraction;
7592 * template <int dim, typename Number>
7593 * void PlasticityLabProg<dim, Number>::set_mesh_motion_LBCs(
7594 * Triangulation<dim> &triangulation,
7595 * LBCSystem<dim, Number, dim> &mesh_motion_lbc_system) {
7597 * std::set<types::boundary_id> all_boundary_ids;
7598 * for(types::boundary_id id: triangulation.get_boundary_ids()) {
7599 * all_boundary_ids.insert(id);
7602 * mesh_motion_lbc_system.no_normal_flux_constraints.push_back(std::make_pair(0, all_boundary_ids));
7606 * template <int dim, typename Number>
7607 * void PlasticityLabProg<dim, Number>::make_cylindrical_grid(
7608 * Triangulation<dim> &triangulation,
7609 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
7610 * LBCSystem<dim, Number, 1> &therm_lbc_system,
7611 * int n_initial_global_refinements) {
7613 * [[maybe_unused]] const Number initial_velocity = 1.9e5; // [mm/s]
7614 * const Number height = 2.5*25.4; // [mm]
7615 * const Number inner_radius = 12.5; // [mm]
7616 * const Number radius = 12.5; // [mm]
7618 * const Number top_coordinate = height/2;
7619 * const Number base_coordinate = 0.0;
7621 * const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
7622 * const unsigned int aspect_ratio = std::ceil(0.25 * height / radius);
7624 * GridGenerator::subdivided_hyper_rectangle(
7626 * std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
7627 * Point<dim>(inner_radius, base_coordinate),
7628 * Point<dim>(inner_radius + radius, top_coordinate),
7632 * for (auto &cell: triangulation.active_cell_iterators()) {
7633 * for (const auto &face : cell->face_iterators()) {
7634 * if(face->boundary_id() == 0 || face->boundary_id() == 1) {
7635 * if(face->center()[1] > 0.95 * height/2) {
7636 * face->set_boundary_id(4);
7644 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.3, base_coordinate), triangulation);
7645 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.4, base_coordinate), triangulation);
7646 * GridTools::transform(RefiningTransform<dim>/(inner_radius, 0.35, inner_radius + radius, 0), triangulation);
7650 * for(unsigned int i=0; i<2; i++) {
7651 * for (auto &cell : triangulation.active_cell_iterators()) {
7652 * for (const auto &face : cell->face_iterators()) {
7653 * if (face->boundary_id() == 2) {
7654 * cell->set_refine_flag();
7659 * triangulation.execute_coarsening_and_refinement();
7666 * ComponentMask x_component_mask(dim+1, false);
7667 * x_component_mask.set(0, true);
7668 * ComponentMask y_component_mask(dim+1, false);
7669 * y_component_mask.set(1, true);
7670 * ComponentMask x_and_y_component_mask(dim+1, false);
7671 * x_and_y_component_mask.set(0, true);
7672 * x_and_y_component_mask.set(1, true);
7673 * ComponentMask z_component_mask(dim+1, false);
7674 * z_component_mask.set(dim-1, true);
7675 * ComponentMask rho_component_mask(dim+1, false);
7676 * rho_component_mask.set(dim, true);
7680 * std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
7681 * base_constraint_function_map.insert(
7682 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7683 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7684 * InterpolatoryConstraintApplier<dim, Number>(
7685 * base_constraint_function_map,
7686 * y_component_mask));
7692 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7693 * top_constraint_function_map.insert(
7694 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7695 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7696 * InterpolatoryConstraintApplier<dim, Number>(
7697 * top_constraint_function_map,
7698 * x_component_mask));
7700 * std::map< types::boundary_id, const Function< dim, Number > * > clamp_constraint_function_map;
7701 * clamp_constraint_function_map.insert(
7702 * std::pair<types::boundary_id, Function<dim, Number>*>(4, &mech_lbc_system.zero_function));
7703 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7704 * InterpolatoryConstraintApplier<dim, Number>(
7705 * clamp_constraint_function_map,
7706 * x_component_mask));
7708 * if(std::abs(inner_radius) < 1e-16) {
7709 * std::map< types::boundary_id, const Function< dim, Number > * > axial_constraint_function_map;
7710 * axial_constraint_function_map.insert(
7711 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7712 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7713 * InterpolatoryConstraintApplier<dim, Number>(
7714 * axial_constraint_function_map,
7715 * x_component_mask));
7717 * std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
7718 * axial_rotation_constraint_function_map.insert(
7719 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7720 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7721 * InterpolatoryConstraintApplier<dim, Number>(
7722 * axial_rotation_constraint_function_map,
7723 * rho_component_mask));
7728 * therm_lbc_system.boundaryLoadAppliers.push_back(
7729 * std::pair<int,BodyForceApplier<dim,Number> >(
7730 * 2, BodyForceApplier<dim,Number>(0, 22e0)));
7736 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
7737 * top_rotation_constraint_function_map.insert(
7738 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7739 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7740 * InterpolatoryConstraintApplier<dim, Number>(
7741 * top_rotation_constraint_function_map,
7742 * rho_component_mask));
7746 * std::map< types::boundary_id, const Function< dim, Number > * > base_rotation_constraint_function_map;
7747 * base_rotation_constraint_function_map.insert(
7748 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7749 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7750 * InterpolatoryConstraintApplier<dim, Number>(
7751 * base_rotation_constraint_function_map,
7752 * rho_component_mask));
7756 * Thermal constraints
7759 * const Number convection_coefficient = /*17.5e-6*/ 100e-6; // [J.mm^-2.s^-1.K^-1]
7760 * therm_lbc_system.convection_BC_appliers.push_back(
7761 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7763 * ConvectionBoundaryConditionApplier<dim, Number>(
7764 * 0, convection_coefficient, ambient_temperature)));
7765 * therm_lbc_system.convection_BC_appliers.push_back(
7766 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7768 * ConvectionBoundaryConditionApplier<dim, Number>(
7769 * 0, convection_coefficient, ambient_temperature)));
7770 * therm_lbc_system.convection_BC_appliers.push_back(
7771 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7773 * ConvectionBoundaryConditionApplier<dim, Number>(
7774 * 0, convection_coefficient, ambient_temperature)));
7775 * therm_lbc_system.convection_BC_appliers.push_back(
7776 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7778 * ConvectionBoundaryConditionApplier<dim, Number>(
7779 * 0, convection_coefficient, ambient_temperature)));
7783 * therm_lbc_system.convection_BC_appliers.push_back(
7784 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
7786 * ConvectionBoundaryConditionApplier<dim, Number>(
7787 * 0, 3000*convection_coefficient, 1350.0 /*a little less than melting*/)));
7791 * const Number total_elongation = 2 * 80.0; // mm
7792 * const Number elongation_rate = time_since_start < 6.0? 0.05 : 1.75; // [mm/s]
7793 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
7794 * auto scale_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7795 * new ConstantFunction<dim, Number>({0, -total_elongation/(static_cast<Number>(n_steps)/**height*/), 0}),
7799 * ComponentMask(dim+1, false),
7805 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_z_handler);
7811 * mech_lbc_system.boundaryLoadAppliers.push_back(
7812 * std::pair<int,BodyForceApplier<dim,Number> >(
7813 * 3, BodyForceApplier<dim,Number>(dim-1, -40)));
7815 * auto top_surface_unidirectional_penalty_spec = new BoundaryUnidirectionalPenaltySpec<Number>(3, 1e-2, 0, 1e4 / (time_increment * time_increment) );
7816 * mech_lbc_system.boundary_unidirectional_penalty_specs.push_back(top_surface_unidirectional_penalty_spec);
7820 * auto constant_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7821 * new ScaleZFunction<dim, Number, dim+1>(-total_elongation/(static_cast<Number>(n_steps)*time_increment/**height*/), dim-1),
7825 * ComponentMask(dim+1, false),
7828 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_velocity_handler);
7829 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7830 * top_constraint_function_map.insert(
7831 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7832 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7833 * InterpolatoryConstraintApplier<dim, Number>(
7834 * top_constraint_function_map,
7835 * y_component_mask));
7841 * const Number drive_speed = 0.8*314.159/3.0; // [rad/s]
7843 * auto scale_rotation_increment = new IncrementInterpolationHandler<dim, Number, dim+1>(
7844 * new ScaleComponentFunction<dim, Number, dim+1>(drive_speed * time_increment, 0, dim),
7846 * rho_component_mask,
7848 * ComponentMask(dim+1, false),
7851 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_rotation_increment);
7853 * auto constant_angular_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7854 * new ScaleComponentFunction<dim, Number, dim+1>(drive_speed, 0, dim),
7856 * rho_component_mask,
7858 * ComponentMask(dim+1, false),
7861 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_angular_velocity_handler);
7865 * mech_lbc_system.boundaryLoadAppliers.push_back(
7866 * std::pair<int,BodyForceApplier<dim,Number> >(
7867 * 1, BodyForceApplier<dim,Number>(dim, 3.750e0)));
7873 * } /* make_cylindrical_grid() */
7876 * template <int dim, typename Number>
7877 * void PlasticityLabProg<dim, Number>::make_grid_() {
7879 * } /*make_grid_()*/
7881 * template <int dim>
7882 * struct InterferenceTaperTransform
7884 * Point<dim> operator()(const Point<dim> &p) const
7887 * if (p[0]>=35 && p[0]<=300 && p[1]<=0 && p[1]>=-150)
7889 * q[0] += 5 * ((p[1] + 150) / 150) * ((p[0]-300) / (35-300));
7895 * template <int dim>
7896 * struct NeckingTaperTransform
7899 * NeckingTaperTransform(double factor) : factor(factor) {}
7901 * Point<dim> operator()(const Point<dim> &p) const
7904 * q[0] += factor * q[0] * q[1];
7910 * template <int dim, typename Number>
7911 * void PlasticityLabProg<dim, Number>::make_necking_grid(
7912 * Triangulation<dim> &triangulation,
7913 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
7914 * LBCSystem<dim, Number, 1> &therm_lbc_system,
7915 * int n_initial_global_refinements) {
7917 * const Number height = 53.334; // [mm]
7918 * const Number radius = 6.413; // [mm]
7920 * const Number top_coordinate = height/2;
7921 * const Number base_coordinate = 0.0;
7922 * const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
7923 * const unsigned int aspect_ratio = std::ceil(0.5 * height / radius);
7925 * GridGenerator::subdivided_hyper_rectangle(
7927 * std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
7928 * Point<dim>(0, base_coordinate),
7929 * Point<dim>(radius, top_coordinate),
7935 * GridTools::transform(RefiningTransform<dim>(top_coordinate, 0.15, base_coordinate), triangulation);
7941 * ComponentMask x_component_mask(dim+1, false);
7942 * x_component_mask.set(0, true);
7943 * ComponentMask y_component_mask(dim+1, false);
7944 * y_component_mask.set(1, true);
7945 * ComponentMask z_component_mask(dim+1, false);
7946 * z_component_mask.set(dim-1, true);
7947 * ComponentMask rho_component_mask(dim+1, false);
7948 * rho_component_mask.set(dim, true);
7950 * std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
7951 * base_constraint_function_map.insert(
7952 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
7953 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7954 * InterpolatoryConstraintApplier<dim, Number>(
7955 * base_constraint_function_map,
7956 * y_component_mask));
7958 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
7959 * top_constraint_function_map.insert(
7960 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7961 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7962 * InterpolatoryConstraintApplier<dim, Number>(
7963 * top_constraint_function_map,
7964 * y_component_mask));
7966 * std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
7967 * yz_constraint_function_map.insert(
7968 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
7969 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7970 * InterpolatoryConstraintApplier<dim, Number>(
7971 * yz_constraint_function_map,
7972 * x_component_mask));
7975 * const Number total_elongation = 2*8.0; // mm
7976 * const Number elongation_rate = 2*1.0; // [mm/s]
7977 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
7979 * auto scale_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
7980 * new ScaleZFunction<dim, Number, dim+1>(total_elongation/(static_cast<Number>(n_steps)*height), dim-1),
7984 * ComponentMask(dim+1, false),
7988 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_z_handler);
7990 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
7991 * top_rotation_constraint_function_map.insert(
7992 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
7993 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
7994 * InterpolatoryConstraintApplier<dim, Number>(
7995 * top_rotation_constraint_function_map,
7996 * rho_component_mask));
7998 * std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
7999 * axial_rotation_constraint_function_map.insert(
8000 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8001 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8002 * InterpolatoryConstraintApplier<dim, Number>(
8003 * axial_rotation_constraint_function_map,
8004 * rho_component_mask));
8008 * Thermal constraints
8011 * const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8012 * therm_lbc_system.convection_BC_appliers.push_back(
8013 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8015 * ConvectionBoundaryConditionApplier<dim, Number>(
8016 * 0, convection_coefficient, ambient_temperature)));
8017 * therm_lbc_system.convection_BC_appliers.push_back(
8018 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8020 * ConvectionBoundaryConditionApplier<dim, Number>(
8021 * 0, convection_coefficient, ambient_temperature)));
8022 * } /* make_necking_grid() */
8025 * template <int dim, typename Number>
8026 * void PlasticityLabProg<dim, Number>::make_interference_cylinder_grid(
8027 * Triangulation<dim> &triangulation,
8028 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8029 * LBCSystem<dim, Number, 1> &therm_lbc_system,
8030 * int n_initial_global_refinements) {
8032 * const Number height = 300.0; // [mm]
8033 * const Number radius = 40.0; // [mm]
8035 * const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
8036 * const unsigned int aspect_ratio = std::ceil(0.5 * height / radius);
8038 * GridGenerator::subdivided_hyper_rectangle(
8040 * std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
8042 * Point<dim>(radius, height),
8048 * mech_lbc_system.boundaryLoadAppliers.push_back(
8049 * std::pair<int,BodyForceApplier<dim,Number> >(
8050 * 1, BodyForceApplier<dim,Number>(dim, 0.8*4.50e1)));
8056 * ComponentMask x_component_mask(dim+1, false);
8057 * x_component_mask.set(0, true);
8058 * ComponentMask y_component_mask(dim+1, false);
8059 * y_component_mask.set(1, true);
8060 * ComponentMask z_component_mask(dim+1, false);
8061 * z_component_mask.set(dim-1, true);
8062 * ComponentMask rho_component_mask(dim+1, false);
8063 * rho_component_mask.set(dim, true);
8065 * std::map< types::boundary_id, const Function< dim, Number > * > top_constraint_function_map;
8066 * top_constraint_function_map.insert(
8067 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8068 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8069 * InterpolatoryConstraintApplier<dim, Number>(
8070 * top_constraint_function_map,
8071 * y_component_mask));
8073 * std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
8074 * yz_constraint_function_map.insert(
8075 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8076 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8077 * InterpolatoryConstraintApplier<dim, Number>(
8078 * yz_constraint_function_map,
8079 * x_component_mask));
8082 * const Number total_elongation = 300.0; // mm
8083 * const Number elongation_rate = 1.0; // [mm/s]
8084 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
8086 * auto push_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8087 * new ConstantFunction<dim, Number>(std::vector< Number >{0, -total_elongation/static_cast<Number>(n_steps), 0}),
8091 * ComponentMask(dim+1, false),
8095 * mech_lbc_system.increment_interpolation_handlers.push_back(push_z_handler);
8097 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8098 * top_rotation_constraint_function_map.insert(
8099 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8100 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8101 * InterpolatoryConstraintApplier<dim, Number>(
8102 * top_rotation_constraint_function_map,
8103 * rho_component_mask));
8105 * std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8106 * axial_rotation_constraint_function_map.insert(
8107 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8108 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8109 * InterpolatoryConstraintApplier<dim, Number>(
8110 * axial_rotation_constraint_function_map,
8111 * rho_component_mask));
8113 * const Number drive_speed = 0.2; // [rad/s]
8115 * auto scale_rotation_increment = new IncrementInterpolationHandler<dim, Number, dim+1>(
8116 * new ScaleComponentFunction<dim, Number, dim+1>(drive_speed * time_increment, 0, dim),
8118 * rho_component_mask,
8120 * ComponentMask(dim+1, false),
8123 * mech_lbc_system.increment_interpolation_handlers.push_back(scale_rotation_increment);
8124 * auto constant_angular_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8125 * new ScaleComponentFunction<dim, Number, dim+1>(drive_speed, 0, dim),
8127 * rho_component_mask,
8129 * ComponentMask(dim+1, false),
8132 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_angular_velocity_handler);
8136 * auto constant_velocity_angular_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8137 * new ScaleComponentFunction<dim, Number, dim+1>(0.0e-3, 0, dim),
8139 * rho_component_mask,
8141 * ComponentMask(dim+1, false),
8147 * mech_lbc_system.initial_deformation_interpolation_handlers.push_back(constant_velocity_angular_handler);
8151 * Thermal constraints
8154 * const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8155 * therm_lbc_system.convection_BC_appliers.push_back(
8156 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8158 * ConvectionBoundaryConditionApplier<dim, Number>(
8159 * 0, convection_coefficient, ambient_temperature)));
8160 * therm_lbc_system.convection_BC_appliers.push_back(
8161 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8163 * ConvectionBoundaryConditionApplier<dim, Number>(
8164 * 0, convection_coefficient, ambient_temperature)));
8165 * therm_lbc_system.convection_BC_appliers.push_back(
8166 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8168 * ConvectionBoundaryConditionApplier<dim, Number>(
8169 * 0, convection_coefficient, ambient_temperature)));
8173 * std::map< types::boundary_id, const Function< dim, Number > * > thermal_constraint_function_map;
8174 * thermal_constraint_function_map.insert(
8175 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &therm_lbc_system.zero_function));
8176 * thermal_constraint_function_map.insert(
8177 * std::pair<types::boundary_id, Function<dim, Number>*>(8, &therm_lbc_system.zero_function));
8178 * therm_dof_system.interpolatoryConstraintAppliers.push_back(
8179 * InterpolatoryConstraintApplier<dim,Number>(
8180 * thermal_constraint_function_map,ComponentMask(1, true)));
8183 * } /* make_interference_cylinder_grid() */
8186 * template <int dim, typename Number>
8187 * void PlasticityLabProg<dim, Number>::make_ball_in_hypershell_grid(
8188 * Triangulation<dim> &triangulation,
8189 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8190 * LBCSystem<dim, Number, 1> &therm_lbc_system,
8191 * int n_initial_global_refinements) {
8193 * const unsigned int INNER_BOUNDARY_ID = 0;
8195 * const Number outer_radius = 60.0; // [mm]
8197 * GridGenerator::half_hyper_ball(
8199 * Point<dim>(0, -10),
8203 * for (const auto &cell : triangulation.active_cell_iterators()) {
8204 * cell->set_boundary_id(INNER_BOUNDARY_ID);
8207 * triangulation.refine_global(n_initial_global_refinements);
8209 * mech_lbc_system.boundaryLoadAppliers.push_back(
8210 * std::pair<int,BodyForceApplier<dim,Number> >(
8211 * 1, BodyForceApplier<dim,Number>(dim, 0.8*4.50e1)));
8213 * ComponentMask x_component_mask(dim+1, false);
8214 * x_component_mask.set(0, true);
8215 * ComponentMask y_component_mask(dim+1, false);
8216 * y_component_mask.set(1, true);
8217 * ComponentMask z_component_mask(dim+1, false);
8218 * z_component_mask.set(dim-1, true);
8219 * ComponentMask rho_component_mask(dim+1, false);
8220 * rho_component_mask.set(dim, true);
8221 * ComponentMask all_component_mask(dim+1, true);
8223 * std::map< types::boundary_id, const Function< dim, Number > * > yz_constraint_function_map;
8224 * yz_constraint_function_map.insert(
8225 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &mech_lbc_system.zero_function));
8226 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8227 * InterpolatoryConstraintApplier<dim, Number>(
8228 * yz_constraint_function_map,
8229 * x_component_mask));
8231 * std::map< types::boundary_id, const Function< dim, Number > * > down_constraint_function_map;
8232 * down_constraint_function_map.insert(
8233 * std::pair<types::boundary_id, Function<dim, Number>*>(INNER_BOUNDARY_ID, &mech_lbc_system.zero_function));
8234 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8235 * InterpolatoryConstraintApplier<dim, Number>(
8236 * down_constraint_function_map,
8237 * y_component_mask));
8239 * const Number total_elongation = 300.0; // mm
8240 * const Number elongation_rate = 225.0e-2; // [mm/s]
8241 * const unsigned int n_steps = ceil(total_elongation/(elongation_rate*time_increment));
8243 * auto push_z_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8244 * new ConstantFunction<dim, Number>(std::vector< Number >{0, -total_elongation/static_cast<Number>(n_steps), 0}),
8248 * ComponentMask(dim+1, false),
8249 * INNER_BOUNDARY_ID,
8252 * mech_lbc_system.increment_interpolation_handlers.push_back(push_z_handler);
8254 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8255 * top_rotation_constraint_function_map.insert(
8256 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8257 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8258 * InterpolatoryConstraintApplier<dim, Number>(
8259 * top_rotation_constraint_function_map,
8260 * rho_component_mask));
8264 * Thermal constraints
8267 * const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8268 * therm_lbc_system.convection_BC_appliers.push_back(
8269 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8271 * ConvectionBoundaryConditionApplier<dim, Number>(
8272 * 0, convection_coefficient, ambient_temperature)));
8273 * therm_lbc_system.convection_BC_appliers.push_back(
8274 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8276 * ConvectionBoundaryConditionApplier<dim, Number>(
8277 * 0, convection_coefficient, ambient_temperature)));
8278 * therm_lbc_system.convection_BC_appliers.push_back(
8279 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8281 * ConvectionBoundaryConditionApplier<dim, Number>(
8282 * 0, convection_coefficient, ambient_temperature)));
8283 * } /* make_ball_in_hypershell_grid() */
8289 * template <int dim, typename Number>
8290 * void PlasticityLabProg<dim, Number>::make_cylindrical_impact_grid(
8291 * Triangulation<dim> &triangulation,
8292 * LBCSystem<dim, Number, dim+1> &mech_lbc_system,
8293 * LBCSystem<dim, Number, 1> &therm_lbc_system,
8294 * int n_initial_global_refinements) {
8296 * const Number initial_velocity = 1.9e5; // [mm/s]
8297 * const Number height = 25.4; // [mm]
8298 * const Number radius = 3.81; // [mm]
8300 * const unsigned int base_repetitions = std::pow(2, n_initial_global_refinements);
8301 * const unsigned int aspect_ratio = std::ceil(0.25 * height / radius);
8303 * GridGenerator::subdivided_hyper_rectangle(
8305 * std::vector<unsigned int> {base_repetitions, aspect_ratio * base_repetitions},
8307 * Point<dim>(radius, height),
8313 * mech_lbc_system.boundaryLoadAppliers.push_back(
8314 * std::pair<int,BodyForceApplier<dim,Number> >(
8315 * 6, BodyForceApplier<dim,Number>(2, -4.50)));
8321 * ComponentMask x_component_mask(dim, false);
8322 * x_component_mask.set(0, true);
8323 * ComponentMask y_component_mask(3, false);
8324 * y_component_mask.set(1, true);
8325 * ComponentMask z_component_mask(dim, false);
8326 * z_component_mask.set(dim-1, true);
8327 * ComponentMask rho_component_mask(dim+1, false);
8328 * rho_component_mask.set(dim, true);
8330 * std::map< types::boundary_id, const Function< dim, Number > * > axial_constraint_function_map;
8331 * axial_constraint_function_map.insert(
8332 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8333 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8334 * InterpolatoryConstraintApplier<dim, Number>(
8335 * axial_constraint_function_map,
8336 * x_component_mask));
8338 * std::map< types::boundary_id, const Function< dim, Number > * > base_constraint_function_map;
8339 * base_constraint_function_map.insert(
8340 * std::pair<types::boundary_id, Function<dim, Number>*>(2, &mech_lbc_system.zero_function));
8341 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8342 * InterpolatoryConstraintApplier<dim, Number>(
8343 * base_constraint_function_map,
8344 * y_component_mask));
8346 * auto constant_velocity_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8347 * new ConstantFunction<dim, Number>(std::vector< Number >{0, -initial_velocity, 0}),
8351 * ComponentMask(dim, false),
8355 * mech_lbc_system.initial_velocity_interpolation_handlers.push_back(constant_velocity_handler);
8357 * std::map< types::boundary_id, const Function< dim, Number > * > top_rotation_constraint_function_map;
8358 * top_rotation_constraint_function_map.insert(
8359 * std::pair<types::boundary_id, Function<dim, Number>*>(3, &mech_lbc_system.zero_function));
8360 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8361 * InterpolatoryConstraintApplier<dim, Number>(
8362 * top_rotation_constraint_function_map,
8363 * rho_component_mask));
8365 * std::map< types::boundary_id, const Function< dim, Number > * > axial_rotation_constraint_function_map;
8366 * axial_rotation_constraint_function_map.insert(
8367 * std::pair<types::boundary_id, Function<dim, Number>*>(0, &mech_lbc_system.zero_function));
8368 * mech_lbc_system.interpolatoryConstraintAppliers.push_back(
8369 * InterpolatoryConstraintApplier<dim, Number>(
8370 * axial_rotation_constraint_function_map,
8371 * rho_component_mask));
8373 * auto constant_velocity_angular_handler = new IncrementInterpolationHandler<dim, Number, dim+1>(
8374 * new ScaleComponentFunction<dim, Number, dim+1>(0.0e2, 0, dim),
8376 * rho_component_mask,
8378 * ComponentMask(dim+1, false),
8382 * mech_lbc_system.initial_deformation_interpolation_handlers.push_back(constant_velocity_angular_handler);
8386 * Thermal constraints
8389 * const Number convection_coefficient = 17.5e-6; // [J.mm^-2.s^-1.K^-1]
8390 * therm_lbc_system.convection_BC_appliers.push_back(
8391 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8393 * ConvectionBoundaryConditionApplier<dim, Number>(
8394 * 0, convection_coefficient, ambient_temperature)));
8395 * therm_lbc_system.convection_BC_appliers.push_back(
8396 * std::pair<int, ConvectionBoundaryConditionApplier<dim, Number> >(
8398 * ConvectionBoundaryConditionApplier<dim, Number>(
8399 * 0, convection_coefficient, ambient_temperature)));
8403 * std::map< types::boundary_id, const Function< dim, Number > * > thermal_constraint_function_map;
8404 * thermal_constraint_function_map.insert(
8405 * std::pair<types::boundary_id, Function<dim, Number>*>(1, &therm_lbc_system.zero_function));
8406 * thermal_constraint_function_map.insert(
8407 * std::pair<types::boundary_id, Function<dim, Number>*>(8, &therm_lbc_system.zero_function));
8408 * therm_dof_system.interpolatoryConstraintAppliers.push_back(
8409 * InterpolatoryConstraintApplier<dim,Number>(
8410 * thermal_constraint_function_map,ComponentMask(1, true)));
8416 * } /* make_cylindrical_impact_grid() */
8419 * template <int dim, typename Number>
8420 * void PlasticityLabProg<dim, Number>::make_hook_membrane_grid(
8421 * int /*n_initial_global_refinements*/) {
8423 * } /* make_necking_grid() */
8427 * template <int dim, typename Number>
8428 * Tensor<2, dim+1, Number> PlasticityLabProg<dim, Number>::get_rotation_tensor(
8429 * const Tensor<2, dim+1, Number> &skew_symmetric_rotation) const {
8430 * const Number theta = Constants<dim, Number>::sqrt_half() * skew_symmetric_rotation.norm();
8431 * if (theta > 1e-8) {
8432 * const Number h1 = (1./(theta*theta)*(1.-std::cos(theta)));
8433 * const Number h2 = (1./theta*std::sin(theta));
8434 * return static_cast<Tensor<2, dim+1, Number>>(unit_symmetric_tensor<dim+1, Number>())
8435 * + h1 * skew_symmetric_rotation * skew_symmetric_rotation
8436 * + h2 * skew_symmetric_rotation;
8438 * return static_cast<Tensor<2, dim+1, Number>>(unit_symmetric_tensor<dim+1, Number>());
8443 * template <int dim, typename Number>
8444 * Tensor<2, dim+1, Number> PlasticityLabProg<dim, Number>::get_rotation_tensor_variation(
8445 * const Tensor<2, dim+1, Number> &skew_symmetric_rotation,
8446 * const Tensor<2, dim+1, Number> &skew_symmetric_rotation_variation) const {
8448 * const Number theta = Constants<dim, Number>::sqrt_half() * skew_symmetric_rotation.norm();
8449 * if (theta > 1e-8) {
8450 * const Number h1 = (1./(theta*theta)*(1.-std::cos(theta)));
8451 * const Number h2 = (1./theta*std::sin(theta));
8452 * const Number delta_theta = 1./(2.*theta) * scalar_product(skew_symmetric_rotation, skew_symmetric_rotation_variation);
8453 * const Number delta_h1 = (-2./theta * (h1 - 0.5 * h2)) * delta_theta;
8454 * const Number delta_h2 = (-1./theta * h2 + 1./theta * std::cos(theta)) * delta_theta;
8455 * const Tensor<2, dim+1, Number> rotation_tensor_variation = delta_h1 * skew_symmetric_rotation * skew_symmetric_rotation
8456 * + h1 * skew_symmetric_rotation_variation * skew_symmetric_rotation
8457 * + h1 * skew_symmetric_rotation * skew_symmetric_rotation_variation
8458 * + delta_h2 * skew_symmetric_rotation
8459 * + h2 * skew_symmetric_rotation_variation;
8460 * return rotation_tensor_variation;
8462 * return Tensor<2, dim+1, Number>();
8471<a name="ann-src/PointHistory.h"></a>
8472<h1>Annotated version of src/PointHistory.h</h1>
8481 * * Created on: 21 Jul 2014
8485 * #ifndef POINTHISTORY_H_
8486 * #define POINTHISTORY_H_
8488 * #include <deal.II/base/utilities.h>
8489 * #include <deal.II/base/function.h>
8491 * #include <deal.II/numerics/vector_tools.h>
8492 * #include <deal.II/numerics/matrix_tools.h>
8493 * #include <deal.II/numerics/data_out.h>
8495 * #include <deal.II/lac/trilinos_vector.h>
8497 * namespace PlasticityLab {
8499 * template <int dim, typename Number = double>
8500 * class PointHistory {
8503 * virtual ~PointHistory();
8505 * struct HardeningParameters {
8506 * HardeningParameters(
8507 * Number equivalent_plastic_strain,
8508 * ::SymmetricTensor<2, dim, Number> kinematic_hardening):
8509 * equivalent_plastic_strain(equivalent_plastic_strain),
8510 * kinematic_hardening(kinematic_hardening) { }
8511 * HardeningParameters() {}
8513 * Number equivalent_plastic_strain;
8514 * ::SymmetricTensor<2, dim, Number> kinematic_hardening;
8517 * PointHistory(const ::SymmetricTensor<2, dim, Number> &,
8518 * const HardeningParameters &,
8519 * Number plastic_entropy,
8520 * Number material_Jacobian);
8522 * ::SymmetricTensor<2, dim, Number> plastic_strain;
8523 * HardeningParameters hardening_parameters;
8524 * Number plastic_entropy;
8525 * Number material_Jacobian;
8529 * template <int dim, typename Number>
8530 * PointHistory<dim, Number>::PointHistory()
8532 * plastic_strain (::unit_symmetric_tensor<dim, Number>()),
8533 * hardening_parameters(Number(0.0), Number(0.0) * ::unit_symmetric_tensor<dim, Number>()),
8534 * plastic_entropy(Number(0.0)),
8535 * material_Jacobian(1.0) {
8538 * template <int dim, typename Number>
8539 * PointHistory<dim, Number>::
8540 * PointHistory(const ::SymmetricTensor<2, dim, Number> &plastic_strain,
8541 * const HardeningParameters &hardening_parameters,
8542 * const Number plastic_entropy,
8543 * const Number material_Jacobian):
8544 * plastic_strain(plastic_strain),
8545 * hardening_parameters(hardening_parameters),
8546 * plastic_entropy(plastic_entropy),
8547 * material_Jacobian(material_Jacobian) {
8550 * template <int dim, typename Number>
8551 * PointHistory<dim, Number>::~PointHistory() {
8554 * } /* namespace PlasticityLab */
8556 * #endif /* POINTHISTORY_H_ */
8560<a name="ann-src/ReferencePoint.h"></a>
8561<h1>Annotated version of src/ReferencePoint.h</h1>
8568 * * ReferencePoint.h
8570 * * Created on: 29 Nov 2020
8574 * #ifndef REFERENCEPOINT_H_
8575 * #define REFERENCEPOINT_H_
8578 * #include <deal.II/dofs/dof_handler.h>
8579 * #include <deal.II/base/point.h>
8581 * using namespace dealii;
8583 * namespace PlasticityLab {
8584 * template <int dim, typename Number>
8585 * class ReferencePoint {
8588 * virtual ~ReferencePoint();
8590 * typename DoFHandler<dim>::active_cell_iterator mesh_motion_cell;
8591 * typename DoFHandler<dim>::active_cell_iterator field_cell;
8592 * unsigned int q_point;
8593 * Point<dim, Number> reference_point;
8594 * Point<dim, Number> remapped_point;
8597 * template <int dim, typename Number>
8598 * ReferencePoint<dim, Number>::ReferencePoint() {
8601 * template <int dim, typename Number>
8602 * ReferencePoint<dim, Number>::~ReferencePoint() {}
8604 * } /* namespace PlasticityLab */
8606 * #endif /* REFERENCEPOINT_H_ */
8610<a name="ann-src/RemappedPoint.h"></a>
8611<h1>Annotated version of src/RemappedPoint.h</h1>
8620 * * Created on: 29 Nov 2020
8624 * #ifndef REMAPPEDPOINT_H_
8625 * #define REMAPPEDPOINT_H_
8628 * #include <deal.II/dofs/dof_handler.h>
8629 * #include <deal.II/base/point.h>
8631 * using namespace dealii;
8633 * namespace PlasticityLab {
8634 * template <int dim, typename Number>
8635 * class RemappedPoint {
8638 * virtual ~RemappedPoint();
8640 * typename DoFHandler<dim>::active_cell_iterator mesh_motion_cell;
8641 * typename DoFHandler<dim>::active_cell_iterator field_cell;
8642 * typename DoFHandler<dim>::active_cell_iterator mixed_fe_cell;
8643 * Point<dim, Number> unit_cell_point;
8644 * Point<dim, Number> remapped_point;
8647 * template <int dim, typename Number>
8648 * RemappedPoint<dim, Number>::RemappedPoint() {
8651 * template <int dim, typename Number>
8652 * RemappedPoint<dim, Number>::~RemappedPoint() {}
8654 * } /* namespace PlasticityLab */
8656 * #endif /* REMAPPEDPOINT_H_ */
8660<a name="ann-src/RotationFunction.h"></a>
8661<h1>Annotated version of src/RotationFunction.h</h1>
8668 * * RotationFunction.h
8670 * * Created on: 06 Dec 2016
8674 * #ifndef ROTATIONFUNCTION_H_
8675 * #define ROTATIONFUNCTION_H_
8678 * #include <deal.II/base/function.h>
8679 * #include <deal.II/base/utilities.h>
8681 * using namespace dealii;
8683 * namespace PlasticityLab {
8685 * template<int dim, typename Number = double>
8686 * class RotationFunction: public Function<dim, Number> {
8689 * const Number angular_frequency,
8690 * const Number axial_velocity,
8691 * const Number current_angle = 0.0);
8692 * virtual ~RotationFunction();
8694 * virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const;
8695 * virtual void set_time (const Number new_time);
8698 * void update_rotation_matrix();
8699 * Tensor<2, dim, Number> previousRotationMatrix, currentRotationMatrix;
8700 * Number current_angle;
8701 * Number previous_displacement, current_displacement;
8702 * Number angular_frequency;
8703 * Number axial_velocity;
8706 * template<int dim, typename Number = double>
8707 * class AngularVelocityFunction: public Function<dim, Number> {
8709 * AngularVelocityFunction(const Number angular_frequency) : Function<dim, Number>(dim) {
8710 * this->angular_frequency = angular_frequency;
8712 * virtual ~AngularVelocityFunction() {}
8714 * virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const {
8715 * values[0] = - 2 * 3.14159 * angular_frequency * p[1];
8716 * values[1] = 2 * 3.14159 * angular_frequency * p[0];
8723 * Number angular_frequency;
8726 * template<int dim, typename Number>
8727 * RotationFunction<dim, Number>::~RotationFunction() {}
8729 * template<int dim, typename Number>
8730 * RotationFunction<dim, Number>::RotationFunction(
8731 * const Number angular_frequency,
8732 * const Number axial_velocity,
8733 * const Number current_angle) : Function<dim, Number>(dim) {
8734 * this->angular_frequency = angular_frequency;
8735 * this->axial_velocity = axial_velocity;
8736 * this->current_angle = current_angle;
8737 * this->set_time(0.0);
8738 * current_displacement = 0.0;
8741 * template<int dim, typename Number>
8742 * void RotationFunction<dim, Number>::vector_value (const Point< dim > &p, Vector< Number > &values) const {
8743 * const auto p_prev = previousRotationMatrix * p;
8744 * const auto res = currentRotationMatrix * p;
8745 * for (unsigned int i = 0; i < dim; ++i)
8746 * values[i] = res[i] - p_prev[i] + (i == 2 ? current_displacement - previous_displacement : 0.0);
8749 * template<int dim, typename Number>
8750 * void RotationFunction<dim, Number>::update_rotation_matrix () {
8751 * previousRotationMatrix = currentRotationMatrix;
8752 * const Number c_theta = std::cos(current_angle);
8753 * const Number s_theta = std::sin(current_angle);
8754 * currentRotationMatrix[0][0] = c_theta;
8755 * currentRotationMatrix[0][1] = -s_theta;
8756 * currentRotationMatrix[1][0] = s_theta;
8757 * currentRotationMatrix[1][1] = c_theta;
8759 * currentRotationMatrix[2][2] = 1.0;
8762 * template<int dim, typename Number>
8763 * void RotationFunction<dim, Number>::set_time (const Number new_time) {
8764 * Function<dim, Number>::set_time(new_time);
8765 * current_angle = angular_frequency * Function<dim, Number>::get_time();
8766 * update_rotation_matrix();
8767 * previous_displacement = current_displacement;
8768 * current_displacement = axial_velocity * Function<dim, Number>::get_time();
8771 * } /* namespace PlasticityLab */
8773 * #endif /* ROTATIONFUNCTION_H_ */
8777<a name="ann-src/ScaleComponentFunction.h"></a>
8778<h1>Annotated version of src/ScaleComponentFunction.h</h1>
8785 * * ScaleComponentFunction.h
8787 * * Created on: 28 Dec 2019
8791 * #ifndef SCALECOMPONENTFUNCTION_H_
8792 * #define SCALECOMPONENTFUNCTION_H_
8795 * #include <deal.II/base/function.h>
8796 * #include <deal.II/base/utilities.h>
8798 * using namespace dealii;
8800 * namespace PlasticityLab {
8802 * template<int dim, typename Number = double, int components=dim>
8803 * class ScaleComponentFunction: public Function<dim, Number> {
8805 * ScaleComponentFunction(
8806 * const Number scale_factor,
8807 * const unsigned int in_component=2,
8808 * const unsigned int out_component=2);
8809 * virtual ~ScaleComponentFunction();
8810 * virtual void vector_value(const Point<dim> &p, Vector<Number> &values) const override;
8813 * Number scale_factor;
8814 * const unsigned int in_component;
8815 * const unsigned int out_component;
8818 * template<int dim, typename Number, int components>
8819 * ScaleComponentFunction<dim, Number, components>::ScaleComponentFunction(
8820 * const Number scale_factor,
8821 * const unsigned int in_component,
8822 * const unsigned int out_component) :
8823 * Function<dim, Number>(components),
8824 * scale_factor(scale_factor),
8825 * in_component(in_component),
8826 * out_component(out_component) { }
8828 * template<int dim, typename Number, int components>
8829 * ScaleComponentFunction<dim, Number, components>::~ScaleComponentFunction() {}
8831 * template<int dim, typename Number, int components>
8832 * void ScaleComponentFunction<dim, Number, components>::vector_value(const Point<dim> &p, Vector<Number> &values) const {
8834 * values[out_component] = scale_factor * p[in_component];
8837 * } /* namespace PlasticityLab */
8839 * #endif /* SCALECOMPONENTFUNCTION_H_ */
8843<a name="ann-src/ScaleZFunction.h"></a>
8844<h1>Annotated version of src/ScaleZFunction.h</h1>
8851 * * ScaleZFunction.h
8853 * * Created on: 06 Dec 2016
8857 * #ifndef SCALEZFUNCTION_H_
8858 * #define SCALEZFUNCTION_H_
8861 * #include <deal.II/base/function.h>
8862 * #include <deal.II/base/utilities.h>
8864 * using namespace dealii;
8866 * namespace PlasticityLab {
8868 * template<int dim, typename Number = double, int components=dim>
8869 * class ScaleZFunction: public Function<dim, Number> {
8871 * ScaleZFunction(const Number scale_factor, const unsigned int component=2);
8872 * virtual ~ScaleZFunction();
8873 * virtual void vector_value(const Point<dim> &p, Vector<Number> &values) const override;
8876 * Number scale_factor;
8877 * const unsigned int component;
8880 * template<int dim, typename Number, int components>
8881 * ScaleZFunction<dim, Number, components>::ScaleZFunction(
8882 * const Number scale_factor,
8883 * const unsigned int component) :
8884 * Function<dim, Number>(components),
8885 * component(component) {
8886 * this->scale_factor = scale_factor;
8889 * template<int dim, typename Number, int components>
8890 * ScaleZFunction<dim, Number, components>::~ScaleZFunction() {}
8892 * template<int dim, typename Number, int components>
8893 * void ScaleZFunction<dim, Number, components>::vector_value(const Point<dim> &p, Vector<Number> &values) const {
8895 * values[component] = scale_factor * p[component];
8898 * } /* namespace PlasticityLab */
8900 * #endif /* SCALEZFUNCTION_H_ */
8904<a name="ann-src/TensorUtilities.h"></a>
8905<h1>Annotated version of src/TensorUtilities.h</h1>
8912 * * TensorUtilities.h
8914 * * Created on: 06 Nov 2020
8918 * #ifndef TENSOR_UTILITIES_H_
8919 * #define TENSOR_UTILITIES_H_
8921 * #include<exception>
8923 * #include <deal.II/base/tensor.h>
8924 * #include <deal.II/base/symmetric_tensor.h>
8927 * using namespace dealii;
8929 * namespace PlasticityLab {
8930 * template <int dim, typename Number>
8931 * SymmetricTensor<2, dim, Number> get_log_of_tensor(
8932 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate) {
8934 * const auto eig_vals_vecs = eigenvectors(symmetric_stretch_rate);
8935 * SymmetricTensor<2, dim, Number> result =
8936 * std::log(eig_vals_vecs[0].first)
8939 * eig_vals_vecs[0].second,
8940 * eig_vals_vecs[0].second));
8941 * for(unsigned int d=1; d<dim; ++d) {
8943 * std::log(eig_vals_vecs[d].first)
8946 * eig_vals_vecs[d].second,
8947 * eig_vals_vecs[d].second));
8950 * } catch(std::exception& e) {
8951 * std::cout << "Could not get log of tensor: " << symmetric_stretch_rate << std::endl;
8952 * return symmetric_stretch_rate;
8957 * template <int dim, typename Number>
8958 * SymmetricTensor<2, dim, Number> get_log_of_tensor_variation(
8959 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate,
8960 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate_variation) {
8961 * const double epsilon = 1e-10;
8962 * return (1./epsilon) * (get_log_of_tensor(symmetric_stretch_rate + epsilon * symmetric_stretch_rate_variation) - get_log_of_tensor(symmetric_stretch_rate));
8965 * template <int dim, typename Number>
8966 * SymmetricTensor<2, dim, Number> get_exp_of_tensor(
8967 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate) {
8969 * const auto eig_vals_vecs = eigenvectors(symmetric_stretch_rate);
8970 * SymmetricTensor<2, dim, Number> result =
8971 * std::exp(eig_vals_vecs[0].first)
8974 * eig_vals_vecs[0].second,
8975 * eig_vals_vecs[0].second));
8976 * for(unsigned int d=1; d<dim; ++d) {
8978 * std::exp(eig_vals_vecs[d].first)
8981 * eig_vals_vecs[d].second,
8982 * eig_vals_vecs[d].second));
8985 * } catch(std::exception& e) {
8986 * std::cout << "Could not get exp of tensor: " << symmetric_stretch_rate << std::endl;
8987 * return symmetric_stretch_rate;
8991 * template <int dim, typename Number>
8992 * SymmetricTensor<2, dim, Number> get_exp_of_tensor_variation(
8993 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate,
8994 * const SymmetricTensor<2, dim, Number> &symmetric_stretch_rate_variation) {
8995 * const Number epsilon = 1e-10;
8996 * return (1./epsilon) * (get_exp_of_tensor(symmetric_stretch_rate + epsilon * symmetric_stretch_rate_variation) - get_exp_of_tensor(symmetric_stretch_rate));
9000 * #endif // TENSOR_UTILITIES_H_ * @endcode
9003<a name="ann-src/ThermoPlasticMaterial.cpp"></a>
9004<h1>Annotated version of src/ThermoPlasticMaterial.cpp</h1>
9011 * * ThermoPlasticMaterial.cpp
9013 * * Created on: 05 Jan 2015
9018 * #include <sstream>
9020 * #include <deal.II/base/tensor.h>
9021 * #include <deal.II/base/symmetric_tensor.h>
9023 * #include "symmetric_tensor_entries.h"
9025 * #include "ExponentialHardeningThermoviscoplasticYieldLaw.h"
9026 * #include "JohnsonCookThermoviscoplasticYieldLaw.h"
9028 * #include "ThermoPlasticMaterial.h"
9029 * #include "Constants.h"
9030 * #include "TensorUtilities.h"
9032 * namespace PlasticityLab {
9034 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9035 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9036 * ThermoPlasticMaterial(
9037 * const Number kappa,
9039 * const Number thermal_expansion_coefficient,
9040 * const Number thermal_conductivity,
9041 * const Number heat_capacity,
9042 * const Number dissipation_factor,
9043 * const ViscoplasticYieldLaw &viscoplastic_yield_law) :
9046 * thermal_expansion_coefficient(thermal_expansion_coefficient),
9047 * thermal_conductivity(thermal_conductivity),
9048 * heat_capacity(heat_capacity),
9049 * reference_temperature(293.15),
9050 * dissipation_factor(dissipation_factor),
9051 * viscoplastic_yield_law(viscoplastic_yield_law) { }
9053 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9054 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::~ThermoPlasticMaterial() {
9057 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9058 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::compute_constitutive_request(
9059 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9060 * const point_index_t &point_index) {
9061 * const ConstitutiveModelUpdateFlags update_flags = constitutive_request.get_update_flags();
9063 * if (update_pressure & update_flags)
9064 * compute_pressure(constitutive_request, point_index);
9066 * if ((update_stress_deviator | update_mechanical_dissipation) & update_flags)
9067 * compute_stress_deviator_and_d_gamma(constitutive_request, point_index);
9069 * if (update_heat_flux & update_flags)
9070 * compute_heat_flux(constitutive_request, point_index);
9072 * if (update_thermoelastic_heating & update_flags)
9073 * compute_thermo_elastic_heating(constitutive_request, point_index);
9075 * if (update_stored_heat & update_flags)
9076 * compute_stored_heat_rate(constitutive_request, point_index);
9079 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9080 * std::vector<Number> ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_state_parameters(
9081 * const point_index_t &point_index,
9082 * const Tensor<2, dim, Number> &reference_transformation) const {
9083 * std::vector<Number> state_parameters;
9084 * state_parameters.reserve(get_material_parameter_count());
9086 * const PointHistory<dim, Number> &point_history = material_point_history.at(point_index);
9087 * state_parameters.push_back(std::log(1 + point_history.hardening_parameters.equivalent_plastic_strain));
9089 * const Number reference_transformation_Jacobian = determinant(reference_transformation);
9090 * const auto isochoric_reference_transformation =
9091 * std::pow(reference_transformation_Jacobian, -Constants<dim, Number>::one_third()) * reference_transformation;
9093 * const SymmetricTensor<2, dim, Number> log_of_b_e =
9094 * get_log_of_tensor(
9096 * isochoric_reference_transformation
9097 * * static_cast<Tensor<2, dim, Number>>(point_history.plastic_strain)
9098 * * transpose(isochoric_reference_transformation)));
9100 * for (const auto &element :
9101 * dealii_utils::symmetric_tensor_entries(log_of_b_e)) {
9102 * state_parameters.push_back(element);
9105 * for (const auto &element :
9106 * dealii_utils::symmetric_tensor_entries(
9107 * point_history.hardening_parameters.kinematic_hardening)
9109 * state_parameters.push_back(element);
9112 * state_parameters.push_back(std::log(std::pow(reference_transformation_Jacobian, 1) * point_history.material_Jacobian));
9114 * return state_parameters;
9117 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9118 * size_t ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>:: get_material_parameter_count() const {
9119 * return 1 + 2 * (dim * (dim + 1) / 2) + 1; // one scalar and two symmetric tensors and one more scalar
9122 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9123 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::set_state_parameters(
9124 * const point_index_t &point_index,
9125 * const std::vector<Number> &state_parameters,
9126 * const Tensor<2, dim, Number> &reference_transformation) {
9127 * PointHistory<dim, Number> &point_history = material_point_history.at(point_index);
9128 * size_t cursor = 0;
9130 * point_history.hardening_parameters.equivalent_plastic_strain = std::exp(state_parameters[cursor++]) - 1;
9132 * SymmetricTensor<2, dim, Number> log_of_b_e;
9134 * for (auto &element :
9135 * dealii_utils::symmetric_tensor_entries(log_of_b_e)) {
9136 * element = state_parameters[cursor++];
9139 * const Number reference_transformation_Jacobian = determinant(reference_transformation);
9140 * const auto inverse_isochoric_reference_transformation =
9141 * std::pow(reference_transformation_Jacobian, Constants<dim, Number>::one_third()) * invert(reference_transformation);
9143 * point_history.plastic_strain = symmetrize(
9144 * inverse_isochoric_reference_transformation
9145 * * static_cast<Tensor<2, dim, Number>>(get_exp_of_tensor(log_of_b_e))
9146 * * transpose(inverse_isochoric_reference_transformation));
9148 * for (auto &element :
9149 * dealii_utils::symmetric_tensor_entries(
9150 * point_history.hardening_parameters.kinematic_hardening
9152 * element = state_parameters[cursor++];
9155 * point_history.material_Jacobian = std::pow(reference_transformation_Jacobian, -1) * std::exp(state_parameters[cursor++]);
9158 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9159 * Number ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_material_Jacobian(const point_index_t &point_index) const {
9160 * return material_point_history.at(point_index).material_Jacobian;
9164 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9165 * ::SymmetricTensor<2, dim, Number> ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::get_plastic_strain(const point_index_t &point_index) const {
9166 * return material_point_history.at(point_index).plastic_strain;
9172 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9174 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::setup_point_history (const point_index_t point_count) {
9176 * std::vector< PointHistory<dim, Number> > tmp;
9177 * tmp.swap (material_point_history);
9179 * const typename PointHistory<dim, Number>::HardeningParameters hardening_parameters(
9181 * Number(0.0)*::unit_symmetric_tensor<dim, Number>());
9182 * const PointHistory< dim, Number> point_history(unit_symmetric_tensor<dim, Number>(),
9183 * hardening_parameters,
9186 * material_point_history.resize (point_count, point_history);
9189 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9191 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9192 * compute_pressure(ConstitutiveModelRequest<dim, Number> &constitutive_request,
9193 * const point_index_t &) {
9194 * const Number J = constitutive_request.get_deformation_Jacobian();
9195 * const Number temperature = constitutive_request.get_temperature();
9197 * const Number p = kappa * (J-1.0/J) - 3 * kappa * thermal_expansion_coefficient * (temperature - reference_temperature) * (1 + 1./(J*J));
9198 * constitutive_request.set_pressure(p);
9204 * const Number dp = kappa * (1 + 1/(J*J)) - 3 * kappa * thermal_expansion_coefficient * (temperature - reference_temperature) * (-2 * 1./(J*J*J));
9205 * constitutive_request.set_pressure_tangent_modulus(dp);
9207 * std::ostringstream convert;
9208 * convert << "Encountered deformation gradient with non-positive determinant! " << J;
9209 * throw MaterialDomainException(convert.str());
9213 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9214 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::compute_stress_deviator_and_d_gamma(
9215 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9216 * const point_index_t &point_index) {
9217 * const ConstitutiveModelUpdateFlags update_flags = constitutive_request.get_update_flags();
9218 * const Tensor<2, dim, Number> b_e = material_point_history[point_index].plastic_strain;
9219 * typename PointHistory<dim, Number>::HardeningParameters hardening_parameters =
9220 * material_point_history[point_index].hardening_parameters;
9221 * const Tensor<2, dim, Number> isochoric_deformation_gradient = constitutive_request.get_deformation_gradient();
9222 * const Number temperature = constitutive_request.get_temperature();
9223 * const auto b_e_bar_next = static_cast<SymmetricTensor<2, dim, Number> >(
9224 * symmetrize(isochoric_deformation_gradient * b_e
9225 * * transpose(isochoric_deformation_gradient)));
9226 * if(std::isnan(b_e_bar_next.norm())) {
9227 * std::cout << "b_e_bar_next is nan: " << b_e_bar_next << std::endl;
9228 * std::cout << "b_e: " << b_e << std::endl;
9229 * std::cout << "isochoric_deformation_gradient: " << isochoric_deformation_gradient << std::endl;
9230 * std::ostringstream convert;
9231 * convert << "Encountered an elastic deviatoric tensor with NaN values! ";
9232 * throw MaterialDomainException(convert.str());
9234 * const auto epsilon_e_bar_next = get_log_of_tensor<>(b_e_bar_next);
9235 * const SymmetricTensor<2, dim, Number> dev_stress_trial = deviator((0.5 * mu) * epsilon_e_bar_next);
9238 * const SymmetricTensor<2, dim, Number> dev_stress_trial = deviator((0.5 * mu) * b_e_bar_next);
9241 * const SymmetricTensor<2, dim, Number> ksi_trial = dev_stress_trial
9242 * - hardening_parameters.kinematic_hardening;
9243 * const Number norm_ksi_trial = ksi_trial.norm();
9244 * const Number mu_bar = (0.5 * mu);
9247 * const Number mu_bar = (0.5 * mu) * Constants<dim, Number>::one_third()
9248 * * trace(b_e_bar_next);
9251 * const SymmetricTensor<2, dim, Number> stress_flow_direction = ksi_trial
9253 * constitutive_request.set_b_e_bar(b_e_bar_next);
9254 * constitutive_request.set_mu((0.5 * mu));
9255 * const Number time_increment = constitutive_request.get_time_increment();
9257 * const Number trial_yield_criterion = viscoplastic_yield_law.trial_yield_criterion(norm_ksi_trial,
9258 * hardening_parameters.equivalent_plastic_strain,
9263 * if (0 < trial_yield_criterion && constitutive_request.get_is_plastic()) {
9264 * constitutive_request.set_is_plastic(true);
9265 * Number delta_gamma, alpha_n_plus_1;
9267 * determine_delta_gamma(delta_gamma, alpha_n_plus_1, norm_ksi_trial,
9268 * mu_bar, hardening_parameters.equivalent_plastic_strain, temperature,
9269 * time_increment, 1e-04, 300);
9270 * } catch(const MaterialDomainException &exc) {
9271 * std::cout << "isochoric_deformation_gradient: " << isochoric_deformation_gradient
9272 * << "\nb_e: " << b_e
9273 * << "\nb_e_bar_next: " << b_e_bar_next
9274 * << "\nmu_bar: " << mu_bar
9276 * std::cerr << exc.what() << std::endl;
9283 * constitutive_request.set_delta_gamma(delta_gamma);
9287 * 4. Update back stress, plastic strain and stress
9290 * Number K_alpha_n_plus_1, K_alpha_n, H_alpha_n_plus_1, H_alpha_n;
9291 * Number DK_alpha_n_plus_1, DH_alpha_n_plus_1;
9292 * viscoplastic_yield_law.hardening_values(H_alpha_n,
9294 * hardening_parameters.equivalent_plastic_strain,
9298 * const Number y_alpha = viscoplastic_yield_law.hardening_values(
9305 * [[maybe_unused]] const Number d_y_alpha_d_alpha = viscoplastic_yield_law.hardening_alpha_derivatives(
9306 * DH_alpha_n_plus_1,
9307 * DK_alpha_n_plus_1,
9313 * if (update_stress_deviator & update_flags) {
9314 * const SymmetricTensor<2, dim, Number> stress = deviator(dev_stress_trial
9315 * - 2 * mu_bar * delta_gamma
9316 * * stress_flow_direction);
9317 * constitutive_request.set_stress_deviator(stress);
9318 * constitutive_request.set_dH(DH_alpha_n_plus_1);
9319 * constitutive_request.set_dK(DK_alpha_n_plus_1);
9320 * if (update_material_point_history & update_flags) {
9321 * material_point_history[point_index].hardening_parameters.equivalent_plastic_strain =
9323 * material_point_history[point_index].hardening_parameters.kinematic_hardening =
9324 * hardening_parameters.kinematic_hardening
9325 * + Constants<dim, Number>::sqrt2thirds()
9326 * * (K_alpha_n_plus_1 - K_alpha_n)
9327 * * stress_flow_direction;
9331 * // compute one_third_I_bar_e (c.f. Simo, Miehe 1992 pp 64)
9332 * const auto stress_over_mu = stress / (0.5 * mu);
9333 * const Number norm_stress_over_mu = stress_over_mu.norm();
9334 * const Number J_e2 = 0.5 * norm_stress_over_mu * norm_stress_over_mu;
9335 * const Number J_e3 = determinant(stress_over_mu);
9336 * const Number q = 0.5*(1-J_e3);
9337 * const Number sqrt_d = std::sqrt(-std::pow(Constants<dim, Number>::one_third()*J_e2, 3) + q*q);
9338 * const Number one_third_I_bar_e = std::pow(q + sqrt_d, Constants<dim, Number>::one_third())
9339 * + std::pow(q - sqrt_d, Constants<dim, Number>::one_third());
9343 * auto b_e_bar = stress / (0.5 * mu)
9344 * + Constants<dim, Number>::one_third() * trace(b_e_bar_next)
9345 * * unit_symmetric_tensor<dim, Number>();
9348 * auto b_e_bar = get_exp_of_tensor(stress / (0.5 * mu));
9352 * correct volumetric component so that return mapping does not change volume
9355 * const Number det_b_e_bar_trial = determinant(b_e_bar_next);
9356 * Number det_plastic_strain = determinant(b_e_bar);
9357 * if(std::abs(det_plastic_strain - 1) > 1e-7) {
9358 * std::cout << "det_plastic_strain: " << det_plastic_strain << std::endl;
9360 * while (std::abs(det_plastic_strain-det_b_e_bar_trial) > 1e-10) {
9361 * const Number u = (det_b_e_bar_trial - det_plastic_strain) / (det_plastic_strain * trace(invert(b_e_bar)));
9362 * b_e_bar += u*unit_symmetric_tensor<dim, Number>();
9363 * det_plastic_strain = determinant(b_e_bar);
9366 * [[maybe_unused]] const Tensor<2, dim, Number> inverse_isochoric_deformation_gradient = invert(isochoric_deformation_gradient);
9367 * material_point_history[point_index].plastic_strain = b_e_bar;
9369 * } /*if(update_stress_deviator & update_flags)*/
9370 * if (update_mechanical_dissipation & update_flags) {
9371 * const Number time_increment = constitutive_request.get_time_increment();
9372 * const Number mechanical_dissipation =
9373 * dissipation_factor
9374 * * Constants<dim, Number>::sqrt2thirds()
9375 * * y_alpha * delta_gamma
9376 * / (1000. * time_increment); // [J.mm^-3.s^-1]
9377 * constitutive_request.set_mechanical_dissipation(mechanical_dissipation);
9378 * Number DH_theta, DK_theta;
9379 * const Number d_y_alpha_d_theta =
9380 * viscoplastic_yield_law.hardening_temperature_derivatives(DH_theta, DK_theta,
9385 * const Number mechanical_dissipation_temperature_tangent =
9386 * dissipation_factor
9387 * * d_y_alpha_d_theta
9388 * * (Constants<dim, Number>::sqrt2thirds() * delta_gamma
9389 * - y_alpha / (3 * mu_bar))
9390 * / (1000. * time_increment); // [J.mm^-3.s^-3.K^-1]
9391 * constitutive_request.set_mechanical_dissipation_tangent_modulus(
9392 * mechanical_dissipation_temperature_tangent);
9393 * } /*if (update_mechanical_dissipation & updateFlags)*/
9394 * } /*if ( trial yield criterion test )*/
9396 * constitutive_request.set_delta_gamma(0.0);
9397 * constitutive_request.set_is_plastic(false);
9398 * if (update_stress_deviator & update_flags) {
9399 * constitutive_request.set_stress_deviator(dev_stress_trial);
9400 * constitutive_request.set_dK(0.0);
9401 * constitutive_request.set_dH(0.0);
9403 * if (update_mechanical_dissipation & update_flags) {
9404 * constitutive_request.set_mechanical_dissipation(0.0);
9405 * constitutive_request.set_mechanical_dissipation_tangent_modulus(0.0);
9409 * The following is only necessary for the elastic case when b_e is tracked instead of G_p
9412 * if (update_stress_deviator & update_flags) {
9413 * if (update_material_point_history & update_flags) {
9414 * material_point_history[point_index].plastic_strain = b_e_bar_next;
9420 * The following is only necessary if the total Jacobian is tracked (J_c * J_m), rather than just J_m
9423 * if (update_material_point_history & update_flags) {
9424 * material_point_history.at(point_index).material_Jacobian = constitutive_request.get_unprojected_deformation_Jacobian();
9426 * } /*computeStressDeviatorAndDGamma()*/
9428 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9429 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9430 * compute_heat_flux(
9431 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9432 * const point_index_t &) {
9433 * const Tensor<1, dim, Number> thermal_gradient = constitutive_request.get_thermal_gradient();
9434 * constitutive_request.set_heat_flux(thermal_conductivity * thermal_gradient);
9435 * constitutive_request.set_heat_flux_tangent_moduli(thermal_conductivity * unit_symmetric_tensor<dim, Number>());
9438 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9439 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9440 * compute_thermo_elastic_heating(
9441 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9442 * const point_index_t &point_index) {
9443 * const auto point_history = material_point_history.at(point_index);
9444 * const Number J = constitutive_request.get_deformation_Jacobian();
9445 * const Number previous_J = constitutive_request.get_previous_deformation_Jacobian();
9446 * [[maybe_unused]] const Number J_time_rate = constitutive_request.get_deformation_Jacobian_time_rate();
9447 * const Number theta = constitutive_request.get_temperature();
9448 * [[maybe_unused]] const Number previous_theta = constitutive_request.get_previous_temperature();
9449 * const Number time_increment = constitutive_request.get_time_increment();
9450 * if (J != 0 and previous_J != 0) {
9451 * const Number eta = (3.0/1000.0) * kappa * thermal_expansion_coefficient * (J - 1.0/J);
9452 * const Number previous_eta = (3.0/1000.0) * kappa * thermal_expansion_coefficient * (previous_J - 1.0/previous_J);
9453 * constitutive_request.set_thermo_elastic_heating(-theta * (eta - previous_eta) / time_increment);
9454 * constitutive_request.set_thermo_elastic_heating_tangent_modulus(-(eta - previous_eta) / time_increment);
9458 * TODO define and throw appropriate exception: bad deformation gradient!
9461 * constitutive_request.set_thermo_elastic_heating(0);
9462 * constitutive_request.set_thermo_elastic_heating_tangent_modulus(0);
9466 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9467 * void ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9468 * compute_stored_heat_rate(
9469 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9470 * const point_index_t &) {
9471 * const Number stored_heat_rate = heat_capacity * constitutive_request.get_temperature_time_rate();
9472 * constitutive_request.set_stored_heat_rate(stored_heat_rate);
9473 * constitutive_request.set_stored_heat_rate_tangent_modulus(heat_capacity);
9476 * template <int dim, typename ViscoplasticYieldLaw, typename Number>
9478 * ThermoPlasticMaterial<dim, ViscoplasticYieldLaw, Number>::
9479 * determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
9480 * const Number norm_ksi_trial,
9481 * const Number mu_bar,
9482 * const Number alpha_n,
9483 * const Number temperature,
9484 * const Number time_increment,
9486 * const unsigned int max_iter) const {
9487 * unsigned int k = 0;
9488 * const Number sqrt2thirds = Constants<dim, Number>::sqrt2thirds();
9489 * const Number two_thirds = Constants<dim, Number>::two_thirds();
9490 * Number g_of_gamma_k, Dg_of_gamma_k;
9491 * Number H_alpha_n, H_alpha_n_plus_1, K_alpha_n, K_alpha_n_plus_1;
9492 * Number DK_alpha_n_plus_1, DH_alpha_n_plus_1;
9495 * alpha_n_plus_1 = alpha_n;
9497 * viscoplastic_yield_law.hardening_values(H_alpha_n, K_alpha_n, alpha_n, 0.0, time_increment, temperature);
9499 * viscoplastic_yield_law.hardening_values(H_alpha_n_plus_1, K_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9500 * g_of_gamma_k = norm_ksi_trial
9501 * - 2 * mu_bar * delta_gamma
9502 * - sqrt2thirds * H_alpha_n_plus_1
9503 * - sqrt2thirds * (K_alpha_n_plus_1 - K_alpha_n);
9505 * viscoplastic_yield_law.hardening_alpha_derivatives(DH_alpha_n_plus_1, DK_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9506 * Dg_of_gamma_k = -2 * mu_bar - two_thirds * (DK_alpha_n_plus_1 + DH_alpha_n_plus_1);
9508 * delta_gamma = delta_gamma - g_of_gamma_k / Dg_of_gamma_k;
9509 * alpha_n_plus_1 = alpha_n + sqrt2thirds * delta_gamma;
9511 * viscoplastic_yield_law.hardening_values(H_alpha_n_plus_1, K_alpha_n_plus_1, alpha_n_plus_1, delta_gamma, time_increment, temperature);
9512 * g_of_gamma_k = norm_ksi_trial
9513 * - 2 * mu_bar * delta_gamma
9514 * - sqrt2thirds * H_alpha_n_plus_1
9515 * - sqrt2thirds * (K_alpha_n_plus_1 - K_alpha_n);
9516 * } while (std::fabs(g_of_gamma_k) > tol && ++k < max_iter);
9517 * if (std::fabs(g_of_gamma_k) > tol) {
9518 * std::ostringstream convert;
9519 * convert << "Did not converge after " << k << " iterations. g: " << g_of_gamma_k
9520 * << ", norm_ksi_trial: " << norm_ksi_trial
9521 * << ", mu_bar: " << mu_bar
9522 * << ", H_alpha_n_plus_1: " << H_alpha_n_plus_1
9523 * << ", alpha: " << alpha_n_plus_1
9524 * << ", delta_gamma: " << delta_gamma
9525 * << ", temperature: " << temperature
9526 * << ", gradient: " << Dg_of_gamma_k;
9527 * throw MaterialDomainException(convert.str());
9531 * template class ThermoPlasticMaterial<3, ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>;
9532 * template class ThermoPlasticMaterial<2, ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>;
9534 * template class ThermoPlasticMaterial<3, JohnsonCookThermoviscoplasticYieldLaw<double>, double>;
9535 * template class ThermoPlasticMaterial<2, JohnsonCookThermoviscoplasticYieldLaw<double>, double>;
9537 * } /* namespace PlasticityLab */
9541<a name="ann-src/ThermoPlasticMaterial.h"></a>
9542<h1>Annotated version of src/ThermoPlasticMaterial.h</h1>
9549 * * ThermoPlasticMaterial.h
9551 * * Created on: 05 Jan 2015
9555 * #ifndef THERMOPLASTICMATERIAL_H_
9556 * #define THERMOPLASTICMATERIAL_H_
9558 * #include "PointHistory.h"
9559 * #include "Material.h"
9560 * #include "ConstitutiveModelRequest.h"
9562 * using namespace dealii;
9564 * namespace PlasticityLab {
9566 * template <int dim, typename ViscoplasticYieldLaw, typename Number = double>
9567 * class ThermoPlasticMaterial : public Material<dim, Number> {
9569 * ThermoPlasticMaterial(const Number kappa,
9571 * const Number thermal_expansion_coefficient,
9572 * const Number thermal_conductivity,
9573 * const Number heat_capacity,
9574 * const Number dissipation_factor,
9575 * const ViscoplasticYieldLaw &viscoplastic_yield_law);
9577 * virtual ~ThermoPlasticMaterial();
9579 * void compute_constitutive_request(
9580 * ConstitutiveModelRequest <dim, Number> &constitutive_request,
9581 * const point_index_t &point_index) override;
9583 * Number get_material_Jacobian(const point_index_t &point_index) const override;
9584 * ::SymmetricTensor<2, dim, Number> get_plastic_strain(const point_index_t &point_index) const override;
9586 * std::vector<Number> get_state_parameters(
9587 * const point_index_t &point_index,
9588 * const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) const override;
9590 * void set_state_parameters(
9591 * const point_index_t &point_index,
9592 * const std::vector<Number> &state_parameters,
9593 * const Tensor<2, dim, Number> &reference_transformation=unit_symmetric_tensor<dim>()) override;
9594 * size_t get_material_parameter_count() const override;
9597 * void setup_point_history (const point_index_t point_count) override;
9600 * const Number kappa;
9603 * const Number thermal_expansion_coefficient;
9604 * const Number thermal_conductivity;
9605 * const Number heat_capacity;
9606 * const Number reference_temperature;
9608 * const Number dissipation_factor;
9609 * const ViscoplasticYieldLaw viscoplastic_yield_law;
9611 * std::vector< PointHistory<dim, Number> > material_point_history;
9615 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9616 * const point_index_t &point_index);
9619 * determine_delta_gamma(Number &delta_gamma, Number &alpha_n_plus_1,
9620 * const Number norm_ksi_trial,
9621 * const Number mu_bar,
9622 * const Number alpha_n,
9623 * const Number temperature,
9624 * const Number time_increment,
9625 * const Number tol, unsigned int max_iter) const;
9627 * void compute_stress_deviator_and_d_gamma(
9628 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9629 * const point_index_t &point_index);
9631 * void compute_heat_flux(
9632 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9633 * const point_index_t &point_index);
9635 * void compute_thermo_elastic_heating(
9636 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9637 * const point_index_t &point_index);
9639 * void compute_stored_heat_rate(
9640 * ConstitutiveModelRequest<dim, Number> &constitutive_request,
9641 * const point_index_t &point_index);
9645 * } /* namespace PlasticityLab */
9647 * #endif /* THERMOPLASTICMATERIAL_H_ */
9651<a name="ann-src/TimeRateRequest.h"></a>
9652<h1>Annotated version of src/TimeRateRequest.h</h1>
9659 * * TimeRateRequest.h
9661 * * Created on: 27 Nov 2019
9665 * #ifndef TIMERATEREQUEST_H_
9666 * #define TIMERATEREQUEST_H_
9668 * #include <deal.II/base/tensor.h>
9670 * #include "Constants.h"
9671 * #include "TimeRateUpdateFlags.h"
9673 * namespace PlasticityLab {
9675 * template <typename ValueType, int dim, typename Number=double>
9676 * class TimeRateRequest {
9678 * TimeRateRequest(TimeRateUpdateFlags);
9679 * virtual ~TimeRateRequest();
9683 * Interface to be used by request client (FE system assembler)
9684 * --request configuration stage--
9687 * void set_value(const ValueType &value);
9688 * void set_previous_value(const ValueType &previous_value);
9689 * void set_second_previous_value(const ValueType &second_previous_value);
9691 * void set_time_increment(const Number time_increment);
9692 * void set_previous_time_increment(const Number previous_time_increment);
9694 * void set_previous_partial_time_rate(const ValueType &previous_partial_time_rate);
9695 * void set_previous_total_time_rate(const ValueType &previous_total_time_rate);
9697 * void set_velocity(const ::Tensor<1, dim, Number> &velocity);
9701 * Interface to be used by request client (FE system assembler)
9702 * --request response retrieval and interrogation stage--
9705 * ValueType get_partial_time_rate() const;
9706 * ValueType get_total_time_rate() const;
9707 * ValueType get_partial_second_time_rate() const;
9708 * ValueType get_total_second_time_rate() const;
9710 * ValueType get_partial_time_rate_tangent(const ValueType &value_increment) const;
9711 * ValueType get_partial_second_time_rate_tangent(const ValueType &value_increment) const;
9713 * template<typename GradientType>
9714 * ValueType get_total_time_rate_tangent(
9715 * const ValueType &value_increment,
9716 * const ValueType &gradient_increment) const;
9718 * template<typename GradientType>
9719 * ValueType get_total_second_time_rate_tangent(
9720 * const ValueType &value_increment,
9721 * const ValueType &gradient_increment) const;
9725 * interface used by constitutive model object to perform computation
9726 * TODO consider hiding this interface and exposing it through adapter
9729 * TimeRateUpdateFlags get_update_flags() const;
9730 * ValueType get_value() const;
9731 * ValueType get_previous_value() const;
9732 * ValueType get_second_previous_value() const;
9734 * Number get_time_increment() const;
9735 * Number get_previous_time_increment() const;
9737 * ValueType get_previous_partial_time_rate() const;
9738 * ValueType get_previous_total_time_rate() const;
9740 * ::Tensor<1, dim, Number> get_velocity() const;
9747 * void set_partial_time_rate(const ValueType &partial_time_rate);
9748 * void set_total_time_rate(const ValueType &total_time_rate);
9749 * void set_partial_second_time_rate(const ValueType &partial_second_time_rate);
9750 * void set_total_second_time_rate(const ValueType &total_second_time_rate);
9752 * void set_partial_time_rate_tangent(const ValueType &partial_time_rate_tangent);
9753 * void set_total_time_rate_tangent(const ValueType &total_time_rate_tangent);
9754 * void set_partial_second_time_rate_tangent(const ValueType &partial_second_time_rate_tangent);
9755 * void set_total_second_time_rate_tangent(const ValueType &total_second_time_rate_tangent);
9763 * TimeRateUpdateFlags update_flags;
9766 * ValueType previous_value;
9767 * ValueType second_previous_value;
9769 * Number time_increment;
9770 * Number previous_time_increment;
9772 * ValueType previous_partial_time_rate;
9773 * ValueType previous_total_time_rate;
9775 * ::Tensor<1, dim, Number> velocity;
9782 * ValueType partial_time_rate;
9783 * ValueType total_time_rate;
9784 * ValueType partial_second_time_rate;
9785 * ValueType total_second_time_rate;
9787 * ValueType partial_time_rate_tangent;
9788 * ValueType total_time_rate_tangent;
9789 * ValueType partial_second_time_rate_tangent;
9790 * ValueType total_second_time_rate_tangent;
9794 * template <typename ValueType, int dim, typename Number>
9795 * TimeRateRequest<ValueType, dim, Number>::
9796 * TimeRateRequest(TimeRateUpdateFlags update_flags):
9797 * update_flags(update_flags) {
9800 * template <typename ValueType, int dim, typename Number>
9801 * TimeRateRequest<ValueType, dim, Number>::~TimeRateRequest() { }
9804 * template <typename ValueType, int dim, typename Number>
9805 * void TimeRateRequest<ValueType, dim, Number>::
9806 * set_value(const ValueType &value) {
9807 * this->value = value;
9811 * template <typename ValueType, int dim, typename Number>
9812 * void TimeRateRequest<ValueType, dim, Number>::
9813 * set_previous_value(const ValueType &previous_value) {
9814 * this->previous_value = previous_value;
9818 * template <typename ValueType, int dim, typename Number>
9819 * void TimeRateRequest<ValueType, dim, Number>::
9820 * set_second_previous_value(const ValueType &second_previous_value) {
9821 * this->second_previous_value = second_previous_value;
9825 * template <typename ValueType, int dim, typename Number>
9826 * void TimeRateRequest<ValueType, dim, Number>::
9827 * set_time_increment(const Number time_increment) {
9828 * this->time_increment = time_increment;
9832 * template <typename ValueType, int dim, typename Number>
9833 * void TimeRateRequest<ValueType, dim, Number>::
9834 * set_previous_time_increment(const Number previous_time_increment) {
9835 * this->previous_time_increment = previous_time_increment;
9839 * template <typename ValueType, int dim, typename Number>
9840 * void TimeRateRequest<ValueType, dim, Number>::
9841 * set_previous_partial_time_rate(const ValueType &previous_partial_time_rate) {
9842 * this->previous_partial_time_rate = previous_partial_time_rate;
9846 * template <typename ValueType, int dim, typename Number>
9847 * void TimeRateRequest<ValueType, dim, Number>::
9848 * set_previous_total_time_rate(const ValueType &previous_total_time_rate) {
9849 * this->previous_total_time_rate = previous_total_time_rate;
9853 * template <typename ValueType, int dim, typename Number>
9854 * void TimeRateRequest<ValueType, dim, Number>::
9855 * set_velocity(const ::Tensor<1, dim, Number> &velocity) {
9856 * this->velocity = velocity;
9862 * template <typename ValueType, int dim, typename Number>
9863 * ValueType TimeRateRequest<ValueType, dim, Number>::
9864 * get_partial_time_rate() const {
9865 * return partial_time_rate;
9869 * template <typename ValueType, int dim, typename Number>
9870 * ValueType TimeRateRequest<ValueType, dim, Number>::
9871 * get_total_time_rate() const {
9872 * return total_time_rate;
9876 * template <typename ValueType, int dim, typename Number>
9877 * ValueType TimeRateRequest<ValueType, dim, Number>::
9878 * get_partial_second_time_rate() const {
9879 * return partial_second_time_rate;
9883 * template <typename ValueType, int dim, typename Number>
9884 * ValueType TimeRateRequest<ValueType, dim, Number>::
9885 * get_total_second_time_rate() const {
9886 * return total_second_time_rate;
9890 * template <typename ValueType, int dim, typename Number>
9891 * ValueType TimeRateRequest<ValueType, dim, Number>::
9892 * get_partial_time_rate_tangent(const ValueType &value_increment) const {
9893 * return partial_time_rate_tangent;
9897 * template <typename ValueType, int dim, typename Number>
9898 * ValueType TimeRateRequest<ValueType, dim, Number>::
9899 * get_partial_second_time_rate_tangent(const ValueType &value_increment) const {
9900 * return partial_second_time_rate_tangent;
9904 * template <typename ValueType, int dim, typename Number>
9905 * template<typename GradientType>
9906 * ValueType TimeRateRequest<ValueType, dim, Number>::
9907 * get_total_time_rate_tangent(
9908 * const ValueType &value_increment,
9909 * const ValueType &gradient_increment) const {
9914 * template <typename ValueType, int dim, typename Number>
9915 * template<typename GradientType>
9916 * ValueType TimeRateRequest<ValueType, dim, Number>::
9917 * get_total_second_time_rate_tangent(
9918 * const ValueType &value_increment,
9919 * const ValueType &gradient_increment) const {
9927 * template <typename ValueType, int dim, typename Number>
9928 * TimeRateUpdateFlags TimeRateRequest<ValueType, dim, Number>::
9929 * get_update_flags() const {
9930 * return update_flags;
9934 * template <typename ValueType, int dim, typename Number>
9935 * ValueType TimeRateRequest<ValueType, dim, Number>::
9936 * get_value() const {
9941 * template <typename ValueType, int dim, typename Number>
9942 * ValueType TimeRateRequest<ValueType, dim, Number>::
9943 * get_previous_value() const {
9944 * return previous_value;
9948 * template <typename ValueType, int dim, typename Number>
9949 * ValueType TimeRateRequest<ValueType, dim, Number>::
9950 * get_second_previous_value() const {
9951 * return second_previous_value;
9955 * template <typename ValueType, int dim, typename Number>
9956 * Number TimeRateRequest<ValueType, dim, Number>::
9957 * get_time_increment() const {
9958 * return time_increment;
9962 * template <typename ValueType, int dim, typename Number>
9963 * Number TimeRateRequest<ValueType, dim, Number>::
9964 * get_previous_time_increment() const {
9965 * return previous_time_increment;
9969 * template <typename ValueType, int dim, typename Number>
9970 * ValueType TimeRateRequest<ValueType, dim, Number>::
9971 * get_previous_partial_time_rate() const {
9972 * return previous_partial_time_rate;
9976 * template <typename ValueType, int dim, typename Number>
9977 * ValueType TimeRateRequest<ValueType, dim, Number>::
9978 * get_previous_total_time_rate() const {
9979 * return previous_total_time_rate;
9983 * template <typename ValueType, int dim, typename Number>
9984 * ::Tensor<1, dim, Number> TimeRateRequest<ValueType, dim, Number>::
9985 * get_velocity() const {
9993 * template <typename ValueType, int dim, typename Number>
9994 * void TimeRateRequest<ValueType, dim, Number>::
9995 * set_partial_time_rate(const ValueType &partial_time_rate) {
9996 * this->partial_time_rate = partial_time_rate;
10000 * template <typename ValueType, int dim, typename Number>
10001 * void TimeRateRequest<ValueType, dim, Number>::
10002 * set_total_time_rate(const ValueType &total_time_rate) {
10003 * this->total_time_rate = total_time_rate;
10007 * template <typename ValueType, int dim, typename Number>
10008 * void TimeRateRequest<ValueType, dim, Number>::
10009 * set_partial_second_time_rate(const ValueType &partial_second_time_rate) {
10010 * this->partial_second_time_rate = partial_second_time_rate;
10014 * template <typename ValueType, int dim, typename Number>
10015 * void TimeRateRequest<ValueType, dim, Number>::
10016 * set_total_second_time_rate(const ValueType &total_second_time_rate) {
10017 * this->total_second_time_rate = total_second_time_rate;
10021 * template <typename ValueType, int dim, typename Number>
10022 * void TimeRateRequest<ValueType, dim, Number>::
10023 * set_partial_time_rate_tangent(const ValueType &partial_time_rate_tangent) {
10024 * this->partial_time_rate_tangent = partial_time_rate_tangent;
10028 * template <typename ValueType, int dim, typename Number>
10029 * void TimeRateRequest<ValueType, dim, Number>::
10030 * set_total_time_rate_tangent(const ValueType &total_time_rate_tangent) {
10031 * this->total_time_rate_tangent = total_time_rate_tangent;
10035 * template <typename ValueType, int dim, typename Number>
10036 * void TimeRateRequest<ValueType, dim, Number>::
10037 * set_partial_second_time_rate_tangent(const ValueType &partial_second_time_rate_tangent) {
10038 * this->partial_second_time_rate_tangent = partial_second_time_rate_tangent;
10042 * template <typename ValueType, int dim, typename Number>
10043 * void TimeRateRequest<ValueType, dim, Number>::
10044 * set_total_second_time_rate_tangent(const ValueType &total_second_time_rate_tangent) {
10045 * this->total_second_time_rate_tangent = total_second_time_rate_tangent;
10049 * } /* namespace PlasticityLab */
10051 * #endif /* TIMERATEREQUEST_H_ */
10055<a name="ann-src/TimeRateUpdateFlags.h"></a>
10056<h1>Annotated version of src/TimeRateUpdateFlags.h</h1>
10063 * * TimeRateUpdateFlags.h
10065 * * Created on: 27 Nov 2019
10069 * #ifndef TIMERATEUPDATEFLAGS_H_
10070 * #define TIMERATEUPDATEFLAGS_H_
10072 * namespace PlasticityLab {
10074 * enum TimeRateUpdateFlags {
10075 * default_timerate_update_flags = 0x0000,
10076 * update_partial_time_rate = 0x0001,
10077 * update_total_time_rate = 0x0002,
10078 * update_partial_second_time_rate=0x0004,
10079 * update_total_second_time_rate=0x0008,
10080 * update_partial_time_rate_tangent=0x0010,
10081 * update_total_time_rate_tangent=0x0020,
10082 * update_partial_second_time_rate_tangent=0x0040,
10083 * update_total_second_time_rate_tangent=0x0080
10087 * TimeRateUpdateFlags
10088 * operator | (TimeRateUpdateFlags f1, TimeRateUpdateFlags f2) {
10089 * return static_cast<TimeRateUpdateFlags> (
10090 * static_cast<unsigned int> (f1) |
10091 * static_cast<unsigned int> (f2));
10095 * const TimeRateUpdateFlags &
10096 * operator |= (TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2) {
10102 * TimeRateUpdateFlags
10103 * operator & (TimeRateUpdateFlags f1, TimeRateUpdateFlags f2) {
10104 * return static_cast<TimeRateUpdateFlags> (
10105 * static_cast<unsigned int> (f1) &
10106 * static_cast<unsigned int> (f2));
10110 * const TimeRateUpdateFlags &
10111 * operator &= (TimeRateUpdateFlags &f1, TimeRateUpdateFlags f2) {
10116 * } /* namespace PlasticityLab */
10118 * #endif /*TIMERATEUPDATEFLAGS_H_*/
10122<a name="ann-src/main.cpp"></a>
10123<h1>Annotated version of src/main.cpp</h1>
10127 * ============================================================================
10129 * Author : Maien Hamed
10132 * Description : Hello World in C++, Ansi-style
10133 * ============================================================================
10139 * #include <iostream>
10141 * #include "utilities.h"
10142 * #include "ThermoPlasticMaterial.h"
10143 * #include "ExponentialHardeningThermoviscoplasticYieldLaw.h"
10144 * #include "JohnsonCookThermoviscoplasticYieldLaw.h"
10145 * #include "ExponentialHardeningElastoplasticMaterial.h"
10146 * #include "PlasticityLabProg.h"
10150 * PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10151 * getExponentialHardeningThermoPlasticMaterial();
10153 * PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10154 * getJohnsonCookThermoPlasticMaterial();
10156 * int main(int argc, char **argv) {
10158 * Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv);
10160 * deallog.depth_console(0);
10161 * auto material = getExponentialHardeningThermoPlasticMaterial();
10162 * PlasticityLab::PlasticityLabProg<DIM> plasticityLab(material);
10163 * plasticityLab.run();
10164 * if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
10165 * std::cout << "Finished." << std::endl; // prints
10167 * } catch (std::exception &exc) {
10168 * std::cerr << std::endl << std::endl
10169 * << "----------------------------------------------------"
10171 * std::cerr << "Exception on processing: " << std::endl
10172 * << exc.what() << std::endl
10173 * << "Aborting!" << std::endl
10174 * << "----------------------------------------------------"
10178 * std::cerr << std::endl << std::endl
10179 * << "----------------------------------------------------"
10181 * std::cerr << "Unknown exception!" << std::endl
10182 * << "Aborting!" << std::endl
10183 * << "----------------------------------------------------"
10190 * PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10191 * getExponentialHardeningThermoPlasticMaterial() {
10192 * double kappa (164206.0), // [MPa]
10193 * mu (801938.0), // [MPa]
10194 * thermal_expansion_coefficient(1.0e-5), // [K^-1]
10195 * thermal_conductivity(4.5e-2), // [J/mm.K.s]
10196 * heat_capacity(3.588e-3), // cp*rho: [J.mm^-3.K^-1]
10197 * K_0(450.0/*std::numeric_limits<double>::max()*/), // [MPa]
10198 * K_infty(715.0/*std::numeric_limits<double>::max()*/), // [MPa]
10199 * delta(16.93), // dimensionless
10200 * H_bar(129.24), // [MPa]
10201 * beta(1.0), // dimensionless (1.0 for isotropic hardening, 0.0 for kinematic hardening)
10202 * flow_stress_softening(0.002), // [K^-1]
10203 * hardening_softening(0.002), // [K^-1]
10204 * dissipation_factor(0.9); // dimensionless
10206 * PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double> thermo_viscoplastic_yield_law(
10212 * flow_stress_softening,
10213 * hardening_softening);
10215 * return PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::ExponentialHardeningThermoviscoplasticYieldLaw<double>, double>
10218 * thermal_expansion_coefficient,
10219 * thermal_conductivity,
10221 * dissipation_factor,
10222 * thermo_viscoplastic_yield_law);
10225 * PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10226 * getJohnsonCookThermoPlasticMaterial() {
10227 * double kappa (103300.0), // [MPa]
10228 * mu (47690.0), // [MPa]
10229 * A(89.7), // [MPa]
10230 * B(291.87), // [MPa]
10231 * C(0.025), // dimensionless
10232 * m(1.09), // dimensionless
10233 * n(0.31), // dimensionless
10234 * melting_temperature(1356), // [K]
10235 * reference_temperature(293.15), // [K]
10236 * reference_strain_rate(1.0), // [s^-1]
10237 * thermal_expansion_coefficient(1.0e-5), // [K^-1]
10238 * thermal_conductivity(4.5e-2), // [J/mm.K.s] // http://www.matweb.com/search/datasheet_print.aspx?matguid=193434cf42e343fab880e1dabdb143ba
10239 * heat_capacity(3.588e-3), // cp*rho: [J.mm^-3.K^-1]
10240 * dissipation_factor(0.9); // dimensionless
10242 * PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double> thermo_viscoplastic_yield_law(
10245 * melting_temperature,
10246 * reference_strain_rate,
10247 * reference_temperature);
10249 * return PlasticityLab::ThermoPlasticMaterial<DIM+1, PlasticityLab::JohnsonCookThermoviscoplasticYieldLaw<double>, double>
10252 * thermal_expansion_coefficient,
10253 * thermal_conductivity,
10255 * dissipation_factor,
10256 * thermo_viscoplastic_yield_law);
10261<a name="ann-src/symmetric_tensor_entries.h"></a>
10262<h1>Annotated version of src/symmetric_tensor_entries.h</h1>
10270 * #include <deal.II/base/symmetric_tensor.h>
10272 * #include <cstddef>
10273 * #include <iterator>
10275 * namespace dealii_utils
10279 * ---------------- Const view ----------------
10282 * template <int rank, int dim, typename Number>
10283 * class SymmetricTensorConstEntriesView
10286 * using tensor_type = ::SymmetricTensor<rank, dim, Number>;
10288 * explicit SymmetricTensorConstEntriesView(const tensor_type &t) : t_(&t) {}
10290 * class const_iterator
10293 * using iterator_category = std::forward_iterator_tag;
10294 * using value_type = Number;
10295 * using difference_type = std::ptrdiff_t;
10296 * using pointer = const Number *;
10297 * using reference = const Number &;
10299 * const_iterator() = default;
10300 * const_iterator(const tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10302 * reference operator*() const { return t_->access_raw_entry(i_); }
10304 * const_iterator &operator++() { ++i_; return *this; }
10305 * const_iterator operator++(int) { const_iterator tmp(*this); ++(*this); return tmp; }
10307 * friend bool operator==(const const_iterator &a, const const_iterator &b)
10309 * return a.t_ == b.t_ && a.i_ == b.i_;
10311 * friend bool operator!=(const const_iterator &a, const const_iterator &b) { return !(a == b); }
10314 * const tensor_type *t_ = nullptr;
10315 * unsigned int i_ = 0;
10318 * const_iterator begin() const { return const_iterator(t_, 0u); }
10319 * const_iterator end() const { return const_iterator(t_, tensor_type::n_independent_components); }
10320 * const_iterator cbegin() const { return begin(); }
10321 * const_iterator cend() const { return end(); }
10324 * const tensor_type *t_;
10330 * ---------------- Mutable view ----------------
10333 * template <int rank, int dim, typename Number>
10334 * class SymmetricTensorMutableEntriesView
10337 * using tensor_type = ::SymmetricTensor<rank, dim, Number>;
10339 * explicit SymmetricTensorMutableEntriesView(tensor_type &t) : t_(&t) {}
10344 * using iterator_category = std::forward_iterator_tag;
10345 * using value_type = Number;
10346 * using difference_type = std::ptrdiff_t;
10347 * using pointer = Number *;
10348 * using reference = Number &;
10350 * iterator() = default;
10351 * iterator(tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10353 * reference operator*() const { return t_->access_raw_entry(i_); }
10355 * iterator &operator++() { ++i_; return *this; }
10356 * iterator operator++(int) { iterator tmp(*this); ++(*this); return tmp; }
10358 * friend bool operator==(const iterator &a, const iterator &b)
10360 * return a.t_ == b.t_ && a.i_ == b.i_;
10362 * friend bool operator!=(const iterator &a, const iterator &b) { return !(a == b); }
10365 * tensor_type *t_ = nullptr;
10366 * unsigned int i_ = 0;
10369 * class const_iterator
10372 * using iterator_category = std::forward_iterator_tag;
10373 * using value_type = Number;
10374 * using difference_type = std::ptrdiff_t;
10375 * using pointer = const Number *;
10376 * using reference = const Number &;
10378 * const_iterator() = default;
10379 * const_iterator(const tensor_type *t, unsigned int i) : t_(t), i_(i) {}
10381 * reference operator*() const { return t_->access_raw_entry(i_); }
10383 * const_iterator &operator++() { ++i_; return *this; }
10384 * const_iterator operator++(int) { const_iterator tmp(*this); ++(*this); return tmp; }
10386 * friend bool operator==(const const_iterator &a, const const_iterator &b)
10388 * return a.t_ == b.t_ && a.i_ == b.i_;
10390 * friend bool operator!=(const const_iterator &a, const const_iterator &b) { return !(a == b); }
10393 * const tensor_type *t_ = nullptr;
10394 * unsigned int i_ = 0;
10397 * iterator begin() { return iterator(t_, 0u); }
10398 * iterator end() { return iterator(t_, tensor_type::n_independent_components); }
10400 * const_iterator begin() const { return const_iterator(t_, 0u); }
10401 * const_iterator end() const { return const_iterator(t_, tensor_type::n_independent_components); }
10402 * const_iterator cbegin() const { return begin(); }
10403 * const_iterator cend() const { return end(); }
10412 * ---------------- Factories ----------------
10415 * template <int rank, int dim, typename Number>
10416 * SymmetricTensorConstEntriesView<rank, dim, Number>
10417 * symmetric_tensor_entries(const ::SymmetricTensor<rank, dim, Number> &t)
10419 * return SymmetricTensorConstEntriesView<rank, dim, Number>(t);
10422 * template <int rank, int dim, typename Number>
10423 * SymmetricTensorMutableEntriesView<rank, dim, Number>
10424 * symmetric_tensor_entries(::SymmetricTensor<rank, dim, Number> &t)
10426 * return SymmetricTensorMutableEntriesView<rank, dim, Number>(t);
10428 * } // namespace dealii_utils
10432<a name="ann-src/utilities.h"></a>
10433<h1>Annotated version of src/utilities.h</h1>
10439 * #ifndef _UTILITIES_H
10440 * #define _UTILITIES_H
10442 * #include <deal.II/base/utilities.h>
10445 * namespace PlasticityLab {
10447 * [[maybe_unused]] static MPI_Comm mpi_communicator(MPI_COMM_WORLD);
10449 * struct NotImplementedException : std::exception {
10450 * const char *what() const _GLIBCXX_USE_NOEXCEPT override {
10451 * return "Not Implemented.!\n";
10455 * } /*namespace PlasticityLab*/
10458 * #endif /*_UTILITIES_H*/
*const Number elongation_rate
*mech_lbc_system interpolatoryConstraintAppliers push_back * InterpolatoryConstraintApplier(*top_constraint_function_map, *y_component_mask)
*const unsigned int n_steps
***const Number total_elongation
* x_component_mask set(0, true)
* * * struct InterferenceTaperTransform *
* * const_iterator()=default
* *endcode **Thermal constraints **code * const Number convection_coefficient
const unsigned int dofs_per_cell
virtual void advance_time(const Number delta_t)
Abstract base class for mapping classes.
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.
@ 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 > &)
std::vector< std::vector< bool > > constant_modes
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()