void CoupledFieldsElement :: giveInternalForcesVectorGen(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord, void (*Nfunc)(GaussPoint*, FloatMatrix), void (*Bfunc)(GaussPoint*, FloatMatrix, int, int), //(GaussPoint*, FloatMatrix) void (*NStressFunc)(GaussPoint*, FloatArray), void (*BStressFunc)(GaussPoint*, FloatArray), double (*dVFunc)(GaussPoint*)) { // General implementation of internal forces that computes // f = sum_gp( N^T*GenStress_N + B^T*GenStress_B ) * dV FloatArray NStress, BStress, vGenStress, NS, BS; FloatMatrix N, B; for ( int j = 0; j < this->giveNumberOfIntegrationRules(); j++ ) { for ( auto &gp: this->giveIntegrationRule(j) ) { double dV = this->computeVolumeAround(gp); // compute generalized stress measures if ( NStressFunc && Nfunc ) { Nfunc(gp, N); NStressFunc(gp, NStress); NS.beTProductOf(N, NStress); answer.add(dV, NS); } if ( BStressFunc && Bfunc ) { Bfunc(gp, B, 1, 3); BStressFunc(gp, BStress); BS.beTProductOf(B, BStress); answer.add(dV, BS); } } } }
void CoupledFieldsElement :: computeStiffnessMatrixGen(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep, void (*Nfunc)(GaussPoint*, FloatMatrix), void (*Bfunc)(GaussPoint*, FloatMatrix), void (*NStiffness)(FloatMatrix, MatResponseMode, GaussPoint*, TimeStep*), void (*BStiffness)(FloatMatrix, MatResponseMode, GaussPoint*, TimeStep*), double (*volumeAround)(GaussPoint*) ) { FloatMatrix B, DB, N, DN, D_B, D_N; IntegrationRule *iRule = this->giveIntegrationRule(0); bool matStiffSymmFlag = this->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode); answer.resize(0,0); for ( int j = 0; j < iRule->giveNumberOfIntegrationPoints(); j++ ) { GaussPoint *gp = iRule->getIntegrationPoint(j); double dV = this->computeVolumeAround(gp); // compute int_V ( N^t * D_N * N )dV if ( NStiffness && Nfunc ) { Nfunc(gp, N); NStiffness(D_N, rMode, gp, tStep); DN.beProductOf(D_N, N); if ( matStiffSymmFlag ) { answer.plusProductSymmUpper(N, DN, dV); } else { answer.plusProductUnsym(N, DN, dV); } } // compute int_V ( B^t * D_B * B )dV if ( BStiffness && Bfunc ) { Bfunc(gp, B); BStiffness(D_B, rMode, gp, tStep); DB.beProductOf(D_B, B); if ( matStiffSymmFlag ) { answer.plusProductSymmUpper(B, DB, dV); } else { answer.plusProductUnsym(B, DB, dV); } } } if ( matStiffSymmFlag ) { answer.symmetrized(); } }