void Tr21Stokes :: computeLoadVector(FloatArray &answer, BodyLoad *load, CharType type, ValueModeType mode, TimeStep *tStep) { if ( type != ExternalForcesVector ) { answer.clear(); return; } FluidDynamicMaterial *mat = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial(); FloatArray N, gVector, temparray(12); load->computeComponentArrayAt(gVector, tStep, VM_Total); temparray.zero(); if ( gVector.giveSize() ) { for ( GaussPoint *gp: *integrationRulesArray [ 0 ] ) { const FloatArray &lcoords = gp->giveNaturalCoordinates(); double rho = mat->give('d', gp); double detJ = fabs( this->interpolation_quad.giveTransformationJacobian( lcoords, FEIElementGeometryWrapper(this) ) ); double dA = detJ * gp->giveWeight(); this->interpolation_quad.evalN( N, lcoords, FEIElementGeometryWrapper(this) ); for ( int j = 0; j < 6; j++ ) { temparray(2 * j) += N(j) * rho * gVector(0) * dA; temparray(2 * j + 1) += N(j) * rho * gVector(1) * dA; } } } answer.resize(15); answer.zero(); answer.assemble(temparray, this->momentum_ordering); }
void Tr21Stokes :: computeBodyLoadVectorAt(FloatArray &answer, Load *load, TimeStep *tStep) { IntegrationRule *iRule = this->integrationRulesArray [ 0 ]; GaussPoint *gp; FloatArray N, gVector, *lcoords, temparray(15); double dA, detJ, rho; load->computeComponentArrayAt(gVector, tStep, VM_Total); temparray.zero(); if ( gVector.giveSize() ) { for ( int k = 0; k < iRule->getNumberOfIntegrationPoints(); k++ ) { gp = iRule->getIntegrationPoint(k); lcoords = gp->giveCoordinates(); rho = this->giveMaterial()->giveCharacteristicValue(MRM_Density, gp, tStep); detJ = fabs( this->interpolation_quad.giveTransformationJacobian(* lcoords, FEIElementGeometryWrapper(this)) ); dA = detJ * gp->giveWeight(); this->interpolation_quad.evalN(N, * lcoords, FEIElementGeometryWrapper(this)); for ( int j = 0; j < 6; j++ ) { temparray(2 * j) += N(j) * rho * gVector(0) * dA; temparray(2 * j + 1) += N(j) * rho * gVector(1) * dA; } } } answer.resize(15); answer.zero(); answer.assemble( temparray, this->ordering ); }
void tet21ghostsolid :: computeLoadVector(FloatArray &answer, Load *load, CharType type, ValueModeType mode, TimeStep *tStep) { answer.resize(64); answer.zero(); if ( type != ExternalForcesVector ) { answer.resize(0); return; } #ifdef __FM_MODULE FluidDynamicMaterial *mat = static_cast< FluidCrossSection * >( this->giveCrossSection() )->giveFluidMaterial(); #endif IntegrationRule *iRule = this->integrationRulesArray [ 0 ]; FloatArray N, gVector, temparray(30), dNv, u, inc, u_prev, vload; FloatMatrix dNx, G; load->computeComponentArrayAt(gVector, tStep, VM_Total); temparray.zero(); vload.resize(4); vload.zero(); this->giveDisplacementsIncrementData(u_prev, u, inc, tStep); for ( int k = 0; k < iRule->giveNumberOfIntegrationPoints(); k++ ) { GaussPoint *gp = iRule->getIntegrationPoint(k); FloatArray *lcoords = gp->giveNaturalCoordinates(); double detJ = fabs( this->interpolation.giveTransformationJacobian( * lcoords, FEIElementGeometryWrapper(this) ) ); double dA = detJ * gp->giveWeight(); // Body load if ( gVector.giveSize() ) { #ifdef __FM_MODULE double rho = mat->give('d', gp); #else OOFEM_ERROR("Missing FM module"); double rho = 1.0; #endif this->interpolation.evalN( N, * lcoords, FEIElementGeometryWrapper(this) ); for ( int j = 0; j < N.giveSize(); j++ ) { temparray(3 * j + 0) += N(j) * rho * gVector(0) * dA; temparray(3 * j + 1) += N(j) * rho * gVector(1) * dA; temparray(3 * j + 2) += N(j) * rho * gVector(2) * dA; } } // "load" from previous step this->interpolation.evaldNdx( dNx, * gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); this->interpolation_lin.evalN( N, * 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); } G.plusDyadUnsym(N, dNv, dA); FloatMatrix GT; GT.beTranspositionOf(G); vload.plusProduct(GT, u_prev, -0.0 ); //vload.printYourself(); } #if USEUNCOUPLED == 1 // Totaly uncoupled answer.assemble(temparray, this->momentum_ordering); #else answer.assemble(temparray, this->ghostdisplacement_ordering); answer.assemble(vload, this->conservation_ordering); #endif // answer.printYourself(); }