void Tr21Stokes :: computeExternalForcesVector(FloatArray &answer, TimeStep *tStep) { FloatArray vec; answer.clear(); int nLoads = this->boundaryLoadArray.giveSize() / 2; for ( int i = 1; i <= nLoads; i++ ) { // For each Neumann boundary condition int load_number = this->boundaryLoadArray.at(2 * i - 1); int load_id = this->boundaryLoadArray.at(2 * i); Load *load = this->domain->giveLoad(load_number); bcGeomType ltype = load->giveBCGeoType(); if ( ltype == EdgeLoadBGT ) { this->computeBoundarySurfaceLoadVector(vec, static_cast< BoundaryLoad * >(load), load_id, ExternalForcesVector, VM_Total, tStep); answer.add(vec); } } BodyLoad *bload; nLoads = this->giveBodyLoadArray()->giveSize(); for ( int i = 1; i <= nLoads; i++ ) { Load *load = domain->giveLoad( bodyLoadArray.at(i) ); if ((bload = dynamic_cast<BodyLoad*>(load))) { bcGeomType ltype = load->giveBCGeoType(); if ( ltype == BodyLoadBGT && load->giveBCValType() == ForceLoadBVT ) { this->computeLoadVector(vec, bload, ExternalForcesVector, VM_Total, tStep); answer.add(vec); } } } }
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 SUPGElement2 :: computeBCRhsTerm_MB(FloatArray &answer, TimeStep *tStep) { int nLoads; answer.clear(); int rule = 0; IntegrationRule *iRule = this->integrationRulesArray [ rule ]; FloatArray un, gVector, s, helpLoadVector; FloatMatrix b, nu; // add body load (gravity) termms nLoads = this->giveBodyLoadArray()->giveSize(); for ( int i = 1; i <= nLoads; i++ ) { Load *load = domain->giveLoad( bodyLoadArray.at(i) ); bcGeomType ltype = load->giveBCGeoType(); if ( ( ltype == BodyLoadBGT ) && ( load->giveBCValType() == ForceLoadBVT ) ) { load->computeComponentArrayAt(gVector, tStep, VM_Total); if ( gVector.giveSize() ) { for ( GaussPoint *gp: *iRule ) { this->computeUDotGradUMatrix( b, gp, tStep->givePreviousStep() ); this->computeNuMatrix(nu, gp); double dV = this->computeVolumeAround(gp); double rho = this->giveMaterial()->give('d', gp); answer.plusProduct(b, gVector, t_supg * rho * dV); answer.plusProduct(nu, gVector, rho * dV); } } } } // integrate tractions // if no traction bc applied but side marked as with traction load // then zero traction is assumed !!! // loop over boundary load array nLoads = this->giveBoundaryLoadArray()->giveSize() / 2; for ( int i = 1; i <= nLoads; i++ ) { int n = boundaryLoadArray.at(1 + ( i - 1 ) * 2); int id = boundaryLoadArray.at(i * 2); Load *load = domain->giveLoad(n); bcGeomType ltype = load->giveBCGeoType(); if ( ltype == EdgeLoadBGT ) { this->computeEdgeLoadVector_MB(helpLoadVector, load, id, tStep); if ( helpLoadVector.giveSize() ) { answer.add(helpLoadVector); } } else if ( ltype == SurfaceLoadBGT ) { this->computeSurfaceLoadVector_MB(helpLoadVector, load, id, tStep); if ( helpLoadVector.giveSize() ) { answer.add(helpLoadVector); } } else { OOFEM_ERROR("unsupported load type class"); } } }
void SUPGElement2 :: computeBCRhsTerm_MC(FloatArray &answer, TimeStep *tStep) { int nLoads; FloatArray s, gVector, helpLoadVector; FloatMatrix g; int rule = 1; answer.clear(); nLoads = this->giveBodyLoadArray()->giveSize(); for ( int i = 1; i <= nLoads; i++ ) { Load *load = domain->giveLoad( bodyLoadArray.at(i) ); bcGeomType ltype = load->giveBCGeoType(); if ( ( ltype == BodyLoadBGT ) && ( load->giveBCValType() == ForceLoadBVT ) ) { load->computeComponentArrayAt(gVector, tStep, VM_Total); if ( gVector.giveSize() ) { for ( GaussPoint *gp: *this->integrationRulesArray [ rule ] ) { this->computeGradPMatrix(g, gp); double dV = this->computeVolumeAround(gp); answer.plusProduct(g, gVector, t_pspg * dV); } } } } // integrate tractions // if no traction bc applied but side marked as with traction load // then zero traction is assumed !!! // loop over boundary load array nLoads = this->giveBoundaryLoadArray()->giveSize() / 2; for ( int i = 1; i <= nLoads; i++ ) { int n = boundaryLoadArray.at(1 + ( i - 1 ) * 2); int id = boundaryLoadArray.at(i * 2); Load *load = domain->giveLoad(n); bcGeomType ltype = load->giveBCGeoType(); if ( ltype == EdgeLoadBGT ) { this->computeEdgeLoadVector_MC(helpLoadVector, load, id, tStep); if ( helpLoadVector.giveSize() ) { answer.add(helpLoadVector); } } else if ( ltype == SurfaceLoadBGT ) { this->computeSurfaceLoadVector_MC(helpLoadVector, load, id, tStep); if ( helpLoadVector.giveSize() ) { answer.add(helpLoadVector); } } else { OOFEM_ERROR("unsupported load type class"); } } }
void SUPGElement :: computeBCLhsTerm_MB(FloatMatrix &answer, TimeStep *tStep) { bcType boundarytype; int nLoads = 0; //bcType loadtype; FloatMatrix helpMatrix; // loop over boundary load array answer.clear(); nLoads = this->giveBoundaryLoadArray()->giveSize() / 2; if ( nLoads ) { for ( int i = 1; i <= nLoads; i++ ) { int n = boundaryLoadArray.at(1 + ( i - 1 ) * 2); int side = boundaryLoadArray.at(i * 2); Load *load = domain->giveLoad(n); boundarytype = load->giveType(); if ( boundarytype == SlipWithFriction ) { this->computeSlipWithFrictionBCTerm_MB(helpMatrix, load, side, tStep); answer.add(helpMatrix); } else if ( boundarytype == PenetrationWithResistance ) { this->computePenetrationWithResistanceBCTerm_MB(helpMatrix, load, side, tStep); answer.add(helpMatrix); } else { // OOFEM_ERROR("unsupported load type class"); } } } nLoads = this->giveBodyLoadArray()->giveSize(); if ( nLoads ) { bcGeomType ltype; for ( int i = 1; i <= nLoads; i++ ) { Load *load = domain->giveLoad( bodyLoadArray.at(i) ); ltype = load->giveBCGeoType(); if ( ( ltype == BodyLoadBGT ) && ( load->giveBCValType() == ReinforceBVT ) ) { this->computeHomogenizedReinforceTerm_MB(helpMatrix, load, tStep); answer.add(helpMatrix); } } } }
void SUPGElement :: computeBCLhsPressureTerm_MC(FloatMatrix &answer, TimeStep *tStep) { int nLoads = 0; //bcType loadtype; FloatMatrix helpMatrix; nLoads = this->giveBodyLoadArray()->giveSize(); answer.clear(); if ( nLoads ) { bcGeomType ltype; for ( int i = 1; i <= nLoads; i++ ) { Load *load = domain->giveLoad( bodyLoadArray.at(i) ); ltype = load->giveBCGeoType(); if ( ( ltype == BodyLoadBGT ) && ( load->giveBCValType() == ReinforceBVT ) ) { this->computeHomogenizedReinforceTerm_MC(helpMatrix, load, tStep); answer.add(helpMatrix); } } } }
void BeamBaseElement :: computeLocalForceLoadVector(FloatArray &answer, TimeStep *tStep, ValueModeType mode) // computes the part of load vector, which is imposed by force loads acting // on element volume (surface). // Why is this function taken separately ? // When reactions forces are computed, they are computed from element::GiveRealStressVector // in this vector a real forces are stored (temperature part is subtracted). // so we need further subtract part corresponding to non-nodal loading. { FloatArray helpLoadVector(1); answer.clear(); // loop over body load array first int nBodyLoads = this->giveBodyLoadArray()->giveSize(); for ( int i = 1; i <= nBodyLoads; i++ ) { int id = bodyLoadArray.at(i); Load *load = domain->giveLoad(id); bcGeomType ltype = load->giveBCGeoType(); if ( ( ltype == BodyLoadBGT ) && ( load->giveBCValType() == ForceLoadBVT ) ) { this->computeBodyLoadVectorAt(helpLoadVector, load, tStep, mode); if ( helpLoadVector.giveSize() ) { answer.add(helpLoadVector); } } else { if ( load->giveBCValType() != TemperatureBVT && load->giveBCValType() != EigenstrainBVT ) { // temperature and eigenstrain is handled separately at computeLoadVectorAt subroutine OOFEM_ERROR("body load %d is of unsupported type (%d)", id, ltype); } } } // loop over boundary load array int nBoundaryLoads = this->giveBoundaryLoadArray()->giveSize() / 2; for ( int i = 1; i <= nBoundaryLoads; i++ ) { int n = boundaryLoadArray.at(1 + ( i - 1 ) * 2); int id = boundaryLoadArray.at(i * 2); Load *load = domain->giveLoad(n); BoundaryLoad* bLoad; if ((bLoad = dynamic_cast<BoundaryLoad*> (load))) { bcGeomType ltype = load->giveBCGeoType(); if ( ltype == EdgeLoadBGT ) { this->computeBoundaryEdgeLoadVector(helpLoadVector, bLoad, id, ExternalForcesVector, mode, tStep, false); if ( helpLoadVector.giveSize() ) { answer.add(helpLoadVector); } } else if ( ltype == SurfaceLoadBGT ) { this->computeBoundarySurfaceLoadVector(helpLoadVector, bLoad, id, ExternalForcesVector, mode, tStep, false); if ( helpLoadVector.giveSize() ) { answer.add(helpLoadVector); } } else if ( ltype == PointLoadBGT ) { // id not used this->computePointLoadVectorAt(helpLoadVector, load, tStep, mode, false); if ( helpLoadVector.giveSize() ) { answer.add(helpLoadVector); } } else { OOFEM_ERROR("boundary load %d is of unsupported type (%d)", id, ltype); } } } // add exact end forces due to nonnodal loading applied indirectly (via sets) BCTracker *bct = this->domain->giveBCTracker(); BCTracker::entryListType bcList = bct->getElementRecords(this->number); FloatArray help; for (BCTracker::entryListType::iterator it = bcList.begin(); it != bcList.end(); ++it) { GeneralBoundaryCondition *bc = this->domain->giveBc((*it).bcNumber); BodyLoad *bodyLoad; BoundaryLoad *boundaryLoad; if (bc->isImposed(tStep)) { if ((bodyLoad = dynamic_cast<BodyLoad*>(bc))) { // body load this->computeBodyLoadVectorAt(help,bodyLoad, tStep, VM_Total); // this one is local answer.add(help); } else if ((boundaryLoad = dynamic_cast<BoundaryLoad*>(bc))) { // compute Boundary Edge load vector in GLOBAL CS !!!!!!! this->computeBoundaryEdgeLoadVector(help, boundaryLoad, (*it).boundaryId, ExternalForcesVector, VM_Total, tStep, false); // get it transformed back to local c.s. // this->computeGtoLRotationMatrix(t); // help.rotatedWith(t, 'n'); answer.add(help); } } } }
void Lattice2d_mt :: computeInternalSourceRhsVectorAt(FloatArray &answer, TimeStep *atTime, ValueModeType mode) { int i, j, n, nLoads; double dV; bcGeomType ltype; Load *load; IntegrationRule *iRule = integrationRulesArray [ 0 ]; GaussPoint *gp; Node *nodeA, *nodeB; FloatArray deltaX(3), normalVector(3); FloatArray val, helpLoadVector, globalIPcoords; FloatMatrix nm; double k; answer.resize(0); FloatArray gravityHelp(2); nLoads = this->giveBodyLoadArray()->giveSize(); for ( i = 1; i <= nLoads; i++ ) { n = bodyLoadArray.at(i); load = ( Load * ) domain->giveLoad(n); ltype = load->giveBCGeoType(); if ( ltype == GravityPressureBGT ) { //Compute change of coordinates nodeA = this->giveNode(1); nodeB = this->giveNode(2); deltaX.at(1) = nodeB->giveCoordinate(1) - nodeA->giveCoordinate(1); deltaX.at(2) = nodeB->giveCoordinate(2) - nodeA->giveCoordinate(2); deltaX.at(3) = nodeB->giveCoordinate(2) - nodeA->giveCoordinate(2); //Compute the local coordinate system gp = iRule->getIntegrationPoint(0); gravityHelp.at(1) = 1.; gravityHelp.at(2) = -1.; dV = this->computeVolumeAround(gp); load->computeValueAt(val, atTime, deltaX, mode); k = static_cast< TransportMaterial * >( this->giveMaterial() )->giveCharacteristicValue(Conductivity_hh, gp, atTime); double helpFactor = val.at(1) * k * dV; helpFactor /= pow(this->giveLength(), 2.); gravityHelp.times(helpFactor); if ( helpLoadVector.isEmpty() ) { helpLoadVector.resize( gravityHelp.giveSize() ); } for ( j = 1; j <= gravityHelp.giveSize(); j++ ) { helpLoadVector.at(j) += gravityHelp.at(j); } } answer.add(helpLoadVector); } return; }