@@ -126,6 +126,8 @@ namespace mfront::gb::finite_strain {
126126 reportError (d, " invalid choice for consistent tangent operator" );
127127 return -1 ;
128128 }
129+ const auto bs = d.K [0 ] > 50 ;
130+ const auto Ke = bs ? d.K [0 ] - 100 : d.K [0 ];
129131 tfel::math::stensor<N, real> s0;
130132 tfel::math::stensor<N, real> s1;
131133 auto * const thermodynamic_forces0_old = d.s0 .thermodynamic_forces ;
@@ -163,45 +165,49 @@ namespace mfront::gb::finite_strain {
163165 reportError (d, " invalid choice for the stress measure" );
164166 return -1 ;
165167 }
168+ s1 = s0;
166169 d.s0 .thermodynamic_forces = s0.begin ();
167170 d.s1 .thermodynamic_forces = s1.begin ();
168171 }
169172 const auto r = mfront::gb::integrate<Behaviour>(d, smf, p);
170173 d.s0 .thermodynamic_forces = thermodynamic_forces0_old;
171174 d.s1 .thermodynamic_forces = thermodynamic_forces1_old;
172- if ((r) && (sm != StressMeasure::CAUCHY)) {
173- tfel::math::tensor<N, real> F1;
174- tfel::fsalgo::copy<TensorSize>::exe (d.s1 .gradients , F1.begin ());
175- if constexpr ((hypothesis == ModellingHypothesis::PLANESTRESS) ||
176- (hypothesis == ModellingHypothesis::
177- AXISYMMETRICALGENERALISEDPLANESTRESS)) {
178- if constexpr (Traits::has_axial_deformation_gradient_offset) {
179- const auto F1zz = d.s1 .internal_state_variables
180- [Traits::axial_deformation_gradient_offset];
181- if constexpr (hypothesis == ModellingHypothesis::PLANESTRESS) {
182- F1[2 ] += F1zz;
175+ if (Ke > -0.25 ) { // not a prediction
176+ if ((r) && (sm != StressMeasure::CAUCHY)) {
177+ tfel::math::tensor<N, real> F1;
178+ tfel::fsalgo::copy<TensorSize>::exe (d.s1 .gradients , F1.begin ());
179+ if constexpr ((hypothesis == ModellingHypothesis::PLANESTRESS) ||
180+ (hypothesis ==
181+ ModellingHypothesis::
182+ AXISYMMETRICALGENERALISEDPLANESTRESS)) {
183+ if constexpr (Traits::has_axial_deformation_gradient_offset) {
184+ const auto F1zz = d.s1 .internal_state_variables
185+ [Traits::axial_deformation_gradient_offset];
186+ if constexpr (hypothesis == ModellingHypothesis::PLANESTRESS) {
187+ F1[2 ] += F1zz;
188+ } else {
189+ F1[1 ] += F1zz;
190+ }
183191 } else {
184- F1[1 ] += F1zz;
192+ reportError (d,
193+ " the axial deformation gradient is not defined "
194+ " as an internal state variable" );
195+ return -1 ;
185196 }
197+ }
198+ if (sm == StressMeasure::PK1) {
199+ tfel::math::TensorView<N, real> pk1 (d.s1 .thermodynamic_forces );
200+ pk1 = tfel::math::convertCauchyStressToFirstPiolaKirchhoffStress (s1,
201+ F1);
202+ } else if (sm == StressMeasure::PK2) {
203+ tfel::math::StensorView<N, real> S1 (d.s1 .thermodynamic_forces );
204+ S1 = tfel::math::convertCauchyStressToSecondPiolaKirchhoffStress (s1,
205+ F1);
186206 } else {
187- reportError (d,
188- " the axial deformation gradient is not defined "
189- " as an internal state variable" );
207+ reportError (d, " invalid choice for the stress measure" );
190208 return -1 ;
191209 }
192210 }
193- if (sm == StressMeasure::PK1) {
194- tfel::math::TensorView<N, real> pk1 (d.s1 .thermodynamic_forces );
195- pk1 =
196- tfel::math::convertCauchyStressToFirstPiolaKirchhoffStress (s1, F1);
197- } else if (sm == StressMeasure::PK2) {
198- tfel::math::StensorView<N, real> S1 (d.s1 .thermodynamic_forces );
199- S1 =
200- tfel::math::convertCauchyStressToSecondPiolaKirchhoffStress (s1, F1);
201- } else {
202- reportError (d, " invalid choice for the stress measure" );
203- return -1 ;
204- }
205211 }
206212 return r;
207213 } // end of integrate
0 commit comments