void NonLinearDynamic :: assembleIncrementalReferenceLoadVectors(FloatArray &_incrementalLoadVector, FloatArray &_incrementalLoadVectorOfPrescribed, SparseNonLinearSystemNM :: referenceLoadInputModeType _refMode, Domain *sourceDomain, EquationID ut, TimeStep *tStep) { EModelDefaultEquationNumbering en; _incrementalLoadVector.resize( sourceDomain->giveEngngModel()->giveNumberOfDomainEquations(sourceDomain->giveNumber(), EModelDefaultEquationNumbering()) ); _incrementalLoadVector.zero(); _incrementalLoadVectorOfPrescribed.resize( sourceDomain->giveEngngModel()->giveNumberOfDomainEquations(sourceDomain->giveNumber(), EModelDefaultPrescribedEquationNumbering()) ); _incrementalLoadVectorOfPrescribed.zero(); if ( _refMode == SparseNonLinearSystemNM :: rlm_incremental ) { this->assembleVector(_incrementalLoadVector, tStep, ut, ExternalForcesVector, VM_Incremental, EModelDefaultEquationNumbering(), sourceDomain); this->assembleVector(_incrementalLoadVectorOfPrescribed, tStep, ut, ExternalForcesVector, VM_Incremental, EModelDefaultPrescribedEquationNumbering(), sourceDomain); } else { this->assembleVector(_incrementalLoadVector, tStep, ut, ExternalForcesVector, VM_Total, EModelDefaultEquationNumbering(), sourceDomain); this->assembleVector(_incrementalLoadVectorOfPrescribed, tStep, ut, ExternalForcesVector, VM_Total, EModelDefaultPrescribedEquationNumbering(), sourceDomain); } #ifdef __PARALLEL_MODE this->updateSharedDofManagers(_incrementalLoadVector, LoadExchangeTag); #endif }
void NonLinearStatic :: assembleIncrementalReferenceLoadVectors(FloatArray &_incrementalLoadVector, FloatArray &_incrementalLoadVectorOfPrescribed, SparseNonLinearSystemNM :: referenceLoadInputModeType _refMode, Domain *sourceDomain, TimeStep *tStep) { _incrementalLoadVector.resize( sourceDomain->giveEngngModel()->giveNumberOfDomainEquations( sourceDomain->giveNumber(), EModelDefaultEquationNumbering() ) ); _incrementalLoadVector.zero(); _incrementalLoadVectorOfPrescribed.resize( sourceDomain->giveEngngModel()->giveNumberOfDomainEquations( sourceDomain->giveNumber(), EModelDefaultPrescribedEquationNumbering() ) ); _incrementalLoadVectorOfPrescribed.zero(); if ( _refMode == SparseNonLinearSystemNM :: rlm_incremental ) { ///@todo This was almost definitely wrong before. It never seems to be used. Is this code even relevant? this->assembleVector(_incrementalLoadVector, tStep, ExternalForceAssembler(), VM_Incremental, EModelDefaultEquationNumbering(), sourceDomain); this->assembleVector(_incrementalLoadVectorOfPrescribed, tStep, ExternalForceAssembler(), VM_Incremental, EModelDefaultPrescribedEquationNumbering(), sourceDomain); } else { this->assembleVector(_incrementalLoadVector, tStep, ExternalForceAssembler(), VM_Total, EModelDefaultEquationNumbering(), sourceDomain); this->assembleVector(_incrementalLoadVectorOfPrescribed, tStep, ExternalForceAssembler(), VM_Total, EModelDefaultPrescribedEquationNumbering(), sourceDomain); } this->updateSharedDofManagers(_incrementalLoadVector, EModelDefaultEquationNumbering(), LoadExchangeTag); }
int IntMatIsoDamage :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) { IntMatIsoDamageStatus *status = static_cast< IntMatIsoDamageStatus * >( this->giveStatus(gp) ); if ( type == IST_DamageTensor ) { answer.resize(6); answer.zero(); answer.at(1) = answer.at(2) = answer.at(3) = status->giveDamage(); return 1; } else if ( type == IST_DamageTensorTemp ) { answer.resize(6); answer.zero(); answer.at(1) = answer.at(2) = answer.at(3) = status->giveTempDamage(); return 1; } else if ( type == IST_PrincipalDamageTensor ) { answer.resize(3); answer.at(1) = answer.at(2) = answer.at(3) = status->giveDamage(); return 1; } else if ( type == IST_PrincipalDamageTempTensor ) { answer.resize(3); answer.at(1) = answer.at(2) = answer.at(3) = status->giveTempDamage(); return 1; } else if ( type == IST_MaxEquivalentStrainLevel ) { answer.resize(1); answer.at(1) = status->giveKappa(); return 1; } else { return StructuralInterfaceMaterial :: giveIPValue(answer, gp, type, tStep); } }
void M1Material :: giveRealStressVector_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &totalStrain, TimeStep *tStep) { answer.resize(6); answer.zero(); // get the status at the beginning M1MaterialStatus *status = static_cast< M1MaterialStatus * >( this->giveStatus(gp) ); // prepare status at the end this->initTempStatus(gp); // get the initial values of plastic strains on microplanes (set to zero in the first step) FloatArray epspN = status->giveNormalMplanePlasticStrains(); if ( epspN.giveSize() < numberOfMicroplanes ) { epspN.resize(numberOfMicroplanes); epspN.zero(); } // loop over microplanes FloatArray sigN(numberOfMicroplanes); IntArray plState(numberOfMicroplanes); for ( int imp = 1; imp <= numberOfMicroplanes; imp++ ) { Microplane *mPlane = this->giveMicroplane(imp - 1, gp); //IntegrationPointStatus *mPlaneStatus = this->giveMicroplaneStatus(mPlane); double epsN = computeNormalStrainComponent(mPlane, totalStrain); // evaluate trial stress on the microplane double sigTrial = EN * ( epsN - epspN.at(imp) ); // evaluate the yield stress (from total microplane strain, not from its plastic part) double sigYield = EN * ( s0 + HN * epsN ) / ( EN + HN ); if ( sigYield < 0. ) { sigYield = 0.; } // check whether the yield stress is exceeded and set the microplane stress if ( sigTrial > sigYield ) { //plastic yielding sigN.at(imp) = sigYield; epspN.at(imp) = epsN - sigYield / EN; plState.at(imp) = 1; } else { sigN.at(imp) = sigTrial; plState.at(imp) = 0; } // add the contribution of the microplane to macroscopic stresses for ( int i = 1; i <= 6; i++ ) { answer.at(i) += N [ imp - 1 ] [ i - 1 ] * sigN.at(imp) * microplaneWeights [ imp - 1 ]; } } // multiply the integral over unit hemisphere by 6 answer.times(6); // update status status->letTempStrainVectorBe(totalStrain); status->letTempStressVectorBe(answer); status->letTempNormalMplaneStressesBe(sigN); status->letTempNormalMplanePlasticStrainsBe(epspN); status->letPlasticStateIndicatorsBe(plState); }
void SimpleCrossSection :: giveReducedCharacteristicVector(FloatArray &answer, GaussPoint *gp, const FloatArray &charVector3d) // // returns reduced stressVector or strainVector from full 3d vector reduced // to vector required by gp->giveStressStrainMode() // { MaterialMode mode = gp->giveMaterialMode(); StructuralMaterial *mat = static_cast< StructuralMaterial * >( gp->giveElement()->giveMaterial() ); IntArray indx; int size = charVector3d.giveSize(); int i, j; if ( ( mode == _3dShell ) || ( mode == _3dBeam ) || ( mode == _2dPlate ) || ( mode == _2dBeam ) ) { if ( size != 12 ) { OOFEM_ERROR("SimpleCrossSection :: giveReducedCharacteristicVector - charVector3d size mismatch"); } mat->giveStressStrainMask( indx, ReducedForm, gp->giveMaterialMode() ); answer.resize( indx.giveSize() ); answer.zero(); for ( i = 1; i <= indx.giveSize(); i++ ) { if ( ( j = indx.at(i) ) ) { answer.at(i) = charVector3d.at(j); } } return; } else if ( mode == _3dBeam ) { if ( size != 6 ) { OOFEM_ERROR("SimpleCrossSection :: giveReducedCharacteristicVector - charVector3d size mismatch"); } answer = charVector3d; return; } else if ( mode == _PlaneStressRot ) { if ( size != 7 ) { OOFEM_ERROR("SimpleCrossSection :: giveReducedCharacteristicVector - charVector3d size mismatch"); } mat->giveStressStrainMask( indx, ReducedForm, gp->giveMaterialMode() ); answer.resize( indx.giveSize() ); answer.zero(); for ( i = 1; i <= indx.giveSize(); i++ ) { if ( ( j = indx.at(i) ) ) { answer.at(i) = charVector3d.at(j); } } return; } else { StructuralCrossSection :: giveReducedCharacteristicVector(answer, gp, charVector3d); return; } }
int FEI3dHexaQuad :: global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo) { FloatArray res, delta, guess; FloatMatrix jac; double convergence_limit, error; // find a suitable convergence limit convergence_limit = 1e-6 * this->giveCharacteristicLength(cellgeo); // setup initial guess answer.resize(gcoords.giveSize()); answer.zero(); // apply Newton-Raphson to solve the problem for (int nite = 0; nite < 10; nite++) { // compute the residual this->local2global(guess, answer, cellgeo); res.beDifferenceOf(gcoords, guess); // check for convergence error = res.computeNorm(); if ( error < convergence_limit ) { break; } // compute the corrections this->giveJacobianMatrixAt(jac, answer, cellgeo); jac.solveForRhs(res, delta, true); // update guess answer.add(delta); } if ( error > convergence_limit) { // Imperfect, could give false negatives. //OOFEM_ERROR ("global2local: no convergence after 10 iterations"); answer.zero(); return false; } // check limits for each local coordinate [-1,1] for quadrilaterals. (different for other elements, typically [0,1]). bool inside = true; for ( int i = 1; i <= answer.giveSize(); i++ ) { if ( answer.at(i) < ( -1. - POINT_TOL ) ) { answer.at(i) = -1.; inside = false; } else if ( answer.at(i) > ( 1. + POINT_TOL ) ) { answer.at(i) = 1.; inside = false; } } return inside; }
void StructuralEngngModel :: computeExternalLoadReactionContribution(FloatArray &reactions, TimeStep *tStep, int di) { int numRestrDofs = this->giveNumberOfPrescribedDomainEquations(di, EID_MomentumBalance); reactions.resize(numRestrDofs); reactions.zero(); FloatArray contribution(numRestrDofs); reactions.resize( this->giveNumberOfPrescribedDomainEquations(di, EID_MomentumBalance) ); reactions.zero(); this->assembleVector( reactions, tStep, EID_MomentumBalance, ExternalForcesVector, VM_Total, EModelDefaultPrescribedEquationNumbering(), this->giveDomain(di) ); }
void RampFunction :: evaluateEnrFuncDerivAt(FloatArray &oEnrFuncDeriv, const FloatArray &iPos, const double &iLevelSet, const FloatArray &iGradLevelSet) const { oEnrFuncDeriv.resize(2); oEnrFuncDeriv.zero(); oEnrFuncDeriv.at(1) = iGradLevelSet.at(1) * sgn(iLevelSet); oEnrFuncDeriv.at(2) = iGradLevelSet.at(2) * sgn(iLevelSet); }
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 Node2NodeContactL :: computeContactForces(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms) { //Loop through all the master objects and let them do their thing FloatArray gap, C, Fc; this->computeGap(gap, tStep); GaussPoint *gp = this->integrationRule->getIntegrationPoint(0); FloatArray t; this->computeContactTractionAt(gp, t ,gap, tStep); this->computeCmatrixAt(gp, C, tStep); // compute load vector // for Lagrange: fc = traction * C^T * A (traction = lambda) FloatArray temp = t.at(1) *this->area * C; answer.resize( C.giveSize() + 1); answer.zero(); if( gap.at(1) < 0.0 ) { answer.addSubVector(temp,1); answer.at( C.giveSize() + 1 ) = -gap.at(1); } }
void SolutionbasedShapeFunction :: setLoads(EngngModel *myEngngModel, int d) { DynamicInputRecord ir; FloatArray gradP; gradP.resize( this->giveDomain()->giveNumberOfSpatialDimensions() ); gradP.zero(); gradP.at(d) = 1.0; ir.setRecordKeywordField("deadweight", 1); ir.setField(gradP, _IFT_Load_components); ir.setField(1, _IFT_GeneralBoundaryCondition_timeFunct); int bcID = myEngngModel->giveDomain(1)->giveNumberOfBoundaryConditions() + 1; GeneralBoundaryCondition *myBodyLoad; myBodyLoad = classFactory.createBoundaryCondition( "deadweight", bcID, myEngngModel->giveDomain(1) ); myBodyLoad->initializeFrom(& ir); myEngngModel->giveDomain(1)->setBoundaryCondition(bcID, myBodyLoad); for ( int i = 1; i <= myEngngModel->giveDomain(1)->giveNumberOfElements(); i++ ) { IntArray *blArray; blArray = myEngngModel->giveDomain(1)->giveElement(i)->giveBodyLoadArray(); blArray->resizeWithValues(blArray->giveSize() + 1); blArray->at( blArray->giveSize() ) = bcID; } }
void MisesMatNl :: giveRemoteNonlocalStiffnessContribution(GaussPoint *gp, IntArray &rloc, const UnknownNumberingScheme &s, FloatArray &rcontrib, TimeStep *tStep) { double kappa, tempKappa; MisesMatNlStatus *status = static_cast< MisesMatNlStatus * >( this->giveStatus(gp) ); StructuralElement *elem = static_cast< StructuralElement * >( gp->giveElement() ); FloatMatrix b; LinearElasticMaterial *lmat = this->giveLinearElasticMaterial(); double E = lmat->give('E', gp); elem->giveLocationArray(rloc, s); elem->computeBmatrixAt(gp, b); kappa = status->giveCumulativePlasticStrain(); tempKappa = status->giveTempCumulativePlasticStrain(); rcontrib.clear(); if ( ( tempKappa - kappa ) > 0 ) { const FloatArray &stress = status->giveTempEffectiveStress(); if ( gp->giveMaterialMode() == _1dMat ) { double coeff = sgn( stress.at(1) ) * E / ( E + H ); rcontrib.plusProduct(b, stress, coeff); return; } } rcontrib.resize(b.giveNumberOfColumns()); rcontrib.zero(); }
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 ConstantEdgeLoad :: computeValueAt(FloatArray &answer, TimeStep *stepN, FloatArray &coords, ValueModeType mode) { // we overload general implementation on the boundary load level due // to implementation efficiency double factor; if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) { _error("computeValueAt: mode not supported"); } // ask time distribution /* * factor = this -> giveLoadTimeFunction() -> at(stepN->giveTime()) ; * if ((mode==VM_Incremental) && (!stepN->isTheFirstStep())) * //factor -= this->giveLoadTimeFunction()->at(stepN->givePreviousStep()->giveTime()) ; * factor -= this->giveLoadTimeFunction()->at(stepN->giveTime()-stepN->giveTimeIncrement()) ; */ factor = this->giveLoadTimeFunction()->evaluate(stepN, mode); answer = componentArray; answer.times(factor); if ( !isImposed(stepN) ){ answer.zero(); } }
void DynCompCol :: timesT(const FloatArray &x, FloatArray &answer) const { // Check for compatible dimensions: if ( x.giveSize() != nRows ) { OOFEM_ERROR("Error in CompCol -- incompatible dimensions"); } answer.resize(nColumns); answer.zero(); #ifndef DynCompCol_USE_STL_SETS int i, t; double r; for ( i = 0; i < nColumns; i++ ) { r = 0.0; for ( t = 1; t <= columns_ [ i ]->giveSize(); t++ ) { r += columns_ [ i ]->at(t) * x( rowind_ [ i ]->at(t) ); } answer(i) = r; } #else double r; for ( int i = 0; i < nColumns; i++ ) { double r = 0.0; for ( auto &val: columns [ i ] ) { r += val.second * x(val.first); } answer(i) = r; } #endif }
void B3SolidMaterial :: computePointShrinkageStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) { /* dEpsSh/dt = kSh * dh/dt (h = humidity) * ->> EpsSh = kSh * h_difference */ double humDiff, EpsSh; int size; FloatArray fullAnswer; MaterialMode mode = gp->giveMaterialMode(); if ( ( mode == _3dShell ) || ( mode == _3dBeam ) || ( mode == _2dPlate ) || ( mode == _2dBeam ) ) { size = 12; } else { size = 6; } humDiff = this->giveHumidityIncrement(gp, tStep); EpsSh = humDiff * kSh; fullAnswer.resize(size); fullAnswer.zero(); fullAnswer.at(1) = fullAnswer.at(2) = fullAnswer.at(3) = EpsSh; StructuralMaterial :: giveReducedSymVectorForm( answer, fullAnswer, gp->giveMaterialMode() ); }
void VTKXMLExportModule :: makeFullForm(FloatArray &answer, const FloatArray &reducedForm, InternalStateValueType type, const IntArray &redIndx) { answer.resize(9); answer.zero(); if ( type == ISVT_TENSOR_S3 ) { for (int i = 1; i <= redIndx.giveSize(); i++) { if (redIndx.at(i) > 0) { answer.at(redToFull.at(i)) = reducedForm.at(redIndx.at(i)); } } } else if ( type == ISVT_TENSOR_S3E ) { for (int i = 1; i <= redIndx.giveSize(); i++) { if (redIndx.at(i) > 3) { answer.at(redToFull.at(i)) = reducedForm.at(i)*0.5; } else if (redIndx.at(i) > 0) { answer.at(redToFull.at(i)) = reducedForm.at(i); } } } // Symmetrize answer.at(4) = answer.at(2); answer.at(7) = answer.at(3); answer.at(8) = answer.at(6); }
// computes Btransposed*eta for the given Gauss point // (where eta is the derivative of cum. plastic strain wrt final strain) void RankineMatNl :: giveRemoteNonlocalStiffnessContribution(GaussPoint *gp, IntArray &rloc, const UnknownNumberingScheme &s, FloatArray &rcontrib, TimeStep *atTime) { RankineMatNlStatus *status = ( RankineMatNlStatus * ) this->giveStatus(gp); StructuralElement *elem = ( StructuralElement * )( gp->giveElement() ); elem->giveLocationArray(rloc, EID_MomentumBalance, s); FloatMatrix b; elem->computeBmatrixAt(gp, b); int ncols = b.giveNumberOfColumns(); rcontrib.resize(ncols); double kappa = status->giveCumulativePlasticStrain(); double tempKappa = status->giveTempCumulativePlasticStrain(); if ( tempKappa <= kappa ) { rcontrib.zero(); return; } int i, j; double sum; int nsize = 3; FloatArray eta(3); computeEta(eta, status); for ( i = 1; i <= ncols; i++ ) { sum = 0.; for ( j = 1; j <= nsize; j++ ) { sum += eta.at(j) * b.at(j, i); } rcontrib.at(i) = sum; } }
void CompCol_ICPreconditioner :: ICSolve(FloatArray &dest) const { int i, t, M = dest.giveSize(); FloatArray work(M); double val; // lower diag work.zero(); // solve Uw=x for ( i = 0; i < M; i++ ) { work(i) = val = ( dest(i) + work(i) ) / val_( pntr_(i) ); for ( t = pntr_(i) + 1; t < pntr_(i + 1); t++ ) { work( indx_(t) ) -= val_(t) * val; } } dest.zero(); // solve U^Ty=w for ( i = M - 1; i >= 0; i-- ) { for ( t = pntr_(i) + 1; t < pntr_(i + 1); t++ ) { dest(i) -= val_(t) * dest( indx_(t) ); } dest(i) = ( work(i) + dest(i) ) / val_( pntr_(i) ); } }
void FluidDynamicMaterial :: giveVolumetricDeviatoricStiffness(FloatArray &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) { int size = ((FluidDynamicMaterialStatus*)this->giveStatus(gp))->giveDeviatoricStressVector().giveSize(); answer.resize(size); answer.zero(); }
void HeMoTKMaterial :: giveFluxVector(FloatArray &answer, GaussPoint *gp, const FloatArray &grad, const FloatArray &field, TimeStep *tStep) { TransportMaterialStatus *ms = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) ); double w = field.at(2); double t = field.at(1); FloatArray ans_w, ans_t; FloatArray grad_w, grad_t; int size = grad.giveSize() / 2; for ( int i = 1; i <= size; ++i ) { grad_w.at(i) = grad.at(i); } for ( int i = size + 1; i <= size * 2; ++i ) { grad_t.at(i) = grad.at(i); } ans_w.beScaled(perm_ww(w, t), grad_w); ans_w.beScaled(perm_wt(w, t), grad_t); ans_t.beScaled(perm_ww(w, t) * get_latent(w, t), grad_w); ans_t.beScaled(get_chi(w, t) + get_latent(w, t) * perm_wt(w, t), grad_t); answer.resize(size * 2); answer.zero(); answer.addSubVector(ans_w, 1); answer.addSubVector(ans_t, size + 1); ms->setTempField(field); ms->setTempGradient(grad); ms->setTempFlux(answer); }
void Tr21Stokes :: computeLoadVector(FloatArray &answer, TimeStep *tStep) { int i, load_number, load_id; Load *load; bcGeomType ltype; FloatArray vec; int nLoads = this->boundaryLoadArray.giveSize() / 2; answer.resize(15); answer.zero(); for ( i = 1; i <= nLoads; i++ ) { // For each Neumann boundary condition load_number = this->boundaryLoadArray.at(2 * i - 1); load_id = this->boundaryLoadArray.at(2 * i); load = this->domain->giveLoad(load_number); ltype = load->giveBCGeoType(); if ( ltype == EdgeLoadBGT ) { this->computeEdgeBCSubVectorAt(vec, load, load_id, tStep); answer.add(vec); } } nLoads = this->giveBodyLoadArray()->giveSize(); for ( i = 1; i <= nLoads; i++ ) { load = domain->giveLoad( bodyLoadArray.at(i) ); ltype = load->giveBCGeoType(); if ( ltype == BodyLoadBGT && load->giveBCValType() == ForceLoadBVT ) { this->computeBodyLoadVectorAt(vec, load, tStep); answer.add(vec); } } }
void TrabBoneNL3D :: giveRemoteNonlocalStiffnessContribution(GaussPoint *gp, IntArray &rloc, const UnknownNumberingScheme &s, FloatArray &rcontrib, TimeStep *tStep) { TrabBoneNL3DStatus *nlStatus = static_cast< TrabBoneNL3DStatus * >( this->giveStatus(gp) ); StructuralElement *elem = static_cast< StructuralElement * >( gp->giveElement() ); FloatMatrix b; elem->giveLocationArray(rloc, s); elem->computeBmatrixAt(gp, b); double kappa = nlStatus->giveKappa(); double tempKappa = nlStatus->giveTempKappa(); double dKappa = tempKappa - kappa; if ( dKappa < 10.e-9 ) { dKappa = 0; } if ( dKappa > 0.0 ) { FloatArray remoteNu, prodTensor; const FloatArray &plasFlowDirec = nlStatus->givePlasFlowDirec(); const FloatMatrix &SSaTensor = nlStatus->giveSSaTensor(); double beta = nlStatus->giveBeta(); prodTensor.beTProductOf(SSaTensor, plasFlowDirec); remoteNu = 1 / beta * prodTensor; rcontrib.beTProductOf(b, remoteNu); } else { rcontrib.resize(b.giveNumberOfColumns()); rcontrib.zero(); } }
void SymCompCol :: times(const FloatArray &x, FloatArray &answer) const { int M = dim_ [ 0 ]; int N = dim_ [ 1 ]; // Check for compatible dimensions: if ( x.giveSize() != N ) { OOFEM_ERROR("SymCompCol::times: Error in CompCol -- incompatible dimensions"); } answer.resize(M); answer.zero(); int j, t; double rhs, sum; for ( j = 0; j < N; j++ ) { rhs = x(j); sum = 0.0; for ( t = colptr_(j) + 1; t < colptr_(j + 1); t++ ) { answer( rowind_(t) ) += val_(t) * rhs; // column loop sum += val_(t) * x( rowind_(t) ); // row loop } answer(j) += sum; answer(j) += val_( colptr_(j) ) * rhs; // diagonal } }
void B3SolidMaterial :: giveShrinkageStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep, ValueModeType mode) { FloatArray prevAnswer; if ( this->shMode == B3_NoShrinkage ) { answer.resize( StructuralMaterial :: giveSizeOfVoigtSymVector( gp->giveMaterialMode() ) ); answer.zero(); return; } if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) { OOFEM_ERROR("unsupported mode"); } if ( this->shMode == B3_AverageShrinkage ) { this->computeTotalAverageShrinkageStrainVector(answer, gp, tStep); if ( ( mode == VM_Incremental ) && ( !tStep->isTheFirstStep() ) ) { this->computeTotalAverageShrinkageStrainVector( prevAnswer, gp, tStep->givePreviousStep() ); answer.subtract(prevAnswer); } } else { this->computePointShrinkageStrainVector(answer, gp, tStep); } }
void CompCol_ILUPreconditioner :: solve(const FloatArray &x, FloatArray &y) const { int M = x.giveSize(); FloatArray work(M); int i, t; y.resize(M); work.zero(); // solve Lw=x for ( i = 0; i < M; i++ ) { work(i) = x(i) + work(i); for ( t = l_colptr_(i); t < l_colptr_(i + 1); t++ ) { work( l_rowind_(t) ) -= l_val_(t) * work(i); } } y.zero(); // solve Uy=w for ( i = M - 1; i >= 0; i-- ) { y(i) = ( work(i) ) / u_val_(u_colptr_(i + 1) - 1); for ( t = u_colptr_(i); t < u_colptr_(i + 1) - 1; t++ ) { work( u_rowind_(t) ) -= u_val_(t) * y(i); } } //return y; }
void DynCompCol :: times(const FloatArray &x, FloatArray &answer) const { // Check for compatible dimensions: if ( x.giveSize() != nColumns ) { OOFEM_ERROR("incompatible dimensions"); } answer.resize(nRows); answer.zero(); #ifndef DynCompCol_USE_STL_SETS int j, t; double rhs; for ( j = 0; j < nColumns; j++ ) { rhs = x(j); for ( t = 1; t <= columns_ [ j ]->giveSize(); t++ ) { answer( rowind_ [ j ]->at(t) ) += columns_ [ j ]->at(t) * rhs; } } #else double rhs; for ( int j = 0; j < nColumns; j++ ) { rhs = x(j); for ( auto &val: columns [ j ] ) { answer(val.first) += val.second * rhs; } } #endif }
void Tr1Darcy :: computeInternalForcesVector(FloatArray &answer, TimeStep *atTime) { FloatArray *lcoords, w, a, gradP, I; FloatMatrix BT; GaussPoint *gp; TransportMaterial *mat = ( TransportMaterial * ) this->domain->giveMaterial(this->material); IntegrationRule *iRule = integrationRulesArray [ 0 ]; this->computeVectorOf(EID_ConservationEquation, VM_Total, atTime, a); answer.resize(3); answer.zero(); for ( int i = 0; i < iRule->getNumberOfIntegrationPoints(); i++ ) { gp = iRule->getIntegrationPoint(i); lcoords = gp->giveCoordinates(); double detJ = this->interpolation_lin.giveTransformationJacobian( * lcoords, FEIElementGeometryWrapper(this) ); this->interpolation_lin.evaldNdx( BT, * lcoords, FEIElementGeometryWrapper(this) ); gradP.beTProductOf(BT, a); mat->giveFluxVector(w, gp, gradP, atTime); I.beProductOf(BT, w); answer.add(- gp->giveWeight() * detJ, I); } }
void Quad1MindlinShell3D :: computeSurfaceLoadVectorAt(FloatArray &answer, Load *load, int iSurf, TimeStep *tStep, ValueModeType mode) { BoundaryLoad *surfLoad = static_cast< BoundaryLoad * >(load); if ( dynamic_cast< ConstantPressureLoad * >(surfLoad) ) { // Just checking the type of b.c. // EXPERIMENTAL CODE: FloatArray n, gcoords, pressure; answer.resize(24); answer.zero(); for ( GaussPoint *gp: *integrationRulesArray [ 0 ] ) { double dV = this->computeVolumeAround(gp); this->interp.evalN( n, * gp->giveNaturalCoordinates(), FEIVoidCellGeometry() ); this->interp.local2global( gcoords, * gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); surfLoad->computeValueAt(pressure, tStep, gcoords, mode); answer.at(3) += n.at(1) * pressure.at(1) * dV; answer.at(9) += n.at(2) * pressure.at(1) * dV; answer.at(15) += n.at(3) * pressure.at(1) * dV; answer.at(21) += n.at(4) * pressure.at(1) * dV; } // Second surface is the outside; if ( iSurf == 2 ) { answer.negated(); } } else { OOFEM_ERROR("only supports constant pressure boundary load."); } }
void Tr1Darcy :: computeLoadVector(FloatArray &answer, TimeStep *atTime) { // TODO: Implement support for body forces FloatArray vec; answer.resize(3); answer.zero(); // Compute characteristic vector for Neumann boundary conditions. int i, load_number, load_id; GeneralBoundaryCondition *load; bcGeomType ltype; int nLoads = boundaryLoadArray.giveSize() / 2; for ( i = 1; i <= nLoads; i++ ) { // For each Neumann boundary condition .... load_number = boundaryLoadArray.at(2 * i - 1); load_id = boundaryLoadArray.at(2 * i); load = ( GeneralBoundaryCondition * ) domain->giveLoad(load_number); ltype = load->giveBCGeoType(); if ( ltype == EdgeLoadBGT ) { this->computeEdgeBCSubVectorAt(vec, ( Load * ) load, load_id, atTime); } answer.add(vec); } answer.negated(); }