void NonLinearStatic :: showSparseMtrxStructure(int type, oofegGraphicContext &context, TimeStep *atTime) { Domain *domain = this->giveDomain(1); CharType ctype; int i; if ( type != 1 ) { return; } if ( stiffMode == nls_tangentStiffness ) { ctype = TangentStiffnessMatrix; } else if ( stiffMode == nls_secantStiffness ) { ctype = SecantStiffnessMatrix; } else { ctype = SecantStiffnessMatrix; } int nelems = domain->giveNumberOfElements(); for ( i = 1; i <= nelems; i++ ) { domain->giveElement(i)->showSparseMtrxStructure(ctype, context, atTime); } for ( i = 1; i <= nelems; i++ ) { domain->giveElement(i)->showExtendedSparseMtrxStructure(ctype, context, atTime); } }
void StaticFracture :: filterSensitivities(ObjectiveFunction *objFunc) { // Loop through all active elements and compute distance to neighbours EngngModel *sp = this->giveSlaveProblem(1); Domain *d = sp->giveDomain(1); int numEl = d->giveNumberOfElements(); double radius = 5.0; FloatArray oldSensitivities = objFunc->sensitivityList; // navie implementation FloatArray center0, center, lCoords; for (int i = 1; i <= numEl; i++) { Element *el = d->giveElement(i); lCoords.resize( el->giveSpatialDimension() ); lCoords.zero(); // center of element el->computeGlobalCoordinates(center0, lCoords); double distSum = 0.0, help = 0.0; for (int j = 1; j <= numEl; j++) { d->giveElement(j)->computeGlobalCoordinates(center, lCoords); double dist = sqrt( center0.distance_square(center) ); if ( dist <= radius ) { distSum += dist; help += oldSensitivities.at(j) * dist; } } objFunc->sensitivityList.at(i) = help / distSum; // new filtered sensitivity } }
void StructuralEngngModel :: updateInternalState(TimeStep *stepN) { int j, nnodes; Domain *domain; for ( int idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) { domain = this->giveDomain(idomain); nnodes = domain->giveNumberOfDofManagers(); if ( requiresUnknownsDictionaryUpdate() ) { for ( j = 1; j <= nnodes; j++ ) { this->updateDofUnknownsDictionary(domain->giveDofManager(j), stepN); } } if ( internalVarUpdateStamp != stepN->giveSolutionStateCounter() ) { int nelem = domain->giveNumberOfElements(); for ( j = 1; j <= nelem; j++ ) { domain->giveElement(j)->updateInternalState(stepN); } internalVarUpdateStamp = stepN->giveSolutionStateCounter(); } } }
void NonlocalMaterialWTP :: fastRebuildNonlocalTables() { Domain *d = lb->giveDomain(); int n, i, globnum, ie, nelem = d->giveNumberOfElements(); IntArray localElementDep; Element *elem; // build nonlocal element dependency array for each element for ( ie = 1; ie <= nelem; ie++ ) { elem = d->giveElement(ie); if ( ( elem->giveParallelMode() == Element_local ) ) { IntArray localMap; // translate here nonlocElementDependencyMap[_globnum] to corresponding local numbers globnum = elem->giveGlobalNumber(); n = nonlocElementDependencyMap [ globnum ].giveSize(); localElementDep.resize(n); for ( i = 1; i <= n; i++ ) { localElementDep.at(i) = d->elementGlobal2Local( nonlocElementDependencyMap [ globnum ].at(i) ); } elem->ipEvaluator(this, & NonlocalMaterialWTP :: fastElementIPNonlocTableUpdater, localElementDep); } } }
bool LEPlicElementInterface :: isBoundary() { int i, nneighbr, ineighbr; double fvk, fvi = this->giveTempVolumeFraction(); IntArray currCell(1), neighborList; LEPlicElementInterface *ineghbrInterface; Domain *domain = this->giveElement()->giveDomain(); ConnectivityTable *contable = domain->giveConnectivityTable(); if ( ( fvi > 0. ) && ( fvi <= 1.0 ) ) { // potentially boundary cell if ( ( fvi > 0. ) && ( fvi < 1.0 ) ) { return true; } currCell.at(1) = this->giveElement()->giveNumber(); contable->giveElementNeighbourList(neighborList, currCell); // loop over neighbors to assemble normal equations nneighbr = neighborList.giveSize(); for ( i = 1; i <= nneighbr; i++ ) { ineighbr = neighborList.at(i); if ( ( ineghbrInterface = ( LEPlicElementInterface * ) ( domain->giveElement(ineighbr)->giveInterface(LEPlicElementInterfaceType) ) ) ) { fvk = ineghbrInterface->giveTempVolumeFraction(); if ( fvk < 1.0 ) { return true; } } } } return false; }
int NonLinearDynamic :: checkConsistency() { // check internal consistency // if success returns nonzero int i, nelem; Element *ePtr; NLStructuralElement *sePtr; StructuralElementEvaluator *see; Domain *domain = this->giveDomain(1); nelem = domain->giveNumberOfElements(); // check for proper element type for ( i = 1; i <= nelem; i++ ) { ePtr = domain->giveElement(i); sePtr = dynamic_cast< NLStructuralElement * >( ePtr ); see = dynamic_cast< StructuralElementEvaluator * >( ePtr ); if ( ( sePtr == NULL ) && ( see == NULL ) ) { _warning2("checkConsistency: element %d has no Structural support", i); return 0; } } EngngModel :: checkConsistency(); return 1; }
// needed for CemhydMat void NonStationaryTransportProblem :: averageOverElements(TimeStep *tStep) { ///@todo Verify this, the function is completely unused. Domain *domain = this->giveDomain(1); int nelem = domain->giveNumberOfElements(); FloatArray vecTemperature; for ( int ielem = 1; ielem <= nelem; ielem++ ) { TransportElement *element = static_cast< TransportElement * >( domain->giveElement(ielem) ); TransportMaterial *mat = static_cast< CemhydMat * >( element->giveMaterial() ); if ( mat ) { for ( GaussPoint *gp: *element->giveDefaultIntegrationRulePtr() ) { element->giveIPValue(vecTemperature, gp, IST_Temperature, tStep); //mat->IP_volume += dV; //mat->average_temp += vecState.at(1) * dV; } } } for ( int i = 1; i <= domain->giveNumberOfMaterialModels(); i++ ) { CemhydMat *mat = static_cast< CemhydMat * >( domain->giveMaterial(i) ); if ( mat ) { //mat->average_temp /= mat->IP_volume; } } }
int FreeWarping :: estimateMaxPackSize(IntArray &commMap, DataStream &buff, int packUnpackType) { int count = 0, pcount = 0; Domain *domain = this->giveDomain(1); if ( packUnpackType == 0 ) { ///@todo Fix this old ProblemCommMode__NODE_CUT value for ( int map: commMap ) { for ( Dof *jdof: *domain->giveDofManager( map ) ) { if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) { count++; } else { pcount++; } } } // -------------------------------------------------------------------------------- // only pcount is relevant here, since only prescribed components are exchanged !!!! // -------------------------------------------------------------------------------- return ( buff.givePackSizeOfDouble(1) * pcount ); } else if ( packUnpackType == 1 ) { for ( int map: commMap ) { count += domain->giveElement( map )->estimatePackSize(buff); } return count; } return 0; }
int NonStationaryTransportProblem :: checkConsistency() { // check internal consistency // if success returns nonzero int i, nelem; Element *ePtr; TransportElement *sePtr; Domain *domain = this->giveDomain(1); nelem = domain->giveNumberOfElements(); // check for proper element type for ( i = 1; i <= nelem; i++ ) { ePtr = domain->giveElement(i); sePtr = dynamic_cast< TransportElement * >(ePtr); if ( sePtr == NULL ) { _warning2("Element %d has no TransportElement base", i); return 0; } } EngngModel :: checkConsistency(); return 1; }
void MatlabExportModule :: doOutputMesh(TimeStep *tStep, FILE *FID) { Domain *domain = emodel->giveDomain(1); fprintf(FID, "\tmesh.p=["); for ( auto &dman : domain->giveDofManagers() ) { for ( int j = 1; j <= domain->giveNumberOfSpatialDimensions(); j++) { double c = dman->giveCoordinate(j); fprintf(FID, "%f, ", c); } fprintf(FID, "; "); } fprintf(FID, "]';\n"); int numberOfDofMans=domain->giveElement(1)->giveNumberOfDofManagers(); fprintf(FID, "\tmesh.t=["); for ( auto &elem : domain->giveElements() ) { if ( elem->giveNumberOfDofManagers() == numberOfDofMans ) { for ( int j = 1; j <= elem->giveNumberOfDofManagers(); j++ ) { fprintf( FID, "%d,", elem->giveDofManagerNumber(j) ); } } fprintf(FID, ";"); } fprintf(FID, "]';\n"); }
void LinearStability :: terminateLinStatic(TimeStep *stepN) { Domain *domain = this->giveDomain(1); FILE *File; int j; File = this->giveOutputStream(); stepN->setTime(0.); fprintf(File, "\nOutput for time % .3e \n\n", stepN->giveTargetTime() ); fprintf(File, "Linear static:\n\n"); int nnodes = domain->giveNumberOfDofManagers(); if ( requiresUnknownsDictionaryUpdate() ) { for ( j = 1; j <= nnodes; j++ ) { this->updateDofUnknownsDictionary(domain->giveDofManager(j), stepN); } } for ( j = 1; j <= nnodes; j++ ) { domain->giveDofManager(j)->updateYourself(stepN); domain->giveDofManager(j)->printOutputAt(File, stepN); } # ifdef VERBOSE VERBOSE_PRINT0("Updated nodes & sides ", nnodes) # endif Element *elem; int nelem = domain->giveNumberOfElements(); for ( j = 1; j <= nelem; j++ ) { elem = domain->giveElement(j); elem->updateInternalState(stepN); elem->updateYourself(stepN); elem->printOutputAt(File, stepN); } # ifdef VERBOSE VERBOSE_PRINT0("Updated Elements ", nelem) # endif fprintf(File, "\n"); /* * // save context if required * // default - save only if ALWAYS is set ( see cltypes.h ) * * if ((domain->giveContextOutputMode() == COM_Always ) || * (domain->giveContextOutputMode() == COM_Required )) { * this->saveContext(NULL); * } * else if (domain->giveContextOutputMode() == COM_UserDefined ) { * if (stepN->giveNumber()%domain->giveContextOutputStep() == 0) * this->saveContext(NULL); * } */ this->printReactionForces(stepN, 1); }
void NonStationaryTransportProblem :: updateInternalState(TimeStep *stepN) { int j, idomain, nelem; Domain *domain; for ( idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) { domain = this->giveDomain(idomain); if ( requiresUnknownsDictionaryUpdate() ) { //update temperature vector UnknownsField->update( VM_Total, stepN, * ( this->UnknownsField->giveSolutionVector(stepN) ) ); //update Rhs vector UnknownsField->update(VM_RhsTotal, stepN, bcRhs); } if ( internalVarUpdateStamp != stepN->giveSolutionStateCounter() ) { nelem = domain->giveNumberOfElements(); for ( j = 1; j <= nelem; j++ ) { domain->giveElement(j)->updateInternalState(stepN); } internalVarUpdateStamp = stepN->giveSolutionStateCounter(); } } }
int NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, DataStream &buff, int packUnpackType) { int count = 0, pcount = 0; Domain *domain = this->giveDomain(1); if ( packUnpackType == 0 ) { ///@todo Fix this old ProblemCommMode__NODE_CUT value for ( int map: commMap ) { DofManager *dman = domain->giveDofManager( map ); for ( Dof *dof: *dman ) { if ( dof->isPrimaryDof() && ( dof->__giveEquationNumber() ) ) { count++; } else { pcount++; } } } return ( buff.givePackSizeOfDouble(1) * max(count, pcount) ); } else if ( packUnpackType == 1 ) { for ( int map: commMap ) { count += domain->giveElement( map )->estimatePackSize(buff); } return count; } return 0; }
void NonStationaryTransportProblem :: updateYourself(TimeStep *tStep) { this->updateInternalState(tStep); EngngModel :: updateYourself(tStep); ///@todo Find a cleaner way to do these cemhyd hacks #ifdef __CEMHYD_MODULE for ( int idomain = 1; idomain <= ndomains; idomain++ ) { Domain *d = this->giveDomain(idomain); for ( int i = 1; i <= d->giveNumberOfElements(); ++i ) { TransportElement *elem = static_cast< TransportElement * >( d->giveElement(i) ); //store temperature and associated volume on each GP before performing averaging CemhydMat *cem = dynamic_cast< CemhydMat * >( elem->giveMaterial() ); if ( cem ) { cem->clearWeightTemperatureProductVolume(elem); cem->storeWeightTemperatureProductVolume(elem, tStep); } } //perform averaging on each material instance for ( int i = 1; i <= d->giveNumberOfMaterialModels(); i++ ) { CemhydMat *cem = dynamic_cast< CemhydMat * >( d->giveMaterial(i) ); if ( cem ) { cem->averageTemperature(); } } } #ifdef VERBOSE VERBOSE_PRINT0("Updated Materials ", 0) #endif #endif }
void StaticFracture :: optimalityCriteria(ObjectiveFunction *objFunc) { FloatArray &x = objFunc->designVarList; FloatArray &dc = objFunc->sensitivityList; ///x.printYourself(); EngngModel *sp = this->giveSlaveProblem(1); Domain *d = sp->giveDomain(1); int numEl = d->giveNumberOfElements(); // Solver paramters double l1 = 0; double l2 = 100000; double move = 0.2; double averageDensity = 0.0; FloatArray xOld = x; while (l2-l1 > 1.0e-4) { double lmid = 0.5*(l2+l1); double totalVolume = 0.0; double help = 0.0; for (int i = 1; i <= numEl; i++) { // should only be el that contribute Element *el = d->giveElement(i); // xnew = max(0.001,max(x-move,min(1.,min(x+move,x.*sqrt(-dc./lmid))))); double xe = max(0.001, max(xOld.at(i)-move, min(1., min(xOld.at(i) + move, xOld.at(i) * sqrt(-dc.at(i)/lmid) ) ))); //double xe = max(0.001, max(xOld.at(i)-move, min(1., min(xOld.at(i) + move, xOld.at(i) * sqrt(-objFunc->sensitivityList.at(i)/lmid) ) ))); //double temp1 = x.at(i) + move; //double temp2 = x.at(i) * sqrt(-dc.at(i)/lmid); //double temp3 = min(temp1, temp2); //temp2 = min(1.0, temp3); //temp1 = x.at(i) - move; //temp3 = max(temp1, temp2); //temp1 = max(0.001,temp3); ////designVarList.at(i) = max(0.001, max(x-move, min(1., min(x+move,x.*sqrt(-dCostFunction.at(i)/lmid))))); x.at(i) = xe; //objFunc->designVarList.at(i) = xe; double dV = el->computeVolumeAreaOrLength(); totalVolume += dV; help += xe * dV; } averageDensity = help / totalVolume; if ( averageDensity - objFunc->constraint > 0 ) { //if ( objFunc->designVarList.sum() - objFunc->constraint*20*20 > 0 ) { l1 = lmid; } else { l2 = lmid; } } printf("\n average density %e \n", averageDensity ); }
void StationaryTransportProblem :: updateInternalState(TimeStep *stepN) { ///@todo Remove this, unnecessary with solving as a nonlinear problem (left for now, since nonstationary problems might still need it) for ( int idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) { Domain *domain = this->giveDomain(idomain); int nelem = domain->giveNumberOfElements(); for ( int j = 1; j <= nelem; j++ ) { domain->giveElement(j)->updateInternalState(stepN); } } }
void NonLinearDynamic :: showSparseMtrxStructure(int type, oofegGraphicContext &gc, TimeStep *tStep) { Domain *domain = this->giveDomain(1); CharType ctype; if ( type != 1 ) { return; } ctype = TangentStiffnessMatrix; int nelems = domain->giveNumberOfElements(); for ( int i = 1; i <= nelems; i++ ) { domain->giveElement(i)->showSparseMtrxStructure(ctype, gc, tStep); } for ( int i = 1; i <= nelems; i++ ) { domain->giveElement(i)->showExtendedSparseMtrxStructure(ctype, gc, tStep); } }
void StructuralEngngModel :: showSparseMtrxStructure(int type, oofegGraphicContext &context, TimeStep *tStep) { Domain *domain = this->giveDomain(1); if ( type != 1 ) { return; } int nelems = domain->giveNumberOfElements(); for ( int i = 1; i <= nelems; i++ ) { domain->giveElement(i)->showSparseMtrxStructure(StiffnessMatrix, context, tStep); } }
void MatlabExportModule :: doOutputMesh(TimeStep *tStep, FILE *FID) { Domain *domain = emodel->giveDomain(1); fprintf(FID, "\tmesh.p=["); for ( int i = 1; i <= domain->giveNumberOfDofManagers(); i++ ) { double x = domain->giveDofManager(i)->giveCoordinate(1), y = domain->giveDofManager(i)->giveCoordinate(2); fprintf(FID, "%f,%f;", x, y); } fprintf(FID, "]';\n"); fprintf(FID, "\tmesh.t=["); for ( int i = 1; i <= domain->giveNumberOfElements(); i++ ) { for ( int j = 1; j <= domain->giveElement(i)->giveNumberOfDofManagers(); j++ ) { fprintf( FID, "%u,", domain->giveElement(i)->giveDofManagerNumber(j) ); } fprintf(FID, ";"); } fprintf(FID, "]';\n"); }
void StokesFlow :: updateInternalState(TimeStep *tStep) { Domain *domain; for ( int idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) { domain = this->giveDomain(idomain); if (domain->giveTopology()) { // Must be done before updating nodal positions this->ts = domain->giveTopology()->updateYourself(tStep); } int nelem = domain->giveNumberOfElements(); for (int j = 1; j <= nelem; j++ ) { domain->giveElement(j)->updateInternalState(tStep); } } }
void Delamination :: propagateFronts(bool &oFrontsHavePropagated) { oFrontsHavePropagated = false; Domain *d = this->giveDomain(); TipPropagation tipProp; if ( mpPropagationLaw->propagateInterface(* giveDomain(), * mpEnrichmentFrontStart, tipProp) ) { // Propagate front // Check if nodes are viable for enrichment ///TODO: this should actually not inlcude the nodes at the boundary of the delamination, since this will propagate the delamination outside. IntArray delamNodes, propNodes; for (int CSnum : this->giveDelamCrossSectionNum()) { Set *elSet = d->giveSet(d->giveCrossSection(CSnum)->giveSetNumber()); for (int elID : elSet->giveElementList() ) { delamNodes.followedBy(d->giveElement(elID)->giveDofManArray()); } } delamNodes.sort(); delamNodes.findCommonValuesSorted(tipProp.mPropagationDofManNumbers, propNodes); //propNodes.printYourself("propNodes"); bool printed = false; for ( int inode : propNodes ) { //std::list< int > :: iterator p; std :: vector< int > :: iterator p; p = std :: find( this->dofManList.begin(), this->dofManList.end(), inode ); if ( p == this->dofManList.end() ) { // if new node if ( !printed ) { printf("\n Enrichment %i - The following nodes will be expanded to:",this->giveNumber()); printed = true; } printf(" %i", inode ); this->dofManList.push_back( inode ); } } printf(" \n"); std :: sort( dofManList.begin(), this->dofManList.end() ); oFrontsHavePropagated = true; } this->updateGeometry(); }
int StationaryTransportProblem :: checkConsistency() { Domain *domain = this->giveDomain(1); // check for proper element type int nelem = domain->giveNumberOfElements(); for ( int i = 1; i <= nelem; i++ ) { Element *ePtr = domain->giveElement(i); if ( !dynamic_cast< TransportElement * >(ePtr) ) { _warning2("Element %d has no TransportElement base", i); return 0; } } return EngngModel :: checkConsistency(); }
int StructuralEngngModel :: packRemoteElementData(ProcessCommunicator &processComm) { int result = 1; int i, size; IntArray const *toSendMap = processComm.giveToSendMap(); CommunicationBuffer *send_buff = processComm.giveProcessCommunicatorBuff()->giveSendBuff(); Domain *domain = this->giveDomain(1); size = toSendMap->giveSize(); for ( i = 1; i <= size; i++ ) { result &= domain->giveElement( toSendMap->at(i) )->packUnknowns( * send_buff, this->giveCurrentStep() ); } return result; }
void StructuralEngngModel :: showSparseMtrxStructure(int type, oofegGraphicContext &context, TimeStep *atTime) { Domain *domain = this->giveDomain(1); CharType ctype; int i; if ( type != 1 ) { return; } ctype = StiffnessMatrix; int nelems = domain->giveNumberOfElements(); for ( i = 1; i <= nelems; i++ ) { domain->giveElement(i)->showSparseMtrxStructure(ctype, context, atTime); } }
int StokesFlow :: checkConsistency() { int nelem; FMElement *sePtr; Domain *domain = this->giveDomain(1); nelem = domain->giveNumberOfElements(); // check for proper element type for ( int i = 1; i <= nelem; i++ ) { sePtr = dynamic_cast< FMElement * >( domain->giveElement(i) ); if ( sePtr == NULL ) { OOFEM_WARNING2("Element %d has no FMElement base", i); return false; } } return EngngModel :: checkConsistency(); }
void StaticFracture :: optimize(TimeStep *tStep) { // Main optimization loop MinCompliance *objFunc = dynamic_cast< MinCompliance * >( this->objFuncList[0] ); for ( int subProb = 1; subProb <= this->giveNumberOfSlaveProblems(); subProb++ ) { EngngModel *sp = this->giveSlaveProblem(subProb); Domain *d = sp->giveDomain(1); double cost = 0.0; // should lie in obj fnc double dce = 0.0; for (int i = 1; i <= d->giveNumberOfElements(); i++) { Element *el = d->giveElement(i); cost += objFunc->evaluateYourself(el, dce, sp->giveCurrentStep() ); // add cost for each element } // Filter sensitivities this->filterSensitivities(objFunc); // Update design variables based on some method. For now use the 'standard' optimality criteria this->optimalityCriteria(objFunc); // Update material parameters for (int i = 1; i <= d->giveNumberOfMaterialModels(); i++) { DynamicInputRecord ir; Material *mat = d->giveMaterial(i); mat->giveInputRecord(ir); double E0 = 1.0; double fac = pow( objFunc->designVarList.at(i), objFunc->penalty); ir.setField( E0 * fac, _IFT_IsotropicLinearElasticMaterial_e); mat->initializeFrom(&ir); } printf("\n costfunction %e & sum sensitivity %e & sum x %e \n", cost, objFunc->sensitivityList.sum(), objFunc->designVarList.sum() ); } }
int NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType) { int mapSize = commMap.giveSize(); int i, j, ndofs, count = 0, pcount = 0; IntArray locationArray; Domain *domain = this->giveDomain(1); DofManager *dman; Dof *jdof; if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) { for ( i = 1; i <= mapSize; i++ ) { count += domain->giveDofManager( commMap.at(i) )->giveNumberOfDofs(); } return ( buff.givePackSize(MPI_DOUBLE, 1) * count ); } else if ( packUnpackType == ProblemCommMode__NODE_CUT ) { for ( i = 1; i <= mapSize; i++ ) { ndofs = ( dman = domain->giveDofManager( commMap.at(i) ) )->giveNumberOfDofs(); for ( j = 1; j <= ndofs; j++ ) { jdof = dman->giveDof(j); if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) { count++; } else { pcount++; } } } //printf ("\nestimated count is %d\n",count); return ( buff.givePackSize(MPI_DOUBLE, 1) * max(count, pcount) ); } else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) { for ( i = 1; i <= mapSize; i++ ) { count += domain->giveElement( commMap.at(i) )->estimatePackSize(buff); } return count; } return 0; }
void NonStationaryTransportProblem :: assembleAlgorithmicPartOfRhs(FloatArray &answer, EquationID ut, const UnknownNumberingScheme &s, TimeStep *tStep) { IntArray loc; FloatMatrix charMtrx, bcMtrx; FloatArray unknownVec, contrib, intSource; Element *element; Domain *domain = this->giveDomain(1); int nelem = domain->giveNumberOfElements(); for ( int i = 1; i <= nelem; i++ ) { element = domain->giveElement(i); #ifdef __PARALLEL_MODE // skip remote elements (these are used as mirrors of remote elements on other domains // when nonlocal constitutive models are used. They introduction is necessary to // allow local averaging on domains without fine grain communication between domains). if ( element->giveParallelMode() == Element_remote ) { continue; } #endif element->giveLocationArray(loc, ut, s); //(alpha-1)*K+C/dt this->giveElementCharacteristicMatrix(charMtrx, i, NSTP_MidpointRhs, tStep, domain); //contribution from previous boundary convection element->giveCharacteristicMatrix(bcMtrx, LHSBCMatrix, tStep); bcMtrx.times(this->alpha - 1.0); if ( bcMtrx.isNotEmpty() ) { charMtrx.add(bcMtrx); } if ( charMtrx.isNotEmpty() ) { element->computeVectorOf(EID_ConservationEquation, VM_Total, tStep, unknownVec); contrib.beProductOf(charMtrx, unknownVec); answer.assemble(contrib, loc); } } }
void StructuralEngngModel :: updateInternalState(TimeStep *tStep) { int nnodes; Domain *domain; for ( int idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) { domain = this->giveDomain(idomain); nnodes = domain->giveNumberOfDofManagers(); if ( requiresUnknownsDictionaryUpdate() ) { for ( int j = 1; j <= nnodes; j++ ) { this->updateDofUnknownsDictionary(domain->giveDofManager(j), tStep); } } int nbc = domain->giveNumberOfBoundaryConditions(); for ( int i = 1; i <= nbc; ++i ) { GeneralBoundaryCondition *bc = domain->giveBc(i); ActiveBoundaryCondition *abc; if ( ( abc = dynamic_cast< ActiveBoundaryCondition * >(bc) ) ) { int ndman = abc->giveNumberOfInternalDofManagers(); for ( int j = 1; j <= ndman; j++ ) { this->updateDofUnknownsDictionary(abc->giveInternalDofManager(j), tStep); } } } if ( internalVarUpdateStamp != tStep->giveSolutionStateCounter() ) { int nelem = domain->giveNumberOfElements(); for ( int j = 1; j <= nelem; j++ ) { domain->giveElement(j)->updateInternalState(tStep); } internalVarUpdateStamp = tStep->giveSolutionStateCounter(); } } }
int FreeWarping :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType) { int count = 0, pcount = 0; IntArray locationArray; Domain *domain = this->giveDomain(1); if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) { for ( int map: commMap ) { count += domain->giveDofManager( map )->giveNumberOfDofs(); } return ( buff.givePackSize(MPI_DOUBLE, 1) * count ); } else if ( packUnpackType == ProblemCommMode__NODE_CUT ) { for ( int map: commMap ) { for ( Dof *jdof: *domain->giveDofManager( map ) ) { if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) { count++; } else { pcount++; } } } // -------------------------------------------------------------------------------- // only pcount is relevant here, since only prescribed components are exchanged !!!! // -------------------------------------------------------------------------------- return ( buff.givePackSize(MPI_DOUBLE, 1) * pcount ); } else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) { for ( int map: commMap ) { count += domain->giveElement( map )->estimatePackSize(buff); } return count; } return 0; }