void AbaqusUserMaterial :: give3dMaterialStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) { AbaqusUserMaterialStatus *ms = dynamic_cast< AbaqusUserMaterialStatus * >( this->giveStatus(gp) ); if ( !ms->hasTangent() ) { ///@todo Make this hack fit more nicely into OOFEM in general; // Evaluating the function once, so that the tangent can be obtained. FloatArray stress(6), strain(6); strain.zero(); this->giveRealStressVector_3d(stress, gp, strain, tStep); } answer = ms->giveTempTangent(); #if 0 double h = 1e-7; FloatArray strain, strainh, stress, stressh; strain = static_cast< StructuralMaterialStatus * >( gp->giveMaterialStatus() )->giveTempStrainVector(); stress = static_cast< StructuralMaterialStatus * >( gp->giveMaterialStatus() )->giveTempStressVector(); FloatMatrix En( strain.giveSize(), strain.giveSize() ); for ( int i = 1; i <= strain.giveSize(); ++i ) { strainh = strain; strainh.at(i) += h; this->giveRealStressVector_3d(stressh, form, gp, strainh, tStep); stressh.subtract(stress); stressh.times(1.0 / h); En.setColumn(stressh, i); } this->giveRealStressVector_3d(stress, form, gp, strain, tStep); printf("En = "); En.printYourself(); printf("Tangent = "); answer.printYourself(); #endif }
void AbaqusUserMaterial :: give3dMaterialStiffnessMatrix_dPdF(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) { AbaqusUserMaterialStatus *ms = dynamic_cast< AbaqusUserMaterialStatus * >( this->giveStatus(gp) ); if ( !ms->hasTangent() ) { ///@todo Make this hack fit more nicely into OOFEM in general; // Evaluating the function once, so that the tangent can be obtained. FloatArray stress, vF; vF = ms->giveTempFVector(); this->giveFirstPKStressVector_3d(stress, gp, vF, tStep); } if ( !mUseNumericalTangent ) { // if(mStressInterpretation == 0) { answer = ms->giveTempTangent(); /* * } * else { * // The Abaqus Documentation of User Subroutines for UMAT Section 1.1.31 says that DDSDDE is defined as * // partial(Delta(sigma))/partial(Delta(epsilon)). * FloatMatrix dSdE; * dSdE = ms->giveTempTangent(); * this->give_dPdF_from(dSdE, answer, gp); * } */ } else { double h = mPerturbation; FloatArray vF, vF_h, stress, stressh; vF = ms->giveTempFVector(); stress = ( ( StructuralMaterialStatus * ) gp->giveMaterialStatus() )->giveTempPVector(); FloatMatrix En(9, 9); for ( int i = 1; i <= 9; ++i ) { vF_h = vF; vF_h.at(i) += h; this->giveFirstPKStressVector_3d(stressh, gp, vF_h, tStep); stressh.subtract(stress); stressh.times(1.0 / h); En.setColumn(stressh, i); } // Reset this->giveFirstPKStressVector_3d(stressh, gp, vF, tStep); /* * printf("En = "); * En.printYourself(); * * answer = ms->giveTempTangent(); * printf("Tangent = "); * answer.printYourself(); * * FloatMatrix diff = En; * diff.subtract(answer); * printf("diff: "); diff.printYourself(); */ answer = En; } }