void LIBeam2dNL :: computeInitialStressMatrix(FloatMatrix &answer, TimeStep *tStep) { int i, j, n; double dV; GaussPoint *gp; IntegrationRule *iRule; FloatArray stress; FloatMatrix A; Material *mat = this->giveMaterial(); answer.resize(6, 6); answer.zero(); iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; // assemble initial stress matrix for ( i = 0; i < iRule->getNumberOfIntegrationPoints(); i++ ) { gp = iRule->getIntegrationPoint(i); dV = this->computeVolumeAround(gp); stress = ( ( StructuralMaterialStatus * ) mat->giveStatus(gp) )->giveStressVector(); n = stress.giveSize(); if ( n ) { for ( j = 1; j <= n; j++ ) { // loop over each component of strain vector this->computeNLBMatrixAt(A, gp, j); if ( A.isNotEmpty() ) { A.times(stress.at(j) * dV); answer.add(A); } } } } }
void LIBeam3dNL :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) { int i, j; Material *mat = this->giveMaterial(); IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; GaussPoint *gp = iRule->getIntegrationPoint(0); FloatArray nm(6), TotalStressVector(6); FloatMatrix x; double s1, s2; // update temp triad this->updateTempTriad(tStep); if ( useUpdatedGpRecord == 1 ) { TotalStressVector = ( ( StructuralMaterialStatus * ) mat->giveStatus(gp) ) ->giveStressVector(); } else { this->computeStressVector(TotalStressVector, gp, tStep); } for ( i = 1; i <= 3; i++ ) { s1 = s2 = 0.0; for ( j = 1; j <= 3; j++ ) { s1 += tempTc.at(i, j) * TotalStressVector.at(j); s2 += tempTc.at(i, j) * TotalStressVector.at(j + 3); } nm.at(i) = s1; nm.at(i + 3) = s2; } this->computeXMtrx(x, tStep); answer.beProductOf(x, nm); }
void InterfaceElem1d :: drawScalar(oofegGraphicContext &context) { int i, indx, result = 0; GaussPoint *gp; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; TimeStep *tStep = this->giveDomain()->giveEngngModel()->giveCurrentStep(); FloatArray gcoord(3), v1; WCRec p [ 1 ]; IntArray map; GraphicObj *go; double val [ 1 ]; if ( !context.testElementGraphicActivity(this) ) { return; } if ( context.getInternalVarsDefGeoFlag() ) { double defScale = context.getDefScale(); p [ 0 ].x = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(1, tStep, EID_MomentumBalance, defScale) + this->giveNode(2)->giveUpdatedCoordinate(1, tStep, EID_MomentumBalance, defScale) ); p [ 0 ].y = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(2, tStep, EID_MomentumBalance, defScale) + this->giveNode(2)->giveUpdatedCoordinate(2, tStep, EID_MomentumBalance, defScale) ); p [ 0 ].z = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(3, tStep, EID_MomentumBalance, defScale) + this->giveNode(2)->giveUpdatedCoordinate(3, tStep, EID_MomentumBalance, defScale) ); } else { p [ 0 ].x = ( FPNum )( this->giveNode(1)->giveCoordinate(1) ); p [ 0 ].y = ( FPNum )( this->giveNode(1)->giveCoordinate(2) ); p [ 0 ].z = ( FPNum )( this->giveNode(1)->giveCoordinate(3) ); } result += giveIPValue(v1, iRule->getIntegrationPoint(0), context.giveIntVarType(), tStep); for ( i = 0; i < iRule->getNumberOfIntegrationPoints(); i++ ) { result = 0; gp = iRule->getIntegrationPoint(i); result += giveIPValue(v1, gp, context.giveIntVarType(), tStep); result += this->giveIntVarCompFullIndx( map, context.giveIntVarType() ); if ( result != 2 ) { continue; } if ( ( indx = map.at( context.giveIntVarIndx() ) ) == 0 ) { return; } val [ 0 ] = v1.at(indx); context.updateFringeTableMinMax(val, 1); EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER); EASValsSetMType(FILLED_CIRCLE_MARKER); go = CreateMarkerWD3D(p, val [ 0 ]); EGWithMaskChangeAttributes(LAYER_MASK | FILL_MASK | MTYPE_MASK, go); EMAddGraphicsToModel(ESIModel(), go); //} } }
double Lattice2d_mt :: givePressure() { LatticeTransportMaterialStatus *status; GaussPoint *gp; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; gp = iRule->getIntegrationPoint(0); Material *mat = this->giveMaterial(); status = ( LatticeTransportMaterialStatus * ) mat->giveStatus(gp); return status->givePressure(); }
double Lattice2d :: giveCrackWidth() { LatticeMaterialStatus *status; GaussPoint *gp; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; gp = iRule->getIntegrationPoint(0); status = static_cast< LatticeMaterialStatus * >( gp->giveMaterialStatus() ); double crackWidth = 0; crackWidth = status->giveCrackWidth(); return crackWidth; }
int Lattice2d :: giveCrackFlag() { LatticeMaterialStatus *status; GaussPoint *gp; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; gp = iRule->getIntegrationPoint(0); status = static_cast< LatticeMaterialStatus * >( gp->giveMaterialStatus() ); int crackFlag = 0; crackFlag = status->giveCrackFlag(); return crackFlag; }
int Lattice2d :: hasBeenUpdated() { LatticeMaterialStatus *status; GaussPoint *gp; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; gp = iRule->getIntegrationPoint(0); status = static_cast< LatticeMaterialStatus * >( gp->giveMaterialStatus() ); int updateFlag = 0; updateFlag = status->hasBeenUpdated(); return updateFlag; }
double Lattice2d :: giveOldNormalStress() { LatticeMaterialStatus *status; GaussPoint *gp; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; gp = iRule->getIntegrationPoint(0); status = static_cast< LatticeMaterialStatus * >( gp->giveMaterialStatus() ); double normalStress = 0; normalStress = status->giveOldNormalStress(); return normalStress; }
double Lattice2d :: giveDeltaDissipation() { LatticeMaterialStatus *status; GaussPoint *gp; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; gp = iRule->getIntegrationPoint(0); status = static_cast< LatticeMaterialStatus * >( gp->giveMaterialStatus() ); double deltaDissipation = 0; deltaDissipation = status->giveDeltaDissipation(); return deltaDissipation; }
double Lattice2d_mt :: giveMass() { LatticeTransportMaterialStatus *status; GaussPoint *gp; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; gp = iRule->getIntegrationPoint(0); Material *mat = this->giveMaterial(); status = ( LatticeTransportMaterialStatus * ) mat->giveStatus(gp); double mass = 0; mass = status->giveMass(); //multiply with volume mass *= this->length * this->width / 2.; return mass; }
void LIBeam3dNL :: computeTempCurv(FloatArray &answer, TimeStep *tStep) { Material *mat = this->giveMaterial(); IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; GaussPoint *gp = iRule->getIntegrationPoint(0); ; FloatArray ui(3), xd(3), curv(3), ac(3), PrevEpsilon; FloatMatrix sc(3, 3), tmid(3, 3); answer.resize(3); // update curvature at midpoint // first, compute Tmid // ask increments this->computeVectorOf(EID_MomentumBalance, VM_Incremental, tStep, ui); ac.at(1) = 0.5 * ( ui.at(10) - ui.at(4) ); ac.at(2) = 0.5 * ( ui.at(11) - ui.at(5) ); ac.at(3) = 0.5 * ( ui.at(12) - ui.at(6) ); this->computeSMtrx(sc, ac); sc.times(1. / 2.); // compute I+sc sc.at(1, 1) += 1.0; sc.at(2, 2) += 1.0; sc.at(3, 3) += 1.0; tmid.beProductOf(sc, this->tc); // update curvature at centre ac.at(1) = ( ui.at(10) - ui.at(4) ); ac.at(2) = ( ui.at(11) - ui.at(5) ); ac.at(3) = ( ui.at(12) - ui.at(6) ); answer.beTProductOf(tmid, ac); answer.times(1 / this->l0); // ask for previous kappa PrevEpsilon = ( ( StructuralMaterialStatus * ) mat->giveStatus(gp) )->giveStrainVector(); if ( PrevEpsilon.giveSize() ) { answer.at(1) += PrevEpsilon.at(4); answer.at(2) += PrevEpsilon.at(5); answer.at(3) += PrevEpsilon.at(6); } }
void StructuralInterfaceElement :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) { // Computes internal forces // if useGpRecord == 1 then data stored in ip->giveStressVector() are used // instead computing stressVector through this->ComputeStressVector(); // this must be done after you want internal forces after element->updateYourself() // has been called for the same time step. IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; FloatMatrix N, rotationMatGtoL; FloatArray u, traction, tractionTemp, jump; this->computeVectorOf(VM_Total, tStep, u); // subtract initial displacements, if defined if ( initialDisplacements ) { u.subtract(* initialDisplacements); } // zero answer will resize accordingly when adding first contribution answer.clear(); for ( IntegrationPoint *ip: *iRule ) { this->computeNmatrixAt(ip, N); //if ( useUpdatedGpRecord == 1 ) { // StructuralInterfaceMaterialStatus *status = static_cast< StructuralInterfaceMaterialStatus * >( ip->giveMaterialStatus() ); // //temp // FloatArray traction3d; // traction3d = status->giveTraction(); // traction.setValues(2, traction3d.at(1), traction3d.at(3) ); //} else { jump.beProductOf(N, u); this->computeTraction(traction, ip, jump, tStep); //} // compute internal cohesive forces as f = N^T*traction dA double dA = this->computeAreaAround(ip); answer.plusProduct(N, traction, dA); } }
void StructuralInterfaceElement :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) { // Computes the stiffness matrix of the receiver K_cohesive = int_A ( N^t * dT/dj * N ) dA FloatMatrix N, D, DN; bool matStiffSymmFlag = this->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode); answer.clear(); IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; FloatMatrix rotationMatGtoL; for ( IntegrationPoint *ip: *iRule ) { if ( this->nlGeometry == 0 ) { this->giveStiffnessMatrix_Eng(D, rMode, ip, tStep); } else if ( this->nlGeometry == 1 ) { this->giveStiffnessMatrix_dTdj(D, rMode, ip, tStep); } else { OOFEM_ERROR("nlgeometry must be 0 or 1!") } this->computeTransformationMatrixAt(ip, rotationMatGtoL); D.rotatedWith(rotationMatGtoL, 't'); // transform stiffness to global coord system this->computeNmatrixAt(ip, N); DN.beProductOf(D, N); double dA = this->computeAreaAround(ip); if ( matStiffSymmFlag ) { answer.plusProductSymmUpper(N, DN, dA); } else { answer.plusProductUnsym(N, DN, dA); } } if ( matStiffSymmFlag ) { answer.symmetrized(); } }
void NLStructuralElement :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) // // returns nodal representation of real internal forces - necessary only for // non-linear analysis. // if useGpRecord == 1 then data stored in gp->giveStressVector() are used // instead computing stressVector through this->ComputeStressVector(); // this must be done after you want internal forces after element->updateYourself() // has been called for the same time step. // { GaussPoint *gp; Material *mat = this->giveMaterial(); IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; FloatMatrix b, A, *ut = NULL, b2; FloatArray bs, TotalStressVector, u; int i, j, k; double dV; // do not resize answer to computeNumberOfDofs(EID_MomentumBalance) // as this is valid only if receiver has no nodes with slaves // zero answer will resize accordingly when adding first contribution answer.resize(0); if ( nlGeometry ) { this->computeVectorOf(EID_MomentumBalance, VM_Total, tStep, u); if ( u.giveSize() ) { ut = new FloatMatrix( &u, 1); } else { ut = NULL; } } for ( i = 0; i < iRule->getNumberOfIntegrationPoints(); i++ ) { gp = iRule->getIntegrationPoint(i); this->computeBmatrixAt(gp, b); if ( nlGeometry ) { for ( j = 1; j <= b.giveNumberOfRows(); j++ ) { // loop over each component of strain vector this->computeNLBMatrixAt(A, gp, j); if ( ( A.isNotEmpty() ) && ( ut != NULL ) ) { b2.beProductOf(*ut,A); for ( k = 1; k <= b.giveNumberOfColumns(); k++ ) { // add nonlinear contribution to each component b.at(j, k) += b2.at(1, k); //mj } } } } // end nlGeometry if ( useUpdatedGpRecord == 1 ) { TotalStressVector = ( ( StructuralMaterialStatus * ) mat->giveStatus(gp) ) ->giveStressVector(); } else { this->computeStressVector(TotalStressVector, gp, tStep); } // // updates gp stress and strain record acording to current // increment of displacement // if ( TotalStressVector.giveSize() == 0 ) { break; } // // now every gauss point has real stress vector // // compute nodal representation of internal forces using f = B^T*Sigma dV // dV = this->computeVolumeAround(gp); bs.beTProductOf(b, TotalStressVector); answer.add(dV, bs); } if ( nlGeometry ) { delete ut; } // if inactive update fields; but do not contribute to structure if ( !this->isActivated(tStep) ) { answer.zero(); return; } }
void NLStructuralElement :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) // // Computes numerically the stiffness matrix of the receiver. // taking into account possible effects of nonlinear geometry // { int i, j, k, l, m, n, iStartIndx, iEndIndx, jStartIndx, jEndIndx; double dV; FloatMatrix d, A, *ut = NULL, b2; FloatMatrix bi, bj, dbj, dij; FloatArray u, stress; GaussPoint *gp; IntegrationRule *iRule; bool matStiffSymmFlag = this->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode, this->material); answer.resize( computeNumberOfDofs(EID_MomentumBalance), computeNumberOfDofs(EID_MomentumBalance) ); answer.zero(); if ( !this->isActivated(tStep) ) { return; } Material *mat = this->giveMaterial(); if ( nlGeometry ) { this->computeVectorOf(EID_MomentumBalance, VM_Total, tStep, u); if ( u.giveSize() ) { ut = new FloatMatrix( &u, 1); } else { ut = NULL; } } if ( numberOfIntegrationRules > 1 ) { for ( i = 0; i < numberOfIntegrationRules; i++ ) { iStartIndx = integrationRulesArray [ i ]->getStartIndexOfLocalStrainWhereApply(); iEndIndx = integrationRulesArray [ i ]->getEndIndexOfLocalStrainWhereApply(); for ( j = 0; j < numberOfIntegrationRules; j++ ) { jStartIndx = integrationRulesArray [ j ]->getStartIndexOfLocalStrainWhereApply(); jEndIndx = integrationRulesArray [ j ]->getEndIndexOfLocalStrainWhereApply(); if ( i == j ) { iRule = integrationRulesArray [ i ]; } else if ( integrationRulesArray [ i ]->getNumberOfIntegrationPoints() < integrationRulesArray [ j ]->getNumberOfIntegrationPoints() ) { iRule = integrationRulesArray [ i ]; } else { iRule = integrationRulesArray [ j ]; } for ( k = 0; k < iRule->getNumberOfIntegrationPoints(); k++ ) { gp = iRule->getIntegrationPoint(k); this->computeBmatrixAt(gp, bi, iStartIndx, iEndIndx); if ( i != j ) { this->computeBmatrixAt(gp, bj, jStartIndx, jEndIndx); } else { bj = bi; } if ( nlGeometry ) { for ( l = 0; l < bi.giveNumberOfRows(); l++ ) { // loop over each component of strain vector this->computeNLBMatrixAt(A, gp, l + iStartIndx); if ( ( A.isNotEmpty() ) && ( ut != NULL ) ) { b2.beProductOf(* ut, A); for ( m = 1; m <= bi.giveNumberOfColumns(); m++ ) { // add nonlinear contribution to each component bi.at(l + 1, m) += b2.at(1, m); //mj } } } } if ( nlGeometry && ( i != j ) ) { for ( l = 0; l < bj.giveNumberOfRows(); l++ ) { // loop over each component of strain vector this->computeNLBMatrixAt(A, gp, l + jStartIndx); if ( ( A.isNotEmpty() ) && ( ut != NULL ) ) { b2.beProductOf(* ut, A); for ( m = 1; m <= bj.giveNumberOfColumns(); m++ ) { // add nonlinear contribution to each component bj.at(l + 1, m) += b2.at(1, m); //mj } } } } // end nlGeometry this->computeConstitutiveMatrixAt(d, rMode, gp, tStep); dij.beSubMatrixOf(d, iStartIndx, iEndIndx, jStartIndx, jEndIndx); dV = this->computeVolumeAround(gp); dbj.beProductOf(dij, bj); if ( matStiffSymmFlag ) { answer.plusProductSymmUpper(bi, dbj, dV); } else { answer.plusProductUnsym(bi, dbj, dV); } } } } } else { // numberOfIntegrationRules == 1 iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; for ( j = 0; j < iRule->getNumberOfIntegrationPoints(); j++ ) { gp = iRule->getIntegrationPoint(j); this->computeBmatrixAt(gp, bj); if ( nlGeometry ) { for ( l = 1; l <= bj.giveNumberOfRows(); l++ ) { // loop over each component of strain vector this->computeNLBMatrixAt(A, gp, l); if ( ( A.isNotEmpty() ) && ( ut != NULL ) ) { b2.beProductOf(* ut, A); for ( k = 1; k <= bj.giveNumberOfColumns(); k++ ) { // add nonlinear contribution to each component bj.at(l, k) += b2.at(1, k); //mj } } } } // end nlGeometry this->computeConstitutiveMatrixAt(d, rMode, gp, tStep); dV = this->computeVolumeAround(gp); dbj.beProductOf(d, bj); if ( matStiffSymmFlag ) { answer.plusProductSymmUpper(bj, dbj, dV); } else { answer.plusProductUnsym(bj, dbj, dV); } } } if ( nlGeometry ) { delete ut; } if ( nlGeometry ) { iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; // assemble initial stress matrix for ( i = 0; i < iRule->getNumberOfIntegrationPoints(); i++ ) { gp = iRule->getIntegrationPoint(i); dV = this->computeVolumeAround(gp); stress = ( ( StructuralMaterialStatus * ) mat->giveStatus(gp) )->giveTempStressVector(); n = stress.giveSize(); if ( n ) { for ( j = 1; j <= n; j++ ) { // loop over each component of strain vector this->computeNLBMatrixAt(A, gp, j); if ( A.isNotEmpty() ) { A.times(stress.at(j) * dV); answer.add(A); } } } } } // end nlGeometry if ( matStiffSymmFlag ) { answer.symmetrized(); } }
void tet21ghostsolid :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) { IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; #ifdef __FM_MODULE FluidDynamicMaterial *fluidMaterial = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial(); #endif FloatMatrix Kf, G, Kx, B, Ed, dNx; FloatArray Strain, Stress, Nlin, dNv, a, aVelocity, aPressure, aGhostDisplacement, fluidStress, epsf; FloatArray momentum, conservation, auxstress; double pressure, epsvol; this->computeVectorOf( VM_Total, tStep, a); if (!tStep->isTheFirstStep()) { // a.printYourself(); } aVelocity.beSubArrayOf(a, momentum_ordering); aPressure.beSubArrayOf(a, conservation_ordering); aGhostDisplacement.beSubArrayOf(a, ghostdisplacement_ordering); for (int j = 0; j<iRule->giveNumberOfIntegrationPoints(); j++) { GaussPoint *gp = iRule->getIntegrationPoint(j); double detJ = fabs( ( this->interpolation.giveTransformationJacobian( * gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ) ) ); double weight = gp->giveWeight(); this->interpolation.evaldNdx( dNx, * gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); this->interpolation_lin.evalN( Nlin, * gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); dNv.resize(30); for (int k = 0; k<dNx.giveNumberOfColumns(); k++) { dNv.at(k*3+1) = dNx.at(1,k+1); dNv.at(k*3+2) = dNx.at(2,k+1); dNv.at(k*3+3) = dNx.at(3,k+1); } if (nlGeometry == 0) { this->computeBmatrixAt(gp, B); epsf.beProductOf(B, aVelocity); pressure = Nlin.dotProduct(aPressure); // Fluid part gp->setMaterialMode(_3dFlow); #ifdef __FM_MODULE fluidMaterial->computeDeviatoricStressVector(fluidStress, epsvol, gp, epsf, pressure, tStep); #else OOFEM_ERROR("Missing FM module"); #endif gp->setMaterialMode(_3dMat); momentum.plusProduct(B, fluidStress, detJ*weight); momentum.add(-pressure * detJ * weight, dNv); conservation.add(epsvol * detJ * weight, Nlin); // Ghost solid part Strain.beProductOf(B, aGhostDisplacement); Stress.beProductOf(Dghost, Strain); auxstress.plusProduct(B, Stress, detJ * weight); } else { OOFEM_ERROR("No support for large deformations yet!"); } } answer.resize(64); answer.zero(); #if USEUNCOUPLED == 1 // Totaly uncoupled answer.assemble(momentum, momentum_ordering); answer.assemble(conservation, conservation_ordering); answer.assemble(auxstress, ghostdisplacement_ordering); #else answer.assemble(momentum, ghostdisplacement_ordering); answer.assemble(conservation, conservation_ordering); answer.assemble(auxstress, momentum_ordering); #endif // Test linear /* if (this->giveNumber() == 364) { FloatMatrix K; FloatArray ans; this->computeStiffnessMatrix(K, TangentStiffness, tStep); ans.beProductOf(K, a); ans.printYourself(); answer.printYourself(); } */ }
void tet21ghostsolid :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) { IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; #ifdef __FM_MODULE FluidDynamicMaterial *fluidMaterial = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial(); #endif FloatMatrix Kf, G, Kx, D, B, Ed, EdB, dNx; FloatArray Nlin, dNv; for (int j = 0; j<iRule->giveNumberOfIntegrationPoints(); j++) { GaussPoint *gp = iRule->getIntegrationPoint(j); double detJ = fabs( ( this->interpolation.giveTransformationJacobian( * gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ) ) ); double weight = gp->giveWeight(); this->interpolation.evaldNdx( dNx, * gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); this->interpolation_lin.evalN( Nlin, * gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); dNv.resize(30); // dNv = [dN1/dx dN1/dy dN1/dz dN2/dx dN2/dy dN2/dz ... dN10/dz] for (int k = 0; k<dNx.giveNumberOfRows(); k++) { dNv.at(k*3+1) = dNx.at(k+1,1); dNv.at(k*3+2) = dNx.at(k+1,2); dNv.at(k*3+3) = dNx.at(k+1,3); } if (nlGeometry == 0) { this->computeBmatrixAt(gp, B); // Fluid part gp->setMaterialMode(_3dFlow); #ifdef __FM_MODULE fluidMaterial->giveDeviatoricStiffnessMatrix(Ed, TangentStiffness, gp, tStep); #else OOFEM_ERROR("Fluid module missing\n"); #endif gp->setMaterialMode(_3dMat); EdB.beProductOf(Ed, B); Kf.plusProductSymmUpper(B, EdB, detJ*weight); // Ghost solid part EdB.beProductOf(Dghost, B); Kx.plusProductSymmUpper(B, EdB, detJ*weight); // Incompressibility part G.plusDyadUnsym(dNv, Nlin, -detJ*weight); } else { OOFEM_ERROR ("No support for large deformations yet!"); } } FloatMatrix GT; GT.beTranspositionOf(G); //GTdeltat.beTranspositionOf(G); //GTdeltat.times(deltat); Kf.symmetrized(); Kx.symmetrized(); // Kf.printYourself(); // G.printYourself(); // GT.printYourself(); // Kx.printYourself(); answer.resize(64, 64); answer.zero(); #define USEUNCOUPLED 0 #if USEUNCOUPLED == 1 // Totaly uncoupled answer.assemble(Kf, momentum_ordering, momentum_ordering); answer.assemble(G, momentum_ordering, conservation_ordering); answer.assemble(GT, conservation_ordering, momentum_ordering); answer.assemble(Kx, ghostdisplacement_ordering, ghostdisplacement_ordering); #else answer.assemble(Kf, ghostdisplacement_ordering, ghostdisplacement_ordering); answer.assemble(Kf, ghostdisplacement_ordering, momentum_ordering); answer.assemble(G, ghostdisplacement_ordering, conservation_ordering); answer.assemble(GT, conservation_ordering, ghostdisplacement_ordering); answer.assemble(GT, conservation_ordering, momentum_ordering); answer.assemble(Kx, momentum_ordering, ghostdisplacement_ordering); #endif //answer.printYourself(); }
void LIBeam3dNL :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) { int i, j, k; double s1, s2; FloatMatrix d, x, xt(12, 6), dxt, sn, sm, sxd, y; FloatArray n(3), m(3), xd(3), TotalStressVector; IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; GaussPoint *gp = iRule->getIntegrationPoint(0); answer.resize( this->computeNumberOfDofs(EID_MomentumBalance), this->computeNumberOfDofs(EID_MomentumBalance) ); answer.zero(); // linear part this->updateTempTriad(tStep); // update temp triad this->computeXMtrx(x, tStep); xt.zero(); for ( i = 1; i <= 12; i++ ) { for ( j = 1; j <= 3; j++ ) { for ( k = 1; k <= 3; k++ ) { // compute x*Tbar, taking into account sparsity of Tbar xt.at(i, j) += x.at(i, k) * tempTc.at(k, j); xt.at(i, j + 3) += x.at(i, k + 3) * tempTc.at(k, j); } } } this->computeConstitutiveMatrixAt(d, rMode, gp, tStep); dxt.beProductTOf(d, xt); answer.beProductOf(xt, dxt); answer.times(1. / this->l0); // geometric stiffness ks = ks1+ks2 // ks1 this->computeStressVector(TotalStressVector, gp, tStep); for ( i = 1; i <= 3; i++ ) { s1 = s2 = 0.0; for ( j = 1; j <= 3; j++ ) { s1 += tempTc.at(i, j) * TotalStressVector.at(j); s2 += tempTc.at(i, j) * TotalStressVector.at(j + 3); } n.at(i) = s1; m.at(i) = s2; } this->computeSMtrx(sn, n); this->computeSMtrx(sm, m); for ( i = 1; i <= 3; i++ ) { for ( j = 1; j <= 3; j++ ) { answer.at(i, j + 3) += sn.at(i, j); answer.at(i, j + 9) += sn.at(i, j); answer.at(i + 3, j + 3) += sm.at(i, j); answer.at(i + 3, j + 9) += sm.at(i, j); answer.at(i + 6, j + 3) -= sn.at(i, j); answer.at(i + 6, j + 9) -= sn.at(i, j); answer.at(i + 9, j + 3) -= sm.at(i, j); answer.at(i + 9, j + 9) -= sm.at(i, j); } } // ks2 this->computeXdVector(xd, tStep); this->computeSMtrx(sxd, xd); y.beProductOf(sxd, sn); y.times(0.5); for ( i = 1; i <= 3; i++ ) { for ( j = 1; j <= 3; j++ ) { answer.at(i + 3, j) -= sn.at(i, j); answer.at(i + 3, j + 3) += y.at(i, j); answer.at(i + 3, j + 6) += sn.at(i, j); answer.at(i + 3, j + 9) += y.at(i, j); answer.at(i + 9, j) -= sn.at(i, j); answer.at(i + 9, j + 3) += y.at(i, j); answer.at(i + 9, j + 6) += sn.at(i, j); answer.at(i + 9, j + 9) += y.at(i, j); } } }