void NonLinearStatic :: updateLoadVectors(TimeStep *tStep) { MetaStep *mstep = this->giveMetaStep( tStep->giveMetaStepNumber() ); bool isLastMetaStep = ( tStep->giveNumber() == mstep->giveLastStepNumber() ); if ( controlMode == nls_indirectControl ) { //if ((tStep->giveNumber() == mstep->giveLastStepNumber()) && ir->hasField("fixload")) { if ( isLastMetaStep ) { if ( !mstep->giveAttributesRecord()->hasField(_IFT_NonLinearStatic_donotfixload) ) { OOFEM_LOG_INFO("Fixed load level\n"); //update initialLoadVector initialLoadVector.add(loadLevel, incrementalLoadVector); initialLoadVectorOfPrescribed.add(loadLevel, incrementalLoadVectorOfPrescribed); incrementalLoadVector.zero(); incrementalLoadVectorOfPrescribed.zero(); this->loadInitFlag = 1; } //if (!mstep->giveAttributesRecord()->hasField("keepll")) this->loadLevelInitFlag = 1; } } else { // direct control //update initialLoadVector after each step of direct control //(here the loading is not proportional) OOFEM_LOG_DEBUG("Fixed load level\n"); initialLoadVector.add(loadLevel, incrementalLoadVector); initialLoadVectorOfPrescribed.add(loadLevel, incrementalLoadVectorOfPrescribed); incrementalLoadVector.zero(); incrementalLoadVectorOfPrescribed.zero(); this->loadInitFlag = 1; } // if (isLastMetaStep) { if ( isLastMetaStep && !mstep->giveAttributesRecord()->hasField(_IFT_NonLinearStatic_donotfixload) ) { #ifdef VERBOSE OOFEM_LOG_INFO("Reseting load level\n"); #endif if ( mstepCumulateLoadLevelFlag ) { cumulatedLoadLevel += loadLevel; } else { cumulatedLoadLevel = 0.0; } this->loadLevel = 0.0; } }
void XFEMStatic :: updateLoadVectors(TimeStep *tStep) { MetaStep *mstep = this->giveMetaStep( tStep->giveMetaStepNumber() ); bool isLastMetaStep = ( tStep->giveNumber() == mstep->giveLastStepNumber() ); if ( controlMode == nls_indirectControl ) { //todo@: not checked //if ((tStep->giveNumber() == mstep->giveLastStepNumber()) && ir->hasField("fixload")) { if ( isLastMetaStep ) { if ( !mstep->giveAttributesRecord()->hasField(_IFT_NonLinearStatic_donotfixload) ) { OOFEM_LOG_INFO("Fixed load level\n"); //update initialLoadVector if ( initialLoadVector.isEmpty() ) { initialLoadVector.resize( incrementalLoadVector.giveSize() ); } incrementalLoadVector.times(loadLevel); initialLoadVector.add(incrementalLoadVector); incrementalLoadVectorOfPrescribed.times(loadLevel); initialLoadVectorOfPrescribed.add(incrementalLoadVectorOfPrescribed); incrementalLoadVector.zero(); incrementalLoadVectorOfPrescribed.zero(); this->loadInitFlag = 1; } //if (!mstep->giveAttributesRecord()->hasField("keepll")) this->loadLevelInitFlag = 1; } } else { // direct control //update initialLoadVector after each step of direct control //(here the loading is not proportional) /*if ( initialLoadVector.isEmpty() ) { * initialLoadVector.resize( incrementalLoadVector.giveSize() ); * } */ OOFEM_LOG_DEBUG("Fixed load level\n"); int neq = this->giveNumberOfDomainEquations( 1, EModelDefaultEquationNumbering() ); // 1 stands for domain? // printf("Before: "); // incrementalLoadVector.printYourself(); if ( incrementalLoadVector.giveSize() != neq ) { //initialLoadVector.resize( incrementalLoadVector.giveSize() ); // initialLoadVector.printYourself(); // initialLoadVector.resize( 0 ); FloatArray incrementalLoadVectorNew; setValsFromDofMap(incrementalLoadVectorNew, incrementalLoadVector); incrementalLoadVector = incrementalLoadVectorNew; } // printf("After: "); // incrementalLoadVector.printYourself(); incrementalLoadVector.times(loadLevel); /////////////////////////////////////////////////////////////////// // Map values in the old initialLoadVector to the new initialLoadVector // printf("Before: "); // initialLoadVector.printYourself(); if ( initialLoadVector.giveSize() != neq ) { //initialLoadVector.resize( incrementalLoadVector.giveSize() ); // initialLoadVector.printYourself(); // initialLoadVector.resize( 0 ); FloatArray initialLoadVectorNew; setValsFromDofMap(initialLoadVectorNew, initialLoadVector); initialLoadVector = initialLoadVectorNew; } // printf("After: "); // initialLoadVector.printYourself(); /////////////////////////////////////////////////////////////////// initialLoadVector.add(incrementalLoadVector); incrementalLoadVectorOfPrescribed.times(loadLevel); initialLoadVectorOfPrescribed.add(incrementalLoadVectorOfPrescribed); incrementalLoadVector.zero(); incrementalLoadVectorOfPrescribed.zero(); this->loadInitFlag = 1; } // if (isLastMetaStep) { if ( isLastMetaStep && !mstep->giveAttributesRecord()->hasField(_IFT_NonLinearStatic_donotfixload) ) { #ifdef VERBOSE OOFEM_LOG_INFO("Reseting load level\n"); #endif if ( mstepCumulateLoadLevelFlag ) { cumulatedLoadLevel += loadLevel; } else { cumulatedLoadLevel = 0.0; } this->loadLevel = 0.0; } }
void AdaptiveNonLinearStatic :: assembleInitialLoadVector(FloatArray &loadVector, FloatArray &loadVectorOfPrescribed, AdaptiveNonLinearStatic *sourceProblem, int domainIndx, TimeStep *tStep) { IRResultType result; // Required by IR_GIVE_FIELD macro int mStepNum = tStep->giveMetaStepNumber(); int hasfixed, mode; InputRecord *ir; MetaStep *iMStep; FloatArray _incrementalLoadVector, _incrementalLoadVectorOfPrescribed; SparseNonLinearSystemNM :: referenceLoadInputModeType rlm; //Domain* sourceDomain = sourceProblem->giveDomain(domainIndx); loadVector.resize( this->giveNumberOfDomainEquations( domainIndx, EModelDefaultEquationNumbering() ) ); loadVectorOfPrescribed.resize( this->giveNumberOfDomainEquations( domainIndx, EModelDefaultPrescribedEquationNumbering() ) ); loadVector.zero(); loadVectorOfPrescribed.zero(); _incrementalLoadVector.resize( this->giveNumberOfDomainEquations( domainIndx, EModelDefaultEquationNumbering() ) ); _incrementalLoadVectorOfPrescribed.resize( this->giveNumberOfDomainEquations( domainIndx, EModelDefaultPrescribedEquationNumbering() ) ); _incrementalLoadVector.zero(); _incrementalLoadVectorOfPrescribed.zero(); for ( int imstep = 1; imstep < mStepNum; imstep++ ) { iMStep = this->giveMetaStep(imstep); ir = iMStep->giveAttributesRecord(); //hasfixed = ir->hasField("fixload"); hasfixed = 1; if ( hasfixed ) { // test for control mode // here the algorithm works only for direct load control. // Direct displacement control requires to know the quasi-rections, and the controlled nodes // should have corresponding node on new mesh -> not supported // Indirect control -> the load level from prevous steps is required, currently nt supported. // additional problem: direct load control supports the reduction of step legth if convergence fails // if this happens, this implementation does not work correctly. // But there is NO WAY HOW TO TEST IF THIS HAPPEN mode = 0; IR_GIVE_OPTIONAL_FIELD(ir, mode, _IFT_AdaptiveNonLinearStatic_controlmode); // check if displacement control takes place if ( ir->hasField(_IFT_AdaptiveNonLinearStatic_ddm) ) { OOFEM_ERROR("fixload recovery not supported for direct displacement control"); } int firststep = iMStep->giveFirstStepNumber(); int laststep = iMStep->giveLastStepNumber(); int _val = 0; IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_AdaptiveNonLinearStatic_refloadmode); rlm = ( SparseNonLinearSystemNM :: referenceLoadInputModeType ) _val; if ( mode == ( int ) nls_directControl ) { // and only load control for ( int istep = firststep; istep <= laststep; istep++ ) { // bad practise here ///@todo Likely memory leak here with new TimeStep; Check. TimeStep *old = new TimeStep(istep, this, imstep, istep - 1.0, deltaT, 0); this->assembleIncrementalReferenceLoadVectors(_incrementalLoadVector, _incrementalLoadVectorOfPrescribed, rlm, this->giveDomain(domainIndx), EID_MomentumBalance, old); _incrementalLoadVector.times( sourceProblem->giveTimeStepLoadLevel(istep) ); loadVector.add(_incrementalLoadVector); loadVectorOfPrescribed.add(_incrementalLoadVectorOfPrescribed); } } else if ( mode == ( int ) nls_indirectControl ) { // bad practise here if ( !ir->hasField(_IFT_NonLinearStatic_donotfixload) ) { TimeStep *old = new TimeStep(firststep, this, imstep, firststep - 1.0, deltaT, 0); this->assembleIncrementalReferenceLoadVectors(_incrementalLoadVector, _incrementalLoadVectorOfPrescribed, rlm, this->giveDomain(domainIndx), EID_MomentumBalance, old); _incrementalLoadVector.times( sourceProblem->giveTimeStepLoadLevel(laststep) ); loadVector.add(_incrementalLoadVector); loadVectorOfPrescribed.add(_incrementalLoadVectorOfPrescribed); } } else { OOFEM_ERROR("fixload recovery not supported"); } } } // end loop over meta-steps /* if direct control; add to initial load also previous steps in same metestep */ iMStep = this->giveMetaStep(mStepNum); ir = iMStep->giveAttributesRecord(); mode = 0; IR_GIVE_OPTIONAL_FIELD(ir, mode, _IFT_AdaptiveNonLinearStatic_controlmode); int firststep = iMStep->giveFirstStepNumber(); int laststep = tStep->giveNumber(); int _val = 0; IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_AdaptiveNonLinearStatic_refloadmode); rlm = ( SparseNonLinearSystemNM :: referenceLoadInputModeType ) _val; if ( mode == ( int ) nls_directControl ) { // and only load control for ( int istep = firststep; istep <= laststep; istep++ ) { // bad practise here TimeStep *old = new TimeStep(istep, this, mStepNum, istep - 1.0, deltaT, 0); this->assembleIncrementalReferenceLoadVectors(_incrementalLoadVector, _incrementalLoadVectorOfPrescribed, rlm, this->giveDomain(domainIndx), EID_MomentumBalance, old); _incrementalLoadVector.times( sourceProblem->giveTimeStepLoadLevel(istep) ); loadVector.add(_incrementalLoadVector); loadVectorOfPrescribed.add(_incrementalLoadVectorOfPrescribed); } } }