462 {
464
465 assert(
466 dynamic_cast<MaterialStateVariablesMFront<DisplacementDim> const*>(
467 &material_state_variables));
468
469 auto state = std::make_unique<
470 MaterialStateVariablesMFront<DisplacementDim>>(
471 static_cast<MaterialStateVariablesMFront<DisplacementDim> const&>(
472 material_state_variables));
473 auto& behaviour_data = state->_behaviour_data;
474
475 behaviour_data.dt = dt;
476 behaviour_data.rdt = 1.0;
477 behaviour_data.K[0] =
478 4.0;
479
480 if (behaviour_data.s0.b.btype ==
481 mgis::behaviour::Behaviour::STANDARDFINITESTRAINBEHAVIOUR)
482 {
483 behaviour_data.K[1] = 1.0;
484
485 behaviour_data.K[2] =
486 1.0;
487
488
489 }
490
491
492 {
493 {
494 auto out = behaviour_data.s0.material_properties.begin();
496 {
497 auto const& vals = (*param)(t - dt, x);
498 out = std::copy(vals.begin(), vals.end(), out);
499 }
500 assert(out == behaviour_data.s0.material_properties.end());
501 }
502
503 {
504 auto out = behaviour_data.s1.material_properties.begin();
506 {
507 auto const& vals = (*param)(t, x);
508 out = std::copy(vals.begin(), vals.end(), out);
509 }
510 assert(out == behaviour_data.s1.material_properties.end());
511 }
512 }
513
514
515
516 if (!behaviour_data.s0.external_state_variables.empty())
517 {
518
519
520
521 behaviour_data.s0.external_state_variables[0] =
522 variable_array_prev.temperature;
523 }
524
525 if (!behaviour_data.s1.external_state_variables.empty())
526 {
527
528
529
530 behaviour_data.s1.external_state_variables[0] =
531 variable_array.temperature;
532 }
533
534
535 std::optional<KelvinMatrixType<DisplacementDim>> Q;
537 {
540 }
541
542 boost::mp11::mp_for_each<Gradients>(
543 detail::SetGradient<DisplacementDim>{
544 variable_array_prev, Q, behaviour_data.s0.gradients.data()});
545 boost::mp11::mp_for_each<Gradients>(
546 detail::SetGradient<DisplacementDim>{
547 variable_array, Q, behaviour_data.s1.gradients.data()});
548
549
550
551
552 boost::mp11::mp_for_each<TDynForces>(
553 detail::SetGradient<DisplacementDim>{
554 variable_array_prev, Q,
555 behaviour_data.s0.thermodynamic_forces.data()});
556 boost::mp11::mp_for_each<TDynForces>(
557 detail::SetGradient<DisplacementDim>{
558 variable_array_prev, Q,
559 behaviour_data.s1.thermodynamic_forces.data()});
560
561 auto v = mgis::behaviour::make_view(behaviour_data);
562 auto const status = mgis::behaviour::integrate(v,
_behaviour);
563 if (status != 1)
564 {
566 "MFront: integration failed with status " +
567 std::to_string(status) + ".");
568 }
569
570 OGSMFrontThermodynamicForcesData tdyn_forces_data;
571 tdyn_forces_data.data.resize(
572
573 behaviour_data.s1.thermodynamic_forces.size());
574
575 boost::mp11::mp_for_each<TDynForces>(
576 [&out_data = tdyn_forces_data,
577 &in_data = behaviour_data.s1.thermodynamic_forces,
578 &Q]<typename TDF>(TDF tdf)
579 {
580 OGSMFrontThermodynamicForcesView<DisplacementDim, TDynForces>
581 view;
582
583 if constexpr (TDF::type ==
584 mgis::behaviour::Variable::Type::STENSOR)
585 {
586 if (Q)
587 {
588 view.block(tdf, out_data) =
589 *Q * eigenSwap45View(view.block(tdf, in_data));
590 }
591 else
592 {
593 view.block(tdf, out_data) =
594 eigenSwap45View(view.block(tdf, in_data));
595 }
596 }
597 else if constexpr (TDF::type ==
598 mgis::behaviour::Variable::Type::SCALAR)
599 {
600 view.block(tdf, out_data) = view.block(tdf, in_data);
601 }
602 else
603 {
605 }
606 });
607
608 return std::make_optional(
609 std::make_tuple<OGSMFrontThermodynamicForcesData,
610 std::unique_ptr<typename MechanicsBase<
611 DisplacementDim>::MaterialStateVariables>,
612 OGSMFrontTangentOperatorData>(
613 std::move(tdyn_forces_data),
614 std::move(state),
617 }
OGSMFrontTangentOperatorData tangentOperatorDataMFrontToOGS(std::vector< double > const &mfront_data, std::optional< MathLib::KelvinVector::KelvinMatrixType< DisplacementDim > > const &Q, mgis::behaviour::Behaviour const &behaviour)
KelvinMatrixType< DisplacementDim > fourthOrderRotationMatrix(Eigen::Matrix< double, DisplacementDim, DisplacementDim, Eigen::ColMajor, DisplacementDim, DisplacementDim > const &transformation)
Eigen::Matrix< double, Dimension, Dimension > transformation(SpatialPosition const &pos) const