void NonLinearStatic :: updateAttributes(MetaStep *mStep) { const char *__proc = "updateAttributes"; // Required by IR_GIVE_FIELD macro IRResultType result; // Required by IR_GIVE_FIELD macro MetaStep *mStep1 = this->giveMetaStep( mStep->giveNumber() );//this line ensures correct input file in staggered problem InputRecord *ir = mStep1->giveAttributesRecord(); LinearStatic :: updateAttributes(mStep1); /* * if ((mstep->giveFirstStepNumber() == atTime->giveNumber()) && hasString(initString, "fixload")) { * double factor; * * printf ("NonLinearStatic: fixed load level"); * if (initialLoadVector.isEmpty()) initialLoadVector.resize(loadVector.giveSize()); * if ((controlMode == nls_directControl) || (controlMode == nls_directControl2)) factor = 1.0; * else factor = loadLevel; * loadVector.times (factor); * initialLoadVector.add(loadVector); * loadVector.zero(); * this->loadInitFlag = 1; * this->loadLevel = 0.0; * } */ int _val = nls_indirectControl; IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_NonLinearStatic_controlmode, "controlmode"); // Macro IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_NonLinearStatic_controlmode, "controllmode"); // for backward compatibility this->controlMode = ( NonLinearStatic_controlType ) _val; _val = IG_None; IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_EngngModel_initialGuess, "initialguess"); this->initialGuessType = ( InitialGuess ) _val; deltaT = 1.0; IR_GIVE_OPTIONAL_FIELD(ir, deltaT, IFT_NonLinearStatic_deltat, "deltat"); // Macro if ( deltaT < 0. ) { _error("updateAttributes: deltaT < 0"); } _val = nls_tangentStiffness; IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_NonLinearStatic_stiffmode, "stiffmode"); // Macro this->stiffMode = ( NonLinearStatic_stiffnessMode ) _val; _val = SparseNonLinearSystemNM :: rlm_total; IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_NonLinearStatic_refloadmode, "refloadmode"); // Macro this->refLoadInputMode = ( SparseNonLinearSystemNM :: referenceLoadInputModeType ) _val; if ( ir->hasField(IFT_NonLinearStatic_keepll, "keepll") ) { mstepCumulateLoadLevelFlag = true; } else { mstepCumulateLoadLevelFlag = false; } // called just to mart filed as recognized, used later ir->hasField(IFT_NonLinearStatic_donotfixload, "donotfixload"); }
void NonLinearStatic :: updateAttributes(MetaStep *mStep) { IRResultType result; // Required by IR_GIVE_FIELD macro MetaStep *mStep1 = this->giveMetaStep( mStep->giveNumber() ); //this line ensures correct input file in staggered problem InputRecord *ir = mStep1->giveAttributesRecord(); LinearStatic :: updateAttributes(mStep1); /* * if ((mstep->giveFirstStepNumber() == tStep->giveNumber()) && hasString(initString, "fixload")) { * double factor; * * printf ("NonLinearStatic: fixed load level"); * if (initialLoadVector.isEmpty()) initialLoadVector.resize(loadVector.giveSize()); * if ((controlMode == nls_directControl) || (controlMode == nls_directControl2)) factor = 1.0; * else factor = loadLevel; * loadVector.times (factor); * initialLoadVector.add(loadVector); * loadVector.zero(); * this->loadInitFlag = 1; * this->loadLevel = 0.0; * } */ int _val = nls_indirectControl; IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_NonLinearStatic_controlmode); IR_GIVE_OPTIONAL_FIELD(ir, _val, "controllmode"); /// @todo If there is ever a major version change, remove this (for backward compatibility) this->controlMode = ( NonLinearStatic_controlType ) _val; _val = IG_None; IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_EngngModel_initialGuess); this->initialGuessType = ( InitialGuess ) _val; deltaT = 1.0; IR_GIVE_OPTIONAL_FIELD(ir, deltaT, _IFT_NonLinearStatic_deltat); if ( deltaT < 0. ) { OOFEM_ERROR("deltaT < 0"); } _val = nls_tangentStiffness; IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_NonLinearStatic_stiffmode); this->stiffMode = ( NonLinearStatic_stiffnessMode ) _val; _val = SparseNonLinearSystemNM :: rlm_total; IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_NonLinearStatic_refloadmode); this->refLoadInputMode = ( SparseNonLinearSystemNM :: referenceLoadInputModeType ) _val; mstepCumulateLoadLevelFlag = ir->hasField(_IFT_NonLinearStatic_keepll); // called just to mark field as recognized, used later ir->hasField(_IFT_NonLinearStatic_donotfixload); }
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); } } }