void PhaseFieldElement :: computeStiffnessMatrix_uu(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) { // This is the regular stiffness matrix times G FloatMatrix B, DB, N, D_B; NLStructuralElement *el = this->giveElement(); StructuralCrossSection *cs = dynamic_cast<StructuralCrossSection* > (el->giveCrossSection() ); bool matStiffSymmFlag = cs->isCharacteristicMtrxSymmetric(rMode); answer.clear(); for ( auto gp: el->giveIntegrationRule(0) ) { double dV = el->computeVolumeAround(gp); // compute int_V ( B^t * D_B * B )dV el->computeBmatrixAt(gp, B ); cs->giveCharMaterialStiffnessMatrix(D_B, rMode, gp, tStep); D_B.times( computeG(gp, VM_Total, tStep) ); DB.beProductOf(D_B, B); if ( matStiffSymmFlag ) { answer.plusProductSymmUpper(B, DB, dV); } else { answer.plusProductUnsym(B, DB, dV); } } if ( matStiffSymmFlag ) { answer.symmetrized(); } }
void NLStructuralElement :: computeStiffnessMatrix_withIRulesAsSubcells(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) { StructuralCrossSection *cs = this->giveStructuralCrossSection(); bool matStiffSymmFlag = cs->isCharacteristicMtrxSymmetric(rMode); answer.clear(); if ( !this->isActivated(tStep) ) { return; } FloatMatrix temp; FloatMatrix *m = & answer; if ( this->giveInterpolation() && this->giveInterpolation()->hasSubPatchFormulation() ) { m = & temp; } // Compute matrix from material stiffness FloatMatrix B, D, DB; IntArray irlocnum; for ( auto &iRule: integrationRulesArray ) { for ( auto &gp : *iRule ) { if ( nlGeometry == 0 ) { this->computeBmatrixAt(gp, B); this->computeConstitutiveMatrixAt(D, rMode, gp, tStep); } else if ( nlGeometry == 1 ) { if ( this->domain->giveEngngModel()->giveFormulation() == AL ) { // Material stiffness dC/de this->computeBmatrixAt(gp, B); cs->giveStiffnessMatrix_dCde(D, rMode, gp, tStep); } else { // Material stiffness dP/dF this->computeBHmatrixAt(gp, B); cs->giveStiffnessMatrix_dPdF(D, rMode, gp, tStep); } } double dV = this->computeVolumeAround(gp); DB.beProductOf(D, B); if ( matStiffSymmFlag ) { m->plusProductSymmUpper(B, DB, dV); } else { m->plusProductUnsym(B, DB, dV); } } // localize irule contribution into element matrix if ( this->giveIntegrationRuleLocalCodeNumbers(irlocnum, *iRule) ) { answer.assemble(* m, irlocnum); m->clear(); } } if ( matStiffSymmFlag ) { answer.symmetrized(); } }
void NLStructuralElement :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) { StructuralCrossSection *cs = this->giveStructuralCrossSection(); bool matStiffSymmFlag = cs->isCharacteristicMtrxSymmetric(rMode); answer.clear(); if ( !this->isActivated(tStep) ) { return; } // Compute matrix from material stiffness (total stiffness for small def.) - B^T * dS/dE * B if ( integrationRulesArray.size() == 1 ) { FloatMatrix B, D, DB; for ( auto &gp : *this->giveDefaultIntegrationRulePtr() ) { // Engineering (small strain) stiffness if ( nlGeometry == 0 ) { this->computeBmatrixAt(gp, B); this->computeConstitutiveMatrixAt(D, rMode, gp, tStep); } else if ( nlGeometry == 1 ) { if ( this->domain->giveEngngModel()->giveFormulation() == AL ) { // Material stiffness dC/de this->computeBmatrixAt(gp, B); /// @todo We probably need overloaded function (like above) here as well. cs->giveStiffnessMatrix_dCde(D, rMode, gp, tStep); } else { // Material stiffness dP/dF this->computeBHmatrixAt(gp, B); /// @todo We probably need overloaded function (like above) here as well. cs->giveStiffnessMatrix_dPdF(D, rMode, gp, tStep); } } double dV = this->computeVolumeAround(gp); DB.beProductOf(D, B); if ( matStiffSymmFlag ) { answer.plusProductSymmUpper(B, DB, dV); } else { answer.plusProductUnsym(B, DB, dV); } } if ( this->domain->giveEngngModel()->giveFormulation() == AL ) { FloatMatrix initialStressMatrix; this->computeInitialStressMatrix(initialStressMatrix, tStep); answer.add(initialStressMatrix); } } else { /// @todo Verify that it works with large deformations if ( this->domain->giveEngngModel()->giveFormulation() == AL ) { OOFEM_ERROR("Updated lagrangian not supported yet"); } int iStartIndx, iEndIndx, jStartIndx, jEndIndx; FloatMatrix Bi, Bj, D, Dij, DBj; for ( int i = 0; i < (int)integrationRulesArray.size(); i++ ) { iStartIndx = integrationRulesArray [ i ]->getStartIndexOfLocalStrainWhereApply(); iEndIndx = integrationRulesArray [ i ]->getEndIndexOfLocalStrainWhereApply(); for ( int j = 0; j < (int)integrationRulesArray.size(); j++ ) { IntegrationRule *iRule; jStartIndx = integrationRulesArray [ j ]->getStartIndexOfLocalStrainWhereApply(); jEndIndx = integrationRulesArray [ j ]->getEndIndexOfLocalStrainWhereApply(); if ( i == j ) { iRule = integrationRulesArray [ i ].get(); } else if ( integrationRulesArray [ i ]->giveNumberOfIntegrationPoints() < integrationRulesArray [ j ]->giveNumberOfIntegrationPoints() ) { iRule = integrationRulesArray [ i ].get(); } else { iRule = integrationRulesArray [ j ].get(); } for ( GaussPoint *gp: *iRule ) { // Engineering (small strain) stiffness dSig/dEps if ( nlGeometry == 0 ) { this->computeBmatrixAt(gp, Bi, iStartIndx, iEndIndx); this->computeConstitutiveMatrixAt(D, rMode, gp, tStep); } else if ( nlGeometry == 1 ) { if ( this->domain->giveEngngModel()->giveFormulation() == AL ) { // Material stiffness dC/de this->computeBmatrixAt(gp, Bi); cs->giveStiffnessMatrix_dCde(D, rMode, gp, tStep); } else { // Material stiffness dP/dF this->computeBHmatrixAt(gp, Bi); cs->giveStiffnessMatrix_dPdF(D, rMode, gp, tStep); } } if ( i != j ) { if ( nlGeometry == 0 ) { this->computeBmatrixAt(gp, Bj, jStartIndx, jEndIndx); } else if ( nlGeometry == 1 ) { if ( this->domain->giveEngngModel()->giveFormulation() == AL ) { this->computeBmatrixAt(gp, Bj); } else { this->computeBHmatrixAt(gp, Bj); } } } else { Bj = Bi; } Dij.beSubMatrixOf(D, iStartIndx, iEndIndx, jStartIndx, jEndIndx); double dV = this->computeVolumeAround(gp); DBj.beProductOf(Dij, Bj); if ( matStiffSymmFlag ) { answer.plusProductSymmUpper(Bi, DBj, dV); } else { answer.plusProductUnsym(Bi, DBj, dV); } } } } } if ( matStiffSymmFlag ) { answer.symmetrized(); } }