// needed for CemhydMat void NonStationaryTransportProblem :: averageOverElements(TimeStep *tStep) { ///@todo Verify this, the function is completely unused. Domain *domain = this->giveDomain(1); FloatArray vecTemperature; for ( auto &elem : domain->giveElements() ) { TransportMaterial *mat = dynamic_cast< CemhydMat * >( elem->giveMaterial() ); if ( mat ) { for ( GaussPoint *gp: *elem->giveDefaultIntegrationRulePtr() ) { elem->giveIPValue(vecTemperature, gp, IST_Temperature, tStep); //mat->IP_volume += dV; //mat->average_temp += vecState.at(1) * dV; } } } for ( auto &mat : domain->giveMaterials() ) { CemhydMat *cem = dynamic_cast< CemhydMat * >( mat.get() ); if ( cem ) { //cem->average_temp /= mat->IP_volume; } } }
int StructuralMaterialEvaluator :: checkConsistency() { Domain *d = this->giveDomain(1); for ( auto &mat : d->giveMaterials() ) { if ( !dynamic_cast< StructuralMaterial * >( mat.get() ) ) { OOFEM_LOG_ERROR("Material %d is not a StructuralMaterial", mat->giveNumber()); return 0; } } return EngngModel :: checkConsistency(); }
void NonStationaryTransportProblem :: applyIC(TimeStep *stepWhenIcApply) { Domain *domain = this->giveDomain(1); int neq = this->giveNumberOfDomainEquations( 1, EModelDefaultEquationNumbering() ); FloatArray *solutionVector; double val; #ifdef VERBOSE OOFEM_LOG_INFO("Applying initial conditions\n"); #endif UnknownsField->advanceSolution(stepWhenIcApply); solutionVector = UnknownsField->giveSolutionVector(stepWhenIcApply); solutionVector->resize(neq); solutionVector->zero(); for ( auto &node : domain->giveDofManagers() ) { for ( Dof *dof: *node ) { // ask for initial values obtained from // bc (boundary conditions) and ic (initial conditions) if ( !dof->isPrimaryDof() ) { continue; } int jj = dof->__giveEquationNumber(); if ( jj ) { val = dof->giveUnknown(VM_Total, stepWhenIcApply); solutionVector->at(jj) = val; //update in dictionary, if the problem is growing/decreasing if ( this->changingProblemSize ) { dof->updateUnknownsDictionary(stepWhenIcApply, VM_Total, val); } } } } //project initial temperature to integration points // for ( int j = 1; j <= nelem; j++ ) { // domain->giveElement(j)->updateInternalState(stepWhenIcApply); // } #ifdef __CEMHYD_MODULE // Not relevant in linear case, but needed for CemhydMat for temperature averaging before solving balance equations // Update element state according to given ic for ( auto &elem : domain->giveElements() ) { TransportElement *element = static_cast< TransportElement * >( elem.get() ); CemhydMat *cem = dynamic_cast< CemhydMat * >( element->giveMaterial() ); //assign status to each integration point on each element if ( cem ) { cem->initMaterial(element); //create microstructures and statuses on specific GPs element->updateInternalState(stepWhenIcApply); //store temporary unequilibrated temperature element->updateYourself(stepWhenIcApply); //store equilibrated temperature cem->clearWeightTemperatureProductVolume(element); cem->storeWeightTemperatureProductVolume(element, stepWhenIcApply); } } //perform averaging on each material instance of CemhydMatClass for ( auto &mat : domain->giveMaterials() ) { CemhydMat *cem = dynamic_cast< CemhydMat * >( mat.get() ); if ( cem ) { cem->averageTemperature(); } } #endif //__CEMHYD_MODULE }