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 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(); } */ }